Tighten newsletter-modal-hide to require an email input#127
Merged
Conversation
The generic [role="dialog"] / [role="alertdialog"] selectors were gated by an "email input OR <form>" check, which was broad enough to catch application dialogs like GitHub's "Create new issue" template chooser once any newsletter-keyword text appeared inside. Real newsletter modals always include an <input type="email"> (collecting the email is the whole point), so dropping the form-only branch keeps coverage intact while letting form-bearing dialogs without an email field through. Refs #126 Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
newsletter-modal-hidecandidate filter; now requires an<input type="email">descendant for generic[role="dialog"]matches to fire. Vendor-specific selectors (Sumo, OptinMonster, Privy, Mailchimp, Klaviyo, etc.) still go through the same gate.role="dialog"with a<form>wrapping template links, no email input, and incidental signup-keyword copy. Test fails onmainand passes after the fix.Why this rule
Of the default-on rules that hide DOM,
newsletter-modal-hideis the only one whose generic surface ([role="dialog"],[role="alertdialog"],.modal.show,.popup) could catch GitHub's chooser.cookie-banner-hiderequiresaria-label*="cookie|consent";chat-widget-hideis vendor-id only;ads-hide's EasyList list has no generic dialog/overlay selectors (I grepped). Threading the issue through this rule's filter is the narrowest fix.The form-only branch was redundant for real-world coverage: every newsletter popup that's also worth firing on collects an email, so requiring
input[type="email"]doesn't lose vendors. It does close the door on a class of false positives — any application dialog (issue chooser, search, command palette, comment form) whose textContent happens to include "subscribe" / "sign up" / "stay updated" was previously eligible.Test plan
bun run test— 992 passing, including the new regression case.bun run check+bun run typecheck.https://github.com/pixiebrix/agent-browser-shield/issues, click New issue, confirm the template chooser modal appears.newsletter-modal-hideback on and bisect from the Options page. The new test still adds defensive coverage for the false-positive class.Closes #126 if manual verification confirms.
🤖 Generated with Claude Code