Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
271 commits
Select commit Hold shift + click to select a range
a999951
[maven-release-plugin] prepare release groovy-sandbox-1.0
kohsuke Jun 9, 2012
e30ab81
[maven-release-plugin] prepare for next development iteration
kohsuke Jun 9, 2012
0a1071f
Support class nodes
vietj Mar 21, 2013
b39732e
Added test for closure (doesn't pass)
vietj Mar 21, 2013
ce072dc
Merge pull request #1 from vietj/master
kohsuke Apr 19, 2013
77d2eec
doc improvement
kohsuke Aug 9, 2013
920f145
implemented interception of compound assignments
kohsuke Aug 9, 2013
d459262
Started working on intercepting comparisons
kohsuke Aug 9, 2013
4c5f473
added support for comparison operators
kohsuke Aug 12, 2013
c06af5e
nested closure definitions weren't visited
kohsuke Aug 12, 2013
9e3ea2f
now that we intercept comparison operators boolean needs to be whitel…
kohsuke Aug 12, 2013
88205b1
more tests
kohsuke Aug 12, 2013
77f5fde
[maven-release-plugin] prepare release groovy-sandbox-1.1
kohsuke Aug 12, 2013
4b11132
[maven-release-plugin] prepare for next development iteration
kohsuke Aug 12, 2013
5c1e1a7
updated the version
kohsuke Aug 12, 2013
2a97fab
Fixed issue #2
kohsuke Sep 3, 2013
7ae834c
method arguments weren't transformed correctly in a recursive manner
kohsuke Nov 4, 2013
397e3d1
Should intercept property lookup
kohsuke Nov 4, 2013
0e869f7
[maven-release-plugin] prepare release groovy-sandbox-1.2
kohsuke Nov 4, 2013
9146684
[maven-release-plugin] prepare for next development iteration
kohsuke Nov 4, 2013
c65b4ef
test case that came from https://github.com/kohsuke/groovy-sandbox/is…
kohsuke Nov 14, 2013
f307fb1
Fixed issue #4: static calls weren't routed properly
kohsuke Nov 14, 2013
a0a3d49
Changed the recorder format to differentiate static methods call vs i…
kohsuke Nov 14, 2013
014d463
Bumping up GMaven to the one that supports 1.8
kohsuke Nov 14, 2013
f9f7d1a
intercept method pointer expressions correctly
kohsuke Nov 14, 2013
da50957
Fixed issue #5: avoid using var args
kohsuke Nov 14, 2013
e0660c0
Fixed issue #6.
kohsuke Nov 14, 2013
1e1482c
misc. follow up fixes to earlier bug fixes
kohsuke Nov 14, 2013
1f909af
[maven-release-plugin] prepare release groovy-sandbox-1.3
kohsuke Nov 14, 2013
d48b8b0
[maven-release-plugin] prepare for next development iteration
kohsuke Nov 14, 2013
704b96a
test case for issue #9
ndeloof Dec 9, 2013
c024567
Fixed issue #9
kohsuke Jan 15, 2014
97b49dc
[maven-release-plugin] prepare release groovy-sandbox-1.4
kohsuke Jan 15, 2014
f71cb46
[maven-release-plugin] prepare for next development iteration
kohsuke Jan 15, 2014
fbcea6f
Fixed the handling of implicit 'this' inside closure
kohsuke Jan 28, 2014
38b0d38
Fixed the handling of implicit 'this' inside closure (property access)
kohsuke Jan 28, 2014
e03c4e7
Leaving note for issue #11
kohsuke Jan 28, 2014
ad77ce4
[maven-release-plugin] prepare release groovy-sandbox-1.5
kohsuke Jan 28, 2014
d153506
[maven-release-plugin] prepare for next development iteration
kohsuke Jan 28, 2014
38eea2e
adding a test case to intercept GString
kohsuke Mar 12, 2014
c272bf3
Create README.md
nathansgreen Mar 14, 2014
546c1ac
Created README
Mar 15, 2014
10a8f54
Syntax highlighting in README
nathansgreen Mar 15, 2014
f0b20e0
Linking to documentation and example in README
Mar 15, 2014
f6bfc9d
Merge pull request #13 from nathansgreen/master
kohsuke Mar 17, 2014
79d8046
Tracking in-scope local variables.
kohsuke May 4, 2014
3b7a333
Intercept property access with implicit 'this' object correctly.
kohsuke May 4, 2014
aa7a42a
Bug fix.
kohsuke May 9, 2014
818b58c
Updated the assertion.
kohsuke May 9, 2014
b0e3a38
Updated tests to correctly handle implicit property access
kohsuke May 9, 2014
2900970
need to allow access to the compiled script itself now that we interc…
kohsuke May 9, 2014
eb6c335
Updated test case and more closure related bug fix
kohsuke May 9, 2014
dd84146
Looks like I was revisiting the same method twice.
kohsuke May 9, 2014
4e24387
Do not intercept 'instanceof'
kohsuke May 9, 2014
dca7b2d
Added support for regexp operators
kohsuke May 9, 2014
24f48fe
[maven-release-plugin] prepare release groovy-sandbox-1.6
kohsuke May 9, 2014
38dcd07
[maven-release-plugin] prepare for next development iteration
kohsuke May 9, 2014
18e5d33
Update README.md
kohsuke May 9, 2014
117af39
generate test jar as well
kohsuke Jul 15, 2014
a5d0798
exposing the visitor to support selective transformation by other cla…
kohsuke Jul 17, 2014
532a9eb
[maven-release-plugin] prepare release groovy-sandbox-1.7
kohsuke Jul 17, 2014
fb8214a
[maven-release-plugin] prepare for next development iteration
kohsuke Jul 17, 2014
1e3d267
Testing the comparison, and this works
kohsuke Oct 28, 2014
9247985
Fixed issue #17
kohsuke Oct 28, 2014
eec9c43
Fixed issue #16.
kohsuke Oct 28, 2014
6e55b9c
Catch statement declares a new local variable
kohsuke Oct 28, 2014
40abd3b
Fixed issue #21
kohsuke Oct 28, 2014
b7a3789
Adding the license explicitly by request
kohsuke Oct 28, 2014
03cdc3f
Fixed issue #15.
kohsuke Oct 28, 2014
4c2ff49
Revisiting the fix for issue #15.
kohsuke Oct 28, 2014
a3d4dc8
[maven-release-plugin] prepare release groovy-sandbox-1.8
kohsuke Oct 28, 2014
b572c60
[maven-release-plugin] prepare for next development iteration
kohsuke Oct 28, 2014
7485402
[JENKINS-28586] figure out where closure is forwarding property/metho…
kohsuke May 27, 2015
0e1ac6a
[maven-release-plugin] prepare release groovy-sandbox-1.9
kohsuke May 27, 2015
ee2e39b
[maven-release-plugin] prepare for next development iteration
kohsuke May 27, 2015
945dd55
Correctly intercept "in" oprator
olivergondza Jun 23, 2015
06d7021
Wrong signature was being tested.
kohsuke Aug 11, 2015
3cfa98f
Merge pull request #26 from olivergondza/JENKINS-28154
kohsuke Aug 15, 2015
2a93479
Property accesss on Map is handled specially by MetaClassImpl
kohsuke Aug 13, 2015
8606336
Bumping up the parent POM
kohsuke Aug 18, 2015
c2e4d6b
[maven-release-plugin] prepare release groovy-sandbox-1.10
kohsuke Aug 18, 2015
1cab580
[maven-release-plugin] prepare for next development iteration
kohsuke Aug 18, 2015
d491a67
Intercept super.foo() calls
kohsuke Sep 18, 2016
e7aad74
[maven-release-plugin] prepare release groovy-sandbox-1.11
kohsuke Sep 18, 2016
5641216
[maven-release-plugin] prepare for next development iteration
kohsuke Sep 18, 2016
15f420c
Converted main sources from Groovy to Java.
jglick Jul 11, 2017
e6447ef
Need to track scope also when transforming fields; otherwise we get a…
jglick Jul 11, 2017
b36bbe2
Seem to have found a fix for JENKINS-34599.
jglick Jul 12, 2017
ce6501a
Better way of tracking owning ClassNode, needed to handle instance in…
jglick Jul 13, 2017
4253268
Merge pull request #32 from jglick/not-feeling-so-Groovy
jglick Jul 18, 2017
17552d5
Merge branch 'master' into final-fields-JENKINS-34599
jglick Jul 18, 2017
13afba1
Merge pull request #33 from jglick/final-fields-JENKINS-34599
jglick Jul 18, 2017
41d58a3
Reflecting the GitHub move to @jenkinsci.
jglick Jul 18, 2017
b6607c6
Groovy 2 update.
jglick Jul 25, 2017
4048d9a
Merge pull request #35 from jglick/groovy2
jglick Jul 25, 2017
870957b
[maven-release-plugin] prepare release groovy-sandbox-1.12
jglick Jul 25, 2017
fa14309
[maven-release-plugin] prepare for next development iteration
jglick Jul 25, 2017
3360065
[maven-release-plugin] rollback the release of groovy-sandbox-1.12
jglick Jul 25, 2017
62fd9f6
Javadoc fixes and warnings.
jglick Jul 25, 2017
108900c
[maven-release-plugin] prepare release groovy-sandbox-1.12
jglick Jul 25, 2017
e546f9f
[maven-release-plugin] prepare for next development iteration
jglick Jul 25, 2017
6d556e2
Updated some more links to @jenkinsci.
jglick Jul 25, 2017
0f2ed68
[JENKINS-45776] Handle local variables better in closures.
abayer Jul 25, 2017
00fcf59
Closed sandbox bypasses via:
jglick Jul 28, 2017
f1e36ad
[maven-release-plugin] prepare release groovy-sandbox-1.13
jglick Jul 28, 2017
29c75aa
[maven-release-plugin] prepare for next development iteration
jglick Jul 28, 2017
8bcb0c0
[FIXED JENKINS-46088] Stop double-transforming casts in declarations
abayer Aug 9, 2017
35aa90d
Merge remote-tracking branch 'origin/master' into jenkins-45776
abayer Aug 9, 2017
df35de0
Test had wrong return value. Whoops.
abayer Aug 9, 2017
3a88b68
[FIXED JENKINS-33468] Declare implicit closure parameter variable
abayer Aug 11, 2017
a336276
Add issue tag
abayer Aug 15, 2017
ef51992
Merge pull request #37 from abayer/jenkins-46088
abayer Aug 16, 2017
f99b3d2
Merge pull request #38 from abayer/jenkins-33468
abayer Aug 16, 2017
7fccff9
Merge remote-tracking branch 'origin/master' into jenkins-45776
abayer Aug 16, 2017
d434167
Merge pull request #36 from abayer/jenkins-45776
abayer Aug 16, 2017
29ba446
[maven-release-plugin] prepare release groovy-sandbox-1.14
jglick Aug 16, 2017
80ec5dd
[maven-release-plugin] prepare for next development iteration
jglick Aug 16, 2017
11de62d
[FIXED JENKINS-46191] Do not cast empty declarations.
abayer Aug 16, 2017
01744cc
Merge pull request #39 from abayer/jenkins-46191
abayer Aug 16, 2017
cc38ef1
[maven-release-plugin] prepare release groovy-sandbox-1.15
jglick Aug 16, 2017
1e3d36e
[maven-release-plugin] prepare for next development iteration
jglick Aug 16, 2017
aa3db03
Updated parent to 19.
jglick Sep 20, 2017
b507bc1
Merge pull request #40 from jglick/autoReleaseAfterClose
abayer Nov 6, 2017
895480b
Jenkinsfile
jglick Nov 27, 2017
1c14f2c
Trying a custom Jenkinsfile, since buildPlugin() assumes *.hpi artifa…
jglick Nov 27, 2017
14c9aff
mvn not in $PATH. Fine, wait for an available Docker agent.
jglick Nov 27, 2017
ca7e2fd
Merge pull request #42 from jglick/Jenkinsfile
jglick Nov 27, 2017
0d985a7
[SECURITY-663] Special-case for CharSequence as File
abayer Nov 22, 2017
e368e2d
[maven-release-plugin] prepare release groovy-sandbox-1.16
abayer Dec 1, 2017
fbea6e0
[maven-release-plugin] prepare for next development iteration
abayer Dec 1, 2017
c4bf3b2
[JENKINS-45982] Unwrap super call GroovyRuntimeExceptions
abayer Feb 27, 2018
6d8152e
[maven-release-plugin] prepare release groovy-sandbox-1.17
abayer Mar 12, 2018
5afec73
[maven-release-plugin] prepare for next development iteration
abayer Mar 12, 2018
72084d3
[FIXED JENKINS-50380] checkedCast should use clazz.cast when assignable
abayer Mar 27, 2018
3dc4b22
Actually, smarter still - just return the object if it can be
abayer Mar 27, 2018
e2454ac
Merge pull request #45 from abayer/jenkins-50380
abayer Mar 28, 2018
c7f50e8
[maven-release-plugin] prepare release groovy-sandbox-1.18
abayer Mar 28, 2018
a6e95d7
[maven-release-plugin] prepare for next development iteration
abayer Mar 28, 2018
dbf8257
[JENKINS-50470] Treat checkedGetProperty for collection as spread
abayer Mar 29, 2018
e95c1c1
Need to make sure we still do .class and friends.
abayer Mar 30, 2018
294f778
Merge pull request #46 from abayer/jenkins-50470
abayer Apr 12, 2018
2480cd8
[maven-release-plugin] prepare release groovy-sandbox-1.19
abayer Apr 12, 2018
26ffba4
[maven-release-plugin] prepare for next development iteration
abayer Apr 12, 2018
0cd7ec1
[SECURITY-1186] Forbid sandboxed classes from overriding finalize.
dwnusbaum Oct 18, 2018
63e8881
[maven-release-plugin] prepare release groovy-sandbox-1.20
jglick Oct 18, 2018
e7f1209
[maven-release-plugin] prepare for next development iteration
jglick Oct 18, 2018
b3e13bd
Update comment, add a test case, and move annotation to class level
dwnusbaum Oct 29, 2018
993c000
Merge pull request #50 from dwnusbaum/cleanup
dwnusbaum Nov 6, 2018
f70ed15
[SECURITY-1353] Problems with casts
jglick Mar 18, 2019
1feec65
Backing out of https://github.com/kohsuke/pom/pull/4 since that seems…
jglick Mar 18, 2019
b69013d
[maven-release-plugin] prepare release groovy-sandbox-1.21
jglick Mar 18, 2019
48f97a9
[maven-release-plugin] prepare for next development iteration
jglick Mar 18, 2019
ccd7c7c
org.kohsuke:pom:21
jglick Mar 29, 2019
eb22cda
Merge pull request #55 from jglick/parent
jglick Mar 29, 2019
e30cd28
[SECURITY-1465] Problems with method pointers and casts
dwnusbaum Jul 25, 2019
5114f22
[maven-release-plugin] prepare release groovy-sandbox-1.22
dwnusbaum Jul 25, 2019
493c686
[maven-release-plugin] prepare for next development iteration
dwnusbaum Jul 25, 2019
18c9f74
[SECURITY-1538] Problems with method and property names and increment…
dwnusbaum Sep 10, 2019
63d0a9d
[maven-release-plugin] prepare release groovy-sandbox-1.23
dwnusbaum Sep 10, 2019
62f4976
[maven-release-plugin] prepare for next development iteration
dwnusbaum Sep 10, 2019
60c3653
[SECURITY-1579] Transform initial expressions for parameters in const…
dwnusbaum Sep 10, 2019
845d61c
[maven-release-plugin] prepare release groovy-sandbox-1.24
dwnusbaum Sep 25, 2019
926d99b
[maven-release-plugin] prepare for next development iteration
dwnusbaum Sep 25, 2019
2900693
Update documentation to make repository location clear
oliverlockwood Nov 14, 2019
22d5172
[SECURITY-1658] Transform initial expressions for parameters in closu…
dwnusbaum Nov 15, 2019
fe9b4e3
[maven-release-plugin] prepare release groovy-sandbox-1.25
dwnusbaum Nov 15, 2019
26624c8
[maven-release-plugin] prepare for next development iteration
dwnusbaum Nov 15, 2019
150be56
Update README.md
oliverlockwood Nov 25, 2019
e2c6747
Update README.md
oliverlockwood Nov 25, 2019
5eff097
Merge pull request #58 from oliverlockwood/document-repository-location
dwnusbaum Nov 25, 2019
f4319eb
[SECURITY-1754] Prevent unsandboxed constructor invocation
dwnusbaum Mar 3, 2020
1574c56
[maven-release-plugin] prepare release groovy-sandbox-1.26
dwnusbaum Mar 3, 2020
1899198
[maven-release-plugin] prepare for next development iteration
dwnusbaum Mar 3, 2020
ab9f16f
Update README to explicitly discourage use of this library from outsi…
dwnusbaum Jan 20, 2020
870b832
Remove Maven site
dwnusbaum May 26, 2020
b14b55d
Merge pull request #63 from dwnusbaum/update-readme
dwnusbaum May 28, 2020
3e0245f
[SECURITY-2020]
dwnusbaum Sep 17, 2020
abf7c35
[maven-release-plugin] prepare release groovy-sandbox-1.27
dwnusbaum Sep 17, 2020
b335967
[maven-release-plugin] prepare for next development iteration
dwnusbaum Sep 17, 2020
bb7b11a
Bump Groovy from 2.4.12 to 2.4.21
basil Nov 20, 2021
ded26c1
Update pom.xml
basil Nov 22, 2021
dc37bc5
Add test demonstrating that EqualsAndHashCode respects the sandbox tr…
dwnusbaum Jun 14, 2022
5c5e5bb
Merge pull request #75 from dwnusbaum/equalsAndHashCode
dwnusbaum Jun 14, 2022
7a33c35
Merge pull request #73 from basil/groovy
dwnusbaum Jun 14, 2022
f5f5db3
Switch parent POM to org.jenkins-ci:jenkins
dwnusbaum Jun 16, 2022
ddfe633
Improve interception of unary operator expressions
dwnusbaum May 24, 2022
3a0db4a
Improve interception of range expressions
dwnusbaum May 24, 2022
4eac49f
Update Jenkinsfile
dwnusbaum Jun 17, 2022
a143ec3
Refactor assertFails to check that the exceptions match each other ra…
dwnusbaum Jun 20, 2022
7adf4a8
Enable Release Drafter
dwnusbaum Jun 20, 2022
5c9810d
Enable Dependabot
dwnusbaum Jun 20, 2022
d1bf35b
Preserve org.kohsuke groupId
dwnusbaum Jun 20, 2022
adbc0ab
Fix SCM URL
dwnusbaum Jun 20, 2022
67c7335
Merge pull request #76 from dwnusbaum/change-parent-pom
dwnusbaum Jun 20, 2022
190dd89
Merge branch 'master' into improve-interception
dwnusbaum Jun 20, 2022
ad7bb99
Fix invalid Javadoc references
dwnusbaum Jun 20, 2022
35b262c
Remove explicit versions for Maven plugins that are already versioned…
dwnusbaum Jun 22, 2022
f487e5d
Update git-changelist-maven-extensions to 1.3
dwnusbaum Jun 22, 2022
413265e
Exclude Groovy from Dependabot updates
dwnusbaum Jun 22, 2022
8bc2ef2
Merge pull request #82 from dwnusbaum/minimize-dependabot-noise
dwnusbaum Jun 23, 2022
ca1d8b0
Refactor comparison to avoid RC_REF_COMPARISON_BAD_PRACTICE_BOOLEAN
dwnusbaum Jun 30, 2022
74d3a4e
Merge pull request #77 from dwnusbaum/improve-interception
dwnusbaum Jul 14, 2022
794849d
Bump git-changelist-maven-extension from 1.3 to 1.4
dependabot[bot] Jul 25, 2022
669ca80
Bump gmavenplus-plugin from 1.13.1 to 2.0.0
dependabot[bot] Oct 10, 2022
5202432
[SECURITY-2824]
dwnusbaum Oct 14, 2022
32d5170
[maven-release-plugin] prepare release groovy-sandbox-1.30
dwnusbaum Oct 14, 2022
ea817a9
[maven-release-plugin] prepare for next development iteration
dwnusbaum Oct 14, 2022
549f6aa
[JENKINS-69899] Do not visit EmptyExpression when transforming fields…
dwnusbaum Oct 19, 2022
46f2fc8
Merge pull request #94 from dwnusbaum/JENKINS-69899
dwnusbaum Oct 20, 2022
17da907
Merge pull request #86 from jenkinsci/dependabot/maven/io.jenkins.too…
dwnusbaum Oct 20, 2022
2300bc2
Merge pull request #93 from jenkinsci/dependabot/maven/org.codehaus.g…
dwnusbaum Oct 20, 2022
13c0201
Add a test for sandbox-transformed constructors with varargs parameters
dwnusbaum Oct 20, 2022
e724b47
Merge pull request #95 from dwnusbaum/test-constructor-varargs
dwnusbaum Oct 20, 2022
66ff87d
[maven-release-plugin] prepare release groovy-sandbox-1.31
dwnusbaum Oct 20, 2022
e2474b6
[maven-release-plugin] prepare for next development iteration
dwnusbaum Oct 20, 2022
4cdfcb5
Migrate all Groovy test sources to Java
dwnusbaum Oct 21, 2022
e416904
Add .DS_Store files to .gitignore
dwnusbaum Oct 21, 2022
3e9735e
Remove gmavenplus
dwnusbaum Oct 21, 2022
91b315a
Remove unhelpful writes to stdout in tests
dwnusbaum Oct 21, 2022
a7d48a5
Try to fix TheTest.testAsFile on Windows
dwnusbaum Oct 25, 2022
a27b11f
Merge pull request #96 from dwnusbaum/no-groovy-test-sources
dwnusbaum Oct 25, 2022
3f6e669
Update parent POM
basil Oct 27, 2022
137211a
Fix broken link
basil Oct 28, 2022
a9b6c1d
Use plugin parent POM
basil Nov 1, 2022
e87067a
Fix interception of return statements in closures
dwnusbaum Dec 8, 2022
fe9f44a
Merge pull request #100 from dwnusbaum/return-statements-in-closures
dwnusbaum Dec 8, 2022
598b7bb
Merge pull request #98 from basil/refresh
dwnusbaum Dec 8, 2022
eed927e
[maven-release-plugin] prepare release groovy-sandbox-1.32
dwnusbaum Dec 8, 2022
6cdba35
[maven-release-plugin] prepare for next development iteration
dwnusbaum Dec 8, 2022
89a23c4
[JENKINS-70080] Do not generate invalid bytecode for field assignment…
dwnusbaum Feb 3, 2023
017bd00
[JENKINS-70080] Simplify code based on review feedback
dwnusbaum Feb 7, 2023
4693c22
Bump git-changelist-maven-extension from 1.4 to 1.6
dependabot[bot] Feb 20, 2023
b84b956
Do not double-visit expressions in for loop and while loop conditions…
dwnusbaum Mar 20, 2023
6c8ab91
Merge branch 'master' into JENKINS-70080
dwnusbaum Mar 20, 2023
b3af9f7
Add comments explaining why we avoid some superclass methods in Scope…
dwnusbaum Mar 20, 2023
0aca2e5
Merge pull request #103 from dwnusbaum/JENKINS-70080
dwnusbaum Mar 20, 2023
0c33017
Merge pull request #105 from jenkinsci/dependabot/maven/io.jenkins.to…
dwnusbaum Mar 20, 2023
018cd2e
[maven-release-plugin] prepare release groovy-sandbox-1.33
dwnusbaum Apr 17, 2023
a59c3fe
[maven-release-plugin] prepare for next development iteration
dwnusbaum Apr 17, 2023
b88f632
SECURITY-3341
Apr 16, 2024
388553a
[maven-release-plugin] prepare release groovy-sandbox-1.34
Kevin-CB Apr 16, 2024
8919027
[maven-release-plugin] prepare for next development iteration
Kevin-CB Apr 16, 2024
81fd696
Update plugin parent POM to latest (#110)
basil Aug 1, 2024
c9b1bed
Bump io.jenkins.tools.incrementals:git-changelist-maven-extension (#121)
dependabot[bot] Aug 1, 2024
740bc74
Bump release-drafter/release-drafter from 5 to 6 (#119)
dependabot[bot] Aug 1, 2024
ac8d69a
Bump org.jenkins-ci.plugins:plugin from 4.60 to 4.86 (#120)
dependabot[bot] Aug 1, 2024
0597506
SECURITY-3792
gbhat618 Jun 16, 2026
182212e
Restructure into a multi-module project
gbhat618 Sep 3, 2026
8d0f97c
Merge groovy-sandbox history into groovy-sandbox/ subdirectory
gbhat618 Sep 3, 2026
1f81ac0
Integrate groovy-sandbox as a module of script-security-plugin
gbhat618 Sep 3, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions groovy-sandbox/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2012-2014 Kohsuke Kawaguchi, CloudBees, Inc., other contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
8 changes: 8 additions & 0 deletions groovy-sandbox/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
groovy-sandbox
==============

**WARNING** This library is only maintained in the context of Jenkins, and should only be used as a dependency of Jenkins plugins such as [Script Security Plugin](https://plugins.jenkins.io/script-security) and [Pipeline: Groovy Plugin](https://plugins.jenkins.io/workflow-cps). It should be considered deprecated and unsafe for all other purposes.

This library provides a compile-time transformer to run Groovy code in an environment in which most operations, such as method calls, are intercepted before being executed. Consumers of the library can hook into the interception to allow or deny specific operations.

This library is **not secure** when used by itself. In particular, you must at least use an additional `CompilationCustomizer` along the lines of [RejectASTTransformsCustomizer](https://github.com/jenkinsci/script-security-plugin/blob/c43e099f2f86425b32b0be492020313644062763/src/main/java/org/jenkinsci/plugins/scriptsecurity/sandbox/groovy/RejectASTTransformsCustomizer.java) to reject AST transformations that can bypass the sandbox, and you need to take special care to ensure untrusted scripts are both parsed and executed inside of the sandbox.
3 changes: 3 additions & 0 deletions groovy-sandbox/ast.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
# show the AST tree of the specified Groovy file in GUI
exec groovy -e 'groovy.inspect.swingui.AstBrowser.main(args)' "$@"
37 changes: 37 additions & 0 deletions groovy-sandbox/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>script-security-parent</artifactId>
<version>${changelist}</version>
</parent>

<groupId>org.kohsuke</groupId>
<artifactId>groovy-sandbox</artifactId>
<url>https://github.com/jenkinsci/script-security-plugin</url>

<name>Groovy Sandbox</name>
<description>Executes untrusted Groovy script safely</description>

<properties>
<!-- ClassRecorder is used by groovy-cps -->
<no-test-jar>false</no-test-jar>
</properties>

<dependencies>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy</artifactId>
<version>2.4.21</version> <!-- Note: Do not update past this version unless Jenkins core is updated to use a newer version of Groovy. -->
</dependency>
</dependencies>

<licenses>
<license>
<name>MIT License</name>
<url>https://opensource.org/licenses/MIT</url>
</license>
</licenses>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,224 @@
package org.kohsuke.groovy.sandbox;

import org.kohsuke.groovy.sandbox.impl.Super;

import java.util.Collections;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;

/**
* Interceptor of Groovy method calls.
*
* <p>
* Once created, it needs to be {@linkplain #register() registered} to start receiving interceptions.
* List of interceptors are maintained per thread.
*
* @author Kohsuke Kawaguchi
*/
public abstract class GroovyInterceptor {
/**
* Intercepts an instance method call on some object of the form "foo.bar(...)"
*/
public Object onMethodCall(Invoker invoker, Object receiver, String method, Object... args) throws Throwable {
return invoker.call(receiver,method,args);
}

/**
* Intercepts a static method call on some class, like "Class.forName(...)".
*
* Note that Groovy doesn't clearly differentiate static method calls from instance method calls.
* If calls are determined to be static at compile-time, you get this method called, but
* method calls whose receivers are {@link Class} can invoke static methods, too
* (that is, {@code x=Integer.class;x.valueOf(5)} results in {@code onMethodCall(invoker,Integer.class,"valueOf",5)}
*/
public Object onStaticCall(Invoker invoker, Class receiver, String method, Object... args) throws Throwable {
return invoker.call(receiver,method,args);
}

/**
* Intercepts an object instantiation, like "new Receiver(...)"
*/
public Object onNewInstance(Invoker invoker, Class receiver, Object... args) throws Throwable {
return invoker.call(receiver,null,args);
}

/**
* Intercepts an super method call, like "super.foo(...)"
*/
public Object onSuperCall(Invoker invoker, Class senderType, Object receiver, String method, Object... args) throws Throwable {
return invoker.call(new Super(senderType,receiver),method,args);
}

/**
* Intercepts a {@code super(…)} call from a constructor.
*/
public void onSuperConstructor(Invoker invoker, Class receiver, Object... args) throws Throwable {
onNewInstance(invoker, receiver, args);
}

/**
* Intercepts a property access, like "z=foo.bar"
*
* @param receiver
* 'foo' in the above example, the object whose property is accessed.
* @param property
* 'bar' in the above example, the name of the property
*/
public Object onGetProperty(Invoker invoker, Object receiver, String property) throws Throwable {
return invoker.call(receiver,property);
}

/**
* Intercepts a property assignment like "foo.bar=z"
*
* @param receiver
* 'foo' in the above example, the object whose property is accessed.
* @param property
* 'bar' in the above example, the name of the property
* @param value
* The value to be assigned.
* @return
* The result of the assignment expression. Normally, you should return the same object as {@code value}.
*/
public Object onSetProperty(Invoker invoker, Object receiver, String property, Object value) throws Throwable {
return invoker.call(receiver,property,value);
}

/**
* Intercepts an attribute access, like "z=foo.@bar"
*
* @param receiver
* 'foo' in the above example, the object whose attribute is accessed.
* @param attribute
* 'bar' in the above example, the name of the attribute
*/
public Object onGetAttribute(Invoker invoker, Object receiver, String attribute) throws Throwable {
return invoker.call(receiver, attribute);
}

/**
* Intercepts an attribute assignment like "foo.@bar=z"
*
* @param receiver
* 'foo' in the above example, the object whose attribute is accessed.
* @param attribute
* 'bar' in the above example, the name of the attribute
* @param value
* The value to be assigned.
* @return
* The result of the assignment expression. Normally, you should return the same object as {@code value}.
*/
public Object onSetAttribute(Invoker invoker, Object receiver, String attribute, Object value) throws Throwable {
return invoker.call(receiver,attribute,value);
}

/**
* Intercepts an array access, like "z=foo[bar]"
*
* @param receiver
* 'foo' in the above example, the array-like object.
* @param index
* 'bar' in the above example, the object that acts as an index.
*/
public Object onGetArray(Invoker invoker, Object receiver, Object index) throws Throwable {
return invoker.call(receiver,null,index);
}

/**
* Intercepts an attribute assignment like "foo[bar]=z"
*
* @param receiver
* 'foo' in the above example, the array-like object.
* @param index
* 'bar' in the above example, the object that acts as an index.
* @param value
* The value to be assigned.
* @return
* The result of the assignment expression. Normally, you should return the same object as {@code value}.
*/
public Object onSetArray(Invoker invoker, Object receiver, Object index, Object value) throws Throwable {
return invoker.call(receiver,null,index,value);
}

/**
* Represents the next interceptor in the chain.
*
* As {@link GroovyInterceptor}, you intercept by doing one of the following:
*
* <ul>
* <li>Pass on to the next interceptor by calling one of the call() method,
* possibly modifying the arguments and return values, intercepting an exception, etc.
* <li>Throws an exception to block the call.
* <li>Return some value without calling the next interceptor.
* </ul>
*
* The signature of the call method is as follows:
*
* <dl>
* <dt>receiver</dt>
* <dd>
* The object whose method/property is accessed.
* For constructor invocations and static calls, this is {@link Class}.
* If the receiver is null, all the interceptors will be skipped.
* </dd>
* <dt>method</dt>
* <dd>
* The name of the method/property/attribute. Otherwise pass in null.
* </dd>
* <dt>args</dt>
* <dd>
* Arguments of the method call, index of the array access, and/or values to be set.
* Multiple override of the call method is provided to avoid the implicit object
* array creation, but otherwise they behave the same way.
* </dd>
* </dl>
*/
public interface Invoker {
Object call(Object receiver, String method) throws Throwable;
Object call(Object receiver, String method, Object arg1) throws Throwable;
Object call(Object receiver, String method, Object arg1, Object arg2) throws Throwable;
Object call(Object receiver, String method, Object... args) throws Throwable;
}

// public void addToGlobal() {
// globalInterceptors.add(this);
// }
//
// public void removeFromGlobal() {
// globalInterceptors.remove(this);
// }

/**
* Registers this interceptor to the current thread's interceptor list.
*/
public void register() {
threadInterceptors.get().add(this);
}

/**
* Reverses the earlier effect of {@link #register()}
*/
public void unregister() {
threadInterceptors.get().remove(this);
}

private static final ThreadLocal<List<GroovyInterceptor>> threadInterceptors = new ThreadLocal<List<GroovyInterceptor>>() {
@Override
protected List<GroovyInterceptor> initialValue() {
return new CopyOnWriteArrayList<GroovyInterceptor>();
}
};

private static final ThreadLocal<List<GroovyInterceptor>> threadInterceptorsView = new ThreadLocal<List<GroovyInterceptor>>() {
@Override
protected List<GroovyInterceptor> initialValue() {
return Collections.unmodifiableList(threadInterceptors.get());
}
};

// private static final List<GroovyInterceptor> globalInterceptors = new CopyOnWriteArrayList<GroovyInterceptor>();

public static List<GroovyInterceptor> getApplicableInterceptors() {
return threadInterceptorsView.get();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
package org.kohsuke.groovy.sandbox;

import groovy.lang.Binding;
import groovy.lang.Script;

/**
* @deprecated
*/
@Deprecated
public class GroovyValueFilter extends GroovyInterceptor {
/**
* Called for every receiver.
*/
public Object filterReceiver(Object receiver) {
return filter(receiver);
}

/**
* Called for a return value of a method call, newly created object, retrieve property/attribute values.
*/
public Object filterReturnValue(Object returnValue) {
return filter(returnValue);
}

/**
* Called for every argument to method/constructor calls.
*/
public Object filterArgument(Object arg) {
return filter(arg);
}

/**
* Called for every index of the array get/set access.
*/
public Object filterIndex(Object index) {
return filter(index);
}

/**
* All the specific {@code filterXXX()} methods delegate to this method.
*/
public Object filter(Object o) {
return o;
}

private Object[] filterArguments(Object[] args) {
for (int i=0; i<args.length; i++)
args[i] = filterArgument(args[i]);
return args;
}

@Override
public Object onMethodCall(Invoker invoker, Object receiver, String method, Object... args) throws Throwable {
return filterReturnValue(super.onMethodCall(invoker, filterReceiver(receiver), method, filterArguments(args)));
}

@Override
public Object onStaticCall(Invoker invoker, Class receiver, String method, Object... args) throws Throwable {
return filterReturnValue(super.onStaticCall(invoker, (Class)filterReceiver(receiver), method, filterArguments(args)));
}

@Override
public Object onNewInstance(Invoker invoker, Class receiver, Object... args) throws Throwable {
if (receiver == Script.class && args.length == 1 && args[0] instanceof Binding) {
// Ignore initial script instantiation.
return super.onNewInstance(invoker, receiver, args);
}
return filterReturnValue(super.onNewInstance(invoker, (Class)filterReceiver(receiver), filterArguments(args)));
}

@Override
public Object onGetProperty(Invoker invoker, Object receiver, String property) throws Throwable {
return filterReturnValue(super.onGetProperty(invoker, filterReceiver(receiver), property));
}

@Override
public Object onSetProperty(Invoker invoker, Object receiver, String property, Object value) throws Throwable {
return filterReturnValue(super.onSetProperty(invoker, filterReceiver(receiver), property, filterArgument(value)));
}

@Override
public Object onGetAttribute(Invoker invoker, Object receiver, String attribute) throws Throwable {
return filterReturnValue(super.onGetAttribute(invoker, filterReceiver(receiver), attribute));
}

@Override
public Object onSetAttribute(Invoker invoker, Object receiver, String attribute, Object value) throws Throwable {
return filterReturnValue(super.onSetAttribute(invoker, filterReceiver(receiver), attribute, filterArgument(value)));
}

@Override
public Object onGetArray(Invoker invoker, Object receiver, Object index) throws Throwable {
return filterReturnValue(super.onGetArray(invoker, filterReceiver(receiver), filterIndex(index)));
}

@Override
public Object onSetArray(Invoker invoker, Object receiver, Object index, Object value) throws Throwable {
return filterReturnValue(super.onSetArray(invoker, filterReceiver(receiver), filterIndex(index), filterArgument(value)));
}
}
Loading
Loading