📦 deps(thirdparty): update snapshots
This commit is contained in:
@@ -0,0 +1,173 @@
|
||||
---
|
||||
name: infinity
|
||||
description: "Enforces a strict input boundary protocol (detect, classify, filter, verify) to ensure untrusted data never reaches business logic raw."
|
||||
risk: safe
|
||||
source: community
|
||||
date_added: "2026-06-23"
|
||||
---
|
||||
|
||||
# infinity — Input Boundary & Validation Protocol
|
||||
|
||||
## Core Philosophy
|
||||
|
||||
> Nothing untrusted ever reaches the core — it is stopped before contact. No external data touches the codebase raw. Every boundary where data enters the system must have a filter.
|
||||
|
||||
The #1 source of silent bugs, crashes, and vulnerabilities is external data that arrives in an unexpected shape and gets used directly without checking. This skill enforces a filter layer at every entry point, every time.
|
||||
|
||||
---
|
||||
|
||||
## When to Use This Skill
|
||||
|
||||
- Use when you need to handle an API response
|
||||
- Use when reading user input or adding a form handler
|
||||
- Use when working with environment variables or CLI arguments
|
||||
- Use when parsing webhooks or reading from the filesystem
|
||||
- Use when any code calls `.body`, `.params`, `.query`, `.env`, `fs.read`, or a third-party SDK response
|
||||
|
||||
---
|
||||
|
||||
## The Four Phases
|
||||
|
||||
### PHASE 1 — Boundary Detection
|
||||
|
||||
Before writing or modifying any code that involves external data, the AI must identify and list every entry point in scope:
|
||||
|
||||
- HTTP request bodies, headers, query params
|
||||
- User form inputs and UI-submitted data
|
||||
- Environment variables and config files
|
||||
- Third-party API responses
|
||||
- Webhook payloads
|
||||
- File reads from disk
|
||||
- CLI arguments
|
||||
- Database query results from external sources
|
||||
- WebSocket messages
|
||||
|
||||
> **The AI must not write any data-handling logic until every entry point in scope is listed.**
|
||||
|
||||
---
|
||||
|
||||
### PHASE 2 — Classify Each Input
|
||||
|
||||
For every entry point identified, the AI classifies it into one of three trust levels:
|
||||
|
||||
| Level | Definition | Examples |
|
||||
|---|---|---|
|
||||
| `TRUSTED` | Internal constants, hardcoded values, your own compile-time config | Enum values, hardcoded defaults, internal constants |
|
||||
| `SEMI-TRUSTED` | Your own internal services, internal APIs, controlled infrastructure | Internal microservice responses, your own database reads |
|
||||
| `UNTRUSTED` | Anything from users, the internet, third parties, or the filesystem | User input, external API responses, uploaded files, env vars, CLI args |
|
||||
|
||||
> **Rule:** `TRUSTED` inputs may be used directly. `SEMI-TRUSTED` and `UNTRUSTED` inputs must pass through a filter layer before any use.
|
||||
|
||||
The AI outputs this classification before writing any handling code:
|
||||
|
||||
```
|
||||
INFINITY — BOUNDARY MAP
|
||||
─────────────────────────────────────────
|
||||
Entry Point | Trust Level | Filter Required
|
||||
─────────────────────────────────────────
|
||||
req.body.email | UNTRUSTED | ✓ format + sanitize
|
||||
process.env.API_KEY | UNTRUSTED | ✓ presence + non-empty
|
||||
internalService.getData()| SEMI-TRUSTED | ✓ schema validate
|
||||
PAGINATION_LIMIT = 20 | TRUSTED | ✗ none needed
|
||||
─────────────────────────────────────────
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### PHASE 3 — Mandatory Filter Layer
|
||||
|
||||
Every `UNTRUSTED` and `SEMI-TRUSTED` input must pass through validation before it reaches any business logic, storage, or rendering. The AI must apply the right filter type for the right context:
|
||||
|
||||
**Type Checking**
|
||||
- Verify the input is the expected type before using it
|
||||
- Never assume a string is a string, a number is a number, or an array is an array
|
||||
|
||||
**Schema Validation**
|
||||
- For objects and API responses, validate shape before accessing nested fields
|
||||
- If a required field is missing, reject — do not use a fallback that hides the problem
|
||||
|
||||
**Sanitization**
|
||||
- Strip or escape content before rendering to UI (prevent XSS)
|
||||
- Normalize strings before storage (trim whitespace, consistent casing where appropriate)
|
||||
|
||||
**Presence & Format Checks**
|
||||
- Env vars: must exist and be non-empty before use
|
||||
- IDs and tokens: must match expected format before use
|
||||
|
||||
**Rejection Rule**
|
||||
- On invalid input: reject explicitly and return a clear error
|
||||
- Never silently use bad data with a fallback
|
||||
- Never let bad data pass through to fix itself "downstream"
|
||||
|
||||
```
|
||||
// WRONG — using raw input directly
|
||||
const user = await db.find(req.params.id);
|
||||
|
||||
// RIGHT — validate before use
|
||||
const id = req.params.id;
|
||||
if (!id || typeof id !== 'string' || !isValidUUID(id)) {
|
||||
return res.status(400).json({ error: 'Invalid ID format' });
|
||||
}
|
||||
const user = await db.find(id);
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### PHASE 4 — Self-Check Before Done
|
||||
|
||||
Before the AI declares any data-handling code complete, it traces each entry point and confirms:
|
||||
|
||||
```
|
||||
INFINITY — VERIFICATION
|
||||
─────────────────────────────────────────
|
||||
Entry Point | Filter Exists | Filter Type
|
||||
─────────────────────────────────────────
|
||||
req.body.email | ✓ YES | format + sanitize
|
||||
process.env.API_KEY | ✓ YES | presence check
|
||||
internalService.getData()| ✓ YES | schema validation
|
||||
─────────────────────────────────────────
|
||||
Unfiltered inputs reaching logic: NONE ✓
|
||||
─────────────────────────────────────────
|
||||
```
|
||||
|
||||
If any `UNTRUSTED` or `SEMI-TRUSTED` input reaches logic, storage, or rendering without a filter — the AI flags it. It does not silently pass.
|
||||
|
||||
---
|
||||
|
||||
## Hard Rules (Never Violated)
|
||||
|
||||
- **No raw external data in business logic.** Ever.
|
||||
- **No silent fallbacks on bad input.** Reject explicitly.
|
||||
- **No assuming shape.** Even if the API "always" returns a string — validate it.
|
||||
- **No skipping env var checks.** Missing env vars must fail loudly at startup, not silently at runtime.
|
||||
- **No partial filtering.** If you validate presence but not format, it is not filtered.
|
||||
- **No filtering in the wrong place.** Filters go at the entry point — not somewhere downstream after the data has already been used once.
|
||||
|
||||
---
|
||||
|
||||
## What This Skill Prevents
|
||||
|
||||
- SQL injection via unvalidated query params
|
||||
- Crashes from unexpected API response shapes
|
||||
- XSS from unescaped user content rendered to UI
|
||||
- Silent failures from missing env variables discovered at runtime
|
||||
- Type errors from assuming external data matches expected shape
|
||||
- Security vulnerabilities from untrusted data reaching sensitive operations
|
||||
|
||||
---
|
||||
|
||||
## Quick Reference
|
||||
|
||||
| Phase | Action | Writes Code? |
|
||||
|---|---|---|
|
||||
| 1 — Detect | List all entry points in scope | ❌ No |
|
||||
| 2 — Classify | Assign trust level to each input | ❌ No |
|
||||
| 3 — Filter | Write filter layer for all UNTRUSTED + SEMI-TRUSTED | ✅ Yes |
|
||||
| 4 — Verify | Trace each input, confirm filter exists | ❌ No |
|
||||
|
||||
---
|
||||
|
||||
## Limitations
|
||||
|
||||
- Does not apply to purely internal logic with no external data involvement.
|
||||
- May add verbosity to trivial scripts where strict validation is not required.
|
||||
Generated
+17
-13
@@ -8,10 +8,10 @@
|
||||
"name": "todo-app-backend",
|
||||
"version": "1.0.0",
|
||||
"dependencies": {
|
||||
"better-sqlite3": "^12.8.0",
|
||||
"cors": "^2.8.5",
|
||||
"better-sqlite3": "^12.10.0",
|
||||
"cors": "^2.8.6",
|
||||
"express": "^4.18.2",
|
||||
"express-rate-limit": "^8.5.1",
|
||||
"express-rate-limit": "^8.5.2",
|
||||
"ip-address": "^10.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
@@ -303,9 +303,9 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/better-sqlite3": {
|
||||
"version": "12.8.0",
|
||||
"resolved": "https://registry.npmjs.org/better-sqlite3/-/better-sqlite3-12.8.0.tgz",
|
||||
"integrity": "sha512-RxD2Vd96sQDjQr20kdP+F+dK/1OUNiVOl200vKBZY8u0vTwysfolF6Hq+3ZK2+h8My9YvZhHsF+RSGZW2VYrPQ==",
|
||||
"version": "12.10.0",
|
||||
"resolved": "https://registry.npmjs.org/better-sqlite3/-/better-sqlite3-12.10.0.tgz",
|
||||
"integrity": "sha512-CyzaZRQKyHkB2ZInfTTl2nvT33EbDpjkLEbE8/Zck3Ll6O0qqvuGdrJ45HgtH+HykRg88ITY3AdreBGN70aBSQ==",
|
||||
"hasInstallScript": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
@@ -313,7 +313,7 @@
|
||||
"prebuild-install": "^7.1.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": "20.x || 22.x || 23.x || 24.x || 25.x"
|
||||
"node": "20.x || 22.x || 23.x || 24.x || 25.x || 26.x"
|
||||
}
|
||||
},
|
||||
"node_modules/bindings": {
|
||||
@@ -459,9 +459,9 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/cors": {
|
||||
"version": "2.8.5",
|
||||
"resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz",
|
||||
"integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==",
|
||||
"version": "2.8.6",
|
||||
"resolved": "https://registry.npmjs.org/cors/-/cors-2.8.6.tgz",
|
||||
"integrity": "sha512-tJtZBBHA6vjIAaF6EnIaq6laBBP9aq/Y3ouVJjEfoHbRBcHBAHYcMh/w8LDrk2PvIMMq8gmopa5D4V8RmbrxGw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"object-assign": "^4",
|
||||
@@ -469,6 +469,10 @@
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.10"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/express"
|
||||
}
|
||||
},
|
||||
"node_modules/create-require": {
|
||||
@@ -688,9 +692,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/express-rate-limit": {
|
||||
"version": "8.5.1",
|
||||
"resolved": "https://registry.npmjs.org/express-rate-limit/-/express-rate-limit-8.5.1.tgz",
|
||||
"integrity": "sha512-5O6KYmyJEpuPJV5hNTXKbAHWRqrzyu+OI3vUnSd2kXFubIVpG7ezpgxQy76Zo5GQZtrQBg86hF+CM/NX+cioiQ==",
|
||||
"version": "8.5.2",
|
||||
"resolved": "https://registry.npmjs.org/express-rate-limit/-/express-rate-limit-8.5.2.tgz",
|
||||
"integrity": "sha512-5Kb34ipNX694DH48vN9irak1Qx30nb0PLYHXfJgw4YEjiC3ZEmZJhwOp+VfiCYwFzvFTdB9QkArYS5kXa2cx2A==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"ip-address": "^10.2.0"
|
||||
|
||||
+3
-3
@@ -9,10 +9,10 @@
|
||||
"dev": "ts-node src/index.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"better-sqlite3": "^12.8.0",
|
||||
"cors": "^2.8.5",
|
||||
"better-sqlite3": "^12.10.0",
|
||||
"cors": "^2.8.6",
|
||||
"express": "^4.18.2",
|
||||
"express-rate-limit": "^8.5.1",
|
||||
"express-rate-limit": "^8.5.2",
|
||||
"ip-address": "^10.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
Reference in New Issue
Block a user