Skip to content

feat(java): detect CredentialsProvider.lookupCredentials with null authentication (CWE-522) - #188

Open
ai-anant wants to merge 1 commit into
CodeVigilant:mainfrom
ai-anant:rule/jenkins-lookupcredentials-null-auth
Open

ai-anant wants to merge 1 commit into
CodeVigilant:mainfrom
ai-anant:rule/jenkins-lookupcredentials-null-auth

Conversation

@ai-anant

Copy link
Copy Markdown

Summary

Detects CredentialsProvider.lookupCredentials invoked with a null authentication argument.

In the Jenkins Credentials plugin, a null Authentication is treated as ACL.SYSTEM, so the lookup returns credentials the current user and the current item may not be allowed to use. Callers should pass the requestor's authentication and the owning Item/ItemGroup (for example CredentialsProvider.findCredentialById(id, type, item)).

Rule

  • id: codevigilant.java.jenkins.credentials.lookup-null-authentication
  • file: java/jenkins/credentials/lookup-null-authentication.yaml
  • CWE-522 / OWASP A01:2021

Validation

  • semgrep --validate on the new file: pass
  • Positive repro (lookupCredentials(..., null, ...)): fires
  • Negative (lookupCredentials with a non-null Authentication): silent
  • Semgrep community java/ and --config auto: 0 hits on the positive repro (not a community duplicate)

Notes

Single rule file on a branch created from upstream/main. No project-specific evidence.

…thentication (CWE-522)

A null Authentication argument is treated as ACL.SYSTEM by the Credentials
plugin, so the lookup returns secrets the caller and current item may not
be allowed to use.
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