Skip to content

feat(java): detect hardcoded credential/token literals (CWE-798) - #143

Open
ai-anant wants to merge 2 commits into
CodeVigilant:mainfrom
ai-anant:rule/java-jenkins-hardcoded-credential-literal
Open

feat(java): detect hardcoded credential/token literals (CWE-798)#143
ai-anant wants to merge 2 commits into
CodeVigilant:mainfrom
ai-anant:rule/java-jenkins-hardcoded-credential-literal

Conversation

@ai-anant

Copy link
Copy Markdown

New generic Jenkins security rule.

Pattern (generic): assignment of a string literal to an identifier whose name implies a secret/token/credential (e.g. TOKEN_ADMIN, apiKey, password, secret, access_key).

Why it matters: credentials embedded as literals in committed source or build/CI scripts are exposed to anyone with repository access and cannot be per-environment scoped or rotated (CWE-798).

Fix guidance: load from a secure secret store / injected environment (Jenkins credentials binding, vault, masked credential provider); never commit secret values.

Validated with semgrep --validate; fires on a hardcoded-token repro and does not fire on an env-injected/benign-identifier repro.

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