Skip to content

feat(java): detect secret-typed Jenkins config fields stored as plain String instead of hudson.util.Secret (CWE-256) - #140

Open
ai-anant wants to merge 1 commit into
CodeVigilant:mainfrom
ai-anant:rule/java-jenkins-plaintext-secret-string-field
Open

feat(java): detect secret-typed Jenkins config fields stored as plain String instead of hudson.util.Secret (CWE-256)#140
ai-anant wants to merge 1 commit into
CodeVigilant:mainfrom
ai-anant:rule/java-jenkins-plaintext-secret-string-field

Conversation

@ai-anant

Copy link
Copy Markdown

Adds a Java/Jenkins rule detecting plugin configuration and credential classes that declare a secret-bearing value (service-account token, password, API/private key, JWT, client secret, etc., identified via field name) as a plain java.lang.String rather than hudson.util.Secret.

Such String fields are persisted verbatim to config.xml/credential XML on disk and echoed back by Stapler getters, leaving the credential readable from disk, backups, and the config UI. The fix is to store the value as hudson.util.Secret.

Rule: codevigilant.java.jenkins.authz.plaintext-secret-string-field

  • severity HIGH, CWE-256, technology jenkins, confidence MEDIUM
  • excludes transient, static final, final, and literal-initialized fields to cut common false positives
  • validated with semgrep --validate; fires on a minimal positive repro and stays silent on a Secret-typed negative repro.

… String instead of hudson.util.Secret (CWE-256)
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