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-10693] Prevent name conflicts with top-level options #6959

Closed
wants to merge 3 commits into from

Conversation

daniel-beck
Copy link
Member

@daniel-beck daniel-beck commented Aug 2, 2022

See JENKINS-10693.

Checkboxes for job names have a name attribute matching the job name. If that's json, that'll mess with the magic parameter for structured form submission populated by buildFormTree. Other problematic names are names of other options, like recurse or useincluderegex: Setting the built-in option will include the job in the view, and/or vice versa.

The solution has two components:

  • Add a prefix to each "dynamic" (job name) checkbox form field, so that they, based on their name as submitted as a form parameter by the browser, do not interfere with the magic json form field, or other top-level form fields accessed with StaplerRequest#getParameter. For structured form submission, the prefixes are removed in buildFormTree using shortenName, so the generated JSON object doesn't include them, which is what counts.
  • Wrap the job name checkboxes in a new object items to prevent collisions in the json parameter at the top-level (e.g. recurse would be a bad job name to have given
    recurse = json.optBoolean("recurse", true);
    )

Proposed changelog entries

  • Prevent problems with the view configuration form when job names are the same as other form field names.

Proposed upgrade guidelines

N/A

Submitter checklist

  • (If applicable) Jira issue is well described
  • Changelog entries and upgrade guidelines are appropriate for the audience affected by the change (users or developer, depending on the change) and are in the imperative mood. Examples
    • Fill-in the Proposed changelog entries section only if there are breaking changes or other changes which may require extra steps from users during the upgrade
  • Appropriate autotests or explanation to why this change has no tests
  • New public classes, fields, and methods are annotated with @Restricted or have @since TODO Javadoc, as appropriate.
  • New deprecations are annotated with @Deprecated(since = "TODO") or @Deprecated(forRemoval = true, since = "TODO") if applicable.
  • For dependency updates: links to external changelogs and, if possible, full diffs

Desired reviewers

@mention

Maintainer checklist

Before the changes are marked as ready-for-merge:

  • There are at least 2 approvals for the pull request and no outstanding requests for change
  • Conversations in the pull request are over OR it is explicit that a reviewer does not block the change
  • Changelog entries in the PR title and/or Proposed changelog entries are accurate, human-readable, and in the imperative mood
  • Proper changelog labels are set so that the changelog can be generated automatically
  • If the change needs additional upgrade steps from users, upgrade-guide-needed label is set and there is a Proposed upgrade guidelines section in the PR title. (example)
  • If it would make sense to backport the change to LTS, a Jira issue must exist, be a Bug or Improvement, and be labeled as lts-candidate to be considered (see query).

@github-actions github-actions bot added the unresolved-merge-conflict There is a merge conflict with the target branch. label May 22, 2023
@github-actions
Copy link
Contributor

Please take a moment and address the merge conflicts of your pull request. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
unresolved-merge-conflict There is a merge conflict with the target branch.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants