Security Rulebook¶
Last updated: 2026-02-22
This rulebook defines mandatory security workflow for this homelab repo.
1. Core Principles¶
- Stop the line on security risks.
- Never commit live credentials.
- Use templates (
*.example) for every sensitive config. - Run security gates before each push.
- Treat any leak as an incident until fully remediated.
2. Non-Negotiable Rules¶
- Never commit:
.envfiles- API keys, tokens, passwords
- private keys or certificate private material
- Keep real credentials in local secret stores only.
- Tracked config must use placeholders like:
CHANGE_ME_*${ENV_VAR}- Validate before every push:
./scripts/validate-secrets.shpre-commit run --all-files- If a secret is exposed, follow the incident playbook below.
3. Standard Workflow¶
Before coding¶
- Pull latest
main. - Confirm no local secret files are staged.
- If adding a new service, add
*.exampletemplates first.
During coding¶
- Keep all credentials in
.envfiles that are gitignored. - Use env vars in compose/config files.
- Do not paste real values in docs, screenshots, examples, or commit messages.
Before commit¶
Before push¶
After push¶
- Confirm
.github/workflows/security-scan.ymlpasses. - If CI reports a leak, start incident handling immediately.
4. Security Incident Playbook¶
Trigger conditions¶
- Secret/token/password appears in tracked content.
- Scanner reports high-severity secret finding.
- Sensitive files were committed by mistake.
Immediate response¶
- Freeze pushes/merges to affected branch.
- Revoke or rotate exposed credentials immediately.
- Remove leaked content from working tree.
- Re-run local security checks.
If history is affected¶
- Create safety tag:
- Rewrite history with
git-filter-repo: --replace-textfor leaked literals--invert-pathsfor sensitive files- Verify cleanup:
- Force-push rewritten history:
- Tell collaborators to re-clone or hard reset.
Collaborator recovery¶
5. Documentation Rules¶
- Keep
SECURITY.mdand this rulebook aligned. - Never place realistic credentials in docs.
- Replace exposed values with
REDACTED_*markers. - Update documentation in the same PR as security-relevant changes.