mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-13 12:02:20 +00:00
Merge branch 'security-master'
This commit is contained in:
commit
f21cf875dc
12 files changed
+501
-32
No files matched your search
@@ -28,8 +28,6 @@ import static hudson.init.InitMilestone.COMPLETED;
|
||||
import static hudson.init.InitMilestone.PLUGINS_LISTED;
|
||||
import static hudson.init.InitMilestone.PLUGINS_PREPARED;
|
||||
import static hudson.init.InitMilestone.PLUGINS_STARTED;
|
||||
import static java.nio.file.attribute.PosixFilePermission.OWNER_READ;
|
||||
import static java.nio.file.attribute.PosixFilePermission.OWNER_WRITE;
|
||||
import static java.util.logging.Level.FINE;
|
||||
import static java.util.logging.Level.INFO;
|
||||
import static java.util.logging.Level.WARNING;
|
||||
@@ -83,7 +81,6 @@ import java.net.URLClassLoader;
|
||||
import java.net.URLConnection;
|
||||
import java.net.http.HttpClient;
|
||||
import java.net.http.HttpRequest;
|
||||
import java.nio.file.FileSystems;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.InvalidPathException;
|
||||
import java.nio.file.Paths;
|
||||
@@ -91,10 +88,8 @@ import java.nio.file.attribute.FileTime;
|
||||
import java.security.CodeSource;
|
||||
import java.time.Duration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
@@ -1883,16 +1878,6 @@ public abstract class PluginManager extends AbstractModelObject implements OnMas
|
||||
copier = new FileUploadPluginCopier(fileItem);
|
||||
}
|
||||
|
||||
if (FileSystems.getDefault().supportedFileAttributeViews().contains("posix")) {
|
||||
Arrays.stream(Objects.requireNonNull(tmpDir.listFiles())).forEach((file -> {
|
||||
try {
|
||||
Files.setPosixFilePermissions(file.toPath(), EnumSet.of(OWNER_READ, OWNER_WRITE));
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
if ("".equals(fileName)) {
|
||||
return new HttpRedirect("advanced");
|
||||
}
|
||||
@@ -1902,7 +1887,8 @@ public abstract class PluginManager extends AbstractModelObject implements OnMas
|
||||
}
|
||||
|
||||
// first copy into a temporary file name
|
||||
File t = File.createTempFile("uploaded", ".jpi");
|
||||
File t = File.createTempFile("uploaded", ".jpi", tmpDir);
|
||||
tmpDir.deleteOnExit();
|
||||
t.deleteOnExit();
|
||||
// TODO Remove this workaround after FILEUPLOAD-293 is resolved.
|
||||
Files.delete(Util.fileToPath(t));
|
||||
@@ -1913,9 +1899,6 @@ public abstract class PluginManager extends AbstractModelObject implements OnMas
|
||||
throw new ServletException(e);
|
||||
}
|
||||
copier.cleanup();
|
||||
if (!tmpDir.delete()) {
|
||||
System.err.println("Failed to delete temporary directory: " + tmpDir);
|
||||
}
|
||||
|
||||
final String baseName = identifyPluginShortName(t);
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ package hudson.console;
|
||||
|
||||
import edu.umd.cs.findbugs.annotations.NonNull;
|
||||
import hudson.Extension;
|
||||
import hudson.Functions;
|
||||
import hudson.MarkupText;
|
||||
import java.io.IOException;
|
||||
import java.util.logging.Level;
|
||||
@@ -52,7 +53,7 @@ public class ExpandableDetailsNote extends ConsoleNote {
|
||||
@Override
|
||||
public ConsoleAnnotator annotate(Object context, MarkupText text, int charPos) {
|
||||
text.addMarkup(charPos,
|
||||
"<input type=button value='" + caption + "' class='reveal-expandable-detail'><div class='expandable-detail'>" + html + "</div>");
|
||||
"<input type=button value='" + Functions.htmlAttributeEscape(caption) + "' class='reveal-expandable-detail'><div class='expandable-detail'>" + html + "</div>");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,9 @@
|
||||
package hudson.util;
|
||||
|
||||
import edu.umd.cs.findbugs.annotations.CheckForNull;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import javax.servlet.ServletException;
|
||||
@@ -46,7 +49,6 @@ import org.kohsuke.accmod.restrictions.NoExternalUse;
|
||||
* @author Kohsuke Kawaguchi
|
||||
*/
|
||||
public class MultipartFormDataParser implements AutoCloseable {
|
||||
private final ServletFileUpload upload = new ServletFileUpload(new DiskFileItemFactory());
|
||||
private final Map<String, FileItem> byName = new HashMap<>();
|
||||
|
||||
/**
|
||||
@@ -74,6 +76,14 @@ public class MultipartFormDataParser implements AutoCloseable {
|
||||
|
||||
@Restricted(NoExternalUse.class)
|
||||
public MultipartFormDataParser(HttpServletRequest request, int maxParts, long maxPartSize, long maxSize) throws ServletException {
|
||||
File tmpDir;
|
||||
try {
|
||||
tmpDir = Files.createTempDirectory("jenkins-multipart-uploads").toFile();
|
||||
} catch (IOException e) {
|
||||
throw new ServletException("Error creating temporary directory", e);
|
||||
}
|
||||
tmpDir.deleteOnExit();
|
||||
ServletFileUpload upload = new ServletFileUpload(new DiskFileItemFactory(DiskFileItemFactory.DEFAULT_SIZE_THRESHOLD, tmpDir));
|
||||
upload.setFileCountMax(maxParts);
|
||||
upload.setFileSizeMax(maxPartSize);
|
||||
upload.setSizeMax(maxSize);
|
||||
|
||||
@@ -42,6 +42,7 @@ import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import jenkins.model.queue.QueueItem;
|
||||
|
||||
/**
|
||||
@@ -371,8 +372,9 @@ public class HistoryPageFilter<T> {
|
||||
|
||||
private boolean fitsSearchBuildVariables(AbstractBuild<?, ?> runAsBuild) {
|
||||
Map<String, String> buildVariables = runAsBuild.getBuildVariables();
|
||||
for (String paramsValues : buildVariables.values()) {
|
||||
if (fitsSearchString(paramsValues)) {
|
||||
Set<String> sensitiveBuildVariables = runAsBuild.getSensitiveBuildVariables();
|
||||
for (Map.Entry<String, String> param : buildVariables.entrySet()) {
|
||||
if (!sensitiveBuildVariables.contains(param.getKey()) && fitsSearchString(param.getValue())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user