Repository navigation
fix: require Job/Build for new explanations and harden Test Configuration and auto-fix - #260
Merged
Merged
Conversation
"Test Configuration" of the Anthropic, Qwen and Azure OpenAI providers resolved the credentials ID with no item, which falls back to the Jenkins root as SYSTEM. A folder or job form could therefore send a credential that only Jenkins itself may use to the URL typed in the form. The test now looks the credential up in the item the form belongs to, as a build of that item does.
The console page and the Stages page called the AI provider for any user with Job/Read, anonymous readers included, and forceNew=true let them replace the explanation a build has. A new explanation now needs Job/Build; Job/Read still shows the explanation a build already has, and the Explain Error button is offered only to users who may use it. A request while an explanation of the build is being generated is answered with a warning instead of a second provider call, and the maxLines request parameter is capped at 1000 lines.
Auto-fix pushes its branch to the origin repository, and a CI system that builds branches runs it before anyone reviews the pull request. A change to a CI or pipeline definition, such as the Jenkinsfile, .github/workflows/*.yml or .gitlab-ci.yml, decides what that build runs and with which credentials, yet the default allow-list reached them through Jenkinsfile and *.yml. Such a file is now changed only when autoFixAllowedPaths spells out its path, with a pattern that does not start with a wildcard. Jenkinsfile leaves the default list, an empty list allows nothing instead of everything, globs are matched against the normalized path, and paths with backslashes are refused.
…sion-checks # Conflicts: # README.md
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.
Description
Three permission and safety fixes:
forceNew=truelet them replace the explanation a build has. A new explanation now needs Job/Build; Job/Read still shows the explanation a build already has, and the button is only offered to users who may use it. A request while an explanation of the build is being generated is answered with a warning instead of a second provider call, and themaxLinesrequest parameter is capped at 1000 lines.credentialsId(Anthropic, Qwen, Azure OpenAI) with no item, which falls back to the Jenkins root as SYSTEM, so a folder or job form could send a credential that only Jenkins itself may use to the URL typed in the form. It now looks the credential up in the folder or job the form belongs to, as a build of that item does.Jenkinsfile,.github/workflows/*,.gitlab-ci.yml,bitbucket-pipelines.ymland the like decides what a build of the pushed fix branch runs. Such a file is changed only whenautoFixAllowedPathsspells out its path (a pattern that does not start with a wildcard).Jenkinsfileleaves the default list, an empty list allows nothing, globs match the normalized path, and backslashes are refused.README and
docs/auto-fix.mddescribe the new rules.Before / After
Same steps against a local Jenkins 2.528.3 with an OpenAI-compatible mock provider, anonymous read access,
main(b048ffd) vs this branch:forceNew=truefor a build that has an explanationmaxLines=100000000on a 200,000-line logAuto-fix path check, through
attemptAutoFixwith the step's default allow-list unless noted:.github/workflows/release.ymlJenkinsfile.gitlab-ci.ymlpom.xmlpom.xml''(empty)src/../Jenkinsfilesrc/**Jenkinsfilepom.xml,JenkinsfileConsole page of a failed build without an explanation, seen by an anonymous reader:
After: a reader still opens the explanation a build has, without the control to replace it:

Related Issues
None.
Testing done
ExplanationPermissionTest: Job/Read vs Job/Build on both endpoints,forceNew, pending requests, themaxLinescap and the button on the console page.ProviderTestConfigurationTest: a folder form cannot send a SYSTEM-scoped credential (Anthropic, Qwen, Azure OpenAI) and still sends one the folder can use.AutoFixOrchestratorTest: CI and pipeline definitions, wildcard patterns, empty lists, normalized paths, backslashes.mvn verify(JDK 21): 901 tests pass, SpotBugs reports no issues.Submitter checklist
Was generative AI tooling used to co-author this PR?