-
Notifications
You must be signed in to change notification settings - Fork 196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[JENKINS-67380] Detect oversized maps, collections and arrays and truncate #492
Conversation
@@ -83,7 +87,7 @@ public ArgumentsActionImpl(@Nonnull Map<String, Object> stepArguments) { | |||
|
|||
/** For testing use only */ | |||
ArgumentsActionImpl(@Nonnull Set<String> sensitiveVariables){ | |||
this.isUnmodifiedBySanitization = false; | |||
this.isUnmodifiedBySanitization = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was wrong. If you do nothing then the data is unmodified.
cc @jglick |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like it would fix the issue though I am not sure the details are right. Probably does not matter much either way.
Would prefer to fix https://github.com/jenkinsci/pipeline-utility-steps-plugin/blob/1d91c29606ce59515614ed0d7536b1aaaea9e356/src/main/java/org/jenkinsci/plugins/pipeline/utility/steps/json/WriteJSONStep.java#L55 to be a String
, perhaps, though this might require some tricks with two JavaBeans attributes backed by a single field. Hard to know exactly what to do with this step because it violates the basic constraint of Pipeline steps that their arguments should be types accepted by DescribableModel
: primitives (String
s, true primitives, maybe enum
s), or Describable
s and List<Describable>
s with their attribute types recursively being acceptable; a Map
is never legal (the stepArguments
are a special case). Would prefer to just deprecate this step and others like it that deal with nonstandard types; they just cause all sorts of problems. (jenkinsci/pipeline-utility-steps-plugin#47, https://issues.jenkins.io/browse/JENKINS-49669?focusedCommentId=353921&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-353921, etc.)
The fundamental problem with the design of ArgumentsAction
(as I failed to convince the author of the API at the time) is that it stores the surface form of arguments, raw from Groovy
final Map<String,Object> namedArgs; |
getResolvedArguments
later and hope you can still reconstruct what was actually meant at the time the build ran. Keeping only the logical form would probably have avoided this particular issue just to the extent that there is no logical form for WriteJSONStep.json
and so this map entry would simply have been discarded for purposes of ArgumentsAction
.
src/main/java/org/jenkinsci/plugins/workflow/cps/actions/ArgumentsActionImpl.java
Outdated
Show resolved
Hide resolved
src/main/java/org/jenkinsci/plugins/workflow/cps/actions/ArgumentsActionImpl.java
Show resolved
Hide resolved
src/test/java/org/jenkinsci/plugins/workflow/cps/actions/ArgumentsActionImplTest.java
Show resolved
Hide resolved
src/test/java/org/jenkinsci/plugins/workflow/cps/actions/ArgumentsActionImplTest.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks right. Thanks!
JENKINS-67380