By NHI Mgmt Group Editorial TeamDomain: Cyber SecuritySource: SemgrepPublished August 20, 2025

TL;DR: Single-file SAST misses real vulnerabilities when taint, inheritance, and data flow cross boundaries, according to Semgrep’s interfile analysis work, even though a benchmark of Java SQL injection cases improved from a 10% to 56% score. The broader lesson is that code security fails when analysis scope stops at file boundaries, not when teams lack more rules.


At a glance

What this is: This is an analysis of how interfile code analysis changes SAST coverage, with the key finding that file-level scanning misses cross-file vulnerability paths.

Why it matters: It matters because application security teams, IAM-adjacent platform teams, and security engineers need detection that follows real data flow across boundaries rather than assuming each file is self-contained.

By the numbers:

  • Semgrep’s benchmark score improved from 10% to 56% after interfile analysis was added.
  • Only 44% of developers are reported to follow security best practices for secrets management.
  • The average estimated time to remediate a leaked secret is 27 days, despite 75% of organisations expressing strong confidence in their secrets management capabilities.

👉 Read Semgrep’s analysis of interfile code analysis for SAST


Context

Interfile analysis is the ability to trace code behaviour across files instead of treating each file as a closed system. In application security, that matters because many real vulnerabilities emerge only when user input, helper methods, inheritance, or taint flow cross those boundaries. For application security programmes, the issue is not whether scanning exists, but whether it models the code paths developers actually write.

For IAM and NHI practitioners, the parallel is familiar: controls fail when they assume a boundary that attackers or runtime behaviour do not respect. Secrets, tokens, service credentials, and application inputs rarely stay neatly contained in one file or one component. The starting point in this article is typical of modern software teams, where coverage gains often depend less on adding more rules and more on improving the analysis model.


Key questions

Q: How should security teams evaluate interfile SAST in real codebases?

A: They should test it against representative repositories with known vulnerabilities, not synthetic examples. The key questions are whether the engine preserves source-to-sink paths across files, whether false positives stay manageable, and whether developers can understand the rule logic well enough to trust the findings. Coverage without triage quality usually does not scale.

Q: Why do file-level scanners miss injection risks so often?

A: Because the risky path usually spans more than one file. Input may arrive in a controller, be transformed in a helper, and only become dangerous when it reaches a sink such as SQL execution or command creation. If the scanner cannot connect those steps, it may miss the vulnerability entirely or flag only a fragment of the path.

Q: What do security teams get wrong about interfile analysis?

A: They often assume the main challenge is deeper computation, when the bigger problem is understanding realistic code structure. In practice, inheritance, aliasing, and method calls matter more than exotic control flow for many production repositories. Teams that overfocus on toy edge cases can misjudge which analysis gaps actually block useful detection.

Q: How do teams decide whether to trust advanced SAST findings?

A: They should look for repeatable evidence that the engine finds real vulnerabilities across multiple repositories and keeps false positives low enough for CI use. Trust increases when rules are explicit, findings are reproducible, and the analysis matches how the code is actually structured. If developers cannot verify a match quickly, adoption will stall.


Technical breakdown

Why single-file SAST misses cross-file vulnerabilities

Single-file static analysis can only reason about what is visible in one source file, so it often loses the relationship between input, transformation, and sink when those steps are split across modules. That limitation is acceptable for some pattern matching, but it breaks down for taint tracking, constant propagation, and call chains that cross class boundaries. In practice, the scanner may see a sink like a command execution or SQL construction point without seeing the original untrusted source. That is why interfile scope matters for real vulnerability detection, not just for deeper theoretical analysis.

Practical implication: prioritise analysis modes that preserve cross-file data flow for injection-style findings.

How taint analysis changes when data flows across files

Taint analysis tracks whether untrusted input can reach a sensitive operation. In interfile mode, the challenge is not the taint concept itself, but keeping the source-to-sink chain intact when one file receives input and another file performs the dangerous operation. The article shows this clearly with Spring request parameters flowing through one class and into a ProcessBuilder call in another. Without interfile support, a tool may report nothing or misclassify the path. With it, the scanner can identify a genuine command injection path rather than a local pattern in isolation.

Practical implication: use interprocedural taint rules where risky flows may traverse helper methods or service layers.

Why benchmark design matters more than feature claims

A security engine improves only when the benchmark reflects the real repository operations it must understand. The article’s team narrowed the problem to Java and SQL injection, then annotated repositories for true positives, false positives, and the kinds of operations needed for correct detection. That method exposed a useful lesson for broader security engineering: feature completeness is less important than proving the scanner handles the common patterns that appear in production code. Benchmarking also prevents teams from overfitting to toy examples that look impressive but fail in real pipelines.

Practical implication: evaluate scanners against representative repositories and verified vulnerabilities, not demo snippets.


Threat narrative

Attacker objective: The attacker aims to turn cross-file data flow into command execution, SQL injection, or another exploitable sink that bypasses file-level scanning.

  1. Entry occurs when untrusted input is accepted in one file through request parameters or similar sources.
  2. Credential or data abuse is not the main step here, but the vulnerable flow persists when that input is passed across files into a sensitive sink without complete analysis.
  3. Impact occurs when the sink executes a command or constructs a dangerous SQL operation, allowing injection and potential server compromise.

NHI Mgmt Group analysis

Cross-file visibility is now a baseline requirement for meaningful application security scanning. File-by-file rule engines can still be useful for local pattern checks, but they fail once input handling and risky sinks are separated by normal software structure. That is especially true in modern applications built from controllers, helpers, services, and shared libraries. Security teams should treat cross-file reasoning as a detection requirement, not an advanced optional feature.

Interfile analysis exposes a broader code governance problem: the control boundary is often smaller than the application boundary. This article shows that the most useful security logic depends on inheritance, aliasing, and taint propagation across multiple components. For IAM-adjacent programmes, the same pattern appears when permissions, secrets, or trust relationships are evaluated only in isolation. The practical conclusion is that governance has to follow runtime paths, not just repository structure.

Cross-file analysis creates a useful named concept: detection scope debt. That is the gap between where a scanner can reason and where the application actually moves trust and data. The bigger that gap becomes, the more findings are missed or delayed. Teams should measure tooling by whether it closes detection scope debt on the code paths that matter most.

Developer-facing security tools only work when the analysis model matches developer reality. The article’s focus on maintainable rules and useful defaults is relevant beyond SAST because adoption fails when security output is accurate but unusable. In practice, practitioners should optimise for findings that can be trusted, triaged, and fixed without forcing developers to decode opaque alert logic.

Security research and product engineering need tighter feedback loops for advanced analysis capabilities. The article makes clear that interfile support improved only after benchmark discipline, user testing, and rule refinement came together. That is a governance lesson for any security capability that depends on nuanced context. The field should expect more value from evidence-driven iteration than from feature-first roadmaps.

What this signals

Detection scope debt will become a larger operational issue as application codebases grow more distributed. When analysis cannot follow trust and data across files, teams inherit blind spots that look like tool coverage but behave like missed risk. The practical response is to align scanner scope with the actual code paths developers use, then validate that against sources like NIST SP 800-53 Rev 5 Security and Privacy Controls.

Interfile analysis also changes how engineering leaders should think about security tuning. The most valuable controls are the ones that reduce false positives without sacrificing the ability to catch real injection chains. That makes benchmark discipline, rule maintenance, and developer trust part of the control model rather than afterthoughts.

For identity and secrets-heavy application environments, the lesson extends beyond SAST. If code paths can move untrusted input across components, secrets and credentials can be exposed to the same structural weakness. Teams should reinforce secret handling, access scope, and code scanning together, especially where secrets and application logic intersect.


For practitioners

  • Benchmark scanners against real cross-file paths Use repositories with known vulnerabilities to test whether the tool preserves source-to-sink chains across classes, methods, and helper files. Include both true positives and false positives so you can judge whether interfile support improves precision as well as coverage.
  • Separate single-file and interfile rule sets Maintain distinct rule logic for file-local patterns and interfile taint detection, because rules tuned for one mode often behave badly in the other. Document which checks require interfile analysis so teams know where local scans are insufficient.
  • Prioritise injection paths that span services Focus first on command injection, SQL injection, SSRF, and similar issues where user input often moves through controllers, helper methods, and service layers before reaching a sink. Those are the paths most likely to be missed by one-file analysis.
  • Measure triage quality, not just match counts Track whether alerts are actionable enough for developers to fix without extensive manual reconstruction of data flow. A tool that produces fewer but more definite matches is often more useful than one that floods the queue with ambiguous results.

Key takeaways

  • Interfile analysis matters because many real vulnerabilities only appear when data flow crosses files, classes, or services.
  • The benchmark jump from 10% to 56% shows that analysis scope, not just rule count, determines whether SAST finds usable results.
  • Security teams should test scanners against real repositories and prioritise cross-file taint paths that developers actually ship.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

MITRE ATT&CK address the attack and risk surface, while NIST CSF 2.0, NIST SP 800-53 Rev 5 and CIS Controls v8 set the governance and control requirements practitioners need to meet.

FrameworkControl / ReferenceRelevance
MITRE ATT&CKTA0001 , Initial Access; TA0006 , Credential Access; TA0010 , ExfiltrationThe post centres on injection paths and data flow that support compromise and exfiltration.
NIST CSF 2.0PR.AC-4Cross-file security scanning supports least-privilege and application access governance.
NIST SP 800-53 Rev 5SI-4SI-4 aligns with detection of unsafe code paths and security-relevant anomalies in application flows.
CIS Controls v8CIS-16 , Application Software SecurityThe article is directly about improving application security testing coverage.

Map cross-file injection findings to initial access, credential access, and exfiltration tactics in your detection logic.


Key terms

  • Inter-File Analysis: Inter-file analysis follows code relationships across file boundaries instead of staying inside a single source file. It improves coverage because many real vulnerabilities cross boundaries, but it also increases the context the engine must preserve and can create performance pressure if implemented with redundant passes.
  • Taint Analysis: A method for tracking untrusted data as it moves through a system until it reaches a sensitive operation. In agentic environments, it helps security teams see when external content can influence tool selection, code changes, or other privileged actions that should not have been reachable from that input.
  • Detection Scope Debt: Detection scope debt is the gap between the scope a security tool can analyse and the scope the application actually uses to move trust, data, or privilege. The larger the gap, the more likely teams are to miss real issues, overtrust results, or waste time on false confidence.
  • False Positive: A false positive is a scanner result that looks like a secret but is not actually sensitive. In secret governance, false positives matter because they consume analyst time, weaken trust in alerts, and can delay response to the findings that truly change exposure and access risk.

What's in the full article

Semgrep’s full post covers the implementation detail this post intentionally leaves for the source:

  • The benchmark construction method, including how the team selected Java repositories and annotated true positives and false negatives.
  • The rule design differences between single-file patterns and interfile taint rules, which matter when you are tuning scanners for CI.
  • The engine-side debugging and performance work that was needed before the interfile rules were stable enough for broader testing.
  • The specific examples of command injection paths that become visible only when the analysis can follow code across files.

👉 Semgrep’s full post covers the benchmark design, rule tuning, and cross-file examples in detail.

Deepen your knowledge

The NHI Foundation Level course, the industry's only accredited NHI security programme, covers NHI governance, secrets management, and workload identity in the context of practical security operations. It is designed for practitioners who need to connect identity controls to real implementation decisions across modern engineering environments.
NHIMG Editorial Note
Published by the NHIMG editorial team on August 2, 2026.
NHI Mgmt Group — the independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org