To give a vulnerability scanner credentials without storing them in the scanning tool, put a reference to the secret in the scan configuration and let a component inside your own network read it only when the scan starts. In the Safeguard CLI and runner (v11.19.9 and later), a value such as env://SCAN_WEB_PASSWORD or vault://secret/data/scan/web#password is fetched at scan time on your machine, used for that scan, and discarded when it ends. The secret is never stored in Safeguard's cloud.
Secret references remove the extra copy of a production password that authenticated scanning used to need. Everything below was checked against the CLI source and help text at v11.19.21 (21 November 2026).
Key takeaways
- A scan target or runner job holds only a reference such as
env://NAME,file:///pathorvault://mount/path#key. The secret stays in your vault. - The CLI or runner resolves it at scan time, inside your network, using
~/.safeguard/secret-providers.yaml. - Values print as
[redacted], live in memory for one scan and are overwritten when it ends. - Since v11.19.15, remote plain
http://providers are refused and Vault leases are revoked at scan end.
Where can a scan use a secret reference instead of a password?
A value counts as a reference only when the whole value matches a scheme such as env://, file://, vault:// or pam://. References are accepted for:
- DAST logins and sessions: username, password, bearer token, session cookie and headers.
- API security scans: tokens, keys, secrets and auth headers.
- Source and registry access:
--git-token,--git-password,--registry-passwordand related flags onsafeguard scan, and the matching runner job options. - Host scans (v11.19.10 and later):
safeguard hostscan --credentialtakes a reference to the SSH or WinRM password or key.
Login setup: see DAST authentication setup and authenticated DAST without wrecking the app.
Which reference types exist, and when is each secret discarded?
| Reference | Where the secret is fetched | When | Discarded |
|---|---|---|---|
env://NAME | Environment variable of the CLI or runner process | Scan start | Overwritten in memory at scan end |
file:///abs/path | Local file on the same machine | Scan start | Read buffer overwritten at once; value at scan end |
vault://mount/path#key | Your HashiCorp Vault (KV v1 or v2; token, AppRole or Kubernetes auth) | Scan start, and again if the target rejects the login | Overwritten at scan end; dynamic secret leases revoked |
pam://provider/... | The secrets tool named in your provider file | Scan start | Overwritten at scan end |
Run safeguard secrets --help to see every pam:// format your version supports.
What happens to the secret during a runner scan?
- The platform sends a DAST, API or host scan to your runner (DAST and API since v11.19.9). The job carries only the reference.
- The runner reads its provider file and fetches the secret over TLS, with certificate verification on.
- The value prints as
[redacted]in every format, and values of six characters or more are scrubbed from logs, errors, results and uploads. - At scan end the runner overwrites the bytes it holds and revokes any HashiCorp Vault dynamic secret leases it read.
Safeguard receives only an audit record (reference, provider, result), also kept locally in vault-audit.jsonl. Two limits from the source: values under six characters are not scrubbed, and Go strings made from a value are left to the garbage collector rather than overwritten.
For the wider case for scanning on your own hardware, read local runner sovereignty.
How do I connect the runner to HashiCorp Vault?
Create the provider file with mode 600. The CLI refuses it if group or others can read it, if a secret setting such as secret_id is written inline rather than as an env:// or file:// reference, or if it holds an unknown key. This example is from the CLI's own help:
providers:
- type: hashicorp-vault
url: https://vault.example.internal:8200
auth: approle
role_id: env://VAULT_ROLE_ID
secret_id: file:///etc/safeguard/vault-secret-id
Then run /vault providers in the Safeguard terminal (or the CLI's vault providers subcommand). It shows each provider's status without reading any secret.
A plain http:// URL is refused unless the host is loopback (a local Vault Agent) or you set allow_http: true for a test setup. allowed_refs limits which references a runner may read; anything else fails with NOT_ALLOWED before a request leaves the machine. More Vault patterns: HashiCorp Vault supply chain integration patterns.
How do I test a secret reference without printing it?
export SCAN_WEB_PASSWORD='...'
safeguard secrets test env://SCAN_WEB_PASSWORD
OK env://SCAN_WEB_PASSWORD
provider: an environment variable
value: medium (8-23 characters), not shown
--json prints one object with ok, reference, provider, and on failure code and message. Exit status is 0 or 1. A failed read never falls back to sending the string as a password: the scan does not start.
Does this replace the vault I already run?
No. Your own vault or secrets tool keeps owning storage and access policy. Safeguard reads the secret at scan time, uses it for that scan, and lets it go.
Common mistakes
- Writing
tokenorsecret_idinline in the provider file. Useenv://orfile://. - Leaving the provider file readable by others. Set mode 600.
- Testing on a laptop instead of the runner host.
Credentials only get a scan in. The vulnerabilities it reports, in your code and its open source, still need fixing.
Fix it without waiting for upstream
Whatever the vulnerability, most of the risk sits in two gaps. The first is the time between a fix being published and that fix actually running in your production builds. The second, and worse, is the time before any fix exists at all, while a maintainer works out a patch and a release schedule. Waiting through both gaps is a habit, not a requirement. Safeguard gives teams three ways to close them.
1. Autonomous remediation: pull requests, not tickets
When a fixed version exists, Griffin, Safeguard's security model, opens a policy gated pull request that moves the affected dependency to the safe version, and your own CI runs your tests on it before anyone merges. You can run it on one repository or in bulk across every project that carries the vulnerable version. Remediation categories include dependencies, licenses, security posture and findings, and each one is set separately. Reachability analysis ranks the vulnerable code paths your application actually calls first, so the first pull requests you merge are the ones that matter most. Auto-merge is a separate switch and stays off by default, so your team decides what merges on its own and what still needs a human approval.
2. Gold Open Source: the safe version in seconds, free
gold.safeguard.sh is free and needs no login. Search any CVE or package to see affected and fixed versions, CVSS, EPSS, CISA KEV status and a recommended safe version, or use the "Am I affected?" checker. The same data is available through a free read API, README status badges and RSS threat feeds.
3. Gold Registry: start from components that are already fixed
Safeguard Gold rebuilds patched versions of open-source packages and images from source, signs each build, attaches an SBOM, SLSA provenance and VEX, and serves them from registry.safeguard.sh to your organization. Every Gold artifact is held continuously to zero exploitable critical or high CVEs and a completed license check, with signed build provenance (signed with Safeguard's key and verifiable with cosign, SLSA Build Level 3 as the design target) and a public evidence page you can hand to an auditor. An artifact loses its Gold badge if it regresses. Teams can point their own package directory at the registry so hardened equivalents resolve without changing how developers install anything.
When upstream has no fix yet, or will not ship one, Safeguard first works to get the fix accepted upstream. If the issue is severe or upstream will not move, Safeguard builds a fork, fixes the vulnerability there and publishes a hardened Gold build, so you are not stuck on a maintainer's release schedule. You can also request a hardened build of a specific package. Ask which packages it covers before you plan around it.
| Your situation | What to use |
|---|---|
| A fixed version exists | Autonomous remediation opens the upgrade pull request; Gold Open Source confirms the safe version |
| You need to know today whether you are affected | Gold Open Source lookup and "Am I affected?" checker, free and without login |
| You want vulnerable versions to stop shipping | Safeguard policies and gates in CI |
| Upstream has no fix yet, or will not ship one | A custom Gold request; fork and patch |
| You want to start clean on new projects | Pull hardened components and images from Gold Registry |
One honest limit: when the vulnerable code lives in a vendor appliance, a hosted service or an operating system runtime you do not build yourself, the fix still has to come from that vendor or distribution. The steps above apply to the open source dependencies and container images you build and ship, which is where most teams carry the largest and least tracked share of their exposure.
See how Safeguard would help
This demo sets up the runner on your own machine, approves it with its device code and scans from the terminal. That runner is what resolves secret references for runner-hosted scans.
Click through it at your own pace, or open it full screen.
This real CLI session installs, opens the terminal that holds /vault, fixes a dependency step by step and scans.
Click through it at your own pace, or open it full screen. Get the CLI at safeguard.sh/download, and see the local runner release.
FAQ
Where are scan credentials stored with a secret reference?
In your own vault, environment or file. The scan holds only the reference.
Which CLI version supports secret references?
v11.19.9 (20 November 2026) added safeguard secrets test, the vault commands and /vault. Host scans followed in v11.19.10.
Can I use HashiCorp Vault dynamic secrets?
Yes. Leases read during a scan are revoked at the end by default (revoke_leases).
Can I limit which secrets a runner may read?
Yes, with allowed_refs on the provider.
What if the vault is down when a scan starts?
The scan does not start. Transient errors are retried twice first.
Does Safeguard log which secrets were read?
It logs the reference, provider and result, never the value.
Will a plain password still work?
Yes. Only a value that is wholly a reference is treated as one.
Quick check
A runner reads a vault:// reference for a DAST login. Where does the password travel?
From your Vault to the runner, then to the target at login. Safeguard gets only an audit record.
How do you confirm a reference works without exposing it?
Run safeguard secrets test on the runner host.
Sources
- HashiCorp Vault: AppRole auth method
- HashiCorp Vault: KV secrets engine, version 2
- HashiCorp Vault: leases and revocation
- HashiCorp Vault Agent
- OWASP Secrets Management Cheat Sheet
- Safeguard CLI v11.19.21 help text, README and CHANGELOG
Last reviewed: 22 November 2026.