The Unified and Autonomous Development Platform
fix: Update libraries to avoid potentional security vulnerabilities
Robin Shenc09f7b0f60e9
diff --git a/pom.xml b/pom.xmlindex eb3a2d7de9..ec5f0d10fe 100644--- a/pom.xml+++ b/pom.xml@@ -38,7 +38,7 @@<plugin><groupId>io.onedev</groupId><artifactId>plugin-maven</artifactId>- <version>2.6.8</version>+ <version>2.6.9</version><executions><execution><?m2e execute onConfiguration,onIncremental?>@@ -359,12 +359,12 @@<dependency><groupId>org.yaml</groupId><artifactId>snakeyaml</artifactId>- <version>1.32</version>+ <version>2.2</version></dependency><dependency><groupId>org.bouncycastle</groupId>- <artifactId>bcprov-jdk15on</artifactId>- <version>1.69</version>+ <artifactId>bcprov-jdk18on</artifactId>+ <version>1.74</version></dependency><dependency><groupId>org.unbescape</groupId>@@ -429,7 +429,7 @@<dependency><groupId>org.hsqldb</groupId><artifactId>hsqldb</artifactId>- <version>2.4.0</version>+ <version>2.7.1</version></dependency><dependency><groupId>jaxen</groupId>@@ -439,7 +439,7 @@<dependency><groupId>com.thoughtworks.xstream</groupId><artifactId>xstream</artifactId>- <version>1.4.19</version>+ <version>1.4.20</version></dependency><dependency><groupId>com.joestelmach</groupId>@@ -630,22 +630,22 @@</repository></repositories><properties>- <commons.version>2.9.0</commons.version>- <agent.version>1.11.3</agent.version>+ <commons.version>2.9.1</commons.version>+ <agent.version>1.11.4</agent.version><slf4j.version>2.0.9</slf4j.version><logback.version>1.4.14</logback.version><antlr.version>4.7.2</antlr.version>- <jetty.version>9.4.51.v20230217</jetty.version>+ <jetty.version>9.4.54.v20240208</jetty.version><wicket.version>7.18.0</wicket.version><jersey.version>2.37</jersey.version><hibernate.version>5.4.24.Final</hibernate.version><lucene.version>8.7.0</lucene.version>- <shiro.version>1.12.0</shiro.version>+ <shiro.version>1.13.0</shiro.version><jgit.version>5.13.0.202109080827-r</jgit.version><flexmark.version>0.64.0</flexmark.version><groovy.version>3.0.19</groovy.version><servlet.version>3.1.0</servlet.version><jackson.version>2.14.0-rc1</jackson.version>- <tika.version>1.24.1</tika.version>+ <tika.version>1.28.3</tika.version></properties></project>diff --git a/server-core/pom.xml b/server-core/pom.xmlindex f98cf17103..c5244ddd0c 100644--- a/server-core/pom.xml+++ b/server-core/pom.xml@@ -70,7 +70,7 @@</dependency><dependency><groupId>org.bouncycastle</groupId>- <artifactId>bcprov-jdk15on</artifactId>+ <artifactId>bcprov-jdk18on</artifactId></dependency><dependency><groupId>org.unbescape</groupId>diff --git a/server-core/src/main/java/io/onedev/server/data/migration/VersionedYamlDoc.java b/server-core/src/main/java/io/onedev/server/data/migration/VersionedYamlDoc.javaindex 088f8bf7e8..0ae16c3b14 100644--- a/server-core/src/main/java/io/onedev/server/data/migration/VersionedYamlDoc.java+++ b/server-core/src/main/java/io/onedev/server/data/migration/VersionedYamlDoc.java@@ -1,25 +1,16 @@package io.onedev.server.data.migration;-import java.beans.IntrospectionException;-import java.beans.PropertyDescriptor;-import java.io.IOException;-import java.io.StringReader;-import java.io.StringWriter;-import java.lang.reflect.InvocationTargetException;-import java.lang.reflect.Method;-import java.util.ArrayList;-import java.util.Collection;-import java.util.Comparator;-import java.util.HashMap;-import java.util.Iterator;-import java.util.LinkedHashSet;-import java.util.List;-import java.util.Map;-import java.util.Set;-+import edu.emory.mathcs.backport.java.util.Collections;+import io.onedev.commons.loader.ImplementationRegistry;+import io.onedev.commons.utils.ClassUtils;+import io.onedev.commons.utils.ExplicitException;+import io.onedev.server.OneDev;+import io.onedev.server.annotation.Editable;+import io.onedev.server.util.BeanUtils;import org.hibernate.proxy.HibernateProxyHelper;import org.yaml.snakeyaml.DumperOptions;import org.yaml.snakeyaml.DumperOptions.FlowStyle;+import org.yaml.snakeyaml.LoaderOptions;import org.yaml.snakeyaml.Yaml;import org.yaml.snakeyaml.constructor.Constructor;import org.yaml.snakeyaml.emitter.Emitter;@@ -27,22 +18,19 @@ import org.yaml.snakeyaml.introspector.BeanAccess;import org.yaml.snakeyaml.introspector.MethodProperty;import org.yaml.snakeyaml.introspector.Property;import org.yaml.snakeyaml.introspector.PropertyUtils;-import org.yaml.snakeyaml.nodes.MappingNode;-import org.yaml.snakeyaml.nodes.Node;-import org.yaml.snakeyaml.nodes.NodeTuple;-import org.yaml.snakeyaml.nodes.ScalarNode;-import org.yaml.snakeyaml.nodes.Tag;+import org.yaml.snakeyaml.nodes.*;import org.yaml.snakeyaml.representer.Representer;import org.yaml.snakeyaml.resolver.Resolver;import org.yaml.snakeyaml.serializer.Serializer;-import edu.emory.mathcs.backport.java.util.Collections;-import io.onedev.commons.loader.ImplementationRegistry;-import io.onedev.commons.utils.ClassUtils;-import io.onedev.commons.utils.ExplicitException;-import io.onedev.server.OneDev;-import io.onedev.server.util.BeanUtils;-import io.onedev.server.annotation.Editable;+import java.beans.IntrospectionException;+import java.beans.PropertyDescriptor;+import java.io.IOException;+import java.io.StringReader;+import java.io.StringWriter;+import java.lang.reflect.InvocationTargetException;+import java.lang.reflect.Method;+import java.util.*;public class VersionedYamlDoc extends MappingNode {@@ -127,6 +115,10 @@ public class VersionedYamlDoc extends MappingNode {private static class OneConstructor extends Constructor {+ public OneConstructor() {+ super(new LoaderOptions());+ }+public Object construct(Node node) {return constructDocument(node);}@@ -170,7 +162,7 @@ public class VersionedYamlDoc extends MappingNode {}private static Representer newRepresenter() {- Representer representer = new Representer() {+ Representer representer = new Representer(new DumperOptions()) {@SuppressWarnings("rawtypes")@Overridediff --git a/server-core/src/main/java/org/yaml/snakeyaml/constructor/BaseConstructor.java b/server-core/src/main/java/org/yaml/snakeyaml/constructor/BaseConstructor.javaindex c5c40f7349..596235ae58 100644--- a/server-core/src/main/java/org/yaml/snakeyaml/constructor/BaseConstructor.java+++ b/server-core/src/main/java/org/yaml/snakeyaml/constructor/BaseConstructor.java@@ -57,29 +57,36 @@ public abstract class BaseConstructor {protected static final Object NOT_INSTANTIATED_OBJECT = new Object();/**- * It maps the node kind to the the Construct implementation. When the runtime class is known then- * the implicit tag is ignored.+ * It maps the node kind to the Construct implementation. When the runtime class is known then the+ * implicit tag is ignored.*/protected final Map<NodeId, Construct> yamlClassConstructors =new EnumMap<NodeId, Construct>(NodeId.class);/*** It maps the (explicit or implicit) tag to the Construct implementation. It is used: 1) explicit* tag - if present. 2) implicit tag - when the runtime class of the instance is unknown (the node- * has the Object.class)+ * has the Object.class) 3) when nothing else is found the Construct for the key 'null' is chosen+ * (which is ConstructYamlObject)*/protected final Map<Tag, Construct> yamlConstructors = new HashMap<Tag, Construct>();/*** It maps the (explicit or implicit) tag to the Construct implementation. It is used when no- * exact match found.+ * exact match found. The key in the Map is checked if it starts the class name*/protected final Map<String, Construct> yamlMultiConstructors = new HashMap<String, Construct>();+ /**+ * No graph creator+ */protected Composer composer;final Map<Node, Object> constructedObjects;private final Set<Node> recursiveObjects;private final ArrayList<RecursiveTuple<Map<Object, Object>, RecursiveTuple<Object, Object>>> maps2fill;private final ArrayList<RecursiveTuple<Set<Object>, Object>> sets2fill;+ /**+ * the tag for the root node+ */protected Tag rootTag;private PropertyUtils propertyUtils;private boolean explicitPropertyUtils;@@ -88,16 +95,29 @@ public abstract class BaseConstructor {private boolean enumCaseSensitive = false;+ /**+ * Mapping from a class to its manager+ */protected final Map<Class<? extends Object>, TypeDescription> typeDefinitions;+ /**+ * register classes for tags+ */protected final Map<Tag, Class<? extends Object>> typeTags;+ /**+ * options+ */protected LoaderOptions loadingConfig;- public BaseConstructor() {- this(new LoaderOptions());- }-+ /**+ * Create+ *+ * @param loadingConfig - options+ */public BaseConstructor(LoaderOptions loadingConfig) {+ if (loadingConfig == null) {+ throw new NullPointerException("LoaderOptions must be provided.");+ }constructedObjects = new HashMap<Node, Object>();recursiveObjects = new HashSet<Node>();maps2fill =@@ -228,6 +248,12 @@ public abstract class BaseConstructor {return constructObjectNoCheck(node);}+ /**+ * Construct object from the specified Node without the check if it was already created.+ *+ * @param node - the source+ * @return constructed instance+ */protected Object constructObjectNoCheck(Node node) {if (recursiveObjects.contains(node)) {throw new ConstructorException(null, null, "found unconstructable recursive node",@@ -249,7 +275,7 @@ public abstract class BaseConstructor {/*** Get the constructor to construct the Node. For implicit tags if the runtime class is known a- * dedicated Construct implementation is used. Otherwise the constructor is chosen by the tag.+ * dedicated Construct implementation is used. Otherwise, the constructor is chosen by the tag.** @param node {@link Node} to construct an instance from* @return {@link Construct} implementation for the specified node@@ -258,10 +284,11 @@ public abstract class BaseConstructor {if (node.useClassConstructor()) {return yamlClassConstructors.get(node.getNodeId());} else {- Construct constructor = yamlConstructors.get(node.getTag());+ Tag tag = node.getTag();+ Construct constructor = yamlConstructors.get(tag);if (constructor == null) {for (String prefix : yamlMultiConstructors.keySet()) {- if (node.getTag().startsWith(prefix)) {+ if (tag.startsWith(prefix)) {return yamlMultiConstructors.get(prefix);}}@@ -271,6 +298,12 @@ public abstract class BaseConstructor {}}+ /**+ * Create string from scalar+ *+ * @param node - the source+ * @return the data+ */protected String constructScalar(ScalarNode node) {return node.getValue();}@@ -402,28 +435,60 @@ public abstract class BaseConstructor {// <<<< NEW instance// >>>> Construct => NEW, 2ndStep(filling)++ /**+ * Create List and fill it with data+ *+ * @param node - the source+ * @return filled List+ */protected List<? extends Object> constructSequence(SequenceNode node) {List<Object> result = newList(node);constructSequenceStep2(node, result);return result;}+ /**+ * create Set from sequence+ *+ * @param node - sequence+ * @return constructed Set+ */protected Set<? extends Object> constructSet(SequenceNode node) {Set<Object> result = newSet(node);constructSequenceStep2(node, result);return result;}+ /**+ * Create array from sequence+ *+ * @param node - sequence+ * @return constructed array+ */protected Object constructArray(SequenceNode node) {return constructArrayStep2(node, createArray(node.getType(), node.getValue().size()));}+ /**+ * Fill the provided collection with the data from the Node+ *+ * @param node - the source+ * @param collection - data to fill+ */protected void constructSequenceStep2(SequenceNode node, Collection<Object> collection) {for (Node child : node.getValue()) {collection.add(constructObject(child));}}+ /**+ * Fill array from node+ *+ * @param node - the source+ * @param array - the destination+ * @return filled array+ */protected Object constructArrayStep2(SequenceNode node, Object array) {final Class<?> componentType = node.getType().getComponentType();@@ -481,18 +546,36 @@ public abstract class BaseConstructor {return array;}+ /**+ * Create Set from mapping+ *+ * @param node - mapping+ * @return constructed Set+ */protected Set<Object> constructSet(MappingNode node) {final Set<Object> set = newSet(node);constructSet2ndStep(node, set);return set;}+ /**+ * Create Map from mapping+ *+ * @param node - mapping+ * @return constructed Map+ */protected Map<Object, Object> constructMapping(MappingNode node) {final Map<Object, Object> mapping = newMap(node);constructMapping2ndStep(node, mapping);return mapping;}+ /**+ * Fill provided Map with constructed data+ *+ * @param node - source+ * @param mapping - map to fill+ */protected void constructMapping2ndStep(MappingNode node, Map<Object, Object> mapping) {List<NodeTuple> nodeValue = node.getValue();for (NodeTuple tuple : nodeValue) {@@ -526,8 +609,7 @@ public abstract class BaseConstructor {* different hash after initialization compared to clean just created one. And map of course does* not observe key hashCode changes.*/- @SuppressWarnings({ "rawtypes", "unchecked" })-protected void postponeMapFilling(Map<Object, Object> mapping, Object key, Object value) {+ protected void postponeMapFilling(Map<Object, Object> mapping, Object key, Object value) {maps2fill.add(0, new RecursiveTuple(mapping, new RecursiveTuple(key, value)));}@@ -641,4 +723,8 @@ protected void postponeMapFilling(Map<Object, Object> mapping, Object key, Objecpublic void setEnumCaseSensitive(boolean enumCaseSensitive) {this.enumCaseSensitive = enumCaseSensitive;}++ public LoaderOptions getLoadingConfig() {+ return loadingConfig;+ }}diff --git a/server-core/src/main/java/org/yaml/snakeyaml/nodes/ScalarNode.java b/server-core/src/main/java/org/yaml/snakeyaml/nodes/ScalarNode.javaindex df61acdbee..878bd6b3a2 100644--- a/server-core/src/main/java/org/yaml/snakeyaml/nodes/ScalarNode.java+++ b/server-core/src/main/java/org/yaml/snakeyaml/nodes/ScalarNode.java@@ -1,129 +1,91 @@-/**- * Copyright (c) 2008, SnakeYAML- *- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except- * in compliance with the License. You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software distributed under the License- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express- * or implied. See the License for the specific language governing permissions and limitations under- * the License.- */-package org.yaml.snakeyaml.nodes;--import org.yaml.snakeyaml.DumperOptions;-import org.yaml.snakeyaml.DumperOptions.ScalarStyle;-import org.yaml.snakeyaml.error.Mark;--/**- * Represents a scalar node.- * <p>- * Scalar nodes form the leaves in the node graph.- * </p>- */-public class ScalarNode extends Node {-- private final DumperOptions.ScalarStyle style;-- private String value;-- public ScalarNode(Tag tag, String value) {- this(tag, value, null, null, ScalarStyle.PLAIN);- }-- public ScalarNode(Tag tag, String value, Mark startMark, Mark endMark,- DumperOptions.ScalarStyle style) {- this(tag, true, value, startMark, endMark, style);- }-- public ScalarNode(Tag tag, boolean resolved, String value, Mark startMark, Mark endMark,- DumperOptions.ScalarStyle style) {- super(tag, startMark, endMark);- if (value == null) {- throw new NullPointerException("value in a Node is required.");- }- this.value = value;- if (style == null) {- throw new NullPointerException("Scalar style must be provided.");- }- this.style = style;- this.resolved = resolved;- }-- /*- * Existed in older versions but replaced with {@link DumperOptions.ScalarStyle}-based- * constructor. Restored in v1.22 for backwards compatibility.- *- * @deprecated Since restored in v1.22. Use {@link ScalarNode#ScalarNode(Tag, String, Mark, Mark,- * org.yaml.snakeyaml.DumperOptions.ScalarStyle) }.- */- @Deprecated- public ScalarNode(Tag tag, String value, Mark startMark, Mark endMark, Character style) {- this(tag, value, startMark, endMark, DumperOptions.ScalarStyle.createStyle(style));- }-- /*- * Existed in older versions but replaced with {@link DumperOptions.ScalarStyle}-based- * constructor. Restored in v1.22 for backwards compatibility.- *- * @deprecated Since restored in v1.22. Use {@link ScalarNode#ScalarNode(Tag, boolean, String,- * Mark, Mark, org.yaml.snakeyaml.DumperOptions.ScalarStyle) }.- */- @Deprecated- public ScalarNode(Tag tag, boolean resolved, String value, Mark startMark, Mark endMark,- Character style) {- this(tag, resolved, value, startMark, endMark, DumperOptions.ScalarStyle.createStyle(style));- }-- /**- * Get scalar style of this node.- *- * @see org.yaml.snakeyaml.events.ScalarEvent- * @see <a href="http://yaml.org/spec/1.1/#id903915">Chapter 9. Scalar Styles</a>- * @return style of this scalar node- * @deprecated use getScalarStyle instead- */- @Deprecated- public Character getStyle() {- return style.getChar();- }-- /**- * Get scalar style of this node.- *- * @see org.yaml.snakeyaml.events.ScalarEvent- * @see <a href="http://yaml.org/spec/1.1/#id903915">Chapter 9. Scalar Styles</a>- * @return style of this scalar node- */- public DumperOptions.ScalarStyle getScalarStyle() {- return style;- }-- @Override- public NodeId getNodeId() {- return NodeId.scalar;- }-- /**- * Value of this scalar.- *- * @return Scalar's value.- */- public String getValue() {- return value;- }-- public void setValue(String value) {- this.value = value;- }-- public String toString() {- return "<" + this.getClass().getName() + " (tag=" + getTag() + ", value=" + getValue() + ")>";- }-- public boolean isPlain() {- return style == DumperOptions.ScalarStyle.PLAIN;- }-}+/**+ * Copyright (c) 2008, SnakeYAML+ *+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except+ * in compliance with the License. You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software distributed under the License+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express+ * or implied. See the License for the specific language governing permissions and limitations under+ * the License.+ */+package org.yaml.snakeyaml.nodes;++import org.yaml.snakeyaml.DumperOptions;+import org.yaml.snakeyaml.DumperOptions.ScalarStyle;+import org.yaml.snakeyaml.error.Mark;++/**+ * Represents a scalar node.+ * <p>+ * Scalar nodes form the leaves in the node graph.+ * </p>+ */+public class ScalarNode extends Node {++ private final DumperOptions.ScalarStyle style;++ private String value;++ public ScalarNode(Tag tag, String value) {+ this(tag, value, null, null, ScalarStyle.PLAIN);+ }++ public ScalarNode(Tag tag, String value, Mark startMark, Mark endMark,+ DumperOptions.ScalarStyle style) {+ this(tag, true, value, startMark, endMark, style);+ }++ public ScalarNode(Tag tag, boolean resolved, String value, Mark startMark, Mark endMark,+ DumperOptions.ScalarStyle style) {+ super(tag, startMark, endMark);+ if (value == null) {+ throw new NullPointerException("value in a Node is required.");+ }+ this.value = value;+ if (style == null) {+ throw new NullPointerException("Scalar style must be provided.");+ }+ this.style = style;+ this.resolved = resolved;+ }++ /**+ * Get scalar style of this node.+ *+ * @see org.yaml.snakeyaml.events.ScalarEvent+ * @see <a href="http://yaml.org/spec/1.1/#id903915">Chapter 9. Scalar Styles</a>+ * @return style of this scalar node+ */+ public DumperOptions.ScalarStyle getScalarStyle() {+ return style;+ }++ @Override+ public NodeId getNodeId() {+ return NodeId.scalar;+ }++ /**+ * Value of this scalar.+ *+ * @return Scalar's value.+ */+ public String getValue() {+ return value;+ }++ public void setValue(String value) {+ this.value = value;+ }++ public String toString() {+ return "<" + this.getClass().getName() + " (tag=" + getTag() + ", value=" + getValue() + ")>";+ }++ public boolean isPlain() {+ return style == DumperOptions.ScalarStyle.PLAIN;+ }+}diff --git a/server-core/src/main/java/org/yaml/snakeyaml/representer/Representer.java b/server-core/src/main/java/org/yaml/snakeyaml/representer/Representer.javaindex 761b5215c5..24d7e915a4 100644--- a/server-core/src/main/java/org/yaml/snakeyaml/representer/Representer.java+++ b/server-core/src/main/java/org/yaml/snakeyaml/representer/Representer.java@@ -42,10 +42,6 @@ public class Representer extends SafeRepresenter {protected Map<Class<? extends Object>, TypeDescription> typeDefinitions = Collections.emptyMap();- public Representer() {- this.representers.put(null, new RepresentJavaBean());- }-public Representer(DumperOptions options) {super(options);this.representers.put(null, new RepresentJavaBean());@@ -188,7 +184,7 @@ public class Representer extends SafeRepresenter {// apply map tag where class is the sameClass<? extends Object> t = arguments[0];SequenceNode snode = (SequenceNode) node;- Iterable<Object> memberList = Collections.EMPTY_LIST;+ Iterable<Object> memberList = Collections.emptyList();if (object.getClass().isArray()) {memberList = Arrays.asList((Object[]) object);} else if (object instanceof Iterable<?>) {diff --git a/server-plugin/server-plugin-archetype/src/main/resources/archetype-resources/pom.xml b/server-plugin/server-plugin-archetype/src/main/resources/archetype-resources/pom.xmlindex f1d5cb0cbc..98d6cb2adf 100644--- a/server-plugin/server-plugin-archetype/src/main/resources/archetype-resources/pom.xml+++ b/server-plugin/server-plugin-archetype/src/main/resources/archetype-resources/pom.xml@@ -33,7 +33,7 @@<plugin><groupId>io.onedev</groupId><artifactId>plugin-maven</artifactId>- <version>2.6.8</version>+ <version>2.6.9</version><executions><execution><?m2e execute onConfiguration,onIncremental?>