Skip to content

feat(java): detect secret/token-returning method results passed directly to a logger (CWE-532) - #157

Open
ai-anant wants to merge 1 commit into
CodeVigilant:mainfrom
ai-anant:rule/java-jenkins-logging-secret-token-call-log
Open

feat(java): detect secret/token-returning method results passed directly to a logger (CWE-532)#157
ai-anant wants to merge 1 commit into
CodeVigilant:mainfrom
ai-anant:rule/java-jenkins-logging-secret-token-call-log

Conversation

@ai-anant

Copy link
Copy Markdown

Detects a logger call whose message (or message argument) is the return value of a method whose name indicates it yields a secret (token / secret / password / key / credential / authorization / bearer). Writing a live credential or bearer token to the server log exposes it at rest, where non-privileged operators and log-collection/aggregation systems can read it, enabling credential disclosure (CWE-532). Logs should carry only redacted/sanitized indicators.

Rule: codevigilant.java.jenkins.logging.secret-token-call-log (new java/jenkins/logging/ tree)
Validated with semgrep --validate; fires on a LOG.finest("Auth token: " + authData.authorizationToken()) repro, silent on a logger that receives only string/primitive args or pre-masked constants.

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.

1 participant