Skip to content

Commit

Permalink
Merge pull request #483 from hoppscotch/main
Browse files Browse the repository at this point in the history
Create a new pull request by comparing changes across two branches
  • Loading branch information
GulajavaMinistudio authored Jun 25, 2024
2 parents a2ddb6c + 6e63c72 commit 32b31b6
Show file tree
Hide file tree
Showing 53 changed files with 631 additions and 366 deletions.
17 changes: 6 additions & 11 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,15 @@ Please make sure that the pull request is limited to one type (docs, feature, et
<!-- If this pull request closes an issue, please mention the issue number below -->
Closes # <!-- Issue # here -->

### Description
<!-- Add a brief description of the pull request -->
<!-- Add an introduction into what this PR tries to solve in a couple of sentences -->

### What's changed
<!-- Describe point by point the different things you have changed in this PR -->

<!-- You can also choose to add a list of changes and if they have been completed or not by using the markdown to-do list syntax
- [ ] Not Completed
- [x] Completed
-->

### Checks
<!-- Make sure your pull request passes the CI checks and do check the following fields as needed - -->
- [ ] My pull request adheres to the code style of this project
- [ ] My code requires changes to the documentation
- [ ] I have updated the documentation as required
- [ ] All the tests have passed

### Additional Information
<!-- Any additional information like breaking changes, dependencies added, screenshots, comparisons between new and old behaviour, etc. -->
### Notes to reviewers
<!-- Any information you feel the reviewer should know about when reviewing your PR -->
35 changes: 13 additions & 22 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,30 +1,21 @@
# CODEOWNERS is prioritized from bottom to top

# If none of the below matched
* @AndrewBastin @liyasthomas

# Packages
/packages/codemirror-lang-graphql/ @AndrewBastin
/packages/hoppscotch-cli/ @AndrewBastin
/packages/hoppscotch-common/ @amk-dev @AndrewBastin
/packages/hoppscotch-cli/ @jamesgeorge007
/packages/hoppscotch-data/ @AndrewBastin
/packages/hoppscotch-js-sandbox/ @AndrewBastin
/packages/hoppscotch-ui/ @anwarulislam
/packages/hoppscotch-web/ @amk-dev
/packages/hoppscotch-selfhost-web/ @amk-dev
/packages/hoppscotch-js-sandbox/ @jamesgeorge007
/packages/hoppscotch-selfhost-web/ @jamesgeorge007
/packages/hoppscotch-selfhost-desktop/ @AndrewBastin
/packages/hoppscotch-sh-admin/ @JoelJacobStephen
/packages/hoppscotch-backend/ @ankitsridhar16 @balub

# Sections within Hoppscotch Common
/packages/hoppscotch-common/src/components @anwarulislam
/packages/hoppscotch-common/src/components/collections @nivedin @amk-dev
/packages/hoppscotch-common/src/components/environments @nivedin @amk-dev
/packages/hoppscotch-common/src/composables @amk-dev
/packages/hoppscotch-common/src/modules @AndrewBastin @amk-dev
/packages/hoppscotch-common/src/pages @AndrewBastin @amk-dev
/packages/hoppscotch-common/src/newstore @AndrewBastin @amk-dev
/packages/hoppscotch-backend/ @balub

README.md @liyasthomas
# READMEs and other documentation files
*.md @liyasthomas

# The lockfile has no owner
pnpm-lock.yaml
# Self Host deployment related files
*.Dockerfile @balub
docker-compose.yml @balub
docker-compose.deploy.yml @balub
*.Caddyfile @balub
.dockerignore @balub
5 changes: 1 addition & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,4 @@ Please note we have a code of conduct, please follow it in all your interactions
build.
2. Update the README.md with details of changes to the interface, this includes new environment
variables, exposed ports, useful file locations and container parameters.
3. Increase the version numbers in any examples files and the README.md to the new version that this
Pull Request would represent. The versioning scheme we use is [SemVer](https://semver.org).
4. You may merge the Pull Request once you have the sign-off of two other developers, or if you
do not have permission to do that, you may request the second reviewer merge it for you.
3. Make sure you do not expose environment variables or other sensitive information in your PR.
27 changes: 22 additions & 5 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,36 @@ This document outlines security procedures and general policies for the Hoppscot

- [Security Policy](#security-policy)
- [Reporting a security vulnerability](#reporting-a-security-vulnerability)
- [What is not a valid vulnerability](#what-is-not-a-valid-vulnerability)
- [Incident response process](#incident-response-process)

## Reporting a security vulnerability

Report security vulnerabilities by emailing the Hoppscotch Support team at [email protected].
We use [Github Security Advisories](https://github.com/hoppscotch/hoppscotch/security/advisories) to manage vulnerability reports and collaboration.
Someone from the Hoppscotch team shall report to you within 48 hours of the disclosure of the vulnerability in GHSA. If no response was received, please reach out to
Hoppscotch Support at [email protected] along with the GHSA advisory link.

The primary security point of contact from Hoppscotch Support team will acknowledge your email within 48 hours, and will send a more detailed response within 48 hours indicating the next steps in handling your report. After the initial reply to your report, the security team will endeavor to keep you informed of the progress towards a fix and full announcement, and may ask for additional information or guidance.
> NOTE: Since we have multiple open source components, Advisories may move into the relevant repo (for example, an XSS in a UI component might be part of [`@hoppscotch/ui`](https://github.com/hoppscotch/ui)).
> If in doubt, open your report in `hoppscotch/hoppscotch` GHSA.
**Do not create a GitHub issue ticket to report a security vulnerability.**
**Do not create a GitHub issue ticket to report a security vulnerability!**

The Hoppscotch team and community take all security vulnerability reports in Hoppscotch seriously. Thank you for improving the security of Hoppscotch. We appreciate your efforts and responsible disclosure and will make every effort to acknowledge your contributions.
The Hoppscotch team takes all security vulnerability reports in Hoppscotch seriously. We appreciate your efforts and responsible disclosure and will make every effort to acknowledge your contributions.

Report security bugs in third-party modules to the person or team maintaining the module.
## What is not a valid vulnerability
We receive many reports about different sections of the Hoppscotch platform. Hence, we have a fine line we have drawn defining what is considered valid vulnerability.
Please refrain from opening an advisory if it describes the following:

- A vulnerability in a dependency of Hoppscotch (unless you have practical attack with it on the Hoppscotch codebase)
- Reports of vulnerabilities related to old runtimes (like NodeJS) or container images used by the codebase
- Vulnerabilities present when using Hoppscotch in anything other than the defined minimum requirements that Hoppscotch supports.

Hoppscotch Team ensures security support for:
- Modern Browsers (Chrome/Firefox/Safari/Edge) with versions up to 1 year old.
- Windows versions on or above Windows 10 on Intel and ARM.
- macOS versions dating back up to 2 years on Intel and Apple Silicon.
- Popular Linux distributions with up-to-date packages with preference to x86/64 CPUs.
- Docker/OCI Runtimes (preference to Docker and Podman) dating back up to 1 year.

## Incident response process

Expand Down
2 changes: 1 addition & 1 deletion packages/hoppscotch-backend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hoppscotch-backend",
"version": "2024.3.3",
"version": "2024.3.4",
"description": "",
"author": "",
"private": true,
Expand Down
6 changes: 5 additions & 1 deletion packages/hoppscotch-backend/src/admin/admin.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ describe('AdminService', () => {
NOT: {
inviteeEmail: {
in: [dbAdminUsers[0].email],
mode: 'insensitive',
},
},
},
Expand Down Expand Up @@ -229,7 +230,10 @@ describe('AdminService', () => {

expect(mockPrisma.invitedUsers.deleteMany).toHaveBeenCalledWith({
where: {
inviteeEmail: { in: [invitedUsers[0].inviteeEmail] },
inviteeEmail: {
in: [invitedUsers[0].inviteeEmail],
mode: 'insensitive',
},
},
});
expect(result).toEqualRight(true);
Expand Down
12 changes: 9 additions & 3 deletions packages/hoppscotch-backend/src/admin/admin.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,17 @@ export class AdminService {
adminEmail: string,
inviteeEmail: string,
) {
if (inviteeEmail == adminEmail) return E.left(DUPLICATE_EMAIL);
if (inviteeEmail.toLowerCase() == adminEmail.toLowerCase()) {
return E.left(DUPLICATE_EMAIL);
}
if (!validateEmail(inviteeEmail)) return E.left(INVALID_EMAIL);

const alreadyInvitedUser = await this.prisma.invitedUsers.findFirst({
where: {
inviteeEmail: inviteeEmail,
inviteeEmail: {
equals: inviteeEmail,
mode: 'insensitive',
},
},
});
if (alreadyInvitedUser != null) return E.left(USER_ALREADY_INVITED);
Expand Down Expand Up @@ -159,7 +164,7 @@ export class AdminService {
try {
await this.prisma.invitedUsers.deleteMany({
where: {
inviteeEmail: { in: inviteeEmails },
inviteeEmail: { in: inviteeEmails, mode: 'insensitive' },
},
});
return E.right(true);
Expand Down Expand Up @@ -189,6 +194,7 @@ export class AdminService {
NOT: {
inviteeEmail: {
in: userEmailObjs.map((user) => user.email),
mode: 'insensitive',
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,10 @@ export class ShortcodeService implements UserDataHandler, OnModuleInit {
where: userEmail
? {
User: {
email: userEmail,
email: {
equals: userEmail,
mode: 'insensitive',
},
},
}
: undefined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,13 @@ export class TeamInvitationService {
if (!isEmailValid) return E.left(INVALID_EMAIL);

try {
const teamInvite = await this.prisma.teamInvitation.findUniqueOrThrow({
const teamInvite = await this.prisma.teamInvitation.findFirstOrThrow({
where: {
teamID_inviteeEmail: {
inviteeEmail: inviteeEmail,
teamID: teamID,
inviteeEmail: {
equals: inviteeEmail,
mode: 'insensitive',
},
teamID,
},
});

Expand Down
4 changes: 2 additions & 2 deletions packages/hoppscotch-backend/src/user/user.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ beforeEach(() => {
describe('UserService', () => {
describe('findUserByEmail', () => {
test('should successfully return a valid user given a valid email', async () => {
mockPrisma.user.findUniqueOrThrow.mockResolvedValueOnce(user);
mockPrisma.user.findFirst.mockResolvedValueOnce(user);

const result = await userService.findUserByEmail(
'[email protected]',
Expand All @@ -158,7 +158,7 @@ describe('UserService', () => {
});

test('should return a null user given a invalid email', async () => {
mockPrisma.user.findUniqueOrThrow.mockRejectedValueOnce('NotFoundError');
mockPrisma.user.findFirst.mockResolvedValueOnce(null);

const result = await userService.findUserByEmail('[email protected]');
expect(result).resolves.toBeNone;
Expand Down
18 changes: 9 additions & 9 deletions packages/hoppscotch-backend/src/user/user.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,16 @@ export class UserService {
* @returns Option of found User
*/
async findUserByEmail(email: string): Promise<O.None | O.Some<AuthUser>> {
try {
const user = await this.prisma.user.findUniqueOrThrow({
where: {
email: email,
const user = await this.prisma.user.findFirst({
where: {
email: {
equals: email,
mode: 'insensitive',
},
});
return O.some(user);
} catch (error) {
return O.none;
}
},
});
if (!user) return O.none;
return O.some(user);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/hoppscotch-cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hoppscotch/cli",
"version": "0.8.0",
"version": "0.8.1",
"description": "A CLI to run Hoppscotch test scripts in CI environments.",
"homepage": "https://hoppscotch.io",
"type": "module",
Expand Down
Loading

0 comments on commit 32b31b6

Please sign in to comment.