bug: remove hardcoded API token and session secret from app.js - #220
Open
devin-ai-integration[bot] wants to merge 1 commit into
Open
bug: remove hardcoded API token and session secret from app.js#220devin-ai-integration[bot] wants to merge 1 commit into
devin-ai-integration[bot] wants to merge 1 commit into
Conversation
| var dustHelpers = require('dustjs-helpers'); | ||
| var cons = require('consolidate'); | ||
| const hbs = require('hbs') | ||
| var utils = require('./utils'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
app.jsdeclared an API token as a string literal and printed it to stdout on every start, and configuredexpress-sessionwith the literal'keyboard cat'. Both are hardcoded credentials (CWE-798); the logged token also leaks into any log aggregation.utils.js:session_secret(env = process.env)returnsSESSION_SECRETwhen it is >= 32 chars; in production it throws (fail closed) rather than falling back, otherwise it warns and uses an ephemeralcrypto.randomBytes(32)value.session_cookie(env)keepspath: '/'and addshttpOnly: true,sameSite: 'lax', andsecure(on in production, overridable withSESSION_COOKIE_SECURE).tests/session-config.test.js(tap) asserts app.js contains no token/secret literal and noconsole.logof a token, plus the helper behaviors. 6/6 pass locally.Devin-Org: engineering
Devin Review