-
Bug
-
Resolution: Fixed
-
Critical
-
None
-
Powered by SuggestiMate
I have this error during execution of a Jenkins job with "Scan for compiler warnings" in "post build action" (two parsers are use : parser1 and parser2) :
[WARNINGS] Parsing warnings in files 'output1' with parser parser1 [WARNINGS] Groovy sandbox rejected the parsing script for parser parser1: Scripts not permitted to use method java.util.regex.MatchResult group int. You will need to manually approve the call in the Script Approval UI. [WARNINGS] Parsing warnings in files 'output2' with parser parser2 [WARNINGS] Groovy sandbox rejected the parsing script for parser parser2: Scripts not permitted to use method java.util.regex.MatchResult group int. You will need to manually approve the call in the Script Approval UI.
Problem, java.util.regex.MatchResult method already approve in "In-process Script Approval" Windows (in Manage Jenkins) : see picture below.
In "Manage Jenkins" > "Configure System" > "Compiler Warnings" > "Parsers" there is no error message below parser1 and parser2... (I think about error message like "An exception occurred during evaluation of the Groovy script: Scripts not permitted to use method hudson.plugins.analysis.util.model.FileAnnotation setModuleName java.lang.String").
Can you help me to understand what thing I have missed to make please ?
Edit : as derrickgw say (thanks for him), the problem comes from warnings-plugin version 4.62, and more precisely from commit https://github.com/jenkinsci/warnings-plugin/commit/c59dd109dab6cf3a9f28ab6b221d402726d0f4aa
- is duplicated by
-
JENKINS-44332 Already approved signature still pending
-
- Resolved
-
- mentioned in
-
Page Failed to load
[JENKINS-43813] Scripts not permitted to use a method already approve in In-process Script Approval GUI
I work on :
- Jenkins 2.55
- I don't have warning and analysis-core plugin in my plugin list
romaric, I'm not sure I understand your question, but I will elaborate.
I am using Jenkins 2.32.3 & analysis-core ("Static Analysis Utilities") version 1.86.
Using the Warnings plugin 4.62 prevents my custom error parsers from working. Downgrading back to 4.60 works as expected.
The commit that broke it is this one: https://github.com/jenkinsci/warnings-plugin/commit/c59dd109dab6cf3a9f28ab6b221d402726d0f4aa
The commit comment says it all: "Merged security fixes into master (Groovy Sandbox for parsers)". The thing is, only admins can edit the parsers, since they live on the system configuration page. So if an admin writes the script, it should be automatically approved, and not have to run in the sandbox. I don't see how making the admin approve the scripts that he just wrote adds anything to security.
derrickgw, yes you had understood well my question, thanks for the workaround, it is working for mee too.
I update the ticket.
Hi there, just my 2 cents:
- Approving the scripts doesnt help me. I have approved everything I could find multiple times but not change.
- The problemantic error message is shown when parsing a log file, not the output log.
- I have the warning plugin 4.62 and can only revert to 4.61, not 4.60 as suggested in previous comments.
- In Jenkins script approval settings screen, I have the notification that method java.util.regex.MatchResult group int needs to be approved. But its is already listed in both text boxes as approved:
So I am stuck now with a partly dysfunctional Jenkins which is pretty sad. Is there anything I can do?
Thank you!
Best Regards
Paul
Sorry Paul Schwann, can't help you... I don't know why you can't revert warning plugin before 4.61...
For us it's quite serious that the parser failes silently - so we are happily getting successful builds although they should have failed.
It took some days until we got aware of this - during this time we could've merged faulty code without knowing.
Same problem here.
Could also be "fixed" by downgrading to 4.60
In my case, the problem with 4.62 occurs on node only, not on jobs running on master.
Please have a look at JENKINS-44332
There, I posted steps to reproduce the problem. Not sure if it is this plugin or script security plugin
Steps to reproduce:
1) Install warnings plugin 4.62
2) Go to "Manage Jenkins" -> "Configure System" -> "Compiler Warnings"
3) Add parser as shown in attached screenshot (parser.PNG)
4) Generate freestyle job and add a build step (here: Windows batch) and post build action as shown in attached screenshot (job.PNG)
5) Run the job on master (therefore, you can select "Restrict where this project can be run" to "master" in the job configuration)
6) It should work (probably you need to approve permissions) and you should see the following console output:
[WARNINGS] Parsing warnings in files 'foo.txt' with parser Dummy Parser
[WARNINGS] Searching for all files in C:\Program Files (x86)\Jenkins\workspace\TestWarnings that match the pattern foo.txt
[WARNINGS] Parsing 1 file in C:\Program Files (x86)\Jenkins\workspace\TestWarnings
[WARNINGS] Successfully parsed file C:\Program Files (x86)\Jenkins\workspace\TestWarnings\foo.txt with 1 unique warning and 0 duplicates.
[WARNINGS] Computing warning deltas based on reference build #9
Finished: SUCCESS
7) Change "Restrict where this project can be run" to a node (yes, sorry, you need to have a node) and start the job again. Now, you always see a pending approval which was already approved. After approving, you can run the job again on the node and the signature needs approval again. The console output of the job is like:
[WARNINGS] Parsing warnings in files 'foo.txt' with parser Dummy Parser
[WARNINGS] Groovy sandbox rejected the parsing script for parser Dummy Parser: Scripts not permitted to use new hudson.plugins.warnings.parser.Warning java.lang.String int java.lang.String java.lang.String java.lang.String. You will need to manually approve the call in the Script Approval UI.
[WARNINGS] Computing warning deltas based on reference build #8
You see, that parsing the script was rejected!
Thanks for the detailed steps to reproduce. Indeed, the current implementation in 4.61 and newer does not run on agents, only on the master. This is due to the fact, that the script security plug-in does not support scripts that run on an agent, only scripts on the master are supported so far.
Code changed in jenkins
User: Ulli Hafner
Path:
analysis-core.iml
pom.xml
src/main/java/hudson/plugins/analysis/util/model/AbstractAnnotation.java
src/main/java/hudson/plugins/analysis/util/model/Priority.java
http://jenkins-ci.org/commit/analysis-core-plugin/14be26db0efdf5085b1aaab6149cc7b0f448d98e
Log:
[FIXED JENKINS-43813] Remove dependency to script-security-plugin.
Removed script sandbox for Groovy parsers. Now parsers can be defined
in the global configuration by an administrator with RUN_SCRIPTS
permission. The script itself is not checked by the sandbox anymore.
Compare: https://github.com/jenkinsci/analysis-core-plugin/compare/faea9fdf454e^...14be26db0efd
Code changed in jenkins
User: Ulli Hafner
Path:
pom.xml
src/main/java/hudson/plugins/warnings/WarningsPublisher.java
src/main/java/hudson/plugins/warnings/parser/AbstractWarningsParser.java
src/main/java/hudson/plugins/warnings/parser/GroovyExpressionMatcher.java
src/main/java/hudson/plugins/warnings/parser/GroovyWhiteList.java
src/main/java/hudson/plugins/warnings/parser/RegexpLineParser.java
src/main/java/hudson/plugins/warnings/parser/RegexpParser.java
src/main/java/hudson/plugins/warnings/parser/Warning.java
src/main/resources/hudson/plugins/warnings/parser/groovy.whitelist
src/test/java/hudson/plugins/warnings/parser/DynamicParserTest.java
warnings.iml
http://jenkins-ci.org/commit/warnings-plugin/f699e2aa82e932435711d3b524936b0f8065c73d
Log:
[FIXED JENKINS-43813] Remove dependency to script-security-plugin.
Removed script sandbox for Groovy parsers. Now parsers can be defined
in the global configuration by an administrator with RUN_SCRIPTS
permission. The script itself is not checked by the sandbox anymore.
Compare: https://github.com/jenkinsci/warnings-plugin/compare/f2af9b503e01^...f699e2aa82e9
Code changed in jenkins
User: Ulli Hafner
Path:
analysis-core
warnings
http://jenkins-ci.org/commit/analysis-suite-plugin/faf45e8cbcc32d13533e33d18e08d2866df2660c
Log:
[FIXED JENKINS-43813] Remove dependency to script-security-plugin.
Removed script sandbox for Groovy parsers. Now parsers can be defined
in the global configuration by an administrator with RUN_SCRIPTS
permission. The script itself is not checked by the sandbox anymore.
Code changed in jenkins
User: Ulli Hafner
Path:
analysis-collector.iml
http://jenkins-ci.org/commit/analysis-collector-plugin/3bda19546d1bd91c34a529fe32d6cfeecf0c5328
Log:
JENKINS-43813 Remove dependency to script-security-plugin.
Removed script sandbox for Groovy parsers. Now parsers can be defined
in the global configuration by an administrator with RUN_SCRIPTS
permission. The script itself is not checked by the sandbox anymore.
Code changed in jenkins
User: Ulli Hafner
Path:
analysis-test.iml
http://jenkins-ci.org/commit/analysis-test-plugin/df226e2772ffd2609b50b3b206ce4b364af6dcda
Log:
JENKINS-43813 Remove dependency to script-security-plugin.
Removed script sandbox for Groovy parsers. Now parsers can be defined
in the global configuration by an administrator with RUN_SCRIPTS
permission. The script itself is not checked by the sandbox anymore.
Compare: https://github.com/jenkinsci/analysis-test-plugin/compare/3d724417d5f4...df226e2772ff
Code changed in jenkins
User: Ulli Hafner
Path:
dry.iml
http://jenkins-ci.org/commit/dry-plugin/1b776025338103f333ebab7e26c9074fcdfc20d2
Log:
JENKINS-43813 Remove dependency to script-security-plugin.
Removed script sandbox for Groovy parsers. Now parsers can be defined
in the global configuration by an administrator with RUN_SCRIPTS
permission. The script itself is not checked by the sandbox anymore.
Compare: https://github.com/jenkinsci/dry-plugin/compare/bf8516dddf91...1b7760253381
Code changed in jenkins
User: Ulli Hafner
Path:
checkstyle.iml
http://jenkins-ci.org/commit/checkstyle-plugin/5dfec3459cc769e953544a861efc2a74fe5ffbf8
Log:
JENKINS-43813 Remove dependency to script-security-plugin.
Removed script sandbox for Groovy parsers. Now parsers can be defined
in the global configuration by an administrator with RUN_SCRIPTS
permission. The script itself is not checked by the sandbox anymore.
Compare: https://github.com/jenkinsci/checkstyle-plugin/compare/9275147718b4...5dfec3459cc7
Code changed in jenkins
User: Ulli Hafner
Path:
plugin/findbugs.iml
http://jenkins-ci.org/commit/findbugs-plugin/83152fec086ab0e8538cf3f2f6f30f5111d0ba1c
Log:
JENKINS-43813 Remove dependency to script-security-plugin.
Removed script sandbox for Groovy parsers. Now parsers can be defined
in the global configuration by an administrator with RUN_SCRIPTS
permission. The script itself is not checked by the sandbox anymore.
Compare: https://github.com/jenkinsci/findbugs-plugin/compare/627268976d3e...83152fec086a
Code changed in jenkins
User: Ulli Hafner
Path:
pmd.iml
http://jenkins-ci.org/commit/pmd-plugin/ca84f389ebf92e383ccdd03cd892447409150cfb
Log:
JENKINS-43813 Remove dependency to script-security-plugin.
Removed script sandbox for Groovy parsers. Now parsers can be defined
in the global configuration by an administrator with RUN_SCRIPTS
permission. The script itself is not checked by the sandbox anymore.
Compare: https://github.com/jenkinsci/pmd-plugin/compare/400d6ec6f3bc...ca84f389ebf9
Code changed in jenkins
User: Ulli Hafner
Path:
tasks.iml
http://jenkins-ci.org/commit/tasks-plugin/a53f51259ea001701754bae62dbbe91666f2309b
Log:
JENKINS-43813 Remove dependency to script-security-plugin.
Removed script sandbox for Groovy parsers. Now parsers can be defined
in the global configuration by an administrator with RUN_SCRIPTS
permission. The script itself is not checked by the sandbox anymore.
Compare: https://github.com/jenkinsci/tasks-plugin/compare/c72d47aa9761...a53f51259ea0
Test on a Jenkins slave, parser succefully parse job output and show me warning.
Test on a Jenkins slave, parser succefully parse job output and show me warning.
Test made after update warning plugin to 4.63 version.
Thanks for your work
We can also confirm upgrading to Warnings 4.63 fixed this issue and the job output parsing is now working as expected. Many thanks for the fix.
I'm seeing the same thing with my custom parsers; the built-in warning parsers seem to be fine.
Jenkins version: 2.19.4
warnings plugin version: 4.62
analysis-core plugin version: 1.86