contextos-agents 2.3.0 → 2.3.2
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.
- package/.agents/adapters/cursor/export.js +3 -27
- package/.agents/adapters/gemini/export.js +5 -7
- package/.agents/adapters/shared.js +14 -1
- package/.agents/adapters/zed/export.js +4 -16
- package/.agents/compiled/registry.v2.json +33 -33
- package/.agents/compiled/registry.v2.sha256 +1 -1
- package/.agents/compiler/manifest-compiler.js +8 -5
- package/.agents/core/skills/context-manager/EXAMPLES.md +5 -17
- package/.agents/core/skills/context-manager/SKILL.md +10 -100
- package/.agents/core/skills/context-manager/TROUBLESHOOTING.md +6 -6
- package/.agents/core/skills/context-manager/VALIDATION.json +115 -4
- package/.agents/core/skills/context-manager/references/context-rules.md +3 -57
- package/.agents/core/skills/context-manager/skill.yaml +1 -3
- package/.agents/core/skills/context-os/EXAMPLES.md +25 -15
- package/.agents/core/skills/context-os/SKILL.md +12 -135
- package/.agents/core/skills/context-os/TROUBLESHOOTING.md +11 -6
- package/.agents/core/skills/context-os/VALIDATION.json +115 -4
- package/.agents/core/skills/context-os/packs.yaml +10 -59
- package/.agents/core/skills/context-os/references/context-rules.md +27 -59
- package/.agents/core/skills/context-os/references/pipeline.md +14 -119
- package/.agents/core/skills/context-os/references/project-graph.md +11 -100
- package/.agents/core/skills/context-os/rules.yaml +8 -135
- package/.agents/core/skills/engineering-workflow/EXAMPLES.md +15 -50
- package/.agents/core/skills/engineering-workflow/SKILL.md +10 -10
- package/.agents/core/skills/engineering-workflow/TROUBLESHOOTING.md +11 -19
- package/.agents/core/skills/engineering-workflow/VALIDATION.json +115 -4
- package/.agents/core/skills/engineering-workflow/references/workflow.md +55 -317
- package/.agents/core/skills/gemini-precision/EXAMPLES.md +33 -53
- package/.agents/core/skills/gemini-precision/SKILL.md +11 -147
- package/.agents/core/skills/gemini-precision/TROUBLESHOOTING.md +12 -25
- package/.agents/core/skills/gemini-precision/VALIDATION.json +115 -4
- package/.agents/core/skills/gemini-precision/skill.yaml +1 -1
- package/.agents/core/skills/gstack-roles/EXAMPLES.md +5 -21
- package/.agents/core/skills/gstack-roles/SKILL.md +10 -12
- package/.agents/core/skills/gstack-roles/TROUBLESHOOTING.md +6 -12
- package/.agents/core/skills/gstack-roles/VALIDATION.json +115 -4
- package/.agents/core/skills/gstack-roles/references/roles.md +3 -147
- package/.agents/core/skills/ponytail-mindset/EXAMPLES.md +12 -45
- package/.agents/core/skills/ponytail-mindset/SKILL.md +10 -13
- package/.agents/core/skills/ponytail-mindset/TROUBLESHOOTING.md +10 -19
- package/.agents/core/skills/ponytail-mindset/VALIDATION.json +115 -4
- package/.agents/core/skills/ponytail-mindset/references/minimalism.md +58 -174
- package/.agents/core/skills/security/EXAMPLES.md +19 -55
- package/.agents/core/skills/security/SKILL.md +61 -137
- package/.agents/core/skills/security/TROUBLESHOOTING.md +13 -19
- package/.agents/core/skills/security/VALIDATION.json +115 -4
- package/.agents/core/skills/security/skill.yaml +1 -1
- package/.agents/generated/claude/skills/context-manager/EXAMPLES.md +5 -17
- package/.agents/generated/claude/skills/context-manager/SKILL.md +9 -96
- package/.agents/generated/claude/skills/context-manager/TROUBLESHOOTING.md +6 -6
- package/.agents/generated/claude/skills/context-manager/VALIDATION.json +115 -4
- package/.agents/generated/claude/skills/context-manager/references/context-rules.md +3 -57
- package/.agents/generated/claude/skills/context-os/EXAMPLES.md +25 -15
- package/.agents/generated/claude/skills/context-os/SKILL.md +11 -133
- package/.agents/generated/claude/skills/context-os/TROUBLESHOOTING.md +11 -6
- package/.agents/generated/claude/skills/context-os/VALIDATION.json +115 -4
- package/.agents/generated/claude/skills/context-os/packs.yaml +10 -59
- package/.agents/generated/claude/skills/context-os/references/context-rules.md +27 -59
- package/.agents/generated/claude/skills/context-os/references/pipeline.md +14 -119
- package/.agents/generated/claude/skills/context-os/references/project-graph.md +11 -100
- package/.agents/generated/claude/skills/context-os/rules.yaml +8 -135
- package/.agents/generated/claude/skills/engineering-workflow/EXAMPLES.md +15 -50
- package/.agents/generated/claude/skills/engineering-workflow/SKILL.md +9 -9
- package/.agents/generated/claude/skills/engineering-workflow/TROUBLESHOOTING.md +11 -19
- package/.agents/generated/claude/skills/engineering-workflow/VALIDATION.json +115 -4
- package/.agents/generated/claude/skills/engineering-workflow/references/workflow.md +55 -317
- package/.agents/generated/claude/skills/gemini-precision/EXAMPLES.md +33 -53
- package/.agents/generated/claude/skills/gemini-precision/SKILL.md +10 -143
- package/.agents/generated/claude/skills/gemini-precision/TROUBLESHOOTING.md +12 -25
- package/.agents/generated/claude/skills/gemini-precision/VALIDATION.json +115 -4
- package/.agents/generated/claude/skills/gstack-roles/EXAMPLES.md +5 -21
- package/.agents/generated/claude/skills/gstack-roles/SKILL.md +9 -11
- package/.agents/generated/claude/skills/gstack-roles/TROUBLESHOOTING.md +6 -12
- package/.agents/generated/claude/skills/gstack-roles/VALIDATION.json +115 -4
- package/.agents/generated/claude/skills/gstack-roles/references/roles.md +3 -147
- package/.agents/generated/claude/skills/ponytail-mindset/EXAMPLES.md +12 -45
- package/.agents/generated/claude/skills/ponytail-mindset/SKILL.md +9 -12
- package/.agents/generated/claude/skills/ponytail-mindset/TROUBLESHOOTING.md +10 -19
- package/.agents/generated/claude/skills/ponytail-mindset/VALIDATION.json +115 -4
- package/.agents/generated/claude/skills/ponytail-mindset/references/minimalism.md +58 -174
- package/.agents/generated/claude/skills/security/EXAMPLES.md +19 -55
- package/.agents/generated/claude/skills/security/SKILL.md +60 -134
- package/.agents/generated/claude/skills/security/TROUBLESHOOTING.md +13 -19
- package/.agents/generated/claude/skills/security/VALIDATION.json +115 -4
- package/.agents/generated/gemini/skills/context-manager/EXAMPLES.md +5 -17
- package/.agents/generated/gemini/skills/context-manager/SKILL.md +10 -99
- package/.agents/generated/gemini/skills/context-manager/TROUBLESHOOTING.md +6 -6
- package/.agents/generated/gemini/skills/context-manager/VALIDATION.json +115 -4
- package/.agents/generated/gemini/skills/context-manager/references/context-rules.md +3 -57
- package/.agents/generated/gemini/skills/context-os/EXAMPLES.md +25 -15
- package/.agents/generated/gemini/skills/context-os/SKILL.md +12 -135
- package/.agents/generated/gemini/skills/context-os/TROUBLESHOOTING.md +11 -6
- package/.agents/generated/gemini/skills/context-os/VALIDATION.json +115 -4
- package/.agents/generated/gemini/skills/context-os/packs.yaml +10 -59
- package/.agents/generated/gemini/skills/context-os/references/context-rules.md +27 -59
- package/.agents/generated/gemini/skills/context-os/references/pipeline.md +14 -119
- package/.agents/generated/gemini/skills/context-os/references/project-graph.md +11 -100
- package/.agents/generated/gemini/skills/context-os/rules.yaml +8 -135
- package/.agents/generated/gemini/skills/engineering-workflow/EXAMPLES.md +15 -50
- package/.agents/generated/gemini/skills/engineering-workflow/SKILL.md +10 -11
- package/.agents/generated/gemini/skills/engineering-workflow/TROUBLESHOOTING.md +11 -19
- package/.agents/generated/gemini/skills/engineering-workflow/VALIDATION.json +115 -4
- package/.agents/generated/gemini/skills/engineering-workflow/references/workflow.md +55 -317
- package/.agents/generated/gemini/skills/gemini-precision/EXAMPLES.md +33 -53
- package/.agents/generated/gemini/skills/gemini-precision/SKILL.md +11 -145
- package/.agents/generated/gemini/skills/gemini-precision/TROUBLESHOOTING.md +12 -25
- package/.agents/generated/gemini/skills/gemini-precision/VALIDATION.json +115 -4
- package/.agents/generated/gemini/skills/gstack-roles/EXAMPLES.md +5 -21
- package/.agents/generated/gemini/skills/gstack-roles/SKILL.md +10 -13
- package/.agents/generated/gemini/skills/gstack-roles/TROUBLESHOOTING.md +6 -12
- package/.agents/generated/gemini/skills/gstack-roles/VALIDATION.json +115 -4
- package/.agents/generated/gemini/skills/gstack-roles/references/roles.md +3 -147
- package/.agents/generated/gemini/skills/ponytail-mindset/EXAMPLES.md +12 -45
- package/.agents/generated/gemini/skills/ponytail-mindset/SKILL.md +10 -14
- package/.agents/generated/gemini/skills/ponytail-mindset/TROUBLESHOOTING.md +10 -19
- package/.agents/generated/gemini/skills/ponytail-mindset/VALIDATION.json +115 -4
- package/.agents/generated/gemini/skills/ponytail-mindset/references/minimalism.md +58 -174
- package/.agents/generated/gemini/skills/security/EXAMPLES.md +19 -55
- package/.agents/generated/gemini/skills/security/SKILL.md +61 -136
- package/.agents/generated/gemini/skills/security/TROUBLESHOOTING.md +13 -19
- package/.agents/generated/gemini/skills/security/VALIDATION.json +115 -4
- package/.agents/resolver/canonical-resolver.js +34 -21
- package/.agents/rules/rule-catalog.js +5 -5
- package/.agents/validate.js +9 -2
- package/.agents/validation-evidence.js +89 -0
- package/README.md +132 -197
- package/bin/index.js +1 -1
- package/catalog/skills/typescript/SKILL.md +16 -2
- package/package.json +90 -89
|
@@ -2,178 +2,104 @@
|
|
|
2
2
|
|
|
3
3
|
## Overview
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Protect application and agent trust boundaries. These instructions guide work;
|
|
6
|
+
automated checkers enforce only their explicitly tested scope.
|
|
6
7
|
|
|
7
8
|
## When to Use
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
Authentication, authorization, protected data, inputs, cryptography, external
|
|
11
|
+
requests, payments, destructive actions, and tool execution.
|
|
10
12
|
|
|
11
13
|
## Rules & Patterns
|
|
12
14
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
#### 2. Broken Object Level Authorization (BOLA / IDOR)
|
|
33
|
-
|
|
34
|
-
- Validate user ownership on EVERY database read, update, or delete:
|
|
35
|
-
|
|
36
|
-
```typescript
|
|
37
|
-
// [GOOD] Scoped to authenticated user
|
|
38
|
-
const doc = await db.document.findFirst({
|
|
39
|
-
where: { id: documentId, tenantId: session.tenantId }
|
|
40
|
-
});
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
#### 3. Broken Authentication & Session Management
|
|
44
|
-
|
|
45
|
-
- Use Argon2id or bcrypt (cost factor ≥ 12) for password hashing.
|
|
46
|
-
- Short-lived access tokens (15 min) + secure HTTP-only refresh tokens.
|
|
47
|
-
- Enforce rate limiting and brute-force lockouts on auth endpoints.
|
|
48
|
-
|
|
49
|
-
#### 4. SSRF (Server-Side Request Forgery)
|
|
50
|
-
|
|
51
|
-
- Restrict server-side URL fetching: validate URL scheme (`https:` only), resolve IP, and block private CIDR blocks (`10.0.0.0/8`, `127.0.0.0/8`, `169.254.0.0/16`, `192.168.0.0/16`).
|
|
52
|
-
|
|
53
|
-
#### 5. Security Misconfiguration & Headers
|
|
54
|
-
|
|
55
|
-
Enforce modern production security headers:
|
|
56
|
-
|
|
57
|
-
```http
|
|
58
|
-
Content-Security-Policy: default-src 'self'
|
|
59
|
-
X-Content-Type-Options: nosniff
|
|
60
|
-
X-Frame-Options: DENY
|
|
61
|
-
Strict-Transport-Security: max-age=31536000; includeSubDomains
|
|
62
|
-
Referrer-Policy: strict-origin-when-cross-origin
|
|
63
|
-
Permissions-Policy: camera=(), microphone=(), geolocation=()
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
---
|
|
67
|
-
|
|
68
|
-
### AI Agent & LLM Security Invariants
|
|
69
|
-
|
|
70
|
-
When building AI workflows, tools, or MCP servers:
|
|
71
|
-
|
|
72
|
-
1. **Prompt Injection Defense**:
|
|
73
|
-
- Clearly delineate untrusted user/web content using boundary markers (e.g. `<untrusted_content>` tags).
|
|
74
|
-
- Never allow untrusted content to override system instructions or tool execution permissions.
|
|
75
|
-
2. **Tool Execution Boundaries**:
|
|
76
|
-
- Destructive operations (database drops, file deletions, payment triggers) MUST require explicit user confirmation.
|
|
77
|
-
- Restrict file system tools to the workspace root - block directory traversal (`../`).
|
|
78
|
-
3. **Secret Masking & Output Sanitization**:
|
|
79
|
-
- Scrub API keys (`sk-...`, `Bearer ...`), tokens, and credentials before writing to agent logs or step summaries.
|
|
80
|
-
4. **Sandbox Execution & Write Isolation (Supply-Chain Defense)**:
|
|
81
|
-
- Target code is inspected strictly read-only; never execute target-controlled builds or tests with write access to the repository root.
|
|
82
|
-
- Restrict process write boundaries strictly to an isolated temporary `scratch/` directory.
|
|
83
|
-
- Enforce zero outbound external network access during security audits to prevent secret exfiltration via malicious scripts or dependencies.
|
|
84
|
-
- Promote verified non-secret results to retained `artifacts/` only via trusted parent-side inspection code.
|
|
85
|
-
|
|
86
|
-
---
|
|
15
|
+
- Obtain identity from trusted authentication. Enforce ownership/tenant policy
|
|
16
|
+
before protected reads or mutations; client IDs are not authorization.
|
|
17
|
+
- Validate boundary inputs and reject unknown privilege fields. Parameterize
|
|
18
|
+
queries and encode output for its context; avoid shell interpolation. An ORM
|
|
19
|
+
does not secure interpolated raw SQL.
|
|
20
|
+
- Keep credentials out of source, logs, arguments, and client bundles. Use
|
|
21
|
+
established password/session libraries and cookie, CSRF, origin, and TLS
|
|
22
|
+
policies appropriate to the threat model.
|
|
23
|
+
- Use constant-time primitives for secret comparisons. Surrounding code and
|
|
24
|
+
length handling matter; the whole flow is not necessarily constant-time.
|
|
25
|
+
- External content remains untrusted data. Delimit it and preserve instruction
|
|
26
|
+
and tool authority; markers alone do not prevent prompt injection.
|
|
27
|
+
- Existing authorization carries forward. For destructive actions verify it
|
|
28
|
+
covers the actual target and effect; ask only for missing authority.
|
|
29
|
+
- For untrusted repositories/dependency scripts, inspect before execution,
|
|
30
|
+
isolate writes, withhold credentials, and restrict network access. Ordinary
|
|
31
|
+
authorized development uses relevant project checks. State actual sandbox
|
|
32
|
+
capabilities instead of claiming isolation the tools do not provide.
|
|
87
33
|
|
|
88
34
|
## Code Examples
|
|
89
35
|
|
|
36
|
+
### Timing-safe webhook signature comparison
|
|
90
37
|
|
|
91
|
-
|
|
38
|
+
This runnable block verifies SHA-256 hexadecimal HMAC signatures. Timestamp,
|
|
39
|
+
replay protection, raw-body capture, and provider formats are separate requirements.
|
|
92
40
|
|
|
41
|
+
<!-- example: security-hmac -->
|
|
93
42
|
```javascript
|
|
94
43
|
import crypto from 'node:crypto';
|
|
95
44
|
|
|
96
45
|
export function verifyWebhookSignature(payload, signature, secret) {
|
|
97
|
-
|
|
98
|
-
const digest =
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
if (digest.length !== sigBuffer.length) return false;
|
|
102
|
-
return crypto.timingSafeEqual(digest, sigBuffer);
|
|
46
|
+
if (typeof signature !== 'string' || !/^[a-f0-9]{64}$/i.test(signature)) return false;
|
|
47
|
+
const digest = crypto.createHmac('sha256', secret).update(payload).digest();
|
|
48
|
+
const received = Buffer.from(signature, 'hex');
|
|
49
|
+
return digest.length === received.length && crypto.timingSafeEqual(digest, received);
|
|
103
50
|
}
|
|
104
51
|
```
|
|
105
52
|
|
|
106
|
-
###
|
|
53
|
+
### Restricted partner URL fetch
|
|
107
54
|
|
|
108
|
-
|
|
55
|
+
Follow the [OWASP SSRF guidance](https://cheatsheetseries.owasp.org/cheatsheets/Server_Side_Request_Forgery_Prevention_Cheat_Sheet.html).
|
|
56
|
+
A hostname check followed by ordinary DNS resolution is not a complete SSRF
|
|
57
|
+
boundary. Use a trusted egress transport/proxy that validates IPv4/IPv6 addresses
|
|
58
|
+
at connection time and blocks private, loopback, link-local, and metadata targets,
|
|
59
|
+
including DNS changes. Arbitrary URL fetchers need a separate network policy;
|
|
60
|
+
this sample covers known partner hostnames.
|
|
109
61
|
|
|
110
|
-
|
|
62
|
+
Supply that trusted transport explicitly. This block checks URL syntax, HTTPS,
|
|
63
|
+
credentials, port 443, a trusted hostname allowlist, and redirect policy. There
|
|
64
|
+
is no ambient fetch fallback. Local tests inject a controlled transport; they
|
|
65
|
+
do not verify production egress or DNS behavior.
|
|
111
66
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
4. **Protocol & Credential Restrictions**: Enforce `https:` exclusively; reject embedded credentials (`user:pass@host`) and non-standard ports.
|
|
116
|
-
|
|
117
|
-
```typescript
|
|
118
|
-
/**
|
|
119
|
-
* Verified Allowlist-based HTTP Client (OWASP SSRF Prevention)
|
|
120
|
-
* Enforces HTTPS, strict destination allowlist, and rejects HTTP redirects.
|
|
121
|
-
*/
|
|
122
|
-
export async function fetchFromAllowlist(
|
|
123
|
-
urlString: string,
|
|
124
|
-
allowedHostnames: ReadonlySet<string>,
|
|
125
|
-
options: RequestInit = {}
|
|
126
|
-
): Promise<Response> {
|
|
67
|
+
<!-- example: security-ssrf -->
|
|
68
|
+
```javascript
|
|
69
|
+
export async function fetchFromAllowlist(urlString, allowedHostnames, options, transport) {
|
|
127
70
|
const parsed = new URL(urlString);
|
|
128
|
-
|
|
129
|
-
// 1. Enforce HTTPS only
|
|
130
71
|
if (parsed.protocol !== 'https:') {
|
|
131
|
-
throw new Error(
|
|
72
|
+
throw new Error('SSRF blocked: protocol "' + parsed.protocol + '" is not permitted; HTTPS required');
|
|
132
73
|
}
|
|
133
|
-
|
|
134
|
-
// 2. Reject credentials in URL
|
|
135
74
|
if (parsed.username || parsed.password) {
|
|
136
75
|
throw new Error('SSRF blocked: URL credentials (user:password@host) are prohibited');
|
|
137
76
|
}
|
|
138
|
-
|
|
139
|
-
// 3. Strict positive destination allowlist (prevents internal network probing)
|
|
77
|
+
if (parsed.port && parsed.port !== '443') throw new Error('SSRF blocked: non-standard port');
|
|
140
78
|
const normalizedHost = parsed.hostname.toLowerCase();
|
|
141
79
|
if (!allowedHostnames.has(normalizedHost)) {
|
|
142
|
-
throw new Error(
|
|
80
|
+
throw new Error('SSRF blocked: destination host "' + normalizedHost + '" is not in the approved allowlist');
|
|
143
81
|
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
return fetch(urlString, {
|
|
147
|
-
...options,
|
|
148
|
-
redirect: 'error'
|
|
149
|
-
});
|
|
82
|
+
if (typeof transport !== 'function') throw new TypeError('Trusted egress transport required');
|
|
83
|
+
return transport(parsed.href, { ...options, redirect: 'error' });
|
|
150
84
|
}
|
|
151
85
|
```
|
|
152
86
|
|
|
153
|
-
---
|
|
154
|
-
|
|
155
87
|
## Validation Checklist
|
|
156
88
|
|
|
157
|
-
- [ ]
|
|
158
|
-
- [ ]
|
|
159
|
-
- [ ]
|
|
160
|
-
- [ ]
|
|
161
|
-
- [ ]
|
|
162
|
-
- [ ] No secrets or tokens checked into source control or exposed in logs.
|
|
163
|
-
|
|
164
|
-
---
|
|
89
|
+
- [ ] Allowed and denied identity/tenant cases are checked before data access.
|
|
90
|
+
- [ ] Invalid and unknown inputs never reach protected persistence.
|
|
91
|
+
- [ ] Secrets and production errors preserve their boundaries.
|
|
92
|
+
- [ ] External requests and tool policies are checked at the stated scope.
|
|
93
|
+
- [ ] Commands, results, unrun checks, and limitations are reported.
|
|
165
94
|
|
|
166
95
|
## Common Mistakes
|
|
167
96
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
- **Unvalidated redirects / URLs**: Allowing arbitrary URLs in redirect or fetch parameters.
|
|
172
|
-
|
|
173
|
-
---
|
|
97
|
+
Treating an allowlist as network isolation; comparing role labels instead of
|
|
98
|
+
permissions; passing client payloads into persistence; interpreting a secret scan
|
|
99
|
+
or document validator as a complete application security audit.
|
|
174
100
|
|
|
175
101
|
## Integration Notes
|
|
176
102
|
|
|
177
|
-
-
|
|
178
|
-
|
|
179
|
-
|
|
103
|
+
Use engineering-workflow's proportional verification and existing authority.
|
|
104
|
+
The staged scanner needs --placeholders for stubs and --scope with a real scope
|
|
105
|
+
JSON file for write boundaries. Validate does not replace either check.
|
|
@@ -1,19 +1,13 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
-
|
|
6
|
-
|
|
7
|
-
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
## 3. Storing Sensitive Secrets in Git or Client Bundles
|
|
16
|
-
|
|
17
|
-
- **Symptom**: API keys or JWT signing secrets exposed publicly.
|
|
18
|
-
- **Root Cause**: Hardcoding secrets in source files or prefixing server secrets with NEXT_PUBLIC_.
|
|
19
|
-
- **Fix**: Store all secrets in server-only environment variables; add git-secrets to pre-commit hooks.
|
|
1
|
+
# Security troubleshooting
|
|
2
|
+
|
|
3
|
+
- IDOR/BOLA: verify denied users/tenants before persistence and require the action
|
|
4
|
+
permission, not merely an object ID.
|
|
5
|
+
- SQL/shell interpolation: use parameters or safe argument APIs. Schema checks
|
|
6
|
+
alone do not repair command interpolation.
|
|
7
|
+
- SSRF: DNS prechecks followed by ambient fetch can resolve again; verify the
|
|
8
|
+
connection-time transport policy, A/AAAA results, and redirects.
|
|
9
|
+
- Untrusted scripts: inspect/isolate without credentials; state actual controls.
|
|
10
|
+
- Authority: confirm targets/effects against existing permission instead of
|
|
11
|
+
asking again merely because a phase changed.
|
|
12
|
+
- Green scan: inspect enabled flags, staged files, scope input, and exclusions.
|
|
13
|
+
Results do not prove all security invariants or unstaged code.
|
|
@@ -1,12 +1,123 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"x-contextos-evidence-contract": 1,
|
|
4
|
+
"title": "Scoped verification evidence",
|
|
5
|
+
"description": "Report shape and outcome consistency only; command execution and agent behavior require separate evidence.",
|
|
3
6
|
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"required": [
|
|
9
|
+
"status",
|
|
10
|
+
"checks",
|
|
11
|
+
"limitations"
|
|
12
|
+
],
|
|
4
13
|
"properties": {
|
|
5
|
-
"
|
|
6
|
-
"
|
|
14
|
+
"status": {
|
|
15
|
+
"enum": [
|
|
16
|
+
"verified",
|
|
17
|
+
"partial",
|
|
18
|
+
"not_run"
|
|
19
|
+
]
|
|
20
|
+
},
|
|
21
|
+
"checks": {
|
|
22
|
+
"type": "array",
|
|
23
|
+
"items": {
|
|
24
|
+
"type": "object",
|
|
25
|
+
"additionalProperties": false,
|
|
26
|
+
"required": [
|
|
27
|
+
"command",
|
|
28
|
+
"exitCode",
|
|
29
|
+
"scope"
|
|
30
|
+
],
|
|
31
|
+
"properties": {
|
|
32
|
+
"command": {
|
|
33
|
+
"type": "string",
|
|
34
|
+
"minLength": 1
|
|
35
|
+
},
|
|
36
|
+
"exitCode": {
|
|
37
|
+
"type": [
|
|
38
|
+
"integer",
|
|
39
|
+
"null"
|
|
40
|
+
]
|
|
41
|
+
},
|
|
42
|
+
"scope": {
|
|
43
|
+
"type": "string",
|
|
44
|
+
"minLength": 1
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"limitations": {
|
|
50
|
+
"type": "array",
|
|
51
|
+
"items": {
|
|
52
|
+
"type": "string",
|
|
53
|
+
"minLength": 1
|
|
54
|
+
}
|
|
7
55
|
}
|
|
8
56
|
},
|
|
9
|
-
"
|
|
10
|
-
|
|
57
|
+
"allOf": [
|
|
58
|
+
{
|
|
59
|
+
"if": {
|
|
60
|
+
"properties": {
|
|
61
|
+
"status": {
|
|
62
|
+
"const": "verified"
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
"then": {
|
|
67
|
+
"properties": {
|
|
68
|
+
"checks": {
|
|
69
|
+
"minItems": 1,
|
|
70
|
+
"items": {
|
|
71
|
+
"properties": {
|
|
72
|
+
"exitCode": {
|
|
73
|
+
"const": 0
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"if": {
|
|
83
|
+
"properties": {
|
|
84
|
+
"status": {
|
|
85
|
+
"enum": [
|
|
86
|
+
"partial",
|
|
87
|
+
"not_run"
|
|
88
|
+
]
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
"then": {
|
|
93
|
+
"properties": {
|
|
94
|
+
"limitations": {
|
|
95
|
+
"minItems": 1
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"if": {
|
|
102
|
+
"properties": {
|
|
103
|
+
"status": {
|
|
104
|
+
"const": "not_run"
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
"then": {
|
|
109
|
+
"properties": {
|
|
110
|
+
"checks": {
|
|
111
|
+
"items": {
|
|
112
|
+
"properties": {
|
|
113
|
+
"exitCode": {
|
|
114
|
+
"type": "null"
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
11
122
|
]
|
|
12
123
|
}
|
|
@@ -1,19 +1,7 @@
|
|
|
1
|
-
# context-manager
|
|
1
|
+
# context-manager compatibility examples
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Use the canonical [context-os](../context-os/SKILL.md). An explicit resolver
|
|
4
|
+
request for context-manager redirects to context-os; the warning explains the mapping.
|
|
5
|
+
A directly loaded alias should follow the same canonical instructions.
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
```text
|
|
8
|
-
Agent reads all 180 files in src/ into context to debug a single button click handler.
|
|
9
|
-
Result: Exhausts 150k tokens, reaches rate limits, and forgets user instructions.
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
### Best practice: ContextOS Standard (Targeted AST Traversal)
|
|
13
|
-
|
|
14
|
-
```text
|
|
15
|
-
1. Inspect package.json and AGENTS.md.
|
|
16
|
-
2. Grep for target symbol: grep_search for 'SubmitButton'.
|
|
17
|
-
3. Read ONLY components/SubmitButton.tsx and its direct import types/button.ts.
|
|
18
|
-
Total tokens used: <1,500 tokens. Fast, accurate, zero hallucinations.
|
|
19
|
-
```
|
|
7
|
+
Inspect relevant files, callers, and resolver warnings. Package evidence does not guarantee a complete symbol graph or total prompt budget.
|
|
@@ -1,124 +1,35 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: context-manager
|
|
3
|
-
description:
|
|
4
|
-
Smart context selection engine. Analyzes the current task, consults the Project Graph, and returns only the documents and skills needed to prevent token overflow.
|
|
5
|
-
|
|
3
|
+
description: "Compatibility alias for context-os context selection and budgeting."
|
|
6
4
|
---
|
|
7
5
|
# context-manager
|
|
8
6
|
|
|
9
7
|
## Overview
|
|
10
8
|
|
|
11
|
-
|
|
9
|
+
Deprecated compatibility identifier. Use [context-os](../context-os/SKILL.md) for the canonical instructions.
|
|
12
10
|
|
|
13
11
|
## When to Use
|
|
14
12
|
|
|
15
|
-
|
|
13
|
+
An existing configuration or user explicitly names context-manager.
|
|
16
14
|
|
|
17
15
|
## Rules & Patterns
|
|
18
16
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
## How It Works
|
|
22
|
-
|
|
23
|
-
When given a task:
|
|
24
|
-
|
|
25
|
-
### Step 1: Classify the task
|
|
26
|
-
|
|
27
|
-
```yaml
|
|
28
|
-
task:
|
|
29
|
-
type: [frontend | backend | fullstack | architecture | bugfix | refactor | deploy | review]
|
|
30
|
-
scope: [module | feature | file | project-wide]
|
|
31
|
-
module: {{module_name from Project Graph}}
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
### Step 2: Consult the Project Graph
|
|
35
|
-
|
|
36
|
-
If `docs/PROJECT_GRAPH.md` or `.graphify/graph.json` exists (or activate `graphify` skill to extract AST dependencies):
|
|
37
|
-
|
|
38
|
-
1. Find the module this task belongs to
|
|
39
|
-
2. Get the module's dependencies
|
|
40
|
-
3. Get the module's required skills
|
|
41
|
-
4. Get the files this task will likely touch
|
|
42
|
-
|
|
43
|
-
### Step 3: Apply Context Rules
|
|
44
|
-
|
|
45
|
-
Load `references/context-rules.md` and apply the task type → document mapping.
|
|
46
|
-
|
|
47
|
-
### Step 4: Return Context Package
|
|
48
|
-
|
|
49
|
-
Output a context package:
|
|
50
|
-
|
|
51
|
-
```yaml
|
|
52
|
-
context:
|
|
53
|
-
documents:
|
|
54
|
-
required:
|
|
55
|
-
- docs/API.md # sections: [appointments]
|
|
56
|
-
- docs/ARCHITECTURE.md # sections: [backend, api-layer]
|
|
57
|
-
optional:
|
|
58
|
-
- docs/decisions/0003-postgres.md
|
|
59
|
-
skipped:
|
|
60
|
-
- docs/UI.md # reason: backend task
|
|
61
|
-
- docs/DATABASE.md # reason: no schema change
|
|
62
|
-
|
|
63
|
-
skills:
|
|
64
|
-
loaded: [typescript, node, postgres, testing]
|
|
65
|
-
skipped: [react, tailwind] # reason: backend task
|
|
66
|
-
|
|
67
|
-
project_graph:
|
|
68
|
-
module: appointments
|
|
69
|
-
dependencies: [auth, patients]
|
|
70
|
-
affected_files:
|
|
71
|
-
- src/modules/appointments/api/**
|
|
72
|
-
- src/modules/appointments/services/**
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
### Step 5: Validate Budget
|
|
76
|
-
|
|
77
|
-
Check total token count. If over budget (see context-rules.md):
|
|
78
|
-
|
|
79
|
-
1. Trim Level 1 docs to summaries
|
|
80
|
-
2. Load only affected sections of Level 2 docs
|
|
81
|
-
3. Keep Level 3 (skills) at full detail
|
|
82
|
-
|
|
83
|
-
## Context Caching
|
|
84
|
-
|
|
85
|
-
After first compilation for a module, cache the result:
|
|
86
|
-
|
|
87
|
-
```
|
|
88
|
-
.cache/
|
|
89
|
-
frontend.context.yaml
|
|
90
|
-
backend.context.yaml
|
|
91
|
-
appointments.context.yaml
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
Invalidate cache when:
|
|
95
|
-
|
|
96
|
-
- A document is updated
|
|
97
|
-
- A skill is added/removed
|
|
98
|
-
- The Project Graph changes
|
|
99
|
-
- A Decision Record is added
|
|
100
|
-
|
|
101
|
-
## Questions the Context Manager Can Answer
|
|
102
|
-
|
|
103
|
-
- "What documents do I need for this task?"
|
|
104
|
-
- "Which skills should be loaded?"
|
|
105
|
-
- "What modules are affected by this change?"
|
|
106
|
-
- "Is this context package within budget?"
|
|
107
|
-
- "Why was this document skipped?"
|
|
108
|
-
|
|
17
|
+
Apply the canonical skill without loading a duplicate process. Existing authorization, proportional verification, and optional role declarations carry forward. The resolver redirects this identifier and reports an alias warning.
|
|
109
18
|
|
|
110
19
|
## Code Examples
|
|
111
20
|
|
|
112
|
-
|
|
21
|
+
Explicit context-manager selection resolves to context-os; inspect the resolver result rather than assuming both bodies were loaded.
|
|
113
22
|
|
|
114
23
|
## Validation Checklist
|
|
115
24
|
|
|
116
|
-
|
|
25
|
+
- [ ] Canonical guidance is used.
|
|
26
|
+
- [ ] Alias resolution adds no duplicate body.
|
|
27
|
+
- [ ] Evidence scope and limitations are stated.
|
|
117
28
|
|
|
118
29
|
## Common Mistakes
|
|
119
30
|
|
|
120
|
-
|
|
31
|
+
Treating this compatibility name as an independent engine or a mandatory ceremony.
|
|
121
32
|
|
|
122
33
|
## Integration Notes
|
|
123
34
|
|
|
124
|
-
|
|
35
|
+
Keep legacy links available. Read [references/context-rules.md](references/context-rules.md) only for compatibility details.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
# context-manager
|
|
1
|
+
# context-manager compatibility troubleshooting
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
-
|
|
6
|
-
-
|
|
7
|
-
|
|
3
|
+
- Duplicate process: load the canonical context-os instructions once.
|
|
4
|
+
- Repeated approval or banners: preserve existing authorization and optional roles.
|
|
5
|
+
- Conflicting legacy guidance: use the canonical skill and update the stale link.
|
|
6
|
+
- Claimed automation: inspect actual CLI results and distinguish instructions
|
|
7
|
+
from runtime enforcement.
|