Skip to content

Conversation

@jmgasper
Copy link
Contributor

No description provided.

cl."name" AS customer,
cl."codeName" AS client_codename,
COALESCE(
NULLIF(TRIM(proj.details::jsonb #>> '{taasDefinition,oppurtunityDetails,customerName}'), ''),

Choose a reason for hiding this comment

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

[❗❗ correctness]
The JSON path '{taasDefinition,oppurtunityDetails,customerName}' contains a typo in oppurtunityDetails. It should likely be opportunityDetails. This could lead to incorrect data retrieval if the JSON structure is not as expected.

ba.id::text AS billing_account_id,
ba."name" AS billing_account_name,
COALESCE(
NULLIF(TRIM(proj.details::jsonb #>> '{taasDefinition,oppurtunityDetails,customerName}'), ''),

Choose a reason for hiding this comment

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

[❗❗ correctness]
The JSON path '{taasDefinition,oppurtunityDetails,customerName}' contains a typo in oppurtunityDetails. It should likely be opportunityDetails. This could lead to incorrect data retrieval if the JSON structure is not as expected.

NULLIF(TRIM(proj.details::jsonb #>> '{taasDefinition,oppurtunityDetails,customerName}'), ''),
NULLIF(TRIM(proj.details::jsonb #>> '{project_data,group_customer_name}'), ''),
ba."name"
) AS customer_name,

Choose a reason for hiding this comment

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

[⚠️ maintainability]
The field customer_name is being selected twice in the query. This could lead to confusion or errors in the result set. Consider removing the duplicate selection.


const logger = new Logger("AuthMiddleware");

function decodeTokenPayload(token: string): Record<string, unknown> | null {

Choose a reason for hiding this comment

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

[❗❗ security]
The decodeTokenPayload function manually decodes the JWT payload without verifying the token's signature. This could lead to security issues if the payload is trusted without verification. Consider using a library like jsonwebtoken to decode and verify the token securely.

if (err) {
const token = req.headers.authorization?.replace(/^Bearer\s+/i, "");
const payload = token ? decodeTokenPayload(token) : null;
logger.warn({

Choose a reason for hiding this comment

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

[❗❗ security]
Logging the decoded JWT payload, even partially, can expose sensitive information. Ensure that sensitive data is not logged or consider redacting sensitive fields before logging.

@jmgasper jmgasper merged commit b2c97fd into master Dec 10, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants