Skip to content

[WISE] No secrets in files: gitignore, CI check, AGENTS.md rule - #561

Merged
jaywedgeworth22 merged 14 commits into
mainfrom
wise/no-env-files
Nov 28, 2026
Merged

jaywedgeworth22 merged 14 commits into
mainfrom
wise/no-env-files

Conversation

@jaywedgeworth22

@jaywedgeworth22 jaywedgeworth22 commented Nov 28, 2026 •

Copy link
Copy Markdown
Member

Summary

Establishes a no-secrets-in-files policy where all secrets live only in Infisical. Adds .gitignore entries, an AGENTS.md contributor rule, and a No env files CI check to block tracked .env / .vars files.

Changes

  • .gitignore: ignores .env, .env.*, *.env, .dev.vars, .dev.vars.*, .prod.vars, .prod.vars.*, and *.vars, while allowing *.example, *.sample, and *.template placeholders.
  • AGENTS.md: documents that secrets must never be placed in .env, .vars, .dev.vars, .prod.vars, or similar files, and directs readers to use the documented Infisical reader at runtime. Defines remediation as immediate deletion and rotation if a secret file is committed.
  • .github/workflows/no-env-files.yml: adds CI on pull requests and main pushes that fails if tracked env or vars files are found, excluding *.example, *.sample, *.template, and *.dist suffixes.

Operational impact

Prevents committing secret-bearing env files and fails PRs that track them. Unverified whether the ignore patterns and CI regex fully enforce the stated policy across all filename variants.

Unresolved risks / review findings

Automated review reported 4 unresolved findings:

  • [high] CI check flags committed non-secret .cursor/infisical.env.
  • [high] Env-file check misses suffixed secrets like .env.local.
  • [medium] CI wrongly allows .dist env files that policy forbids.
  • [medium] Missing *.env.* and *.vars.* ignore rules allow secret leaks.

Verification

No test evidence was reported. Added CI behavior is unverified in this description.


Summary

Updates the No secrets in files rule in AGENTS.md to revise handling of accidentally committed secret files. It now directs deleting the file from the tree right away and keeping a backup on our own systems, never in the repo or in chat, with history purge left as a separate owner decision. It removes the prior instruction to rotate every value in the committed file.

Operational impact

Changes owner guidance only; no runtime, gitignore, or CI behavior is altered in this diff. The unverified effect is that secret rotation is no longer required by the documented process.

Unresolved risk

Automated review reported 1 high finding that remains unresolved: committed secrets stay valid without mandatory rotation. No tests added, tests run, deployment verification, or issue references were evidenced in the provided changes.


Summary

Updates the no-env-files CI check to exempt .cursor/infisical.env from failure when tracked. The check otherwise still fails if other .env or *.vars files are tracked.

Operational impact

Allows .cursor/infisical.env to remain tracked without triggering the workflow. Other env/vars file patterns remain blocked by CI.

Risks

Automated review flagged that the exempted infisical.env path can be tracked without content checking, which is unverified and remains unresolved. No test evidence was provided in the changes.


Summary

Extends the No env files CI check to prevent tracked secrets files from reaching main. The detection pattern now also flags *.vars files with suffixes (e.g. *.vars.*), in addition to existing .env patterns. Adds a 10-minute timeout to the workflow job.

Operational impact

Pull requests that track disallowed env or vars files will fail CI with an error directing contributors to keep secrets only in Infisical. Verification status is unverified, as no test evidence was included in the reviewed changes.


Summary

Strengthens the CI guardrail behind the "no secrets in files" effort so all secrets stay in Infisical. The provided diff changes only .github/workflows/no-env-files.yml. (The PR title also references gitignore and an AGENTS.md rule, but those files are not part of the shown changes.)

What changed

  • Wider tracked-file ban: The step that fails the build when env/vars files are tracked now also rejects .envrc files, in addition to .env and .vars files (including dotted and suffixed variants such as .env.local). Only .example, .sample, and .template files remain exempt — dist files are no longer excluded. The .cursor/infisical.env allowlist is preserved, now as an inline exclusion pattern instead of the removed ALLOW_RE env var.
  • New content check on Infisical coordinates files: A new step inspects every tracked .cursor/infisical.env file and fails CI if it contains anything other than blank lines, comments, or INFISICAL_* entries with simple values, or if any key name looks credential-like (contains SECRET, TOKEN, PASSWORD, or CLIENT).

Operational impact

PRs that track env, vars, or envrc files — or an Infisical coordinates file carrying anything beyond INFISICAL_* coordinates — will fail CI with an error annotation identifying the offending files.

Unresolved review finding

  • [medium] .github/workflows/no-env-files.yml:29 — unquoted command substitution splits tracked paths on spaces, which can mishandle file paths containing spaces in the new Infisical check. Not addressed in this PR.

No tests were added and none were reported as run; the checks' runtime behavior has not been verified.


Summary

Enforces that secrets are not stored in tracked files and live only in Infisical. Automated code review reported no issues; runtime verification remains unverified.

Changes

  • Updated .gitignore to ignore *.vars.*, *.env.*, and .envrc while explicitly allowing only .cursor/infisical.env alongside existing example/sample/template exceptions.
  • Tightened CI check in no-env-files.yml to fail if any env, vars, or envrc file is tracked, with the sole tracked exception being .cursor/infisical.env.
  • Added CI validation that .cursor/infisical.env contains only non-credential INFISICAL_* coordinates and rejects credential-looking keys.

Summary

Strengthens the "no secrets in files" guardrails so that secret-bearing env/vars files cannot be tracked in the repository, and the single allowed exceptions file can only contain Infisical coordinates.

.gitignore

  • Adds ignore patterns for additional secret-bearing variants: *.vars.*, *.env.*, and .envrc (direnv files).
  • Explicitly un-ignores .cursor/infisical.env so the Infisical coordinates file stays tracked, alongside the existing example/sample/template exemptions.

CI workflow (.github/workflows/no-env-files.yml)

  • Broadens the tracked-file check to fail on any tracked .env, .vars, or .envrc file, including suffixed variants, while still excluding example/sample/template files and the .cursor/infisical.env allowlist (previously handled via an ALLOW_RE environment variable, now inlined into the grep pipeline).
  • Adds a new step that inspects every tracked .cursor/infisical.env file and fails CI if it contains anything other than blank lines, comments, or INFISICAL_*=<safe value> coordinate entries, or if any key looks credential-like (keys containing SECRET, TOKEN, PASSWORD, or CLIENT). Violations are reported as CI errors with the offending file named.

Operational impact

  • Reduces the risk of committing env/vars secrets, including previously uncovered patterns such as .envrc and dotted variants (e.g. .env.local-style files).
  • Enforces in CI that the only permitted env-like file holds non-secret Infisical coordinates only; any credential-looking content blocks the build with an error.

Note: the PR title references an AGENTS.md rule, but no AGENTS.md change appears in the provided changes. No test changes are included; the checks are enforced by the workflow itself, and no runtime verification is reported.


Summary

This PR hardens the no-secrets-in-files guard so all secrets live only in Infisical. The .cursor/infisical.env exception is now explicitly limited to non-credential coordinates.

Changes

  • Updated No env files CI check to validate tracked files more robustly against spaces in paths. Restricted .cursor/infisical.env to allow only INFISICAL_PROJECT_ID, INFISICAL_ENV and INFISICAL_DOMAIN, replacing the prior broader INFISICAL_* plus credential-keyword check.
  • Updated AGENTS.md to document that narrow exception and note that CI checks its content.

Impact

  • Operational: PRs tracking .env, .vars, .envrc or similar files continue to fail CI, while the documented coordinates file remains allowed. Any additional keys in .cursor/infisical.env will now fail CI verification, which remains unverified in a live run.

Verification

  • Automated code review completed and found no issues. No test evidence was provided in the supplied changes.

Summary

Prevents secrets from being stored in tracked files by extending ignore rules and CI enforcement. All secrets are intended to live only in Infisical.

Changes

  • Updated .gitignore to also ignore *.envrc, *.envrc.*, while still allowing *.example, *.sample, and *.template files.
  • Updated .github/workflows/no-env-files.yml env-file detection to be case-insensitive and to handle directory paths.
  • Hardened config content check to use -- and ./ prefix for safe filename handling.

Operational impact

CI now fails if env or vars files are tracked, and restricts allowed config content to Infisical references only. Developers must use Infisical instead of committing env files.

Unresolved risks / review findings

  • High: placeholder-suffix exclusion may let tracked secret files pass without content check — unverified.
  • Medium: (/|$) in env-file regex may flag every file under a *.env directory — unverified.

Verification

No test evidence was provided in the changes supplied. Behavior described above is unverified.


Summary

Adds a new CI step, "Check placeholder env files hold no real values", to the existing .github/workflows/no-env-files.yml workflow, extending the PR's goal (per its title) of keeping secrets out of files. The provided diff shows only this workflow change; the gitignore and AGENTS.md rule mentioned in the title are not present in the supplied patches.

What the new check does

  • Iterates over tracked placeholder env files whose names match env/vars/envrc patterns and end in .example, .sample, or .template.
  • Flags any KEY=value line where the key looks credential-like (secret, token, password, api key, private, credential, _key, auth) and the value is non-empty and not a recognized placeholder marker (xxx, ..., <, changeme, change-me, your-, example, placeholder, path/to, redacted, dummy, todo).
  • Emits a GitHub error annotation naming the offending file and fails the job when any hit is found.

Operational impact

  • CI will now fail if a placeholder or template env file contains a credential-like key with a value that does not look like an obvious placeholder, guarding against contributors filling sample files with real secrets.

Open review findings and unverified behavior

  • Automated code review reported one medium finding (unresolved): at .github/workflows/no-env-files.yml:43, empty-quoted placeholder values such as SECRET="" are treated as real secrets, since "" matches the non-empty value pattern and is not in the exclusion list — a likely false positive that can fail CI on legitimate placeholder files.
  • The new step's behavior has not been reported as tested or run; no test evidence is included in the provided changes.

Summary

This PR strengthens the guard against committing real secrets in env-style files. Per the PR title, the branch's goal is to keep secrets out of files via a .gitignore entry, a CI check, and an AGENTS.md rule; the provided diff shows only the workflow change.

What changed

  • Added a Check placeholder env files hold no real values step to .github/workflows/no-env-files.yml.
  • The step enumerates tracked files that look like placeholder env files — names containing .env, .vars, or .envrc and ending in .example, .sample, or .template.
  • In each file it looks for credential-like keys (names matching secret, token, password, passwd, api key, private, credential, auth, or ending in _key) assigned a non-empty value.
  • Empty quoted values ("" / '') and common placeholder patterns (xxx, ..., <, changeme, your-*, example, placeholder, path/to, redacted, dummy, todo) are ignored.
  • On any hit, it emits a GitHub error annotation naming the offending file ("is a placeholder file but a credential-like key carries a non-placeholder value") and fails the job.

Operational impact

  • CI now fails when a committed .example / .sample / .template env file contains a credential-like key whose value does not look like a placeholder, giving contributors feedback before merge.

Known issue (unresolved)

  • Automated code review reported one high-severity finding: the placeholder-word exclusion is applied to the whole line, so a trailing comment containing a placeholder word (for example, a real value followed by # placeholder) can bypass the check at line 43 of the workflow. This is not resolved in the provided changes.

Testing

  • No tests were added and no test runs are reported in the provided context; the new check's runtime behavior is unverified.

Summary

Adds an automated guard against real credentials hiding in placeholder env files. The visible change extends the no-env-files CI workflow (.github/workflows/no-env-files.yml) with a new step, "Check placeholder env files hold no real values". The PR title also references gitignore entries and an AGENTS.md rule, but the provided diff covers only the workflow step.

What the new CI step does

  • Scans tracked files whose names look like env files (.env, .vars, .envrc, optionally with suffixes) that end in .example, .sample, or .template.
  • Flags assignment lines where a credential-like key (secret, token, password, passwd, api[-_]key, private, credential, _key, auth) carries a non-empty, non-comment value.
  • Permits values that look like placeholders (xxx, ..., <...>, changeme, change-me, your[-_], example, placeholder, path/to, redacted, dummy, todo).
  • Emits a workflow error naming the offending file and fails the job if any such value is found.

Operational impact

  • CI will now fail when an example/sample/template env file appears to contain a real-looking secret, giving teams an automated early signal before credentials land on main.
  • No tests were added in this diff, and no runtime verification of the check is reported; its behavior beyond what the script shows is unverified.

Known risk (unresolved)

  • Code review flagged (medium) that the credential filter matches the bare substring auth anywhere in a key name, so innocuous keys such as AUTHOR can trigger false positives. This finding has not been addressed in the diff.

Refines the no-env-files CI secret check in .github/workflows/no-env-files.yml so that placeholder-like words can no longer hide real credentials and innocuous keys no longer cause false failures. The scan previously filtered matching lines with chained grep commands, which meant a placeholder word (such as xxx, example, or todo) appearing anywhere in a line — including in the key name — caused the whole line to be skipped, while keys like author or auth_enabled matched the loose auth pattern and were flagged as errors. The filtering is now done in a single awk script that splits each KEY=value line into key and value and applies the rules separately: credential-like keys still include secret, token, password, passwd, api key, private, credential, _key, and auth now only at the start of the key or after an underscore; author and auth_enabled are explicitly excluded; and placeholder words are tolerated only in the value, not the key. Operational impact: CI fails only when a credential-like key in a tracked file genuinely carries a non-placeholder value, so assignments like EXAMPLE_TOKEN=<real value> are now caught while keys such as author=... or auth_enabled=true no longer break the build. No tests were added or reported as run for this workflow change; the automated code review found no issues.

@swu-wise

swu-wise Bot commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

@kody start-review

@kody-ai

This comment has been minimized.

Comment thread .github/workflows/no-env-files.yml Resolved
Comment thread .github/workflows/no-env-files.yml Resolved
Comment thread .github/workflows/no-env-files.yml Resolved
Comment thread .github/workflows/no-env-files.yml Resolved
Comment thread .gitignore Resolved
@kody-ai

kody-ai Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Automatic approval held

Kody's assessment:

Risk was identified in this PR.

@swu-wise

swu-wise Bot commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

@kody start-review (head 2234507, rule wording updated)

@kody-ai

This comment has been minimized.

Comment thread AGENTS.md Resolved
@swu-wise

swu-wise Bot commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

@kody start-review (head 333780c, allowlist for the non-secret Infisical coordinates file)

@kody-ai

This comment has been minimized.

Comment thread .github/workflows/no-env-files.yml Resolved
@kody-ai

This comment has been minimized.

@kody-ai

This comment has been minimized.

Comment thread .github/workflows/no-env-files.yml Resolved
@kody-ai

This comment has been minimized.

@swu-wise

swu-wise Bot commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

@kody start-review (head e63aa5a, check v2 and ignore patterns)

@kody-ai

This comment has been minimized.

@swu-wise

swu-wise Bot commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

@kody start-review (head 0d5f6bb)

@kody-ai

This comment has been minimized.

@swu-wise

swu-wise Bot commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

@kody start-review (head c40f1cc)

@kody-ai

This comment has been minimized.

Comment thread .github/workflows/no-env-files.yml Resolved
Comment thread .github/workflows/no-env-files.yml Resolved
…he No env files job now fails when a tracked .example, .sample or .template env file gives a credential-like key a non-placeholder value, closing the placeholder-suffix bypass.
@kody-ai

This comment has been minimized.

Comment thread .github/workflows/no-env-files.yml Resolved
…gnments like SECRET with an empty quoted value are dropped before the credential check, so legitimate example files stay green while real values still fail.
@jaywedgeworth22
jaywedgeworth22 enabled auto-merge (squash) November 28, 2026 05:33
@kody-ai

This comment has been minimized.

Comment thread .github/workflows/no-env-files.yml Resolved
…check. Trailing comments are stripped before the placeholder filter, so a marker word in a comment no longer lets a real credential value pass.
@kody-ai

This comment has been minimized.

Comment thread .github/workflows/no-env-files.yml Resolved
… Only a whole auth key or an _auth suffix now matches, so non-secret keys like AUTHOR and AUTH_ENABLED no longer fail the check.
@kody-ai

This comment has been minimized.

Comment thread .github/workflows/no-env-files.yml Resolved
…p-list. Auth-prefixed credential keys are matched again, and the known non-secret AUTHOR and AUTH_ENABLED keys are excluded explicitly.
@kody-ai

kody-ai Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Kody Review Complete

Great news! 🎉
No issues were found that match your current review configurations.

Keep up the excellent work! 🚀

Kody Guide: Usage and Configuration
Interacting with Kody
  • Request a Review: Ask Kody to review your PR manually by adding a comment with the @kody start-review command at the root of your PR.

  • Validate Business Logic: Ask Kody to validate your code against business rules by adding a comment with the @kody -v business-logic command.

  • Provide Feedback: Help Kody learn and improve by reacting to its comments with a 👍 for helpful suggestions or a 👎 if improvements are needed.

Current Kody Configuration
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ✅

Access your configuration settings here.

​

@jaywedgeworth22
jaywedgeworth22 merged commit d14b6b2 into main Nov 28, 2026
11 checks passed
@jaywedgeworth22
jaywedgeworth22 deleted the wise/no-env-files branch November 28, 2026 06:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant