File tree Expand file tree Collapse file tree 5 files changed +20
-51
lines changed
main/java/org/jenkinsci/plugins/scriptsecurity/sandbox/whitelists
test/java/org/jenkinsci/plugins/scriptsecurity/sandbox/whitelists Expand file tree Collapse file tree 5 files changed +20
-51
lines changed Original file line number Diff line number Diff line change 24
24
25
25
package org .jenkinsci .plugins .scriptsecurity .sandbox .whitelists ;
26
26
27
- import hudson .Extension ;
28
27
import java .io .IOException ;
29
- import org .kohsuke .accmod .Restricted ;
30
- import org .kohsuke .accmod .restrictions .NoExternalUse ;
31
28
32
29
/**
33
- * Includes entries useful for general kinds of scripts.
30
+ * @deprecated replaced by {@link StaticWhitelist#stockWhitelists}, now used only in tests
34
31
*/
35
- @ Restricted ( NoExternalUse . class )
36
- @ Extension public final class GenericWhitelist extends ProxyWhitelist {
32
+ @ Deprecated
33
+ public final class GenericWhitelist extends ProxyWhitelist {
37
34
38
- // TODO replace this & JenkinsWhitelist with @Extension on a static method
39
35
public GenericWhitelist () throws IOException {
40
36
super (StaticWhitelist .from (GenericWhitelist .class .getResource ("generic-whitelist" )));
41
37
}
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 46
46
47
47
import edu .umd .cs .findbugs .annotations .CheckForNull ;
48
48
import edu .umd .cs .findbugs .annotations .SuppressFBWarnings ;
49
+ import hudson .Extension ;
50
+ import org .apache .commons .io .input .SequenceReader ;
49
51
import org .jenkinsci .plugins .scriptsecurity .sandbox .RejectedAccessException ;
52
+ import org .jenkinsci .plugins .scriptsecurity .sandbox .Whitelist ;
50
53
import org .jenkinsci .plugins .scriptsecurity .scripts .ScriptApproval ;
51
54
import org .kohsuke .accmod .Restricted ;
55
+ import org .kohsuke .accmod .restrictions .DoNotUse ;
52
56
import org .kohsuke .accmod .restrictions .NoExternalUse ;
53
57
54
58
/**
@@ -204,6 +208,17 @@ public static StaticWhitelist from(URL definition) throws IOException {
204
208
}
205
209
}
206
210
211
+ @ Restricted (DoNotUse .class )
212
+ @ Extension public static Whitelist stockWhitelists () throws IOException {
213
+ try (InputStream gis = StaticWhitelist .class .getResourceAsStream ("generic-whitelist" );
214
+ Reader gr = new InputStreamReader (gis , StandardCharsets .UTF_8 );
215
+ InputStream jis = StaticWhitelist .class .getResourceAsStream ("jenkins-whitelist" );
216
+ Reader jr = new InputStreamReader (jis , StandardCharsets .UTF_8 );
217
+ Reader r = new SequenceReader (gr , jr )) {
218
+ return new StaticWhitelist (r );
219
+ }
220
+ }
221
+
207
222
@ Override protected List <MethodSignature > methodSignatures () {
208
223
return methodSignatures ;
209
224
}
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ public class GenericWhitelistTest {
36
36
@ Rule public ErrorCollector errors = new ErrorCollector ();
37
37
38
38
@ Test public void sanity () throws Exception {
39
- StaticWhitelistTest .sanity (GenericWhitelist .class .getResource ("generic-whitelist" ));
39
+ StaticWhitelistTest .sanity (StaticWhitelist .class .getResource ("generic-whitelist" ));
40
40
}
41
41
42
42
@ Issue ("SECURITY-538" )
Original file line number Diff line number Diff line change 29
29
public class JenkinsWhitelistTest {
30
30
31
31
@ Test public void sanity () throws Exception {
32
- StaticWhitelistTest .sanity (JenkinsWhitelist .class .getResource ("jenkins-whitelist" ));
32
+ StaticWhitelistTest .sanity (StaticWhitelist .class .getResource ("jenkins-whitelist" ));
33
33
}
34
34
35
35
}
You can’t perform that action at this time.
0 commit comments