Skip to content

fix: restore the no-permission-check suppression on doIndex - #46

Merged
kurok merged 1 commit into
masterfrom
fix/restore-permission-check-suppression
Sep 18, 2026
Merged

kurok merged 1 commit into
masterfrom
fix/restore-permission-check-suppression

Conversation

@kurok

@kurok kurok commented Sep 18, 2026

Copy link
Copy Markdown

Fixes code scanning alert #13 (jenkins/no-permission-check on BuildUrlAction#doIndex).

I caused this

#44 removed the lgtm[jenkins/no-permission-check] marker, on the grounds that the method "now does check" — having just added the visibleTo guard. That conflated two different things:

  • visibleTo is a principal check — is this caller one of the people the link was restricted to. It narrows access on top of what Jenkins has already granted.
  • The suppression was about a permission check, and its justification never stopped being true.

Why it is a false positive

By the scanner's own criteria — "the method is otherwise protected":

  • doIndex is reachable only as a child of the Run, so core enforces Item.READ on the job and the build before anything in it executes.
  • It has no side effects — it is a 302.
  • The URL it redirects to is one the same caller can already read off the build page.

Adding a checkPermission call would be redundant with the routing that already protects it, and would give the false impression that this endpoint is the access-control boundary. It is not — as the README now says, the target job enforces its own permissions.

What changed

Only the marker and the comment. The reasoning now lives next to the method, including the fact that it was removed in error, so the next person reading "it does check visibleTo" does not reach the same wrong conclusion I did.

Local mvn clean verify: 47 tests, green. The security scan on this PR is the real check — it should come back with the alert gone.

Release note

This was found while cutting 0.3.0. I stopped the release rather than ship a known alert; it will be cut from master once this lands.

The Jenkins Security Scan raised jenkins/no-permission-check on
BuildUrlAction#doIndex after #44. I caused that: #44 removed the
lgtm[jenkins/no-permission-check] marker on the grounds that the method "now
does check", having just added the visibleTo guard.

That conflated two different things. visibleTo is a principal check -- is this
caller one of the people the link was restricted to -- and it narrows access on
top of what Jenkins has already granted. The suppression was about a permission
check, and its justification never stopped being true: the method is reachable
only as a child of the Run, so core enforces Item.READ on the job and the build
before anything in it runs. It has no side effects, and the URL it redirects to
is one the same caller can read off the build page.

So this is a false positive by the scanner's own criteria ("the method is
otherwise protected"), and the fix is to restore the marker rather than to add
a permission check that would be redundant with routing. The reasoning is now
written next to it, including the fact that it was removed in error, so the
next person to read "it does check visibleTo" does not draw the same wrong
conclusion.

Signed-off-by: kurok <22548029+kurok@users.noreply.github.com>
@kurok
kurok merged commit e6cb78b into master Sep 18, 2026
6 checks passed
@kurok
kurok deleted the fix/restore-permission-check-suppression branch September 18, 2026 19:07
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