Consolidate eval-backed rule extension PRs#273
Merged
Conversation
Covered PR families and representatives: - #208 plus #209-#221: first-call and captured-state replay through LAST_CALL_REPLAY. - #172 and #173: mutated captured subscripts/attributes folded into the broad captured-state replay detector. - #252 plus #250/#251 and ignored variants #244/#246/#247/#248/#249: direct and indirect input.float() passthrough output detection, including nullcontext, dynamic type(), __init_subclass__, and descriptor-backed exports. - #253: input reduction fake-output detection for torch.any/all style outputs. - #256 plus #254/#255 and related #257/#258/#259/#261-#271 family: self-matmul/bmm/sentinel-style fake output coverage through SELF_MATMUL_OUTPUT and replay detectors. - #202 plus #203-#207 and related #18/#223 forms: pointer/id/data_ptr replay cache extensions. - #192/#193/#195 and additional ignored variants #156/#165: partial/factory/nonlocal mutable-state replay. - #11/#43/#115/#144/#152/#174/#183/#222/#225: aliases, function/default state, generator-send, and local __dict__ replay variants. - #21: callable/class entrypoint replay blind spots. - #65: contextvars-backed state replay. - #22/#143: lambda/operator setitem pointer-dispatch replay. Implementation notes: - Add shared AST helpers for entrypoint methods, no-op nullcontext bodies, lambda input handling, torch call recognition, and output/cache naming. - Add hard fake-output policies for INPUT_PASSTHROUGH_OUTPUT, INPUT_REDUCTION_OUTPUT, and SELF_MATMUL_OUTPUT. - Register the new replay and fake-output detectors in CODE_DETECTORS and BASE_DETECTOR_SPECS. - Tighten object pointer replay so cached fast paths that launch/refresh work before returning are not treated as stale output replay. Validation: - python3 -m py_compile kernelguard.py - git diff --check - targeted smoke set for new rule families - streaming gates: 251 TP / 2 known flywheel metadata-gap FN / 0 FP / 1421 TN - blue_pr_static_security.py: passed with 0 findings - --audit-rules report generated at /tmp/kg_rule_audit_explicit/rule_audit_report.md
This was referenced Jun 20, 2026
This was referenced Jun 20, 2026
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
Consolidates the useful eval-backed KernelGuard rule-extension PRs into a single surgical rule-family update instead of merging many overlapping detector branches independently.
This adds broader AST detectors for replay, fake-output, and evaluator/runtime manipulation families, wires the resulting rules into
CODE_DETECTORSandBASE_DETECTOR_SPECS, and tightens pointer replay handling so valid fast paths that call/launch work before returning cached output containers are not hard-filtered as stale replay.What changed
INPUT_PASSTHROUGH_OUTPUTcoverage for direct and indirectinput.float()passthroughs, includingnullcontext, dynamictype(...),__init_subclass__, helper-function, and descriptor-backed exports.INPUT_REDUCTION_OUTPUTandSELF_MATMUL_OUTPUThard fake-output families for input reductions and self-matmul/bmm-style fake outputs.LAST_CALL_REPLAYcoverage for first-call sentinel replay, captured mutable state, mutable defaults, function attributes, nonlocal factories,contextvars, local__dict__aliases, partial-bound methods/storage, and generator.send()replay.POINTER_REPLAYcoverage for pointer/id/data_ptr cache hits, class callable state, and lambda/operator pointer dispatch forms.Sourced PRs covered
Replay / captured state:
#208 #209 #210 #211 #212 #213 #214 #215 #216 #217 #218 #219 #220 #221 #172 #173 #11 #43 #115 #144 #152 #174 #183 #222 #225
Partial / factory / callable entrypoints:
#192 #193 #195 #156 #165 #21
Pointer replay:
#202 #203 #204 #205 #206 #207 #18 #223 #22 #143
Fake-output passthrough and reductions:
#252 #250 #251 #244 #246 #247 #248 #249 #253
Self-matmul / bmm / sentinel-style fake-output family:
#256 #254 #255 #257 #258 #259 #261 #262 #263 #264 #265 #266 #267 #268 #269 #270 #271
System/runtime manipulation:
#24 #25 #26 #27
Context-local replay:
#65
Validation
python3 -m py_compile kernelguard.pygit diff --check251 TP / 2 known flywheel metadata-gap FN / 0 FP / 1421 TNscripts/github/blue_pr_static_security.py: passed with0findingsNotes
The two remaining flywheel misses are the pre-existing metadata-gap samples that only hit
DECODE_MM_REFat low confidence; this branch does not broaden that unrelated gate.