Skip to content

feat(java): detect state-changing Stapler do* handlers without @RequirePOST (CWE-352) - #112

Open
ai-anant wants to merge 1 commit into
CodeVigilant:mainfrom
ai-anant:rule/jenkins-requirepost-statechange
Open

feat(java): detect state-changing Stapler do* handlers without @RequirePOST (CWE-352)#112
ai-anant wants to merge 1 commit into
CodeVigilant:mainfrom
ai-anant:rule/jenkins-requirepost-statechange

Conversation

@ai-anant

Copy link
Copy Markdown

Adds a Java rule for the Jenkins framework: a public 'do*' method (Stapler-routed HTTP handler) that schedules builds, interrupts executors, or replaces the queue sorter without the @RequirePOST annotation.

Generic vulnerable shape:

  • public do* handler (no @RequirePOST)
  • body calls scheduleBuild2/scheduleBuild/schedule2, Executor.interrupt, or Queue.setSorter

Stapler routes unannotated do* methods on GET and POST; the Jenkins CSRF crumb is only enforced for POST, so the same state change is triggerable cross-site via a plain GET. Rule ID: codevigilant.java.jenkins.csrf.statechange-without-requirepost (new java/jenkins/csrf tree). Includes pos/neg testcases, validated with semgrep (pos: 1 hit, neg: 0).

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