Join our Newsletter — 33% off our NHI Course

Sensitive File Globbing

Sensitive file globbing is the use of broad path patterns that accidentally match files containing secrets, such as environment files, keys, or configuration data. In CI/CD, this becomes dangerous when matched paths are surfaced in outputs or logs. The safer pattern is explicit include and exclude control around sensitive locations.

How sensitive file globbing creates exposure

Sensitive file globbing is usually introduced as a convenience, but the security issue is that broad patterns can unintentionally sweep up files that were never meant to be handled as ordinary build artifacts. That includes environment files, local config, private keys, token stores, and other secret-bearing files that become visible once a pipeline enumerates matched paths.

The danger is not the glob syntax itself, it is the combination of wide matching and downstream handling. If a CI/CD job expands a pattern like “all files in a directory” and then prints, archives, uploads, or diffs the result, the pattern has become a data exposure mechanism rather than a file-selection helper.

This is why explicit include and exclude control matters. The safer model is to narrow what a job can see from the start, then treat secret-bearing locations as excluded by default rather than hoping a broad match will stay harmless.

Where the operational failure usually starts

The most common failure mode is overbroad path selection in build, test, packaging, or deployment automation. A path pattern that was intended to collect source files can also match .env, local overrides, certificate material, or generated configuration, especially in repositories that mix application code with deployment assets.

Once those files are matched, the next risk is secondary exposure. Outputs, logs, artifacts, and debug traces often receive the matched file list or file contents as part of troubleshooting, validation, or reporting. At that point the problem is no longer just accidental inclusion, it is uncontrolled propagation of secret-bearing data through the delivery chain.

In practice, this makes the subject closely related to secret sprawl and build-time misconfiguration. The file match is only the trigger; the real security consequence appears when the pipeline assumes every matched file is safe to surface.

Why it matters in CI/CD and repository hygiene

Sensitive file globbing is especially problematic in CI/CD because pipelines are designed to automate visibility. Jobs often run with broad workspace access, collect file inventories, and emit structured logs for later inspection, which makes accidental matching more likely to become persistent exposure.

That is why this pattern is often discussed alongside secret handling discipline and zero-trust delivery practices. NHIMG’s Ultimate Guide to NHIs is a useful reference point here because the same operational reality appears in leaked environment files, exposed API keys, and credential material stored in vulnerable locations. The broader lesson is that automation should never assume broad filesystem visibility is safe by default.

One relevant data point from that guide is that 96% of organisations store secrets outside of secrets managers in vulnerable locations including code, config files, and CI/CD tools. That statistic aligns directly with this term because globbing mistakes become much more dangerous when secret-bearing files are already living in ordinary project paths.

Safer patterns and control intent

The control intent is straightforward: make file selection deterministic, reviewable, and secret-aware. Use explicit allow lists for expected files, maintain exclusions for secret locations, and separate operational artifacts from files that may contain credentials or private material.

In mature pipelines, the goal is not to find a glob that happens not to fail. The goal is to design workflows so that a pattern cannot accidentally promote sensitive material into logs, artifacts, or notifications in the first place.

Practitioner note: treat path matching as a security control, not just a build convenience. If a glob can capture secrets, it should be reviewed with the same care you would apply to a permission grant.

Risk and Threat Considerations

Broad file matching can expose secrets indirectly even when the pipeline never intended to print them. The risk is greatest when matched paths are reused in debug output, artifact collection, or automated sync steps, because a single overbroad rule can distribute sensitive files to multiple systems at once.

Failure mechanism: an inclusive glob matches secret-bearing files in shared workspaces or repositories, then a later step logs, uploads, or packages those files as if they were ordinary inputs.

Impact: credentials, keys, and configuration data can be exposed to developers, CI/CD operators, third-party services, or attackers who gain access to build outputs and logs.

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 address the attack and risk surface, while CIS Controls v8 and NIST CSF 2.0 set the governance and control requirements practitioners need to meet.

Framework Control / Reference Relevance
CIS Controls v8 3.4 — Data Access Control Sensitive file globbing can expose secret-bearing files through build outputs and logs.
4.2 — Secure Configuration for Software Broad path patterns often fail as a configuration problem in CI/CD and build automation.
8.2 — Audit Log Management Matched secret files become dangerous when they are surfaced in logs and outputs.
Recommendation — Restrict file enumeration and artifact handling so secret-bearing paths are excluded by default. Harden pipeline configuration to use explicit include and exclude rules for sensitive locations. Prevent secret-bearing path matches from being written into logs or other audit outputs.
OWASP Non-Human Identity Top 10 NHI-01 — Secrets and Credential Management The term directly concerns accidental exposure of secret-bearing files in automation.
NHI-05 — Secret Sprawl and Overexposure Broad globs can surface secrets stored outside proper secret managers.
Recommendation — Treat secret-bearing files as excluded inputs and keep them out of pipeline outputs. Reduce secret sprawl by narrowing file discovery and blocking sensitive path matches.
NIST CSF 2.0 PR.AC-4 — Access Permissions and Authorizations Pipeline file access should be limited so automation cannot freely expose sensitive locations.
Recommendation — Limit pipeline access to only the files it actually needs to process.

Practitioner Guidance

What to watch for: inspect any pipeline step that enumerates files, archives workspace contents, or echoes matched paths. If the step does not distinguish between benign source files and secret-bearing locations, the pattern is too permissive.

Governance implication: file-selection rules should be owned as part of build security, not left as ad hoc developer convenience. Teams should document excluded secret paths and review changes to glob rules the same way they review other delivery-path security controls.