Skip to content
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

Merged
merged 5 commits into from
Dec 16, 2021

Conversation

Vlatombe
Copy link
Member

JENKINS-67380

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests - that demonstrates feature works or fixes the issue

@@ -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;
Copy link
Member Author

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.

@Vlatombe
Copy link
Member Author

cc @jglick

Copy link
Member

@jglick jglick left a 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 (Strings, true primitives, maybe enums), or Describables 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

rather than the logical form, and you need to call 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.

@Vlatombe Vlatombe requested a review from jglick December 16, 2021 15:51
Copy link
Member

@jglick jglick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks right. Thanks!

@car-roll car-roll merged commit 8a4a36d into jenkinsci:master Dec 16, 2021
@Vlatombe Vlatombe deleted the JENKINS-67380 branch January 13, 2022 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants