@@ -144,10 +144,174 @@ Example:
144144
145145## 7. Security
146146
147+ ### 7.1 Secrets Management - Summary: What Must Never Be Checked Into Git or Code
148+
149+ ** The repository must never contain secrets** — any material that can be used to
150+ authenticate, authorize, or bill against an account, service, or infrastructure.
151+
152+ This includes both files and inline values embedded in code or scripts.
153+
154+ #### 7.1.1 Definition of "Secrets"
155+
156+ A secret is any value that:
157+
158+ - Authenticates an identity
159+ - Grants access to a system, API, or service
160+ - Authorizes actions or permissions
161+ - Enables billable usage
162+ - Establishes cryptographic trust
163+
164+ If exposed, a secret can result in:
165+
166+ - Account compromise
167+ - Unauthorized access
168+ - Financial loss
169+ - Infrastructure takeover
170+
171+ #### 7.1.2 Categories of Secrets That Must Never Be Committed
172+
173+ ##### 7.1.2.1 API Keys
174+
175+ Static credentials used for programmatic access.
176+
177+ Examples:
178+
179+ - OpenAI API keys
180+ - Stripe keys
181+ - SendGrid keys
182+ - Twilio keys
183+
184+ Risk:
185+
186+ - Immediate unauthorized API usage
187+ - Direct financial impact
188+
189+ ##### 7.1.2.2 Access Tokens and OAuth Tokens
190+
191+ Bearer tokens granting scoped or full access.
192+
193+ Examples:
194+
195+ - GitHub Personal Access Tokens (PATs)
196+ - OAuth access tokens
197+ - CI/CD tokens
198+
199+ Risk:
200+
201+ - Repository access
202+ - Code modification
203+ - Secret exfiltration
204+
205+ ##### 7.1.2.3 Refresh Tokens
206+
207+ Long-lived tokens capable of minting new access tokens.
208+
209+ Risk:
210+
211+ - Persistent compromise
212+ - Difficult to detect abuse
213+
214+ ##### 7.1.2.4 Cloud Provider Credentials
215+
216+ Credentials granting infrastructure access.
217+
218+ Examples:
219+
220+ - AWS Access Key ID + Secret Key
221+ - GCP service account JSON keys
222+ - Azure client secrets
223+
224+ Risk:
225+
226+ - Infrastructure compromise
227+ - Crypto-mining abuse
228+ - Severe billing impact
229+
230+ ##### 7.1.2.5 Cryptographic Private Keys
231+
232+ Keys establishing identity or trust.
233+
234+ Examples:
235+
236+ - SSH private keys (id_rsa, id_ed25519)
237+ - TLS private keys (` *.pem ` , ` *.key ` )
238+ - Signing keys
239+
240+ Risk:
241+
242+ - Server access
243+ - Trust chain compromise
244+ - Man-in-the-middle attacks
245+
246+ ##### 7.1.2.6 Service Account Credentials
247+
248+ Non-human credentials stored as files.
249+
250+ Examples:
251+
252+ - JSON/YAML credential files
253+ - CI service secrets
254+
255+ Risk:
256+
257+ - Silent, high-privilege access
258+
259+ ##### 7.1.2.7 Webhook Secrets and Shared Secrets
260+
261+ Used to validate inbound requests.
262+
263+ Examples:
264+
265+ - GitHub webhook secrets
266+ - Stripe webhook signing secrets
267+
268+ Risk:
269+
270+ - Forged events
271+ - Unauthorized state changes
272+
273+ #### 7.1.3 File Types and Locations That Must Be Excluded
274+
275+ The following must never be committed:
276+
277+ - ` .env ` , ` .env.* ` (except ` .env.example ` )
278+ - ` vars.env ` , secret variable files
279+ - Credential files (` *.pem ` , ` *.key ` , ` *.p12 ` , ` *.json ` keys)
280+ - Generated logs containing sensitive values
281+ - Tool caches that may contain secrets
282+
283+ These exclusions must be enforced via ` .gitignore ` .
284+
285+ #### 7.1.4 Code and Script Scanning Requirements
286+
287+ Secrets must not appear:
288+
289+ - Inline in source code
290+ - In shell scripts
291+ - In configuration files
292+ - In comments
293+ - In logs or debug output
294+
295+ Repositories must enforce:
296+
297+ - Pre-commit secret scanning
298+ - CI-level secret detection
299+ - AI agent instructions prohibiting secret creation or logging
300+
301+ High-entropy strings and known token patterns must be treated as potential secrets until proven otherwise.
302+
303+ #### 7.1.5 Security Posture Statement
304+
305+ ** Secrets** — including API keys, access tokens, credentials, private keys, or any
306+ material that grants authenticated or billable access — ** must never be committed
307+ to Git repositories** and must be actively scanned for in both code and configuration.
308+
309+ ### 7.2 General Security Standards
310+
147311- Never log secrets
148- - credentails and IP addresses should never be hardcoded into scripts, should exist in .env file
149- - .env file should not be checked into any repo (.gitignore)
150- - An example .env file (.env.example) should be created and checked in via git
312+ - Credentials and IP addresses should never be hardcoded into scripts, should exist in ` .env ` file
313+ - ` .env ` file should not be checked into any repo (` .gitignore ` )
314+ - An example ` .env ` file (` .env.example ` ) should be created and checked in via git
151315- Treat all inputs as untrusted
152316- Document required permissions
153317- Use least privilege
@@ -304,9 +468,38 @@ AI agents must:
304468
305469Violations of ` .gitignore ` rules are considered security defects.
306470
471+ ### 11.2 Secrets and Credentials Handling
472+
473+ AI agents must:
474+
475+ - Never generate real secrets
476+ - Never hardcode credentials
477+ - Never log or echo secret values
478+ - Use environment variables for all sensitive data
479+ - Provide example placeholders only (e.g. ` YOUR_API_KEY_HERE ` )
480+ - Treat any suspected secret as a security defect
481+
482+ If a secret is required for functionality, the AI must:
483+
484+ - Document it
485+ - Reference ` .env.example `
486+ - Ensure it is excluded from version control
487+
488+ AI agents must understand that secrets include:
489+
490+ - API keys (OpenAI, Stripe, SendGrid, Twilio, etc.)
491+ - Access tokens and OAuth tokens (GitHub PATs, CI/CD tokens)
492+ - Refresh tokens
493+ - Cloud provider credentials (AWS, GCP, Azure)
494+ - Cryptographic private keys (SSH, TLS)
495+ - Service account credentials
496+ - Webhook secrets and shared secrets
497+
498+ ** High-entropy strings and known token patterns must be treated as potential secrets until proven otherwise.**
499+
307500---
308501
309- ### 11.2 Pre-commit Execution and Log Generation
502+ ### 11.3 Pre-commit Execution and Log Generation
310503
311504Pre-commit is a mandatory quality gate.
312505
@@ -315,3 +508,16 @@ AI agents must execute pre-commit using the repository helper script:
315508``` bash
316509./scripts/run-precommit.sh
317510```
511+
512+ ---
513+
514+ ## 12. Why Security Matters in This Framework
515+
516+ What this framework enforces is not just "don't commit keys," but:
517+
518+ - ** Defense-in-depth** : Multiple layers of protection (` .gitignore ` , pre-commit, CI scanning)
519+ - ** Least privilege** : Access only what is necessary
520+ - ** Auditability** : Clear trails of what was checked and when
521+ - ** AI-safe development** : Explicit instructions for AI agents to prevent accidental secret exposure
522+
523+ This is exactly the right level of rigor for an AI-assisted engineering framework.
0 commit comments