fix: restore the no-permission-check suppression on doIndex - #46
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes code scanning alert #13 (
jenkins/no-permission-checkonBuildUrlAction#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 thevisibleToguard. That conflated two different things:visibleTois 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.Why it is a false positive
By the scanner's own criteria — "the method is otherwise protected":
doIndexis reachable only as a child of theRun, so core enforcesItem.READon the job and the build before anything in it executes.Adding a
checkPermissioncall 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.