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

Enforce unique constraints from validator #2451

Merged
merged 2 commits into from May 29, 2019
Merged

Conversation

westonruter
Copy link
Member

@westonruter westonruter commented May 28, 2019

Fixes #1580.

The sanitizer is not currently enforcing a unique constraint, resulting in validation errors leaking to the frontend when, for example:

It is straightforward to implement this constraint by merely keeping track of whether or not a given tag spec with the unique constraint has been encountered for a given element. If so, then the element should raise a validation error for removal.

Before

Given the Page Speed theme:

image

After

image

image

Addendum

Static analysis revealed a variable which may not have been defined, so this is fixed in a917b39.

@westonruter westonruter added this to the v1.2 milestone May 28, 2019
@westonruter westonruter requested a review from amedina May 28, 2019 21:29
@googlebot googlebot added the cla: yes Signed the Google CLA label May 28, 2019
Copy link
Member

@amedina amedina left a comment

Choose a reason for hiding this comment

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

LGTM. Ship it.

@westonruter westonruter merged commit cdaecb1 into develop May 29, 2019
@westonruter westonruter deleted the add/unique-constraint branch May 29, 2019 04:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Signed the Google CLA
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement unique constraint in whitelist sanitizer
3 participants