Skip to content

Conversation

@ardatan
Copy link
Owner

@ardatan ardatan commented Sep 23, 2025

Potential fix for https://github.com/ardatan/graphql-tools-prisma-loader/security/code-scanning/1

To remediate, we must ensure that sensitive data from environment variables is never logged directly, especially in error, warning, or info logs. The fix should be targeted at the logging operation where tainted data may be logged. In the current path, this specifically means altering the way error messages are constructed and logged in the populateVariable() method (in Variables.ts). Here, rather than include the actual value (which can be sensitive) in log messages, the code should refer only to variable names or use a placeholder indicating value omission.

So, in the relevant error message (when trying to populate a non-string value into a string), we should avoid logging the value of matchedString if it could ever be sensitive. Instead, only log that a variable reference failed without stating its value, or obscure the value (e.g., replace with [REDACTED]). Additionally, all logging in Output.warn() should be reviewed to reject or redact sensitive data if provided, but since we cannot change every use, it's best to sanitize error message construction.

Steps:

  • In Variables.ts, update the error message construction in populateVariable: do not log the actual value of variable substitutions; log only the variable name or a string like [REDACTED] as appropriate.
  • No changes are required in the Output.ts file, so logging methods remain unchanged.
  • No new dependencies are needed.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

ardatan and others added 2 commits September 23, 2025 15:06
…nsitive information

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@ardatan ardatan marked this pull request as ready for review September 23, 2025 12:08
@ardatan ardatan merged commit 31a6fbe into master Sep 23, 2025
@github-actions github-actions bot mentioned this pull request Sep 23, 2025
@github-actions
Copy link
Contributor

🚀 Snapshot Release (alpha)

The latest changes of this PR are available as alpha on npm (based on the declared changesets):

Package Version Info
@graphql-tools/prisma-loader 9.0.1-alpha-20250923120853-9b200bb414d0fe046042b4885e5901070659d00b npm ↗︎ unpkg ↗︎

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