Skip to content

Conversation

@Vlasis-Perdikidis
Copy link
Contributor

Description

Context

Type of changes

  • Refactoring (non-breaking change)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would change existing functionality)
  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • I am familiar with the contributing guidelines
  • I have followed the code style of the project
  • I have added tests to cover my changes
  • I have updated the documentation accordingly
  • This PR is a result of pair or mob programming
  • If I have used the 'skip-trivy-package' label I have done so responsibly and in the knowledge that this is being fixed as part of a separate ticket/PR.

Sensitive Information Declaration

To ensure the utmost confidentiality and protect your and others privacy, we kindly ask you to NOT including PII (Personal Identifiable Information) / PID (Personal Identifiable Data) or any other sensitive data in this PR (Pull Request) and the codebase changes. We will remove any PR that do contain any sensitive information. We really appreciate your cooperation in this matter.

  • I confirm that neither PII/PID nor sensitive data are included in this PR and the codebase changes.

@Vlasis-Perdikidis Vlasis-Perdikidis requested a review from a team as a code owner February 10, 2026 12:44
};
const emf = buildEMFObject("postLetters", dimensions, metric);
logger.info(emf);
logger.info(`process.env: ${JSON.stringify(process.env)}`);

Check failure

Code scanning / CodeQL

Clear-text logging of sensitive information High

This logs sensitive data returned by
process environment
as clear text.

Copilot Autofix

AI about 1 hour ago

In general, the fix is to avoid logging process.env or any other sensitive configuration values in clear text. If the log statement is only for debugging, it should be removed or conditioned on a safe debug flag that is disabled in production, and even then it’s better to avoid full environment dumps. If some environment-related information is needed for diagnostics, log only non-sensitive, whitelisted keys or high-level metadata (e.g., current stage name) rather than the entire environment.

For this specific code, the safest and simplest fix without changing existing functionality is to remove the line that logs process.env inside emitSuccessMetrics. The rest of the metrics logging (logger.info(emf)) remains intact, so the functional behavior of emitting metrics is preserved; only the unsafe logging of environment variables is removed. No additional imports or helper methods are required. Concretely, in lambdas/api-handler/src/handlers/post-letters.ts, delete line 44 (logger.info(\process.env: ${JSON.stringify(process.env)}`);) from the body of emitSuccessMetrics`.

Suggested changeset 1
lambdas/api-handler/src/handlers/post-letters.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/lambdas/api-handler/src/handlers/post-letters.ts b/lambdas/api-handler/src/handlers/post-letters.ts
--- a/lambdas/api-handler/src/handlers/post-letters.ts
+++ b/lambdas/api-handler/src/handlers/post-letters.ts
@@ -41,7 +41,6 @@
     };
     const emf = buildEMFObject("postLetters", dimensions, metric);
     logger.info(emf);
-    logger.info(`process.env: ${JSON.stringify(process.env)}`);
   }
 }
 
EOF
@@ -41,7 +41,6 @@
};
const emf = buildEMFObject("postLetters", dimensions, metric);
logger.info(emf);
logger.info(`process.env: ${JSON.stringify(process.env)}`);
}
}

Copilot is powered by AI and may make mistakes. Always verify output.
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