Skip to content

Commit

Permalink
Workaround: look up ApprovedWhitelist via a supertype
Browse files Browse the repository at this point in the history
  • Loading branch information
jglick committed Jan 3, 2024
1 parent bcb45b5 commit 343ce96
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -971,7 +971,8 @@ public synchronized String[] getApprovedScriptHashes() {
@Extension public static final class ApprovedWhitelist extends ProxyWhitelist {

static void configurationChanged() {
ExtensionList.lookupSingleton(ApprovedWhitelist.class).initialized.set(false);
// Do not use lookupSingleton: ScriptApprovalLoadingTest.dynamicLoading
ExtensionList.lookup(Whitelist.class).get(ApprovedWhitelist.class).initialized.set(false);

Check warning on line 975 in src/main/java/org/jenkinsci/plugins/scriptsecurity/scripts/ScriptApproval.java

View check run for this annotation

ci.jenkins.io / SpotBugs

NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE

NORMAL: Possible null pointer dereference in org.jenkinsci.plugins.scriptsecurity.scripts.ScriptApproval$ApprovedWhitelist.configurationChanged() due to return value of called method
Raw output
<p> The return value from a method is dereferenced without a null check, and the return value of that method is one that should generally be checked for null. This may lead to a <code>NullPointerException</code> when the code is executed. </p>
}

private final AtomicBoolean initialized = new AtomicBoolean();
Expand Down

0 comments on commit 343ce96

Please sign in to comment.