Treat an unreadable __artifacts_v2__ as a sink, not as a non-sink - #396
Merged
Conversation
A module whose __artifacts_v2__ is built by a helper cannot be evaluated statically, so declares_html_columns() returns None. is_sink read that as falsy, which meant the module was skipped by all three rules -- not just by unguarded-html-columns, which is the only one that actually needs the declaration. That is fail-open in the one case where the answer is unknown. A module in the NOT CHECKED list could gain an html_columns tomorrow and stay completely unguarded, with nothing in the output changing to say so. Now an unreadable declaration is treated as a sink. The uncertainty costs coverage of one rule instead of all three. Verified against a probe artifact whose __artifacts_v2__ is helper-built and which carries both an unescaped interpolation and a remote <img src>: the old behaviour reported 0 findings for it, this reports 3. Measured before committing: no module currently in any core's NOT CHECKED list produces a finding under the new default, so this costs nothing today. It was checked the other way too -- of the eleven such modules across the cores, ten declare no html_columns at runtime and the eleventh (RLEAPP kikReturns) was already being scanned through a media helper. The hole was latent, not live. The NOT CHECKED banner now says the other two rules still run, so the list reads as one missing rule rather than as an unscanned module. Validated: pylint --disable=C,R = 10.00; lint_changed reports no new warnings; unit tests OK; the check still exits 0 on this tree. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
The hole
A module whose
__artifacts_v2__is built by a helper cannot be evaluated statically, sodeclares_html_columns()returnsNone.is_sinkread that as falsy:So the module was skipped by all three rules — not just by
unguarded-html-columns, which is the only one that actually needs the declaration.That is fail-open in the one case where the answer is unknown. A module in the
NOT CHECKEDlist could gain anhtml_columnstomorrow and stay completely unguarded, with nothing in the output changing to say so.The fix
An unreadable declaration is now treated as a sink. The uncertainty costs coverage of one rule instead of all three.
Proof it does something
A probe artifact whose
__artifacts_v2__is helper-built, carrying both an unescaped interpolation and a remote<img src>:Proof it costs nothing
Measured before committing: no module currently in any core's
NOT CHECKEDlist produces a finding under the new default. No new baseline entries, no allowlist growth.Checked the other way too — of the eleven such modules across the cores, ten declare no
html_columnsat runtime, and the eleventh (RLEAPPkikReturns) was already being scanned through a media helper. The hole was latent, not live.The
NOT CHECKEDbanner now states that the other two rules still run, so the list reads as one missing rule rather than as an unscanned module.Validation
pylint --disable=C,R= 10.00;lint_changedreports no new warnings🤖 Generated with Claude Code