|
31 | 31 | import hudson.model.Result; |
32 | 32 | import java.util.Collection; |
33 | 33 | import jenkins.model.Jenkins; |
34 | | -import org.apache.commons.io.output.NullOutputStream; |
35 | 34 | import org.jenkinsci.plugins.structs.describable.DescribableModel; |
36 | 35 | import org.jenkinsci.plugins.structs.describable.UninstantiatedDescribable; |
37 | 36 | import org.jenkinsci.plugins.workflow.actions.ArgumentsAction; |
|
41 | 40 |
|
42 | 41 | import edu.umd.cs.findbugs.annotations.CheckForNull; |
43 | 42 | import edu.umd.cs.findbugs.annotations.NonNull; |
| 43 | +import java.io.OutputStream; |
44 | 44 | import java.lang.reflect.Type; |
45 | 45 | import java.net.URL; |
46 | 46 | import java.util.ArrayList; |
@@ -240,6 +240,9 @@ Object sanitizeObjectAndRecordMutation(@CheckForNull Object o, @CheckForNull Env |
240 | 240 | this.isUnmodifiedBySanitization = true; |
241 | 241 | return NotStoredReason.UNSERIALIZABLE; |
242 | 242 | } |
| 243 | + } else if (modded instanceof String && ((String) modded).contains("\0")) { |
| 244 | + this.isUnmodifiedBySanitization = false; |
| 245 | + return "<contains ASCII NUL>"; |
243 | 246 | } else if (modded instanceof String && vars != null && !vars.isEmpty()) { |
244 | 247 | String replaced = replaceSensitiveVariables((String)modded, vars, sensitiveVariables); |
245 | 248 | if (!replaced.equals(modded)) { |
@@ -282,7 +285,7 @@ Map<String, Object> serializationCheck(@NonNull Map<String, Object> arguments) { |
282 | 285 | try { |
283 | 286 | if (val != null && !(val instanceof String) && !(val instanceof Boolean) && !(val instanceof Number) && !(val instanceof NotStoredReason) && !(val instanceof TimeUnit)) { |
284 | 287 | // We only need to check serialization for nontrivial types |
285 | | - Jenkins.XSTREAM2.toXMLUTF8(entry.getValue(), NullOutputStream.NULL_OUTPUT_STREAM); // Hacky but can't find a better way |
| 288 | + Jenkins.XSTREAM2.toXMLUTF8(entry.getValue(), OutputStream.nullOutputStream()); // Hacky but can't find a better way |
286 | 289 | } |
287 | 290 | out.put(entry.getKey(), entry.getValue()); |
288 | 291 | } catch (Exception ex) { |
|
0 commit comments