Skip to content

Find the holes before someone else does. A fast, 100% Rust vulnerability scanner: XSS, SQL injection, leaked secrets, dependency CVEs and AI agent setups.

feat(secrets): check .env examples, public env prefixes and .gitignore; mask the whole AWS key

Kam823578360d5d
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 26c93f5..1cff384 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,9 +5,10 @@
## 0.1.0 (2026-11-22)
- First release. One command scans a repository: `safe-anything .`
-- 69 rules in six families: code (SQL and command injection, XSS, eval, SSRF, path traversal,
+- 72 rules in six families: code (SQL and command injection, XSS, eval, SSRF, path traversal,
unsafe deserialization, weak crypto, TLS checks off, JWT `none`, template injection, debug
- mode), secrets (provider keys, private keys, passwords, credentials in URLs, `.env` files),
+ mode), secrets (provider keys, private keys, passwords, credentials in URLs, `.env` files and examples, a `.gitignore` missing `.env`, secrets behind public
+ env prefixes like `NEXT_PUBLIC_`),
agent setups (skipped permissions, pre-approved shell, unpinned MCP servers, plaintext MCP
tokens, remote MCP over HTTP, `curl | sh` in hooks and skills, prompt-injection text, credential
file access, invisible Unicode), mobile (Android manifest, WebView, iOS ATS, tokens in plain
diff --git a/README.md b/README.md
index 9ff00ef..228bb3c 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,5 @@
<p align="center">
- <img src="docs/assets/logo.png" width="150" height="150" alt="The safe-anything shield">
+ <img src="docs/assets/logo.png" width="150" height="150" alt="The safe-anything tortoise">
</p>
<h1 align="center">safe-anything</h1>
@@ -19,7 +19,7 @@ and the AI agent setup that writes it all. Every finding comes with the line, th
<a href="https://github.com/erkamyaman/safe-anything"><img src="https://img.shields.io/github/stars/erkamyaman/safe-anything?style=social" alt="GitHub stars"></a>
</p>
-<p align="center"><b><a href="#quick-start">Install</a></b> · <a href="https://github.com/erkamyaman/safe-anything/releases">Releases</a> · <a href="#for-ai-agents">Claude Code plugin</a> · <a href="#in-ci">GitHub Action</a> · <a href="docs/rules.md">All 69 rules</a> · <a href="docs/agent-setups.md">Agent setups</a><br>
+<p align="center"><b><a href="#quick-start">Install</a></b> · <a href="https://github.com/erkamyaman/safe-anything/releases">Releases</a> · <a href="#for-ai-agents">Claude Code plugin</a> · <a href="#in-ci">GitHub Action</a> · <a href="docs/rules.md">All 72 rules</a> · <a href="docs/agent-setups.md">Agent setups</a><br>
Made in Türkiye 🇹🇷 by <a href="https://github.com/erkamyaman">erKam Yaman</a>, who also made <a href="https://github.com/erkamyaman/rust-anything">rust-anything</a> · <a href="https://github.com/sponsors/erkamyaman">❤️ Sponsor me</a> · Sponsored by <a href="https://coderabbit.link/erkamyaman">CodeRabbit</a></p>
<p align="center">
@@ -36,7 +36,7 @@ Made in Türkiye 🇹🇷 by <a href="https://github.com/erkamyaman">erKam Yaman
</td>
<td width="25%" valign="top">
<b>Your secrets</b><br>
- Cloud and AI keys, tokens, private keys, passwords and <code>.env</code> files in the repo. Always redacted in the output.
+ Cloud and AI keys, tokens, private keys, passwords, and <code>.env</code> mistakes: committed env files, real values in <code>.env.example</code>, secrets behind <code>NEXT_PUBLIC_</code> or <code>VITE_</code>. Always redacted in the output.
</td>
<td width="25%" valign="top">
<b>Your stack</b><br>
@@ -83,7 +83,7 @@ The full list is in [docs/rules.md](docs/rules.md).
| | |
| --- | --- |
| **Code** | SQL injection, command injection, XSS (`innerHTML`, `dangerouslySetInnerHTML`, `v-html`, `echo $_GET`, `raw`), `eval` and `new Function`, path traversal, SSRF, unsafe deserialization (pickle, `yaml.load`, `ObjectInputStream`, `BinaryFormatter`, `unserialize`, `Marshal`), TLS checks turned off, MD5/SHA-1, DES/RC4/ECB, JWT `none`, template injection, debug mode, insecure cookies, `Math.random` tokens. JS/TS, Python, Go, Java, Kotlin, PHP, Ruby, C#, SQL |
-| **Secrets** | AWS, GitHub, Slack, Stripe, OpenAI, Anthropic and Google keys, private keys, passwords in code, credentials in connection strings, committed `.env` files |
+| **Secrets** | AWS, GitHub, Slack, Stripe, OpenAI, Anthropic and Google keys, private keys, passwords in code, credentials in connection strings, committed `.env` files, real values in `.env.example`, a `.gitignore` that misses `.env`, secrets behind public prefixes (`NEXT_PUBLIC_`, `VITE_`, `EXPO_PUBLIC_`) that ship in the client bundle |
| **Agent setups** | `bypassPermissions` and `--dangerously-skip-permissions`, pre-approved `Bash`, MCP servers run with unpinned `npx`/`uvx`/`docker`, MCP tokens in plain text, remote MCP over `http://`, `curl \| sh` in hooks and skills, prompt-injection text, skills that read `~/.ssh` or cloud credentials, invisible Unicode in instructions. [More](docs/agent-setups.md) |
| **Mobile** | Android `debuggable`, cleartext traffic, exported content providers, WebView file access and JS bridges, world-readable files; iOS ATS turned off; tokens in UserDefaults, SharedPreferences, AsyncStorage or localStorage |
| **Config** | Docker (unpinned base, root, secrets in `ENV`, `ADD <url>`), GitHub Actions (`pull_request_target`, `write-all`, actions on `@main`, script injection from PR titles), privileged containers, `hostNetwork`, open Terraform ingress, public buckets, nginx autoindex, TLS 1.0/1.1 |
@@ -154,7 +154,7 @@ formats. Nothing is executed. The only network call is the dependency check, whi
names and versions to OSV.dev ([privacy](docs/privacy.md)).
It finds known patterns; it does not trace data through your program. A clean scan means none of
-these 69 problems were found, not that the code is safe. [Design notes](docs/adr).
+these 72 problems were found, not that the code is safe. [Design notes](docs/adr).
## Credits
diff --git a/docs/STATUS.md b/docs/STATUS.md
index 71f36df..db96f01 100644
--- a/docs/STATUS.md
+++ b/docs/STATUS.md
@@ -10,7 +10,7 @@ by this repository's tests (a fixture per family with safe look-alikes that must
| Family | Status | Last real run | Result |
| --- | --- | --- | --- |
| Code | Verified | OWASP Juice Shop, DVWA, express, flask (2026-11-22) | finds the known SQL injections, command injections and `eval` in Juice Shop and DVWA; 0 findings in express; the noisiest rule is `code.xss-inner-html` |
-| Secrets | Verified | Juice Shop seeded users, rust-anything (2026-11-22) | seeded passwords found; placeholders (`xoxp-...`, `****`, `${VAR}`) ignored |
+| Secrets | Verified | Juice Shop seeded users, rust-anything, the 73 Next.js examples that ship env files, each scanned as its own project (2026-11-22) | seeded passwords found; placeholders (`xoxp-...`, `****`, `${VAR}`, `your-key-here`) ignored; in the Next.js examples the env checks flag one project, a password behind `NEXT_PUBLIC_` that ships to the browser, and nothing else |
| Agent setups | Verified | anthropics/skills, vercel-labs/agent-skills, a real `~/.claude` (2026-11-22) | no false prompt-injection hits left on skills that warn against injection; MCP-config checks tested on fixtures only |
| Mobile | Tested | none | Android manifest, network security config, WebView, iOS plist, storage on fixtures |
| Config | Verified | Juice Shop Terraform and workflows, modelcontextprotocol/servers (2026-11-22) | open ingress, `pull_request_target`, unpinned actions found; build-stage `FROM` and action inputs no longer flagged |
diff --git a/docs/rules.md b/docs/rules.md
index fa4a400..8e7fe23 100644
--- a/docs/rules.md
+++ b/docs/rules.md
@@ -21,7 +21,7 @@ Every rule safe-anything checks, generated from `safe-anything --list-rules --js
| [`code.weak-hash`](https://cheatsheetseries.owasp.org/cheatsheets/Password_Storage_Cheat_Sheet.html) | low | [CWE-328](https://cwe.mitre.org/data/definitions/328.html) | A02:2021 Cryptographic Failures | MD5 and SHA-1 are broken for security use (collisions; too fast for passwords). |
| [`code.weak-cipher`](https://cheatsheetseries.owasp.org/cheatsheets/Cryptographic_Storage_Cheat_Sheet.html) | medium | [CWE-327](https://cwe.mitre.org/data/definitions/327.html) | A02:2021 Cryptographic Failures | A weak cipher or ECB mode is used; ECB leaks patterns and DES/RC4 are broken. |
| [`code.insecure-cookie`](https://cheatsheetseries.owasp.org/cheatsheets/Session_Management_Cheat_Sheet.html) | low | [CWE-614](https://cwe.mitre.org/data/definitions/614.html) | A05:2021 Security Misconfiguration | A cookie is set without HttpOnly or Secure, so scripts or plain HTTP can read it. |
-| [`code.jwt-none`](https://cheatsheetseries.owasp.org/cheatsheets/JSON_Web_Token_for_Java_Cheat_Sheet.html) | high | [CWE-347](https://cwe.mitre.org/data/definitions/347.html) | A07:2021 Identification and Authentication Failures | JWT signatures are not checked, so anyone can forge a token. |
+| [`code.jwt-none`](https://cheatsheetseries.owasp.org/cheatsheets/JSON_Web_Token_Cheat_Sheet.html) | high | [CWE-347](https://cwe.mitre.org/data/definitions/347.html) | A07:2021 Identification and Authentication Failures | JWT signatures are not checked, so anyone can forge a token. |
| [`code.cors-wildcard`](https://cheatsheetseries.owasp.org/cheatsheets/HTML5_Security_Cheat_Sheet.html) | low | [CWE-942](https://cwe.mitre.org/data/definitions/942.html) | A05:2021 Security Misconfiguration | CORS allows every origin. Fine for public data; risky for anything behind a login. |
| [`code.insecure-random`](https://cheatsheetseries.owasp.org/cheatsheets/Cryptographic_Storage_Cheat_Sheet.html) | medium | [CWE-338](https://cwe.mitre.org/data/definitions/338.html) | A02:2021 Cryptographic Failures | A secret value is made with a non-cryptographic random generator, which can be predicted. |
| [`code.debug-enabled`](https://cheatsheetseries.owasp.org/cheatsheets/Error_Handling_Cheat_Sheet.html) | medium | [CWE-489](https://cwe.mitre.org/data/definitions/489.html) | A05:2021 Security Misconfiguration | The app runs in debug mode; the debugger can run code and leaks internals. |
@@ -31,7 +31,7 @@ Every rule safe-anything checks, generated from `safe-anything --list-rules --js
| [`code.sql-grant-all`](https://cheatsheetseries.owasp.org/cheatsheets/Database_Security_Cheat_Sheet.html) | medium | [CWE-250](https://cwe.mitre.org/data/definitions/250.html) | A01:2021 Broken Access Control | A database user gets every privilege on every database. |
| [`code.sql-plaintext-password`](https://cheatsheetseries.owasp.org/cheatsheets/Database_Security_Cheat_Sheet.html) | medium | [CWE-798](https://cwe.mitre.org/data/definitions/798.html) | A07:2021 Identification and Authentication Failures | A database password is written in a SQL file. |
-## Secrets (11)
+## Secrets (14)
| Rule | Severity | CWE | OWASP | What it means |
| --- | --- | --- | --- | --- |
@@ -46,6 +46,9 @@ Every rule safe-anything checks, generated from `safe-anything --list-rules --js
| [`secret.hardcoded-password`](https://cheatsheetseries.owasp.org/cheatsheets/Secrets_Management_Cheat_Sheet.html) | high | [CWE-798](https://cwe.mitre.org/data/definitions/798.html) | A07:2021 Identification and Authentication Failures | A password or secret is written in the code. |
| [`secret.url-credentials`](https://cheatsheetseries.owasp.org/cheatsheets/Secrets_Management_Cheat_Sheet.html) | high | [CWE-798](https://cwe.mitre.org/data/definitions/798.html) | A07:2021 Identification and Authentication Failures | A connection string carries a username and password. |
| [`secret.env-file`](https://cheatsheetseries.owasp.org/cheatsheets/Secrets_Management_Cheat_Sheet.html) | medium | [CWE-798](https://cwe.mitre.org/data/definitions/798.html) | A07:2021 Identification and Authentication Failures | A .env file with values is in the repository; these usually hold real secrets. |
+| [`secret.env-example-value`](https://cheatsheetseries.owasp.org/cheatsheets/Secrets_Management_Cheat_Sheet.html) | high | [CWE-798](https://cwe.mitre.org/data/definitions/798.html) | A07:2021 Identification and Authentication Failures | An example env file holds what looks like a real secret value; example files are meant to be committed and shared. |
+| [`secret.public-env-secret`](https://cheatsheetseries.owasp.org/cheatsheets/Secrets_Management_Cheat_Sheet.html) | high | [CWE-200](https://cwe.mitre.org/data/definitions/200.html) | A05:2021 Security Misconfiguration | A secret is given a public env prefix, so the build ships it inside the client bundle where anyone can read it. |
+| [`secret.env-not-ignored`](https://cheatsheetseries.owasp.org/cheatsheets/Secrets_Management_Cheat_Sheet.html) | medium | [CWE-538](https://cwe.mitre.org/data/definitions/538.html) | A05:2021 Security Misconfiguration | The project has env files but .gitignore does not exclude .env, so real secrets are one git add away from the repository. |
## Agent setups (9)
diff --git a/src/engine.rs b/src/engine.rs
index af333fc..3071fb5 100644
--- a/src/engine.rs
+++ b/src/engine.rs
@@ -27,6 +27,7 @@ pub struct Scanned {
pub files: usize,
pub findings: Vec<Finding>,
pub packages: Vec<Package>,
+ pub env_files: Vec<String>,
}
pub fn scan_files(root: &Path, include_tests: bool) -> Scanned {
@@ -34,6 +35,7 @@ pub fn scan_files(root: &Path, include_tests: bool) -> Scanned {
files: 0,
findings: Vec::new(),
packages: Vec::new(),
+ env_files: Vec::new(),
});
let single_file = root.is_file();
let base = if single_file {
@@ -100,6 +102,9 @@ pub fn scan_files(root: &Path, include_tests: bool) -> Scanned {
out.files += 1;
out.findings.extend(findings);
out.packages.extend(packages);
+ if rules::secrets::is_env(&info.name) && !info.is_test() {
+ out.env_files.push(rel.clone());
+ }
WalkState::Continue
})
});
diff --git a/src/lib.rs b/src/lib.rs
index 6a680e6..e8192fb 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -50,6 +50,10 @@ pub fn rules() -> Vec<RuleInfo> {
RuleInfo::new(id, Family::Agent, severity, message)
}),
)
+ .chain(std::iter::once({
+ let (id, severity, message) = rules::secrets::ENV_NOT_IGNORED;
+ RuleInfo::new(id, Family::Secret, severity, message)
+ }))
.chain(std::iter::once(RuleInfo::new(
"dependency.known-vulnerability",
Family::Dependency,
@@ -204,7 +208,12 @@ pub fn scan(root: &Path, options: &Options) -> std::io::Result<Report> {
));
}
let started = std::time::Instant::now();
- let scanned = engine::scan_files(root, options.include_tests);
+ let mut scanned = engine::scan_files(root, options.include_tests);
+ if root.is_dir() {
+ scanned
+ .findings
+ .extend(rules::secrets::env_not_ignored(root, &scanned.env_files));
+ }
let mut report = Report {
files_scanned: scanned.files,
packages_checked: scanned.packages.len(),
diff --git a/src/refs.rs b/src/refs.rs
index 2d8dc5e..e3eb161 100644
--- a/src/refs.rs
+++ b/src/refs.rs
@@ -131,6 +131,16 @@ pub fn of(id: &str) -> Refs {
"Secrets_Management_Cheat_Sheet"
)
}
+ "secret.public-env-secret" => r!(
+ "CWE-200",
+ "A05:2021 Security Misconfiguration",
+ "Secrets_Management_Cheat_Sheet"
+ ),
+ "secret.env-not-ignored" => r!(
+ "CWE-538",
+ "A05:2021 Security Misconfiguration",
+ "Secrets_Management_Cheat_Sheet"
+ ),
"secret.private-key" => r!(
"CWE-321",
"A02:2021 Cryptographic Failures",
diff --git a/src/rules.rs b/src/rules.rs
index 2118721..e2a958d 100644
--- a/src/rules.rs
+++ b/src/rules.rs
@@ -8,7 +8,7 @@ pub mod agent;
mod code;
mod config;
mod mobile;
-mod secrets;
+pub mod secrets;
pub struct FileInfo {
pub rel: String,
@@ -186,7 +186,9 @@ pub fn check(file: &FileInfo, src: &str, include_tests: bool) -> Vec<Finding> {
}
for caps in c.re.captures_iter(src) {
let m = caps.get(0).expect("whole match");
- let secret = (c.rule.family == Family::Secret).then(|| {
+ let secret = (c.rule.family == Family::Secret
+ && !secrets::NAME_ONLY.contains(&c.rule.id))
+ .then(|| {
caps.iter()
.skip(1)
.flatten()
@@ -206,10 +208,10 @@ pub fn check(file: &FileInfo, src: &str, include_tests: bool) -> Vec<Finding> {
{
continue;
}
- if let Some(unless) = &c.unless {
- if unless.is_match(text.line(line)) {
- continue;
- }
+ if let Some(unless) = &c.unless
+ && unless.is_match(text.line(line))
+ {
+ continue;
}
if seen.insert((c.rule.id.to_string(), line)) {
out.push(finding(
diff --git a/src/rules/secrets.rs b/src/rules/secrets.rs
index 1c5a979..db8cd60 100644
--- a/src/rules/secrets.rs
+++ b/src/rules/secrets.rs
@@ -1,17 +1,74 @@
-use super::{FileInfo, Rule};
-use crate::{Family, Severity};
+use std::path::Path;
+
+use super::{FileInfo, Meta, Rule, Text, finding};
+use crate::{Family, Finding, Severity};
+
+pub const NAME_ONLY: &[&str] = &["secret.public-env-secret"];
+
+pub const ENV_NOT_IGNORED: (&str, Severity, &str) = (
+ "secret.env-not-ignored",
+ Severity::Medium,
+ "The project has env files but .gitignore does not exclude .env, so real secrets are one git add away from the repository.",
+);
+
+pub fn is_env(name: &str) -> bool {
+ name == ".env" || name.starts_with(".env.")
+}
+
+pub fn env_not_ignored(root: &Path, env_files: &[String]) -> Option<Finding> {
+ if env_files.is_empty() {
+ return None;
+ }
+ let src = std::fs::read_to_string(root.join(".gitignore")).ok()?;
+ let covered = src.lines().map(str::trim).any(|l| {
+ let l = l.trim_start_matches("**/").trim_start_matches('/');
+ l.starts_with(".env") || l.starts_with("*.env")
+ });
+ if covered {
+ return None;
+ }
+ let text = Text::new(&src);
+ if text.suppressed(1) {
+ return None;
+ }
+ let (id, severity, message) = ENV_NOT_IGNORED;
+ Some(finding(
+ &FileInfo::new(".gitignore"),
+ &text,
+ 1,
+ Meta {
+ id,
+ family: Family::Secret,
+ severity,
+ message,
+ fix: "Add .env and .env.* to .gitignore, with !.env.example so the example file stays tracked.",
+ secret: None,
+ },
+ ))
+}
fn any_text(_: &FileInfo) -> bool {
true
}
fn env_file(f: &FileInfo) -> bool {
- (f.name == ".env" || f.name.starts_with(".env."))
+ is_env(&f.name)
&& !["example", "sample", "template", "dist", "defaults"]
.iter()
.any(|s| f.name.ends_with(s))
}
+fn env_example(f: &FileInfo) -> bool {
+ is_env(&f.name)
+ && ["example", "sample", "template", "dist", "defaults"]
+ .iter()
+ .any(|s| f.name.ends_with(s))
+}
+
+const ENV_SECRET_LINE: &str = r#"(?m)^\s*(?:export\s+)?[A-Za-z0-9_]*(?i:secret|token|password|passwd|api_?key|private_?key|access_?key|auth|credential)[A-Za-z0-9_]*\s*=\s*["']?([A-Za-z0-9+/_.\-]{16,})["']?\s*$"#;
+
+const ENV_PLACEHOLDER: &str = r"^\s*(?:export\s+)?(?:NEXT_PUBLIC|VITE|REACT_APP|EXPO_PUBLIC|NUXT_PUBLIC|GATSBY|VUE_APP|PUBLIC)_|(?i)=\s*[\x22']?(?:\S*(?:your|example|change|replace|placeholder|dummy|xxxx|\.\.\.|<)|sk_test_|pk_test_|(?-i:[a-z]+[-_][a-z]+[-_][a-z]+))";
+
const ROTATE: &str = "Revoke this credential at the provider, then load it from the environment or a secrets manager and keep it out of the repository.";
macro_rules! secret {
@@ -33,7 +90,7 @@ pub static RULES: &[Rule] = &[
secret!(
"secret.aws-access-key",
Critical,
- r"\b(AKIA|ASIA)[0-9A-Z]{16}\b",
+ r"\b(?:AKIA|ASIA)[0-9A-Z]{16}\b",
"An AWS access key id is written in the file."
),
secret!(
@@ -75,7 +132,7 @@ pub static RULES: &[Rule] = &[
secret!(
"secret.private-key",
Critical,
- r"-----BEGIN ((RSA|EC|DSA|OPENSSH|PGP|ENCRYPTED) )?PRIVATE KEY( BLOCK)?-----\r?\n[A-Za-z0-9+/=]{20,}",
+ r"-----BEGIN (?:(?:RSA|EC|DSA|OPENSSH|PGP|ENCRYPTED) )?PRIVATE KEY(?: BLOCK)?-----\r?\n([A-Za-z0-9+/=]{20,})",
"A private key is stored in the repository."
),
Rule {
@@ -105,11 +162,31 @@ pub static RULES: &[Rule] = &[
Rule {
id: "secret.env-file",
family: Family::Secret,
- severity: Severity::Medium,
+ severity: Severity::High,
files: env_file,
- pattern: r"\A(?:.*\n)*?[A-Za-z_][A-Za-z0-9_]*=\S",
+ pattern: ENV_SECRET_LINE,
+ unless: Some(ENV_PLACEHOLDER),
+ message: "A .env file in the repository holds a secret value.",
+ fix: "Revoke the value, remove the file from git (keep a .env.example without values) and add .env to .gitignore.",
+ },
+ Rule {
+ id: "secret.env-example-value",
+ family: Family::Secret,
+ severity: Severity::High,
+ files: env_example,
+ pattern: ENV_SECRET_LINE,
+ unless: Some(ENV_PLACEHOLDER),
+ message: "An example env file holds what looks like a real secret value; example files are meant to be committed and shared.",
+ fix: "Revoke the value, replace it with an empty value or a placeholder like your-key-here, and keep real values only in the ignored .env.",
+ },
+ Rule {
+ id: "secret.public-env-secret",
+ family: Family::Secret,
+ severity: Severity::High,
+ files: any_text,
+ pattern: r"\b(?:NEXT_PUBLIC|VITE|REACT_APP|EXPO_PUBLIC|NUXT_PUBLIC|GATSBY|VUE_APP|PUBLIC)_[A-Z0-9_]*(?:SECRET|PRIVATE|PASSWORD|SERVICE_ROLE|OPENAI|ANTHROPIC)[A-Z0-9_]*\b",
unless: None,
- message: "A .env file with values is in the repository; these usually hold real secrets.",
- fix: "Remove the file from git (keep a .env.example without values) and add .env to .gitignore.",
+ message: "A secret is given a public env prefix, so the build ships it inside the client bundle where anyone can read it.",
+ fix: "Drop the public prefix and use the value only in server code (an API route or server action); the browser should call your server instead.",
},
];
diff --git a/tests/fixtures/config/.env.example b/tests/fixtures/config/.env.example
new file mode 100644
index 0000000..8de43cc
--- /dev/null
+++ b/tests/fixtures/config/.env.example
@@ -0,0 +1,2 @@
+PORT=3000
+API_KEY=
diff --git a/tests/fixtures/config/.gitignore b/tests/fixtures/config/.gitignore
new file mode 100644
index 0000000..36b2960
--- /dev/null
+++ b/tests/fixtures/config/.gitignore
@@ -0,0 +1,2 @@
+.env*
+!.env.example
diff --git a/tests/fixtures/secrets/.env b/tests/fixtures/secrets/.env
index 0bc3be3..ce06538 100644
--- a/tests/fixtures/secrets/.env
+++ b/tests/fixtures/secrets/.env
@@ -1 +1,5 @@
DATABASE_URL=postgres://localhost/app
+SESSION_SECRET={{fake:random}}
+NEXT_PUBLIC_API_URL=https://api.acme.io
+API_TOKEN=your-token-here
+NEXT_PUBLIC_SEARCH_API_KEY=a63d9f0c2b7e4d18a5f3
diff --git a/tests/fixtures/secrets/.env.example b/tests/fixtures/secrets/.env.example
index ce81892..0121fcd 100644
--- a/tests/fixtures/secrets/.env.example
+++ b/tests/fixtures/secrets/.env.example
@@ -1 +1,9 @@
DATABASE_URL=
+JWT_SECRET={{fake:random}}
+API_KEY=your-api-key-here
+SESSION_SECRET=changeme
+NEXT_PUBLIC_OPENAI_API_KEY=
+PORT=3000
+STRIPE_SECRET_KEY=sk_test_xxxxxxxxxxxxxxxxxxxxxxxx
+TOKEN_SECRET="this-is-a-secret-value-with-at-least-32-characters"
+MQTT_PASSWORD="a_secure_password"
diff --git a/tests/fixtures/secrets/.gitignore b/tests/fixtures/secrets/.gitignore
new file mode 100644
index 0000000..552f221
--- /dev/null
+++ b/tests/fixtures/secrets/.gitignore
@@ -0,0 +1,2 @@
+node_modules/
+*.log
diff --git a/tests/fixtures/secrets/EXPECTED b/tests/fixtures/secrets/EXPECTED
index e634af7..a5a8735 100644
--- a/tests/fixtures/secrets/EXPECTED
+++ b/tests/fixtures/secrets/EXPECTED
@@ -1,4 +1,4 @@
-.env:1 secret.env-file
+.env:2 secret.env-file
app/db.js:1 secret.url-credentials
config.py:1 secret.aws-access-key
config.py:10 secret.google-api-key
@@ -10,3 +10,8 @@ config.py:6 secret.stripe-live-key
config.py:8 secret.anthropic-key
config.py:9 secret.openai-key
keys/deploy.pem:1 secret.private-key
+.env.example:2 secret.env-example-value
+.env.example:5 secret.public-env-secret
+.gitignore:1 secret.env-not-ignored
+app/client.ts:1 secret.public-env-secret
+app/client.ts:2 secret.public-env-secret
diff --git a/tests/fixtures/secrets/app/client.ts b/tests/fixtures/secrets/app/client.ts
new file mode 100644
index 0000000..be75b38
--- /dev/null
+++ b/tests/fixtures/secrets/app/client.ts
@@ -0,0 +1,5 @@
+const stripe = process.env.NEXT_PUBLIC_STRIPE_SECRET_KEY;
+const admin = import.meta.env.VITE_SUPABASE_SERVICE_ROLE_KEY;
+const anon = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY;
+const pk = process.env.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY;
+const maps = process.env.EXPO_PUBLIC_GOOGLE_MAPS_KEY;