Join our Newsletter — 33% off our NHI Course

Why do AI-only code scanners miss dependency vulnerabilities and secrets?

They rely on pattern recognition and interpretation, while those problems require structural analysis and exact version intelligence. Dependency CVEs depend on lockfiles and advisory data, and secrets can hide in syntactic forms that do not look like credentials to a model. That makes coverage uneven and hard to trust.

Why AI-only scanners struggle with dependency vulnerabilities

Dependency findings are not mainly a reading-comprehension problem. They depend on exact artifact identity, resolved transitive relationships, and matching that graph against advisory data or a vulnerability database. An AI-only scanner can sound plausible while still missing the one package version, indirect edge, or platform-specific constraint that makes a dependency actually vulnerable.

That is why structural analysis matters more than surface patterns. A scanner has to know what is installed, how it was pinned, where lockfiles disagree with manifests, and whether the vulnerable code path is even reachable in the deployed build. A model that only interprets source text can infer risk, but it cannot reliably prove exposure without that version and graph context.

For example, a package name may appear safe in isolation while a transitive dependency pulls in the affected release. The opposite also happens: a model flags a library because it has seen the name in exploit discussions, but the pinned version is already fixed or the vulnerable feature is not present. That mismatch creates both false negatives and false positives.

Dependency scanners therefore need deterministic inputs such as lockfiles, SBOMs, package metadata, and advisory feeds. Without those, the result is only an approximation of risk. In practice, the question is not whether the model can recognise a risky library name, but whether it can prove the exact vulnerable version is present in the build that will ship.

Why secrets are harder for AI-only scanners to spot

Secrets are often hidden by form, not by meaning. They may appear as encoded strings, embedded JSON, split variables, templated placeholders, base64-like blobs, or values that look ordinary to a language model until they are reconstructed in context. Pattern recognition helps, but it is not enough when the secret does not resemble a classic credential shape.

AI-only tools also struggle with syntactic ambiguity. A token can be legitimate test data, a reference value, a truncated example, or a real credential. Context helps a human reviewer decide, but a model can still miss an exposed secret when it is obfuscated, or over-alert when a harmless sample looks sensitive. That makes trust in coverage difficult.

Secret detection works best when content analysis is paired with rules, entropy checks, known token formats, repository context, and rotation workflows. The scanner has to recognise both obvious credentials and the less obvious cases such as hardcoded API keys, temporary access tokens, and secret material buried in configuration files, examples, or build artifacts.

Once a secret is found, the real issue is not just detection but blast radius. A leaked key may enable direct access to production systems, external APIs, or internal services, so the scanner’s output has to support fast validation, revocation, and replacement. The Secret Sprawl Challenge and Secrets Management Guide both reflect why secrets need lifecycle controls, not just detection.

What this means for scanner design and trust

AI-only scanners are weakest where correctness depends on exactness. Dependency security needs authoritative version and reachability data, while secret detection needs precise identification of sensitive material and the ability to separate real secrets from lookalikes. If the tool cannot explain how it reached the finding, practitioners should treat the result as triage input, not proof.

The practical design choice is to combine AI with deterministic controls rather than replace them. Use the model to improve recall, enrich context, and reduce reviewer time, but keep version resolution, SBOM comparison, advisory matching, and secret-specific rules in the pipeline. OWASP Cheat Sheet Series, OWASP Non-Human Identity Top 10, and CISA Known Exploited Vulnerabilities Catalog each reinforce that secure coverage depends on known controls, current intelligence, and explicit validation.

When scanner output is used for release decisions, the best checkpoint is simple: can the tool show the exact vulnerable dependency, the exact secret pattern or token family, and the exact evidence that makes the finding real? If not, it is useful for prioritisation but not sufficient for closure.

Risk and Threat Considerations

False negatives are the main risk because they leave vulnerable packages or exposed credentials in code, images, or pipelines long enough to be exploited. False positives create a different failure mode, they waste analyst time and can normalise ignoring scanner output when the tool is noisy.

Failure mechanism: AI-only scanners rely on semantic inference, so they can miss transitive vulnerabilities that require lockfile and advisory correlation, and they can fail to recognise secrets that are obfuscated, split across fields, or expressed in non-obvious syntax.

Impact: Missed dependencies can ship known exploitable code, while missed secrets can lead to account compromise, API abuse, or lateral access if the credential is still valid.

Standards & Framework Alignment

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

OWASP Non-Human Identity Top 10 addresses the attack and risk surface, while OWASP ASVS, SLSA and CIS Controls v8 set the governance and control requirements practitioners need to meet.

Framework Control / Reference Relevance
OWASP ASVS V11 — Cryptography Covers secure handling of secret material and credential protection in application code.
Recommendation — Verify secrets handling and cryptographic material are protected by design and not exposed in source or builds.
OWASP Non-Human Identity Top 10 NHI-02 — Secret Leakage Directly addresses leaked secrets and detection limits around exposed credentials.
NHI-07 — Long-Lived Secrets Long-lived credentials raise the impact of missed secret detection and delayed rotation.
NHI-03 — Vulnerable Third-Party NHI Maps to third-party dependency risk when external packages or components are vulnerable.
Recommendation — Scan for secret leakage with deterministic detectors and validate any exposed credential before release. Reduce exposure by replacing long-lived secrets with shorter-lived credentials and rotation. Inventory third-party dependencies and gate releases on exact version and advisory matching.
SLSA Supply Chain Security Build provenance and dependency integrity are central to catching vulnerable components reliably.
Recommendation — Strengthen build and dependency provenance so vulnerable artifacts can be traced and blocked.
CIS Controls v8 CIS-16 — Application Software Security Supports secure code and dependency scanning practices for software and builds.
Recommendation — Embed dependency and secret scanning into software release workflows and review failed findings promptly.

Practitioner Guidance

What to verify: Confirm that the scanner consumes lockfiles, package graphs, and advisory data for dependency analysis, and that it uses secret-specific detectors rather than only a general LLM classification layer.

Decision rule: If the finding cannot be tied to a concrete package version or a concrete secret signature, treat it as a lead for review, not as a trusted security verdict.

Practitioner takeaway: The right measure of scanner quality is not whether it sounds intelligent, but whether it can prove the exact vulnerable dependency or secret with evidence a reviewer can audit.