Skip to content

Scope the Exfiltration Distance Check to real function boundaries (#102) - #361

Merged
squid-protocol merged 1 commit into
mainfrom
feature/102-scope-exfiltration-check
Jul 24, 2026
Merged

squid-protocol merged 1 commit into
mainfrom
feature/102-scope-exfiltration-check

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Summary

Closes out the last "sporadic" gap #102's epic body called out. #346/#348 enumerated and migrated six correlate() pairs in detector.py onto same-function scoping, but the Exfiltration Distance Check (memory_scraping -> exfiltration_camouflage, in coding_analysis()'s Phase 4 AppSec block) was a seventh pair that got missed, and kept running on the old flat 200-character radius after everything else in the file had moved off it.

Migrated it into apply_amplifier_correlations() in spatial_correlation.py, called from _function_slice() once real satellite ranges exist -- same treatment as the RCE taint corroboration and OOM Bomb pairs already there. Same amplifier-not-dampener tradeoff reasoning applies (a wrong-scope amplifier only costs one extra review item, not a false negative), so this was about consistency, not urgency: every correlate() call in the pipeline now shares the same scoping semantics.

Pure relocation, not a behavior change for same-function callers -- counts["memory_scraping"] and mitigations["amplified_leaks"] are still mutated identically when the memory read and the socket send share a function.

Test plan

  • New cross-function regression test in test_detector.py (test_detector_exfiltration_check_does_not_cross_function_boundaries), mirroring the existing dampener cross-function tests, proving a memory read in one function no longer amplifies a socket send in a different, unrelated one.
  • Existing test_detector_spatial_appsec_correlation (same-function case) still passes unchanged.
  • python -m pytest tests/ -q -- full suite, 837 passed, 1 pre-existing xfail.

🤖 Generated with Claude Code

Closes out the last "sporadic" gap #102's epic body called out: #346/
#348 enumerated and migrated six correlate() pairs in detector.py onto
same-function scoping, but the Exfiltration Distance Check
(memory_scraping -> exfiltration_camouflage, in coding_analysis()'s
Phase 4 AppSec block) was a seventh pair that got missed, and kept
running on the old flat 200-character radius after everything else in
the file had moved off it.

Migrated it into apply_amplifier_correlations() in spatial_correlation.py,
called from _function_slice() once real satellite ranges exist -- same
treatment as the RCE taint corroboration and OOM Bomb pairs already
there. Same amplifier-not-dampener tradeoff reasoning applies (a
wrong-scope amplifier only costs one extra review item, not a
false-negative), so this was about consistency, not urgency: every
correlate() call in the pipeline now shares the same scoping semantics.

Pure relocation, not a behavior change for same-function callers --
counts["memory_scraping"] and mitigations["amplified_leaks"] are still
mutated identically when the memory read and the socket send share a
function.

Tests: new cross-function regression test in test_detector.py, mirroring
the existing dampener cross-function tests, proving a memory read in one
function no longer amplifies a socket send in a different, unrelated one.

Full suite: 837 passed, 1 pre-existing xfail.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-protocol
squid-protocol merged commit cdcfd33 into main Jul 24, 2026
22 checks passed
@squid-protocol
squid-protocol deleted the feature/102-scope-exfiltration-check branch July 24, 2026 13:44
squid-protocol added a commit that referenced this pull request Aug 14, 2026
…der Claim 1 (#1562)

Two additions to why_gitgalaxy_beats_ast_here.md, both from a follow-up
discussion after #1427/Claim 3 landed:

- Claim 3's evidence now includes the actual tree-sitter-c-sharp bug-tracker
  trail for the ref/struct gap (issue #14 fixed 2022, issue #361 still open
  since Dec 2024 documenting the exact "one error corrupts the whole file"
  cascade in the maintainers' own words, PR #439 cataloging 8 more known
  gaps as of Aug 2026) -- answers "how long can tree-sitter be out of date"
  with sourced evidence instead of speculation, and a new subsection
  ("Why GitGalaxy doesn't hit this particular wall") generalizes the
  underlying reason: GitGalaxy's narrow four-signal contract (classes,
  functions, arguments, structural signatures -- never a full parse tree)
  exempts it from the specific constraints that cause this class of failure
  in a real grammar (canonical-tree-for-every-permutation, global
  coherence, full versioned grammar-surface tracking).
- Logs m4 (confirmed, already implemented, same body-read idiom as
  bash/perl) and batch (same shape, but NOT yet implemented -- language_standards.py's
  batch entry has empty rules) as two more instances of Claim 1's shape,
  so batch doesn't get lost as a one-off observation before a future
  harden-language-extraction pass picks it up.

No code change.

Co-authored-by: Joe Esquibel <squid-protocol@users.noreply.github.com>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
squid-protocol added a commit that referenced this pull request Aug 14, 2026
…ot ref struct at 14575) (#1568)

* docs: expand Claim 3 with grammar-staleness timeline, log m4/batch under Claim 1

Two additions to why_gitgalaxy_beats_ast_here.md, both from a follow-up
discussion after #1427/Claim 3 landed:

- Claim 3's evidence now includes the actual tree-sitter-c-sharp bug-tracker
  trail for the ref/struct gap (issue #14 fixed 2022, issue #361 still open
  since Dec 2024 documenting the exact "one error corrupts the whole file"
  cascade in the maintainers' own words, PR #439 cataloging 8 more known
  gaps as of Aug 2026) -- answers "how long can tree-sitter be out of date"
  with sourced evidence instead of speculation, and a new subsection
  ("Why GitGalaxy doesn't hit this particular wall") generalizes the
  underlying reason: GitGalaxy's narrow four-signal contract (classes,
  functions, arguments, structural signatures -- never a full parse tree)
  exempts it from the specific constraints that cause this class of failure
  in a real grammar (canonical-tree-for-every-permutation, global
  coherence, full versioned grammar-surface tracking).
- Logs m4 (confirmed, already implemented, same body-read idiom as
  bash/perl) and batch (same shape, but NOT yet implemented -- language_standards.py's
  batch entry has empty rules) as two more instances of Claim 1's shape,
  so batch doesn't get lost as a one-off observation before a future
  harden-language-extraction pass picks it up.

No code change.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* docs: correct Claim 3's csharp root-cause diagnosis (line 5198, not 14575)

#1427's ref struct attribution was wrong -- tested in isolation it parses
cleanly. The real trigger is a C# 11 list-pattern + property-pattern
construct at LanguageParser.cs:5198, over 9,000 lines earlier, which
leaves tree-sitter with zero real_functions for the rest of the file
(vs. 157 before it) -- accounting for all 316 of csharp's current
"extra" false positives, not just the 3 names #1427 excluded.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

---------

Co-authored-by: Joe Esquibel <squid-protocol@users.noreply.github.com>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant