Skip to content

Sync with develop #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Aug 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
/node_modules
/build

# migration files
/prisma/Scorecards

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider specifying the file types or patterns to ignore within the /prisma/Scorecards directory to avoid unintentionally ignoring necessary files.


# Logs
logs
*.log
Expand Down
9 changes: 8 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,14 @@ async function bootstrap() {
credentials: true,
origin: process.env.CORS_ALLOWED_ORIGIN
? new RegExp(process.env.CORS_ALLOWED_ORIGIN)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using new RegExp(process.env.CORS_ALLOWED_ORIGIN) can lead to unexpected behavior if the environment variable is not properly formatted as a regular expression. Consider validating or sanitizing the input to ensure it is a valid regex pattern.

: ['http://localhost:3000', /\.localhost:3000$/],
: [
'http://localhost:3000',
/\.localhost:3000$/,
'https://topcoder.com',
'https://topcoder-dev.com',
/\.topcoder-dev\.com$/,
/\.topcoder\.com$/,
],
methods: 'GET, POST, OPTIONS, PUT, DELETE, PATCH',
};
app.use(cors(corsConfig));
Expand Down
7 changes: 5 additions & 2 deletions src/shared/modules/global/jwt.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,12 @@ export class JwtService implements OnModuleInit {
// Get the signing key from Auth0
const signingKey = await this.getSigningKey(tokenHeader.kid);

console.log(`Signing key: ${JSON.stringify(signingKey)}`);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider removing the console.log statement or replacing it with a proper logging mechanism if needed for debugging purposes. Using console.log in production code can lead to performance issues and may expose sensitive information.


// Verify options
const verifyOptions: VerifyOptions = {
issuer: AuthConfig.jwt.issuer,
audience: AuthConfig.jwt.audience,
//issuer: AuthConfig.jwt.issuer,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commenting out the issuer and audience fields in verifyOptions might affect the security and validity of the JWT verification process. Ensure that these fields are intentionally omitted and that their absence does not compromise the application's security requirements.

//audience: AuthConfig.jwt.audience,
clockTolerance: AuthConfig.jwt.clockTolerance,
ignoreExpiration: AuthConfig.jwt.ignoreExpiration,
};
Expand All @@ -117,6 +119,7 @@ export class JwtService implements OnModuleInit {
throw new UnauthorizedException('Invalid token');
}

console.log(`Decoded token: ${JSON.stringify(decodedToken)}`);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using console.log for logging decoded tokens can expose sensitive information in production environments. Consider using a more secure logging mechanism or remove this statement if not necessary.

const user: JwtUser = { isMachine: false };

// Check for M2M token from Auth0
Expand Down