create-agentic-app 1.1.55 → 1.1.57

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/package.json +1 -1
  2. package/template/.agents/skills/security-scanner/SKILL.md +157 -0
  3. package/template/.agents/skills/security-scanner/references/A01-broken-access-control.md +136 -0
  4. package/template/.agents/skills/security-scanner/references/A02-security-misconfiguration.md +130 -0
  5. package/template/.agents/skills/security-scanner/references/A03-software-supply-chain-failures.md +117 -0
  6. package/template/.agents/skills/security-scanner/references/A04-cryptographic-failures.md +141 -0
  7. package/template/.agents/skills/security-scanner/references/A05-injection.md +155 -0
  8. package/template/.agents/skills/security-scanner/references/A06-insecure-design.md +145 -0
  9. package/template/.agents/skills/security-scanner/references/A07-authentication-failures.md +150 -0
  10. package/template/.agents/skills/security-scanner/references/A08-software-data-integrity-failures.md +132 -0
  11. package/template/.agents/skills/security-scanner/references/A09-security-logging-alerting-failures.md +130 -0
  12. package/template/.agents/skills/security-scanner/references/A10-mishandling-exceptional-conditions.md +154 -0
  13. package/template/.agents/skills/security-scanner/references/report-template.md +148 -0
  14. package/template/.claude/agents/security-scanner.md +214 -0
  15. package/template/.claude/skills/security-scanner/SKILL.md +157 -0
  16. package/template/.claude/skills/security-scanner/references/A01-broken-access-control.md +136 -0
  17. package/template/.claude/skills/security-scanner/references/A02-security-misconfiguration.md +130 -0
  18. package/template/.claude/skills/security-scanner/references/A03-software-supply-chain-failures.md +117 -0
  19. package/template/.claude/skills/security-scanner/references/A04-cryptographic-failures.md +141 -0
  20. package/template/.claude/skills/security-scanner/references/A05-injection.md +155 -0
  21. package/template/.claude/skills/security-scanner/references/A06-insecure-design.md +145 -0
  22. package/template/.claude/skills/security-scanner/references/A07-authentication-failures.md +150 -0
  23. package/template/.claude/skills/security-scanner/references/A08-software-data-integrity-failures.md +132 -0
  24. package/template/.claude/skills/security-scanner/references/A09-security-logging-alerting-failures.md +130 -0
  25. package/template/.claude/skills/security-scanner/references/A10-mishandling-exceptional-conditions.md +154 -0
  26. package/template/.claude/skills/security-scanner/references/report-template.md +148 -0
  27. package/template/AGENTS.md +40 -0
  28. package/template/next-env.d.ts +1 -1
  29. package/template/specs/ui-polish-responsive/README.md +59 -0
  30. package/template/specs/ui-polish-responsive/action-required.md +3 -0
  31. package/template/specs/ui-polish-responsive/requirements.md +53 -0
  32. package/template/specs/ui-polish-responsive/tasks/task-01-globals-css.md +144 -0
  33. package/template/specs/ui-polish-responsive/tasks/task-02-layout.md +66 -0
  34. package/template/specs/ui-polish-responsive/tasks/task-03-site-header.md +79 -0
  35. package/template/specs/ui-polish-responsive/tasks/task-04-site-footer.md +63 -0
  36. package/template/specs/ui-polish-responsive/tasks/task-05-home-page.md +215 -0
  37. package/template/specs/ui-polish-responsive/tasks/task-06-dashboard.md +222 -0
  38. package/template/specs/ui-polish-responsive/tasks/task-07-chat-page.md +225 -0
  39. package/template/specs/ui-polish-responsive/tasks/task-08-profile-page.md +192 -0
  40. package/template/specs/ui-polish-responsive/tasks/task-09-auth-pages.md +97 -0
  41. package/template/specs/ui-polish-responsive/tasks/task-10-setup-checklist.md +120 -0
  42. package/template/specs/ui-polish-responsive/tasks/task-11-starter-prompt-modal.md +87 -0
  43. package/template/src/app/globals.css +65 -7
  44. package/template/src/app/layout.tsx +2 -2
  45. package/template/src/app/page.tsx +174 -174
  46. package/template/src/components/setup-checklist.tsx +162 -162
  47. package/template/src/components/site-footer.tsx +2 -2
  48. package/template/src/components/site-header.tsx +3 -3
  49. package/template/src/components/starter-prompt-modal.tsx +202 -202
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-agentic-app",
3
- "version": "1.1.55",
3
+ "version": "1.1.57",
4
4
  "description": "Scaffold a new agentic AI application with Next.js, Better Auth, and AI SDK",
5
5
  "type": "module",
6
6
  "bin": {
@@ -0,0 +1,157 @@
1
+ ---
2
+ name: security-scanner
3
+ description: >-
4
+ Performs comprehensive OWASP Top 10:2025 security vulnerability analysis on any codebase.
5
+ Use this skill whenever the user asks to: review code for security, perform a security audit,
6
+ scan for vulnerabilities, find security issues, improve application security, check for OWASP
7
+ compliance, do a penetration test review, assess security posture, look for security flaws,
8
+ scan for security risks, harden an application, or check code for exploits. Also trigger when
9
+ the user mentions OWASP, CVEs, CWEs, security hardening, vulnerability assessment, or asks
10
+ for a security report — even if they don't explicitly say "security scan." This skill works
11
+ on any codebase in any language (JavaScript, TypeScript, Python, Java, Go, Ruby, C#, PHP, etc.).
12
+ ---
13
+
14
+ # Security Scanner — OWASP Top 10:2025
15
+
16
+ Performs a systematic security audit of any codebase against all 10 OWASP 2025 categories. Produces a structured markdown report with severity ratings, code locations, and actionable remediation guidance.
17
+
18
+ ## Execution Flow
19
+
20
+ Follow these four steps in order. Do not skip any step.
21
+
22
+ ### Step 1: Detect Project Context
23
+
24
+ Determine whether you are working within an existing project or a blank workspace.
25
+
26
+ Check for source code by looking for common project indicators:
27
+ - `package.json`, `requirements.txt`, `go.mod`, `pom.xml`, `Cargo.toml`, `Gemfile`, `*.csproj`, `composer.json`
28
+ - Or any `src/`, `app/`, `lib/` directory containing code files
29
+
30
+ **If source code is found:** Use the current working directory as the analysis target. Proceed to Step 2.
31
+
32
+ **If NO source code is found:** Ask the user for a GitHub repository URL. Then clone it:
33
+ ```bash
34
+ gh repo clone <url> ./audit-target
35
+ ```
36
+ Use `./audit-target` as the analysis target directory. Proceed to Step 2.
37
+
38
+ ### Step 2: Reconnaissance
39
+
40
+ Before scanning for vulnerabilities, understand what you're analyzing. This context shapes which patterns matter most.
41
+
42
+ 1. **Identify the tech stack** — Read the main dependency manifest (package.json, requirements.txt, etc.) to determine language(s), framework(s), and key libraries
43
+ 2. **Map the project structure** — Use Glob to find all source files and understand the directory layout
44
+ 3. **Locate entry points** — Find API routes, controllers, handlers, page components (e.g., `**/api/**/*.ts`, `**/routes/**`, `**/controllers/**`, `**/views/**`)
45
+ 4. **Find config files** — Glob for `**/*.config.*`, `**/.env*`, `**/settings.*`, `**/application.*`
46
+ 5. **Identify auth modules** — Search for authentication/authorization logic, session management, middleware
47
+ 6. **Find database access** — Locate ORM models, raw query files, database connection setup
48
+
49
+ Record your findings — they guide which detection patterns to prioritize in Step 3.
50
+
51
+ ### Step 3: Systematic Analysis
52
+
53
+ For each OWASP category A01 through A10:
54
+
55
+ 1. **Read the reference file** for that category from `references/` to load the relevant CWEs, detection patterns, and grep expressions
56
+ 2. **Search the codebase** using the patterns from the reference file — use Grep for pattern matching and Glob for file discovery
57
+ 3. **Read flagged files** to confirm findings and get exact line numbers
58
+ 4. **Record each finding** with: file path, line number(s), severity level, CWE, description, evidence (code snippet), and recommended fix
59
+
60
+ Analyze each category in order:
61
+
62
+ #### A01: Broken Access Control
63
+ See [references/A01-broken-access-control.md](references/A01-broken-access-control.md) for CWEs, detection patterns, and fix examples.
64
+
65
+ Focus on: missing auth middleware on routes, IDOR (user-controlled IDs without ownership checks), permissive CORS, directory traversal, missing CSRF protection, privilege escalation, force browsing to admin/debug endpoints.
66
+
67
+ #### A02: Security Misconfiguration
68
+ See [references/A02-security-misconfiguration.md](references/A02-security-misconfiguration.md).
69
+
70
+ Focus on: debug mode in production, default credentials, verbose error messages exposing internals, unnecessary features enabled, missing security headers, hardcoded secrets, exposed environment variables.
71
+
72
+ #### A03: Software Supply Chain Failures
73
+ See [references/A03-software-supply-chain-failures.md](references/A03-software-supply-chain-failures.md).
74
+
75
+ Focus on: known vulnerable dependency versions, unpinned dependencies, CDN scripts without SRI, missing lock files, dependencies from untrusted sources.
76
+
77
+ #### A04: Cryptographic Failures
78
+ See [references/A04-cryptographic-failures.md](references/A04-cryptographic-failures.md).
79
+
80
+ Focus on: weak password hashing (MD5, SHA1), missing salt, hardcoded keys/secrets, weak randomness (Math.random for tokens), cookies missing Secure flag, sensitive data in logs, base64 used as "encryption."
81
+
82
+ #### A05: Injection
83
+ See [references/A05-injection.md](references/A05-injection.md).
84
+
85
+ Focus on: SQL injection (string concatenation in queries), command injection (exec/spawn with user input), XSS (dangerouslySetInnerHTML, innerHTML), eval() with user input, SSRF (fetching user-supplied URLs), template injection.
86
+
87
+ #### A06: Insecure Design
88
+ See [references/A06-insecure-design.md](references/A06-insecure-design.md).
89
+
90
+ Focus on: missing rate limiting on auth endpoints, no input validation, no password complexity requirements, missing account lockout, unrestricted file uploads, guessable/non-expiring tokens.
91
+
92
+ #### A07: Authentication Failures
93
+ See [references/A07-authentication-failures.md](references/A07-authentication-failures.md).
94
+
95
+ Focus on: weak/predictable session tokens, sessions that never expire, credentials in logs/URLs, user enumeration via different error messages, reset tokens in API responses, cookies without HttpOnly/Secure/SameSite, hard-coded credentials.
96
+
97
+ #### A08: Software or Data Integrity Failures
98
+ See [references/A08-software-data-integrity-failures.md](references/A08-software-data-integrity-failures.md).
99
+
100
+ Focus on: eval()/Function() with user input, deserialization of untrusted data, CDN scripts without integrity hashes, mass assignment/prototype pollution, auto-updates without signature verification.
101
+
102
+ #### A09: Security Logging and Alerting Failures
103
+ See [references/A09-security-logging-alerting-failures.md](references/A09-security-logging-alerting-failures.md).
104
+
105
+ Focus on: passwords/tokens/PII in logs, missing audit logging for auth events, no logging on access control failures, error details exposed to users, console.log-only logging without persistence.
106
+
107
+ #### A10: Mishandling of Exceptional Conditions
108
+ See [references/A10-mishandling-exceptional-conditions.md](references/A10-mishandling-exceptional-conditions.md).
109
+
110
+ Focus on: empty catch blocks, stack traces returned to users, fail-open patterns, missing error handling on async operations, resource leaks on exceptions, missing transaction rollbacks.
111
+
112
+ ### Step 4: Generate Report
113
+
114
+ 1. Get today's date and create the output directory:
115
+ ```bash
116
+ mkdir -p ./audit/YYYY-MM-DD/
117
+ ```
118
+
119
+ 2. Read the report template from [references/report-template.md](references/report-template.md)
120
+
121
+ 3. Fill in the template with all findings from Step 3 and write the completed report to:
122
+ ```
123
+ ./audit/YYYY-MM-DD/security-report.md
124
+ ```
125
+
126
+ 4. Present a brief summary to the user: total findings by severity, overall risk score, and the top 3 most critical items to address immediately.
127
+
128
+ ## Severity Classification
129
+
130
+ Assign each finding one of these severity levels:
131
+
132
+ - **Critical** (10 pts): Actively exploitable with immediate data breach risk. Examples: SQL injection, remote code execution, authentication bypass, exposed credentials, command injection.
133
+
134
+ - **High** (7 pts): Exploitable with moderate effort, significant impact. Examples: XSS, CSRF, weak cryptography, IDOR, SSRF, known vulnerable dependencies.
135
+
136
+ - **Medium** (4 pts): Requires specific conditions or must be chained with other vulnerabilities. Examples: missing security headers, verbose errors, user enumeration, missing rate limiting.
137
+
138
+ - **Low** (2 pts): Defense-in-depth issues, best-practice deviations. Examples: weak password policy, console-only logging, missing SRI on CDN scripts.
139
+
140
+ - **Info** (0 pts): Observations and recommendations with no direct exploit path. Examples: outdated but non-vulnerable dependencies, missing SBOM, code quality notes.
141
+
142
+ ## Risk Score
143
+
144
+ Sum all finding points to calculate the overall risk score:
145
+ - **0–10**: Low Risk
146
+ - **11–30**: Moderate Risk
147
+ - **31–60**: High Risk
148
+ - **61+**: Critical Risk
149
+
150
+ ## Important Guidelines
151
+
152
+ - **Read-only analysis**: Never modify any source files in the target project. The audit directory is the only location where files should be written.
153
+ - **Cover all 10 categories**: If a category has no findings, still include it in the report with "No issues identified" and note what was checked.
154
+ - **Be specific**: Every finding must reference a specific file path and line number(s). Include the actual vulnerable code snippet as evidence.
155
+ - **Provide fixes**: Every finding must include an actionable remediation recommendation with a code example showing the fix.
156
+ - **No false positives**: Read and understand the code context before flagging. A `console.log` in a build script is not the same as a `console.log` leaking passwords in a login handler.
157
+ - **Prioritize**: Order the remediation priority section by actual exploitability and impact, not just severity label.
@@ -0,0 +1,136 @@
1
+ # A01:2025 — Broken Access Control
2
+
3
+ ## Overview
4
+
5
+ Broken Access Control is the #1 vulnerability in OWASP Top 10:2025. 100% of applications tested showed some form of broken access control. It encompasses 40 CWEs with 1,839,701 total occurrences and 32,654 CVEs. Access control enforces policy preventing users from exceeding their permissions — failures enable unauthorized data disclosure, modification, or destruction.
6
+
7
+ ## Key CWEs
8
+
9
+ - **CWE-200**: Exposure of Sensitive Information to Unauthorized Actor
10
+ - **CWE-284**: Improper Access Control
11
+ - **CWE-285**: Improper Authorization
12
+ - **CWE-352**: Cross-Site Request Forgery (CSRF)
13
+ - **CWE-425**: Direct Request (Forced Browsing)
14
+ - **CWE-639**: Authorization Bypass Through User-Controlled Key (IDOR)
15
+ - **CWE-862**: Missing Authorization
16
+ - **CWE-863**: Incorrect Authorization
17
+ - **CWE-918**: Server-Side Request Forgery (SSRF)
18
+ - **CWE-22**: Path Traversal
19
+
20
+ ## What to Look For
21
+
22
+ ### General Patterns
23
+ - Routes/endpoints missing authentication middleware or guards
24
+ - Missing authorization/role checks on protected routes (any authenticated user can access admin routes)
25
+ - IDOR: user-controlled IDs in URLs or request bodies used to fetch records without ownership verification
26
+ - CORS misconfiguration (wildcard `*` or overly permissive origins)
27
+ - Directory traversal in file paths (user input used in `path.join`, `fs.readFile`, etc.)
28
+ - CSRF: state-changing operations (POST/PUT/DELETE) without CSRF token validation
29
+ - Privilege escalation: missing role checks, role stored client-side or in JWT without verification
30
+ - Force browsing: admin/debug/internal endpoints accessible without auth
31
+
32
+ ### Grep Patterns
33
+
34
+ ```
35
+ # Missing auth middleware on routes
36
+ Access-Control-Allow-Origin.*\*
37
+ Access-Control-Allow-Credentials.*true
38
+
39
+ # IDOR patterns — user-controlled ID without ownership check
40
+ params\.id|params\.userId|req\.query\.id
41
+ request\.getParameter\("acct"\)
42
+ findById|findOne.*id
43
+
44
+ # Path traversal
45
+ path\.join.*req\.|path\.resolve.*req\.
46
+ \.\.\/|\.\.\\
47
+
48
+ # Missing CSRF
49
+ method.*(POST|PUT|DELETE|PATCH)
50
+ csrf|csrfToken|_csrf
51
+
52
+ # Force browsing / unprotected admin
53
+ /admin|/debug|/internal|/api/admin
54
+ ```
55
+
56
+ ### JavaScript / TypeScript / Node.js
57
+ - Express/Next.js routes without auth middleware (`getSession`, `getServerSession`, `requireAuth`)
58
+ - API routes that read `params.id` or `query.id` and fetch records without checking ownership against session user
59
+ - `next.config.js` with permissive CORS headers
60
+ - Missing `withAuth` or session validation wrappers on API handlers
61
+
62
+ ### Python (Django/Flask)
63
+ - Views without `@login_required` or `@permission_required` decorators
64
+ - `request.GET['id']` used directly in queries without ownership filter
65
+ - Missing `CSRF_COOKIE_SECURE` or `CSRF_COOKIE_HTTPONLY` settings
66
+ - `CORS_ALLOW_ALL_ORIGINS = True`
67
+
68
+ ### Java (Spring)
69
+ - Controllers without `@PreAuthorize` or `@Secured` annotations
70
+ - Missing `SecurityFilterChain` configuration
71
+ - `@CrossOrigin(origins = "*")`
72
+ - Direct use of `request.getParameter()` in database queries without authorization
73
+
74
+ ## Prevention Measures
75
+
76
+ 1. Deny by default — restrict access except for public resources
77
+ 2. Implement centralized, reusable access control mechanisms
78
+ 3. Enforce record ownership — users can only access their own records
79
+ 4. Apply business logic constraints through domain models
80
+ 5. Disable directory listing; remove metadata/backups from web roots
81
+ 6. Log access control failures; alert administrators on suspicious patterns
82
+ 7. Rate limit API/controller access
83
+ 8. Invalidate sessions server-side on logout; use short-lived JWTs
84
+ 9. Include functional access control tests in unit and integration suites
85
+
86
+ ## Example Attack Scenarios
87
+
88
+ **Scenario 1 — Parameter Tampering:**
89
+ ```
90
+ https://example.com/app/accountInfo?acct=notmyacct
91
+ ```
92
+ Attacker modifies the `acct` parameter to access any user's account.
93
+
94
+ **Scenario 2 — Forced Browsing:**
95
+ ```
96
+ https://example.com/app/admin_getappInfo
97
+ ```
98
+ Unauthenticated users access admin pages via direct URL.
99
+
100
+ **Scenario 3 — Client-Side Only Controls:**
101
+ ```bash
102
+ curl https://example.com/app/admin_getappInfo
103
+ ```
104
+ Frontend JavaScript protections bypassed via direct API calls.
105
+
106
+ ## Fix Examples
107
+
108
+ **Before (IDOR vulnerability):**
109
+ ```typescript
110
+ // Any authenticated user can access any note
111
+ export async function GET(req, { params }) {
112
+ const note = await db.get('SELECT * FROM notes WHERE id = ?', params.id);
113
+ return Response.json(note);
114
+ }
115
+ ```
116
+
117
+ **After (ownership check):**
118
+ ```typescript
119
+ export async function GET(req, { params }) {
120
+ const session = await getSession(req);
121
+ if (!session) return Response.json({ error: 'Unauthorized' }, { status: 401 });
122
+ const note = await db.get(
123
+ 'SELECT * FROM notes WHERE id = ? AND user_id = ?',
124
+ [params.id, session.userId]
125
+ );
126
+ if (!note) return Response.json({ error: 'Not found' }, { status: 404 });
127
+ return Response.json(note);
128
+ }
129
+ ```
130
+
131
+ ## References
132
+
133
+ - [OWASP A01:2025](https://owasp.org/Top10/2025/A01_2025-Broken_Access_Control/)
134
+ - OWASP Proactive Controls: C1 Access Control
135
+ - OWASP ASVS V8 Authorization
136
+ - OWASP Authorization Cheat Sheet
@@ -0,0 +1,130 @@
1
+ # A02:2025 — Security Misconfiguration
2
+
3
+ ## Overview
4
+
5
+ Security Misconfiguration is #2 in OWASP Top 10:2025. 100% of applications tested showed some form of misconfiguration with 719,084 total occurrences across 16 CWEs. This occurs when systems lack proper security setup — missing hardening, unnecessary features enabled, default credentials, verbose errors, or insecure settings.
6
+
7
+ ## Key CWEs
8
+
9
+ - **CWE-16**: Configuration
10
+ - **CWE-260**: Password in Configuration File
11
+ - **CWE-489**: Active Debug Code
12
+ - **CWE-526**: Exposure of Environment Variables
13
+ - **CWE-547**: Use of Hard-Coded Security-Relevant Constants
14
+ - **CWE-611**: Improper Restriction of XML External Entity Reference
15
+ - **CWE-614**: Sensitive Cookie in HTTPS Session Without 'Secure' Attribute
16
+ - **CWE-942**: Permissive Cross-domain Policy
17
+ - **CWE-1004**: Sensitive Cookie Without 'HttpOnly' Flag
18
+
19
+ ## What to Look For
20
+
21
+ ### General Patterns
22
+ - Debug/development mode enabled in production configs
23
+ - Default credentials left in code or config (admin/admin, root/root, test/test)
24
+ - Verbose error messages exposing stack traces, SQL queries, or internal paths to users
25
+ - Unnecessary features/services enabled (directory listing, debug endpoints, sample apps)
26
+ - Missing security headers (CSP, HSTS, X-Frame-Options, X-Content-Type-Options)
27
+ - Overly permissive CORS (Access-Control-Allow-Origin: *)
28
+ - Server/framework version headers enabled (X-Powered-By, Server)
29
+ - Hardcoded secrets in source code (API keys, passwords, tokens)
30
+ - Environment variables exposed via debug endpoints or error pages
31
+ - XML external entity processing enabled
32
+
33
+ ### Grep Patterns
34
+
35
+ ```
36
+ # Debug/development mode
37
+ DEBUG\s*=\s*[Tt]rue|debug\s*:\s*true|NODE_ENV.*development
38
+ poweredByHeader|x-powered-by
39
+
40
+ # Default credentials
41
+ admin.*admin|password.*password|root.*root|test.*test
42
+ default.*password|default.*credential
43
+
44
+ # Verbose errors returned to client
45
+ err\.stack|error\.stack|stackTrace|stack_trace
46
+ err\.message|error\.message|e\.getMessage
47
+
48
+ # Missing security headers
49
+ Content-Security-Policy|X-Frame-Options|X-Content-Type-Options
50
+ Strict-Transport-Security|Referrer-Policy
51
+
52
+ # Exposed environment/config
53
+ process\.env|os\.environ|System\.getenv
54
+ /debug|/health|/status|/info|/env|/actuator
55
+
56
+ # Hardcoded secrets
57
+ SECRET.*=.*['"]|API_KEY.*=.*['"]|PASSWORD.*=.*['"]
58
+ private_key|secret_key|access_token
59
+ ```
60
+
61
+ ### JavaScript / TypeScript / Node.js
62
+ - `next.config.js` with `poweredByHeader: true` or missing security headers
63
+ - Express without `helmet` middleware
64
+ - `.env` or `.env.local` files with secrets not in `.gitignore`
65
+ - Debug routes like `/api/debug` or `/api/health` exposing internal state
66
+ - `console.log` of sensitive config values
67
+ - Error handlers returning `err.stack` or `err.message` to client
68
+
69
+ ### Python (Django/Flask)
70
+ - `DEBUG = True` in production settings
71
+ - `ALLOWED_HOSTS = ['*']`
72
+ - `SECRET_KEY` hardcoded in settings.py
73
+ - Flask debug mode: `app.run(debug=True)`
74
+
75
+ ### Java (Spring)
76
+ - `spring.jpa.show-sql=true` in production
77
+ - Actuator endpoints exposed without authentication (`/actuator/env`, `/actuator/beans`)
78
+ - `server.error.include-stacktrace=always`
79
+
80
+ ## Prevention Measures
81
+
82
+ 1. Automate deployment of locked-down environments with unique credentials per environment
83
+ 2. Remove unnecessary features, components, samples, and documentation
84
+ 3. Review and update configurations with each security patch
85
+ 4. Implement segmented architecture (containerization, cloud security groups)
86
+ 5. Send security directives to clients via headers (CSP, HSTS, etc.)
87
+ 6. Automate configuration verification across all environments
88
+ 7. Centralize error handling — never expose stack traces or internal details to users
89
+ 8. Use identity federation and short-lived credentials instead of static secrets
90
+
91
+ ## Example Attack Scenarios
92
+
93
+ **Scenario 1:** Sample applications with known vulnerabilities remain on production servers. Default admin credentials unchanged.
94
+
95
+ **Scenario 2:** Directory listing enabled, allowing attackers to download compiled classes for reverse engineering.
96
+
97
+ **Scenario 3:** Detailed error messages with stack traces and component versions returned to users.
98
+
99
+ **Scenario 4:** Cloud storage defaults to public access, exposing sensitive data.
100
+
101
+ ## Fix Examples
102
+
103
+ **Before (debug endpoint exposing environment):**
104
+ ```typescript
105
+ export async function GET() {
106
+ return Response.json({
107
+ env: process.env,
108
+ nodeVersion: process.version,
109
+ uptime: process.uptime()
110
+ });
111
+ }
112
+ ```
113
+
114
+ **After (remove debug endpoint entirely, or protect it):**
115
+ ```typescript
116
+ // Delete the debug endpoint entirely in production.
117
+ // If needed for ops, protect with admin auth and filter sensitive values:
118
+ export async function GET(req) {
119
+ const session = await getAdminSession(req);
120
+ if (!session?.isAdmin) return Response.json({ error: 'Forbidden' }, { status: 403 });
121
+ return Response.json({ uptime: process.uptime(), nodeEnv: process.env.NODE_ENV });
122
+ }
123
+ ```
124
+
125
+ ## References
126
+
127
+ - [OWASP A02:2025](https://owasp.org/Top10/2025/A02_2025-Security_Misconfiguration/)
128
+ - OWASP Testing Guide: Configuration Management
129
+ - OWASP ASVS V13 Configuration
130
+ - CIS Security Configuration Guides
@@ -0,0 +1,117 @@
1
+ # A03:2025 — Software Supply Chain Failures
2
+
3
+ ## Overview
4
+
5
+ Software Supply Chain Failures is #3 in OWASP Top 10:2025. This category covers compromises in building, distributing, or updating software — vulnerabilities or malicious changes embedded in third-party code, tools, or dependencies. Notable incidents include SolarWinds (2019, 18,000 orgs compromised), Bybit ($1.5B theft, 2025), and Log4Shell (CVE-2021-44228).
6
+
7
+ ## Key CWEs
8
+
9
+ - **CWE-937**: Using Components with Known Vulnerabilities
10
+ - **CWE-1035**: Using Components from Untrusted Sources
11
+ - **CWE-1104**: Use of Unmaintained Third-Party Components
12
+ - **CWE-829**: Inclusion of Functionality from Untrusted Control Sphere
13
+ - **CWE-494**: Download of Code Without Integrity Check
14
+ - **CWE-506**: Embedded Malicious Code
15
+
16
+ ## What to Look For
17
+
18
+ ### General Patterns
19
+ - Known vulnerable dependency versions in package manifests
20
+ - Unpinned or wildcard dependency versions (`*`, `^`, `~` with major ranges)
21
+ - CDN scripts loaded without Subresource Integrity (SRI) hashes
22
+ - Missing lock files or significantly outdated lock files
23
+ - Dependencies from unofficial or untrusted registries
24
+ - No Software Bill of Materials (SBOM) tracking
25
+ - Single-person deployment without review gates
26
+ - CI/CD pipeline configs with weaker security than production
27
+ - Transitive dependencies not tracked or audited
28
+
29
+ ### Grep Patterns
30
+
31
+ ```
32
+ # Wildcard or loose versioning
33
+ "\*"|"latest"|"\^0\."
34
+ ">="|"<="|"~"
35
+
36
+ # CDN scripts without integrity
37
+ <script.*src=.*cdn|<link.*href=.*cdn
38
+ integrity=|crossorigin=
39
+
40
+ # Known vulnerable patterns (check versions)
41
+ lodash.*4\.17\.(0|1[0-1]) # prototype pollution
42
+ axios.*0\.21\.[0-1] # SSRF
43
+ jsonwebtoken.*[5-8]\. # various CVEs
44
+ log4j.*2\.(0|1[0-6]) # Log4Shell
45
+
46
+ # Package manifest files to check
47
+ package\.json|requirements\.txt|Gemfile|go\.mod|pom\.xml|Cargo\.toml|\.csproj
48
+ ```
49
+
50
+ ### JavaScript / TypeScript / Node.js
51
+ - Check `package.json` dependency versions against known CVEs
52
+ - Look for `<script src="https://cdn...">` without `integrity` attribute in HTML/JSX
53
+ - Run `npm audit` or `yarn audit` mentally — flag packages with known issues
54
+ - Check for `package-lock.json` / `yarn.lock` existence and freshness
55
+ - Flag use of deprecated packages (e.g., `request`, `querystring`)
56
+
57
+ ### Python
58
+ - Check `requirements.txt` for pinned versions with known CVEs
59
+ - Look for `pip install` without `--require-hashes`
60
+ - Check for `Pipfile.lock` or `poetry.lock`
61
+
62
+ ### Java
63
+ - Check `pom.xml` dependency versions against known CVEs
64
+ - Look for `<repository>` entries pointing to unofficial Maven repos
65
+ - Flag old Spring, Log4j, Jackson, or Apache Commons versions
66
+
67
+ ## Prevention Measures
68
+
69
+ 1. Generate and maintain Software Bill of Materials (SBOM)
70
+ 2. Track all direct and transitive dependencies
71
+ 3. Remove unused dependencies and unnecessary components
72
+ 4. Continuously monitor for CVEs (OWASP Dependency Check, Snyk, npm audit)
73
+ 5. Obtain components only from official, trusted sources via secure channels
74
+ 6. Implement Subresource Integrity (SRI) for all CDN-loaded resources
75
+ 7. Pin dependency versions and use lock files
76
+ 8. Implement staged rollouts, not simultaneous deployments
77
+ 9. Harden CI/CD pipelines with MFA and access controls
78
+ 10. Require code review for all changes before merge
79
+
80
+ ## Example Attack Scenarios
81
+
82
+ **SolarWinds (2019):** Trusted vendor infiltrated — malware propagated to 18,000 orgs via software updates.
83
+
84
+ **Log4Shell (2021):** CVE-2021-44228 in Apache Log4j enabled remote code execution, affecting millions of Java applications.
85
+
86
+ **Shai-Hulud (2025):** First self-propagating npm worm infected 500+ package versions, harvesting developer credentials.
87
+
88
+ ## Fix Examples
89
+
90
+ **Before (CDN without SRI):**
91
+ ```html
92
+ <script src="https://cdn.example.com/lib.min.js"></script>
93
+ ```
94
+
95
+ **After (CDN with SRI):**
96
+ ```html
97
+ <script src="https://cdn.example.com/lib.min.js"
98
+ integrity="sha384-abc123..."
99
+ crossorigin="anonymous"></script>
100
+ ```
101
+
102
+ **Before (loose dependency versions):**
103
+ ```json
104
+ { "lodash": "^4.17.0", "axios": "*" }
105
+ ```
106
+
107
+ **After (pinned versions, updated):**
108
+ ```json
109
+ { "lodash": "4.17.21", "axios": "1.7.2" }
110
+ ```
111
+
112
+ ## References
113
+
114
+ - [OWASP A03:2025](https://owasp.org/Top10/2025/A03_2025-Software_Supply_Chain_Failures/)
115
+ - OWASP Dependency Check / Dependency Track
116
+ - CycloneDX SBOM Standard
117
+ - OWASP ASVS: Component Verification