forked from jenkinsci/jenkins
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into update-forms
- Loading branch information
Showing
17 changed files
with
416 additions
and
12 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* The MIT License | ||
* | ||
* Copyright 2021 CloudBees, Inc. | ||
* | ||
* 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. | ||
*/ | ||
|
||
package hudson.model; | ||
|
||
import java.io.PrintStream; | ||
import org.apache.commons.io.output.NullPrintStream; | ||
|
||
/** | ||
* @see TaskListener#NULL | ||
*/ | ||
class NullTaskListener implements TaskListener { | ||
|
||
private static final long serialVersionUID = 1L; | ||
|
||
@Override | ||
public PrintStream getLogger() { | ||
return new NullPrintStream(); | ||
} | ||
|
||
} |
This file contains 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
This file contains 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
This file contains 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
20 changes: 20 additions & 0 deletions
20
core/src/main/java/jenkins/formelementpath/FormElementPathPageDecorator.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package jenkins.formelementpath; | ||
|
||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; | ||
import hudson.Extension; | ||
import hudson.Main; | ||
import hudson.model.PageDecorator; | ||
import jenkins.util.SystemProperties; | ||
|
||
@Extension | ||
public class FormElementPathPageDecorator extends PageDecorator { | ||
|
||
@SuppressFBWarnings("MS_SHOULD_BE_FINAL") | ||
private static /*almost final */ boolean ENABLED = Main.isUnitTest || | ||
SystemProperties.getBoolean(FormElementPathPageDecorator.class.getName() + ".enabled"); | ||
|
||
public boolean isEnabled() { | ||
return ENABLED; | ||
} | ||
|
||
} |
This file contains 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
This file contains 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
75 changes: 75 additions & 0 deletions
75
core/src/main/java/jenkins/telemetry/impl/SlaveToMasterFileCallableUsage.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/* | ||
* The MIT License | ||
* | ||
* Copyright 2021 CloudBees, Inc. | ||
* | ||
* 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. | ||
*/ | ||
|
||
package jenkins.telemetry.impl; | ||
|
||
import hudson.Extension; | ||
import hudson.Functions; | ||
import java.time.LocalDate; | ||
import java.util.Collections; | ||
import java.util.Set; | ||
import java.util.TreeSet; | ||
import jenkins.SlaveToMasterFileCallable; | ||
import jenkins.security.s2m.DefaultFilePathFilter; | ||
import jenkins.telemetry.Telemetry; | ||
import net.sf.json.JSONObject; | ||
import org.kohsuke.accmod.Restricted; | ||
import org.kohsuke.accmod.restrictions.NoExternalUse; | ||
|
||
/** | ||
* Records when {@link DefaultFilePathFilter} found {@link SlaveToMasterFileCallable} or similar being used. | ||
*/ | ||
@Extension | ||
@Restricted(NoExternalUse.class) | ||
public class SlaveToMasterFileCallableUsage extends Telemetry { | ||
|
||
private Set<String> traces = new TreeSet<>(); | ||
|
||
@Override | ||
public String getDisplayName() { | ||
return "Access to files on controllers from code running on an agent"; | ||
} | ||
|
||
@Override | ||
public LocalDate getStart() { | ||
return LocalDate.of(2021, 11, 4); // https://www.jenkins.io/security/advisory/2021-11-04/ | ||
} | ||
|
||
@Override | ||
public LocalDate getEnd() { | ||
return LocalDate.of(2022, 3, 1); | ||
} | ||
|
||
@Override | ||
public synchronized JSONObject createContent() { | ||
JSONObject json = JSONObject.fromObject(Collections.singletonMap("traces", traces)); | ||
traces.clear(); | ||
return json; | ||
} | ||
|
||
public synchronized void recordTrace(Throwable trace) { | ||
traces.add(Functions.printThrowable(trace).replaceAll("@[a-f0-9]+", "@…")); | ||
} | ||
|
||
} |
6 changes: 6 additions & 0 deletions
6
core/src/main/resources/jenkins/formelementpath/FormElementPathPageDecorator/footer.jelly
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?jelly escape-by-default='true'?> | ||
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler"> | ||
<j:if test="${it.enabled}"> | ||
<st:adjunct includes="jenkins.formelementpath.form-element-path"/> | ||
</j:if> | ||
</j:jelly> |
Oops, something went wrong.