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-65017] Prevent bugs in form validation from messing up the entire page #5333

Merged
merged 1 commit into from
Mar 8, 2021

Conversation

daniel-beck
Copy link
Member

A simple attempt to prevent NPEs and similar problems in form validation URLs from blowing up forms.

Previously, an entire Jenkins page would be shown below the affected form field, including the Logging ID that replaced stack traces, so we lose a bit of functionality here, but it's just a lot nicer looking (and could be further iterated on, e.g. by more flexibly serving 500 responses based on request type).

Manual testing: Edit any validated form field's checkurl to an invalid one, and observe:

Before

(Current LTS)

Screenshot 2021-03-04 at 15 31 19

After

(This PR)

Screenshot

Proposed changelog entries

  • Do not render full error responses in case of internal errors when validating fields in configuration forms.

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). 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
  • 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 correct
  • 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).

@oleg-nenashev oleg-nenashev added the bug For changelog: Minor bug. Will be listed after features label Mar 4, 2021
Copy link
Member

@oleg-nenashev oleg-nenashev left a comment

Choose a reason for hiding this comment

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

Reloading the page is probably not the best advice. Some unsaved form data may be lost if a user follows this advice.

I also wonder whether it is possible to capture logging ID of the unhandled exception from the original page so that the administrator can figure out what has happened.

@daniel-beck
Copy link
Member Author

daniel-beck commented Mar 4, 2021

Reloading the page is probably not the best advice. Some unsaved form data may be lost if a user follows this advice.

The dialog with the reminder appears on reload attempts. A potential cause for this error is session expiration, in which case all your data is lost anyway.

I also wonder whether it is possible to capture logging ID of the unhandled exception from the original page so that the administrator can figure out what has happened.

If it's a 500 page with logging ID; probably, I see that as future enhancement (I've done something similar with the Apply response before I think).

@timja timja added the ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback label Mar 6, 2021
@timja
Copy link
Member

timja commented Mar 6, 2021

This PR is now ready for merge, after ~24 hours, we will merge it if there's no negative feedback.

Thanks!

@timja timja merged commit beb9da4 into jenkinsci:master Mar 8, 2021
@MarkEWaite MarkEWaite mentioned this pull request Mar 23, 2021
33 tasks
@daniel-beck daniel-beck mentioned this pull request Jun 30, 2021
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug For changelog: Minor bug. Will be listed after features ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants