@ryuenn3123/agentic-senior-core 6.16.2 → 6.16.5
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/plugins/agentic-senior-core/.codex-plugin/plugin.json +1 -1
- package/.agents/plugins/agentic-senior-core/commands/asc-pentest.md +2 -0
- package/.agents/plugins/agentic-senior-core/commands/asc-pentest.toml +3 -0
- package/.agents/plugins/agentic-senior-core/hooks/dedup-gate.js +137 -128
- package/.agents/plugins/agentic-senior-core/hooks/hooks.json +97 -0
- package/.agents/plugins/agentic-senior-core/hooks/ladder-pulse.js +53 -36
- package/.agents/plugins/agentic-senior-core/hooks/lib/known-ui-slop-patterns.json +20 -0
- package/.agents/plugins/agentic-senior-core/hooks/path-util.cjs +118 -4
- package/.agents/plugins/agentic-senior-core/hooks/post-edit-enforce.js +98 -81
- package/.agents/plugins/agentic-senior-core/hooks/pre-tool-dependency-gate.js +168 -191
- package/.agents/plugins/agentic-senior-core/hooks/session-pulse.js +48 -35
- package/.agents/plugins/agentic-senior-core/hooks/session-start.js +62 -11
- package/.agents/plugins/agentic-senior-core/hooks.json +4 -94
- package/.agents/plugins/agentic-senior-core/plugin.json +5 -13
- package/.agents/plugins/agentic-senior-core/rules/agentic-senior-core.md +6 -1
- package/.agents/plugins/agentic-senior-core/skills/asc/SKILL.md +5 -2
- package/.agents/plugins/agentic-senior-core/skills/asc-develop/SKILL.md +3 -3
- package/.agents/plugins/agentic-senior-core/skills/asc-pentest/SKILL.md +97 -0
- package/.agents/plugins/agentic-senior-core/skills/asc-pentest/references/api-security-idor.md +105 -0
- package/.agents/plugins/agentic-senior-core/skills/asc-pentest/references/dast-baseline.md +78 -0
- package/.agents/plugins/agentic-senior-core/skills/asc-pentest/references/fuzzing-dsl.md +66 -0
- package/.agents/plugins/agentic-senior-core/skills/asc-pentest/references/pentest-task-tree.md +70 -0
- package/.agents/plugins/agentic-senior-core/skills/asc-review/SKILL.md +2 -2
- package/.agents/plugins/agentic-senior-core/skills/asc-test/SKILL.md +8 -1
- package/.agents/plugins/agentic-senior-core/skills/asc-test/references/mutation-testing.md +55 -0
- package/.agents/plugins/agentic-senior-core/skills/asc-test/references/performance-budgets.md +67 -0
- package/.agents/plugins/agentic-senior-core/skills/asc-test/references/property-testing.md +72 -0
- package/.agents/plugins/agentic-senior-core/skills/asc-ui/SKILL.md +17 -14
- package/.agents/plugins/agentic-senior-core/skills/asc-ui/references/copy-i18n.md +56 -8
- package/.agents/plugins/agentic-senior-core/skills/asc-ui/references/craft/color-surfaces.md +25 -0
- package/.agents/plugins/agentic-senior-core/skills/asc-ui/references/craft/themes-catalog.md +198 -0
- package/.agents/plugins/agentic-senior-core/skills/asc-ui/references/divergence.md +34 -2
- package/.agents/plugins/agentic-senior-core/skills/asc-ui/references/modes/genre-calibration.md +89 -0
- package/.agents/plugins/agentic-senior-core/skills/asc-ui/references/modes/operate.md +26 -0
- package/.agents/plugins/agentic-senior-core/skills/asc-ui/references/modes/persuade.md +10 -9
- package/.agents/plugins/agentic-senior-core/skills/asc-ui/references/redesign-audit.md +4 -9
- package/bin/agentic-senior-core.js +19 -4
- package/gemini-extension.json +2 -2
- package/lib/cli/ascx/runtime.mjs +5 -27
- package/lib/cli/ascx/windows-spawn.mjs +348 -0
- package/lib/cli/commands/bootstrap.mjs +56 -0
- package/lib/cli/commands/dedup.mjs +500 -0
- package/lib/cli/commands/git-hook-generator.mjs +3 -2
- package/lib/cli/commands/global.mjs +109 -53
- package/lib/cli/commands/preview.mjs +18 -9
- package/package.json +1 -1
- package/plugin.yaml +3 -1
|
@@ -1,23 +1,35 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// Agentic Senior Core — SessionStart hook
|
|
3
|
-
// Injects universal coding rules on
|
|
4
|
-
//
|
|
3
|
+
// Injects universal coding rules on session start for Claude Code, Codex CLI, and Copilot CLI.
|
|
4
|
+
// If invoked under Antigravity SessionStart, returns valid JSON (rules/agentic-senior-core.md
|
|
5
|
+
// is already loaded natively via plugin rules/).
|
|
5
6
|
|
|
6
7
|
const fs = require('fs');
|
|
7
8
|
const path = require('path');
|
|
9
|
+
const { isAntigravityPayload } = require('./path-util.cjs');
|
|
8
10
|
|
|
9
11
|
const pluginRoot = process.env.CLAUDE_PLUGIN_ROOT || path.resolve(__dirname, '..');
|
|
10
12
|
const isCopilot = Boolean(process.env.COPILOT_PLUGIN_DATA);
|
|
11
13
|
const isCodex = !isCopilot && Boolean(process.env.PLUGIN_DATA);
|
|
14
|
+
const isAntigravityEnv = Boolean(
|
|
15
|
+
process.env.ANTIGRAVITY_LS_ADDRESS ||
|
|
16
|
+
process.env.ANTIGRAVITY_CSRF_TOKEN ||
|
|
17
|
+
process.env.ANTIGRAVITY_CLI
|
|
18
|
+
);
|
|
12
19
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
20
|
+
function emitForHost(stdinData) {
|
|
21
|
+
if (isAntigravityEnv || isAntigravityPayload(stdinData)) {
|
|
22
|
+
process.stdout.write('{}\n');
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
let content;
|
|
27
|
+
try {
|
|
28
|
+
content = fs.readFileSync(path.join(pluginRoot, 'rules', 'agentic-senior-core.md'), 'utf8');
|
|
29
|
+
} catch (_) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
19
32
|
|
|
20
|
-
try {
|
|
21
33
|
if (isCopilot) {
|
|
22
34
|
process.stdout.write(JSON.stringify({ additionalContext: content }));
|
|
23
35
|
} else if (isCodex) {
|
|
@@ -31,6 +43,45 @@ try {
|
|
|
31
43
|
} else {
|
|
32
44
|
process.stdout.write(content);
|
|
33
45
|
}
|
|
34
|
-
} catch (e) {
|
|
35
|
-
// Silent fail — stdout closed/EPIPE at hook exit must not surface as a hook failure
|
|
36
46
|
}
|
|
47
|
+
|
|
48
|
+
if (process.stdin.isTTY) {
|
|
49
|
+
try { emitForHost(null); } catch (_) {}
|
|
50
|
+
process.exit(0);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
let handled = false;
|
|
54
|
+
let inputBuffer = '';
|
|
55
|
+
const timer = setTimeout(function () {
|
|
56
|
+
if (!handled) {
|
|
57
|
+
handled = true;
|
|
58
|
+
try { emitForHost(null); } catch (_) {}
|
|
59
|
+
process.exit(0);
|
|
60
|
+
}
|
|
61
|
+
}, 250);
|
|
62
|
+
|
|
63
|
+
process.stdin.setEncoding('utf8');
|
|
64
|
+
process.stdin.on('data', function (chunk) {
|
|
65
|
+
inputBuffer += chunk;
|
|
66
|
+
try {
|
|
67
|
+
const parsed = JSON.parse(inputBuffer);
|
|
68
|
+
if (!handled) {
|
|
69
|
+
handled = true;
|
|
70
|
+
clearTimeout(timer);
|
|
71
|
+
emitForHost(parsed);
|
|
72
|
+
process.exit(0);
|
|
73
|
+
}
|
|
74
|
+
} catch (_) {}
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
process.stdin.on('end', function () {
|
|
78
|
+
if (handled) return;
|
|
79
|
+
handled = true;
|
|
80
|
+
clearTimeout(timer);
|
|
81
|
+
let parsed = null;
|
|
82
|
+
if (inputBuffer.trim()) {
|
|
83
|
+
try { parsed = JSON.parse(inputBuffer); } catch (_) {}
|
|
84
|
+
}
|
|
85
|
+
try { emitForHost(parsed); } catch (_) {}
|
|
86
|
+
process.exit(0);
|
|
87
|
+
});
|
|
@@ -1,120 +1,30 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
3
|
-
"SessionStart": [
|
|
4
|
-
{
|
|
5
|
-
"matcher": "startup|resume|clear|compact",
|
|
6
|
-
"hooks": [
|
|
7
|
-
{
|
|
8
|
-
"type": "command",
|
|
9
|
-
"command": "node hooks/session-start.js",
|
|
10
|
-
"commandWindows": "node hooks/session-start.js",
|
|
11
|
-
"timeout": 5,
|
|
12
|
-
"statusMessage": "Loading ASC rules..."
|
|
13
|
-
}
|
|
14
|
-
]
|
|
15
|
-
}
|
|
16
|
-
],
|
|
17
|
-
"SubagentStart": [
|
|
18
|
-
{
|
|
19
|
-
"hooks": [
|
|
20
|
-
{
|
|
21
|
-
"type": "command",
|
|
22
|
-
"command": "node hooks/subagent-start.js",
|
|
23
|
-
"commandWindows": "node hooks/subagent-start.js",
|
|
24
|
-
"timeout": 5,
|
|
25
|
-
"statusMessage": "Loading ASC rules..."
|
|
26
|
-
}
|
|
27
|
-
]
|
|
28
|
-
}
|
|
29
|
-
],
|
|
2
|
+
"agentic-senior-core": {
|
|
30
3
|
"PreToolUse": [
|
|
31
4
|
{
|
|
32
|
-
"matcher": "
|
|
33
|
-
"hooks": [
|
|
34
|
-
{
|
|
35
|
-
"type": "command",
|
|
36
|
-
"if": "Edit(**/package.json)|Edit(**/requirements.txt)|Edit(**/pyproject.toml)|Edit(**/go.mod)|Edit(**/Cargo.toml)|Edit(**/Gemfile)",
|
|
37
|
-
"command": "node hooks/pre-tool-dependency-gate.js",
|
|
38
|
-
"commandWindows": "node hooks/pre-tool-dependency-gate.js",
|
|
39
|
-
"timeout": 5,
|
|
40
|
-
"statusMessage": "ASC Pre-tool dependency check (Edit)..."
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
"type": "command",
|
|
44
|
-
"if": "Write(**/package.json)|Write(**/requirements.txt)|Write(**/pyproject.toml)|Write(**/go.mod)|Write(**/Cargo.toml)|Write(**/Gemfile)",
|
|
45
|
-
"command": "node hooks/pre-tool-dependency-gate.js",
|
|
46
|
-
"commandWindows": "node hooks/pre-tool-dependency-gate.js",
|
|
47
|
-
"timeout": 5,
|
|
48
|
-
"statusMessage": "ASC Pre-tool dependency check (Write)..."
|
|
49
|
-
}
|
|
50
|
-
]
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
"matcher": "Bash|run_command|run_shell_command|terminal|execute_command",
|
|
5
|
+
"matcher": "edit_file|write_file|replace_file_content|multi_replace_file_content|write_to_file|run_command",
|
|
54
6
|
"hooks": [
|
|
55
7
|
{
|
|
56
8
|
"type": "command",
|
|
57
9
|
"command": "node hooks/pre-tool-dependency-gate.js",
|
|
58
|
-
"
|
|
59
|
-
"timeout": 5,
|
|
60
|
-
"statusMessage": "ASC Pre-tool dependency check (Terminal)..."
|
|
61
|
-
}
|
|
62
|
-
]
|
|
63
|
-
}
|
|
64
|
-
],
|
|
65
|
-
"PostToolUse": [
|
|
66
|
-
{
|
|
67
|
-
"matcher": "Edit|Write|replace_file_content|write_to_file|write_file|multi_replace_file_content",
|
|
68
|
-
"hooks": [
|
|
69
|
-
{
|
|
70
|
-
"type": "command",
|
|
71
|
-
"command": "node hooks/post-edit-enforce.js",
|
|
72
|
-
"commandWindows": "node hooks/post-edit-enforce.js",
|
|
73
|
-
"timeout": 5,
|
|
74
|
-
"statusMessage": "ASC ladder & spec gate check..."
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
"type": "command",
|
|
78
|
-
"command": "node hooks/dedup-gate.js",
|
|
79
|
-
"commandWindows": "node hooks/dedup-gate.js",
|
|
80
|
-
"timeout": 15,
|
|
81
|
-
"statusMessage": "ASC duplicate-code scan..."
|
|
10
|
+
"timeout": 5
|
|
82
11
|
}
|
|
83
12
|
]
|
|
84
13
|
}
|
|
85
14
|
],
|
|
86
15
|
"PreInvocation": [
|
|
87
|
-
{
|
|
88
|
-
"type": "command",
|
|
89
|
-
"command": "node hooks/session-pulse.js",
|
|
90
|
-
"commandWindows": "node hooks/session-pulse.js",
|
|
91
|
-
"timeout": 5,
|
|
92
|
-
"statusMessage": "Loading ASC rules..."
|
|
93
|
-
},
|
|
94
16
|
{
|
|
95
17
|
"type": "command",
|
|
96
18
|
"command": "node hooks/ladder-pulse.js",
|
|
97
|
-
"
|
|
98
|
-
"timeout": 5,
|
|
99
|
-
"statusMessage": "ASC ladder pulse..."
|
|
19
|
+
"timeout": 5
|
|
100
20
|
}
|
|
101
21
|
],
|
|
102
22
|
"PostInvocation": [
|
|
103
23
|
{
|
|
104
24
|
"type": "command",
|
|
105
25
|
"command": "node hooks/post-edit-enforce.js",
|
|
106
|
-
"commandWindows": "node hooks/post-edit-enforce.js",
|
|
107
26
|
"timeout": 15
|
|
108
27
|
}
|
|
109
|
-
],
|
|
110
|
-
"PreCompact": [
|
|
111
|
-
{
|
|
112
|
-
"type": "command",
|
|
113
|
-
"command": "node hooks/pre-compact-pin.js",
|
|
114
|
-
"commandWindows": "node hooks/pre-compact-pin.js",
|
|
115
|
-
"timeout": 5,
|
|
116
|
-
"statusMessage": "ASC constraint pinning..."
|
|
117
|
-
}
|
|
118
28
|
]
|
|
119
29
|
}
|
|
120
30
|
}
|
|
@@ -1,16 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentic-senior-core",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
],
|
|
9
|
-
"commands": [
|
|
10
|
-
"commands/"
|
|
11
|
-
],
|
|
12
|
-
"skills": [
|
|
13
|
-
"skills/"
|
|
14
|
-
],
|
|
15
|
-
"hooks": "hooks.json"
|
|
3
|
+
"displayName": "Agentic Senior Core",
|
|
4
|
+
"version": "6.16.5",
|
|
5
|
+
"description": "Universal AI coding rules and workflows. Write code like a staff engineer.",
|
|
6
|
+
"author": "fatidaprilian",
|
|
7
|
+
"repository": "https://github.com/fatidaprilian/Agentic-Senior-Core"
|
|
16
8
|
}
|
|
@@ -42,7 +42,11 @@ When picking step 5 or 6 (unless trivial):
|
|
|
42
42
|
- Early returns over deep nesting (keep happy path flat).
|
|
43
43
|
- Three similar lines is better than a premature abstraction (duplication over wrong abstraction).
|
|
44
44
|
- Single design source of truth: UI styling must reuse defined design tokens, theme variables, or existing page patterns. No ad-hoc palette, radius, or font deviations between pages.
|
|
45
|
-
-
|
|
45
|
+
- Human writing & prose hygiene: Functional communication is an operational tool, not marketing collateral. This applies to UI microcopy, READMEs, PR descriptions, and code comments alike:
|
|
46
|
+
- 50% reduction rule: Write the statement, then cut unnecessary words. Replace ornamental adjectives with measurable facts (not "a robust, blazing-fast parser", write "parses 50MB/s with zero heap allocations").
|
|
47
|
+
- Ban AI cadences: Never use the Tricolon ("Fast. Simple. Secure."), the Mad-Lib ("The AI-powered platform for modern teams"), the Rebuttal ("Not just a tool, it's a workflow"), or conversational throat-clearing ("In today's fast-paced landscape...").
|
|
48
|
+
- Buzzword blacklist: Never emit `seamless(ly)`, `robust`, `empower(ing)`, `supercharge`, `elevate`, `effortless(ly)`, `cutting-edge`, `delve`, `testament`, `pivotal`, `crucial`, `game-changing`, or `next-generation`.
|
|
49
|
+
- Strict single-language purity: Choose one language per document or surface. In Indonesian contexts, never prefix grammatical affixes to raw English stems (`di-submit`, `meng-generate`, `di-approve`, `me-restore`).
|
|
46
50
|
- Code comment hygiene: Zero decorative character banners (// =====), zero line-by-line narration (// Step 1: validate), zero empty category tags (// Main logic), and zero signature echoes in docstrings. Keep only comments that document non-obvious operational constraints, security boundaries, concurrency hazards, or protocol contracts.
|
|
47
51
|
- Delete code that carries no behavior, safety, or test value. Readability wins over brevity.
|
|
48
52
|
- Detect and respect project linter/formatter configs. Do not restate style rules enforced by tooling.
|
|
@@ -83,6 +87,7 @@ When picking step 5 or 6 (unless trivial):
|
|
|
83
87
|
## Domain References & Skills (On-Demand)
|
|
84
88
|
Detailed domain guidelines are loaded on-demand via skills or scoped rules:
|
|
85
89
|
- **Testing, TDD, Verification, E2E & UAT** → run `/asc-test`
|
|
90
|
+
- **Penetration Testing, DAST & API Security Fuzzing** → run `/asc-pentest`
|
|
86
91
|
- **API Design, Database, Infrastructure, Resilience** → run `/asc-reference`
|
|
87
92
|
- **Frontend UI/UX Engineering & Anti-Slop Design** → run `/asc-ui`
|
|
88
93
|
- **Engineering Lifecycle & Features** → run `/asc-develop`
|
|
@@ -69,9 +69,12 @@ Synchronize ASC rules and skills across all installed AI coding tools.
|
|
|
69
69
|
### CLI Utility Commands
|
|
70
70
|
```bash
|
|
71
71
|
asc status # Detect installed AI coding tools
|
|
72
|
-
asc global
|
|
72
|
+
asc global # Auto-detect installed AI tools and sync global rules/skills/hooks
|
|
73
|
+
asc global --all # Force-install global rules for all supported hosts
|
|
73
74
|
asc adapter --all # Generate workspace adapters for all detected IDEs
|
|
74
|
-
asc
|
|
75
|
+
asc dedup # Scan codebase for Rule-of-Three structural/token clones
|
|
76
|
+
asc bootstrap # Configure project UI/architecture baseline bans (.agents/adaptive_preferences.json)
|
|
77
|
+
asc preview <html/> # Open static HTML mockup or capture headless browser screenshot
|
|
75
78
|
asc uninstall # Clean up adapter files and hooks
|
|
76
79
|
```
|
|
77
80
|
|
|
@@ -27,7 +27,7 @@ Use when creating a new application, service, or repository from zero.
|
|
|
27
27
|
- Can standard library or native platform handle it?
|
|
28
28
|
- Can this be one straightforward function?
|
|
29
29
|
2. Build the core domain entities, data models, and services first before protocol/transport controllers.
|
|
30
|
-
3. For frontend interfaces, follow the
|
|
30
|
+
3. For frontend interfaces, follow `/asc-ui`. For documentation and prose (READMEs, ADRs), enforce the Universal Prose Floor (zero AI throat-clearing, 50% word reduction, zero buzzwords).
|
|
31
31
|
4. Generate a quality gate workflow (e.g., `.github/workflows/quality-gate.yml`) that runs linter, type-check, and tests.
|
|
32
32
|
|
|
33
33
|
### Step 3: Validation
|
|
@@ -51,11 +51,11 @@ Use when adding endpoints, components, pages, or capabilities to an existing cod
|
|
|
51
51
|
- What happens on network/API failure or timeout?
|
|
52
52
|
- What feedback does the user see? (Pending state, inline field error, toast/banner with retry).
|
|
53
53
|
- How can the system recover? (Retry, cached fallback, degraded mode).
|
|
54
|
-
3. If building UI, ensure compliance with `/asc-ui` (zero marketing fluff, single-language consistency, mobile reflow, WCAG AA contrast).
|
|
54
|
+
3. If building UI or writing documentation, ensure compliance with the Universal Prose Floor and `/asc-ui` (zero marketing fluff, single-language consistency, mobile reflow, WCAG AA contrast).
|
|
55
55
|
|
|
56
56
|
### Step 3: Implement & Validate (TDD Integration)
|
|
57
57
|
1. Follow the TDD cycle via `/asc-test`: write the failing test first (RED), write minimal code to pass (GREEN), then refactor.
|
|
58
|
-
2. **Zero-Fake-Done Testing**: Run the project test suite (`ascx
|
|
58
|
+
2. **Zero-Fake-Done Testing**: Run the project test suite (`ascx npm test`, `ascx pytest`, `ascx cargo test`). The test runner **MUST** exit with code 0.
|
|
59
59
|
3. Never weaken or delete test assertions to simulate a passing run. Fix the underlying business logic.
|
|
60
60
|
|
|
61
61
|
---
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: asc-pentest
|
|
3
|
+
description: >
|
|
4
|
+
Trigger this skill when the user is: conducting penetration testing, dynamic application security testing (DAST), API security audits, BOLA/IDOR verification, fuzzing endpoints, probing attack surfaces, or validating security vulnerabilities on running servers. Also trigger when the user says: "pentest this", "security scan", "check IDOR", "test API security", "audit DAST", "fuzz this endpoint", "uji penetrasi", "cari celah runtime", "cek keamanan api".
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Adversarial Penetration Testing & DAST Router (`asc-pentest`)
|
|
8
|
+
|
|
9
|
+
Staff-grade adversarial security testing and dynamic vulnerability validation. Enforces deterministic assessment state and non-destructive proof-of-exploit verification.
|
|
10
|
+
|
|
11
|
+
Grounded in: USENIX Security (PentestGPT architecture), OWASP API Security Top 10, ProjectDiscovery Nuclei DSL, and Schemathesis BOLA verification.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## 1. Safety & Non-Destructive Invariants
|
|
16
|
+
|
|
17
|
+
> [!CAUTION]
|
|
18
|
+
> `asc-pentest` operates exclusively in a defensive, non-destructive posture against authorized local development environments or designated staging servers.
|
|
19
|
+
> - **Local/Staging Targets Only:** Never probe external production endpoints without explicit written authorization.
|
|
20
|
+
> - **Canary Data Only:** All destructive or mutating test cases must use isolated canary records (e.g. `canary_asc_test_user`). Never tamper with production user data.
|
|
21
|
+
> - **No Volumetric Floods:** Never execute brute-force or volumetric DoS attacks that risk system starvation.
|
|
22
|
+
> - **Deterministic Evidence:** Every reported finding must provide an exact, reproducible `curl` reproduction script or automated assertion.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## 2. Pre-Flight Ingestion & Reference Loading (BLOCKING)
|
|
27
|
+
|
|
28
|
+
> [!IMPORTANT]
|
|
29
|
+
> **Reference Path Resolution:**
|
|
30
|
+
> Reference files do NOT reside in the user workspace root. They are located adjacent to this `SKILL.md` file:
|
|
31
|
+
> `<skill_directory>/references/<file>.md`
|
|
32
|
+
> Prepend this skill's directory path when calling `read_file`.
|
|
33
|
+
|
|
34
|
+
Before sending network requests, probing endpoints, or asserting vulnerabilities:
|
|
35
|
+
1. **Mandatory Ingestion (BLOCKING GATE):** Call `read_file` on the reference matching the security assessment phase BEFORE taking action:
|
|
36
|
+
- Stateful multi-step penetration workflow & task tree ➔ `references/pentest-task-tree.md`
|
|
37
|
+
- Baseline DAST, security headers, CORS & open redirects ➔ `references/dast-baseline.md`
|
|
38
|
+
- BOLA / IDOR horizontal privilege & token tampering ➔ `references/api-security-idor.md`
|
|
39
|
+
- Nuclei-style request mutations & boundary fuzzing ➔ `references/fuzzing-dsl.md`
|
|
40
|
+
*Do NOT generate payloads or report vulnerability claims until the relevant reference is loaded.*
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## 3. The 4-Phase Pentesting Decision Tree
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
Is target a running local/staging server?
|
|
48
|
+
│
|
|
49
|
+
┌───────────────┴───────────────┐
|
|
50
|
+
YES NO
|
|
51
|
+
│ │
|
|
52
|
+
┌───────────────┐ ┌───────────────┐
|
|
53
|
+
│ PHASE 1: │ │ Delegate to │
|
|
54
|
+
│ Surface Recon │ │ asc-review │
|
|
55
|
+
└───────┬───────┘ │ (Static SAST) │
|
|
56
|
+
│ └───────────────┘
|
|
57
|
+
Does it have authenticated endpoints / multiple users?
|
|
58
|
+
│
|
|
59
|
+
┌───────┴───────┐
|
|
60
|
+
YES NO
|
|
61
|
+
│ │
|
|
62
|
+
┌───────────────┐ ┌───────────────┐
|
|
63
|
+
│ PHASE 2: │ │ PHASE 3: │
|
|
64
|
+
│ BOLA / IDOR │ │ DAST Baseline │
|
|
65
|
+
│ & Auth Probe │ │ & Fuzzing DSL │
|
|
66
|
+
└───────┬───────┘ └───────┬───────┘
|
|
67
|
+
│ │
|
|
68
|
+
└────────┬────────┘
|
|
69
|
+
▼
|
|
70
|
+
┌─────────────────┐
|
|
71
|
+
│ PHASE 4: │
|
|
72
|
+
│ Exploit Proof & │
|
|
73
|
+
│ Remediation Log │
|
|
74
|
+
└─────────────────┘
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## 4. On-Demand Reference Library
|
|
80
|
+
|
|
81
|
+
| Assessment Phase / Focus Area | Mandatory Reference Path |
|
|
82
|
+
|---|---|
|
|
83
|
+
| Stateful Task Tree (DISCOVER $\to$ ENUMERATE $\to$ TEST $\to$ EXPLOIT $\to$ VERIFY) | `references/pentest-task-tree.md` |
|
|
84
|
+
| Baseline DAST, CORS, CSP, HSTS & Information Leaks | `references/dast-baseline.md` |
|
|
85
|
+
| BOLA / IDOR, Dual-Identity Probing & Mass Assignment | `references/api-security-idor.md` |
|
|
86
|
+
| Multi-part Request Fuzzing (Replace, Prefix, Postfix) | `references/fuzzing-dsl.md` |
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## 5. Verification & Handoff Sweep
|
|
91
|
+
|
|
92
|
+
Before completing any penetration testing engagement:
|
|
93
|
+
1. **Claim Verification:** Confirm every reported vulnerability has an empirical `curl` proof or automated test reproducing the exact failure.
|
|
94
|
+
2. **State Cleanliness:** Confirm all temporary canary test data (`canary_asc_*`) created during the audit has been purged.
|
|
95
|
+
3. **Remediation Precision:** Provide the smallest safe code fix (e.g. policy middleware, parameterized query, input schema constraint).
|
|
96
|
+
4. **No Assumption Claims:** Never declare an application "100% secure"; state the exact assessed surface and tested vector parameters.
|
|
97
|
+
|
package/.agents/plugins/agentic-senior-core/skills/asc-pentest/references/api-security-idor.md
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# API Security, BOLA / IDOR & Authorization Probing
|
|
2
|
+
|
|
3
|
+
Derived from the authorization verification engine of **Schemathesis** (`specs/openapi/object_authorization.py`) and the OWASP API Security Top 10.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 1. BOLA / IDOR Dual-Identity Replay Protocol
|
|
8
|
+
|
|
9
|
+
Broken Object Level Authorization (BOLA / IDOR) is the most pervasive and critical API security flaw. It occurs when an endpoint accepts a resource identifier without verifying whether the requesting user owns or has access to that specific record.
|
|
10
|
+
|
|
11
|
+
### The Algorithmic Dual-Identity Verification Flow
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
┌───────────────────────────────────────┐
|
|
15
|
+
│ 1. OWNER READ (Identity A) │
|
|
16
|
+
│ GET /api/v1/documents/doc_101 │
|
|
17
|
+
│ Authorization: Bearer TOKEN_USER_A │
|
|
18
|
+
└──────────────────┬────────────────────┘
|
|
19
|
+
│
|
|
20
|
+
▼ Expected: 200 OK + Valid Payload
|
|
21
|
+
┌───────────────────────────────────────┐
|
|
22
|
+
│ 2. PEER REPLAY (Identity B) │
|
|
23
|
+
│ GET /api/v1/documents/doc_101 │
|
|
24
|
+
│ Authorization: Bearer TOKEN_USER_B │
|
|
25
|
+
└──────────────────┬────────────────────┘
|
|
26
|
+
│
|
|
27
|
+
├───────────────────────────────────┐
|
|
28
|
+
▼ ▼
|
|
29
|
+
Status 200 OK + Data Status 403 / 404
|
|
30
|
+
┌─────────────────────────┐ ┌─────────────────────────┐
|
|
31
|
+
│ CRITICAL BOLA CONFIRMED │ │ SECURE (Access Denied) │
|
|
32
|
+
└─────────────────────────┘ └─────────────────────────┘
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Reproducible Proof Script (`curl`)
|
|
36
|
+
To provide deterministic proof of a BOLA vulnerability, generate two reproducible requests:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
# Step 1: Prove resource exists and belongs to User A
|
|
40
|
+
curl -s -X GET "http://localhost:3000/api/v1/reports/409" \
|
|
41
|
+
-H "Authorization: Bearer canary_user_a_token" \
|
|
42
|
+
-H "Accept: application/json"
|
|
43
|
+
|
|
44
|
+
# Step 2: Prove User B can retrieve User A's private resource without permission
|
|
45
|
+
curl -s -X GET "http://localhost:3000/api/v1/reports/409" \
|
|
46
|
+
-H "Authorization: Bearer canary_user_b_token" \
|
|
47
|
+
-H "Accept: application/json"
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
**Remediation Rule**:
|
|
51
|
+
Never query resources by primary key alone. Enforce tenant and user boundary scoping directly in database queries:
|
|
52
|
+
```sql
|
|
53
|
+
-- VULNERABLE:
|
|
54
|
+
SELECT * FROM reports WHERE id = :id;
|
|
55
|
+
|
|
56
|
+
-- SECURE:
|
|
57
|
+
SELECT * FROM reports WHERE id = :id AND tenant_id = :authenticated_tenant_id;
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## 2. Mass Assignment & Attribute Tampering
|
|
63
|
+
|
|
64
|
+
Attackers inject privileged or immutable properties into request bodies during entity creation (POST) or update (PUT/PATCH):
|
|
65
|
+
|
|
66
|
+
### High-Risk Attribute Injection Matrix
|
|
67
|
+
|
|
68
|
+
| Target Entity | Injected Attack Attributes | Impact |
|
|
69
|
+
|---|---|---|
|
|
70
|
+
| User Profile | `{"role": "admin", "isAdmin": true, "permissions": ["*"]}` | Privilege escalation to system administrator. |
|
|
71
|
+
| Order / Checkout | `{"total_price": 0.01, "currency": "USD", "is_paid": true}` | Financial tampering and unauthorized checkout. |
|
|
72
|
+
| Account / Tenant | `{"verified": true, "plan": "enterprise", "quota": 999999}` | Subscription and feature gate bypass. |
|
|
73
|
+
| Ownership Binding | `{"user_id": "other_uuid", "tenant_id": "victim_org"}` | Hijacking entity association. |
|
|
74
|
+
|
|
75
|
+
### Test Procedure
|
|
76
|
+
1. Inspect endpoint schema and take factual inventory of allowed properties.
|
|
77
|
+
2. Submit mutation payload containing extra privileged attributes.
|
|
78
|
+
3. Inspect whether backend accepts the payload (200 OK) and persists the modified attributes in subsequent reads.
|
|
79
|
+
|
|
80
|
+
**Remediation Rule**:
|
|
81
|
+
Enforce explicit Data Transfer Object (DTO) allowlists (e.g. Zod, Pydantic, Laravel FormRequests). Never pass raw request payloads directly to ORM persistence methods (`Model.create(req.body)`).
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## 3. Broken Function Level Authorization (BFLA)
|
|
86
|
+
|
|
87
|
+
Verify whether administrative or management routes can be called by ordinary non-privileged users:
|
|
88
|
+
|
|
89
|
+
1. Identify administrative endpoints (`/api/admin/*`, `/api/v1/users/delete`, `/api/manage/*`).
|
|
90
|
+
2. Dispatch requests using the credentials of a standard user role.
|
|
91
|
+
3. If the server returns `200 OK` or `204 No Content`, flag as **CRITICAL BFLA**. Expected response is strictly `403 Forbidden`.
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## 4. Token & JWT Tampering
|
|
96
|
+
|
|
97
|
+
For endpoints utilizing JSON Web Tokens (JWT) for authentication:
|
|
98
|
+
|
|
99
|
+
| Test Case | Attack Vector | Expected Defense |
|
|
100
|
+
|---|---|---|
|
|
101
|
+
| Alg "None" Bypass | Change JWT header `{"alg": "none"}` and strip the signature portion. | Reject with 401 Unauthorized. |
|
|
102
|
+
| Expired Token Replay | Replay token past its `exp` timestamp. | Reject with 401 Unauthorized. |
|
|
103
|
+
| Secret Brute-force / Weak Keys | Verify whether JWT signing secret is weak (e.g. `secret`, `123456`). | Fail audit if signed with dictionary secret. |
|
|
104
|
+
| Signature Stripping | Send JWT with `header.payload.` (trailing dot with empty signature). | Reject with 401 Unauthorized. |
|
|
105
|
+
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# Baseline Dynamic Application Security Testing (DAST)
|
|
2
|
+
|
|
3
|
+
Standardized operational guidelines for scanning running web applications and APIs for fundamental infrastructure and configuration vulnerabilities.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 1. Security Headers Audit
|
|
8
|
+
|
|
9
|
+
For any web application serving HTML or JSON endpoints, probe the root (`/`) and primary API routes (`/api/`) and verify the presence and configuration of essential defense-in-depth headers:
|
|
10
|
+
|
|
11
|
+
| Header | Expected Standard | Risk if Missing / Misconfigured |
|
|
12
|
+
|---|---|---|
|
|
13
|
+
| **`Content-Security-Policy`** | Restrictive script/object sources (`default-src 'self'; script-src 'self' ...`). Never permit `unsafe-inline` or wildcard `*` without nonces/hashes. | Unrestricted Cross-Site Scripting (XSS) and data exfiltration. |
|
|
14
|
+
| **`X-Content-Type-Options`** | Strictly `nosniff`. | MIME-type confusion attacks where user-uploaded files are executed as scripts. |
|
|
15
|
+
| **`Strict-Transport-Security`** | `max-age=31536000; includeSubDomains` (on HTTPS environments). | SSL stripping and man-in-the-middle downgrade attacks. |
|
|
16
|
+
| **`X-Frame-Options`** | `DENY` or `SAMEORIGIN` (or CSP `frame-ancestors 'none'`). | Clickjacking attacks framing the application inside malicious host pages. |
|
|
17
|
+
| **`Referrer-Policy`** | `strict-origin-when-cross-origin` or `no-referrer`. | PII or authorization tokens leaking in HTTP `Referer` headers to third-party endpoints. |
|
|
18
|
+
|
|
19
|
+
### Header Probe Command
|
|
20
|
+
```bash
|
|
21
|
+
curl -I -s -X GET "http://localhost:3000/" | grep -iE "(content-security-policy|x-content-type|strict-transport|x-frame|referrer-policy)"
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## 2. CORS Misconfiguration Probing
|
|
27
|
+
|
|
28
|
+
Verify that the backend does not echo arbitrary user-controlled origins while granting credential access:
|
|
29
|
+
|
|
30
|
+
### Test Case: Dynamic Origin Echo
|
|
31
|
+
Send a request with a hostile origin header:
|
|
32
|
+
```bash
|
|
33
|
+
curl -s -I -H "Origin: https://attacker.example.com" \
|
|
34
|
+
-H "Access-Control-Request-Method: GET" \
|
|
35
|
+
-X OPTIONS "http://localhost:3000/api/user/profile"
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
**Evaluate Response**:
|
|
39
|
+
- **CRITICAL Vulnerability**:
|
|
40
|
+
`Access-Control-Allow-Origin: https://attacker.example.com` **AND** `Access-Control-Allow-Credentials: true`.
|
|
41
|
+
*Impact*: Malicious websites can read private user data via cross-origin `fetch` with browser cookies.
|
|
42
|
+
- **Secure Behavior**:
|
|
43
|
+
No `Access-Control-Allow-Origin` header returned, or fixed whitelist match only (e.g. `http://localhost:3000`).
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## 3. Open Redirect Probing
|
|
48
|
+
|
|
49
|
+
Test all authentication and navigation endpoints that accept redirection query parameters (e.g. `?redirect=`, `?next=`, `?return_to=`, `?url=`):
|
|
50
|
+
|
|
51
|
+
| Attack Vector | Payload Sample | Intent |
|
|
52
|
+
|---|---|---|
|
|
53
|
+
| Protocol-Relative URL | `//evil.com/phish` | Bypasses basic `http(s)://` string prefix filters. |
|
|
54
|
+
| Backslash Obfuscation | `/\\evil.com` or `/\evil.com` | Browser treats as hostname on some platforms. |
|
|
55
|
+
| URL Encoding Bypass | `%2F%2Fevil.com` | Double-decode vulnerabilities in routing handlers. |
|
|
56
|
+
| Dot-Dot Slash Escape | `/redirect?url=https://legit.com@evil.com` | Exploits naive authority parsing. |
|
|
57
|
+
|
|
58
|
+
**Remediation Standard**:
|
|
59
|
+
Always validate redirects against a strict relative-path check (`target.startsWith('/') && !target.startsWith('//') && !target.startsWith('/\\')`) or an absolute origin whitelist.
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## 4. Information Disclosure & Unhandled Sinks
|
|
64
|
+
|
|
65
|
+
Probe application endpoints for stack trace exposure or sensitive metadata leakage:
|
|
66
|
+
|
|
67
|
+
1. **Trigger Malformed HTTP Requests**:
|
|
68
|
+
- Send malformed JSON (`{"id": }`) to POST/PUT routes.
|
|
69
|
+
- Send unexpected data types (`/api/users/abc` where integer ID is expected).
|
|
70
|
+
- Check if response status 500 returns internal stack traces, database queries, framework versions, or file paths.
|
|
71
|
+
2. **Sensitive Asset Probing (Development Residuals)**:
|
|
72
|
+
- Check if `.env`, `.git/HEAD`, or development build artifacts are accessible over HTTP:
|
|
73
|
+
```bash
|
|
74
|
+
curl -s -o /dev/null -w "%{http_code}" "http://localhost:3000/.env"
|
|
75
|
+
curl -s -o /dev/null -w "%{http_code}" "http://localhost:3000/.git/HEAD"
|
|
76
|
+
```
|
|
77
|
+
- Any status `200 OK` indicates a critical misconfiguration requiring immediate web server blocking.
|
|
78
|
+
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# Request Mutation & Boundary Fuzzing DSL
|
|
2
|
+
|
|
3
|
+
Derived directly from the rule DSL of **ProjectDiscovery Nuclei** (`pkg/fuzz/fuzz.go`) and the AST mutation engine of **Schemathesis** (`specs/openapi/negative/mutations.py`).
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 1. Multi-Part Mutation Taxonomy
|
|
8
|
+
|
|
9
|
+
When fuzzing API endpoints and web services, payloads are injected across five distinct request segments using four mutation operators:
|
|
10
|
+
|
|
11
|
+
### Mutation Placement Types (`pkg/fuzz/fuzz.go:12-24`)
|
|
12
|
+
- **`replace`**: Replaces the original parameter value entirely with the fuzz payload.
|
|
13
|
+
- **`prefix`**: Prepends the fuzz payload to the beginning of the legitimate parameter value (`payload + original`).
|
|
14
|
+
- **`postfix`**: Appends the fuzz payload to the end of the legitimate parameter value (`original + payload`).
|
|
15
|
+
- **`infix`**: Injects the fuzz payload into the middle of delimited parameter values (e.g. inside path segments or CSV values).
|
|
16
|
+
|
|
17
|
+
### Request Part Targets
|
|
18
|
+
1. **`query`**: URL query parameters (`?id=FUZZ&filter=FUZZ`).
|
|
19
|
+
2. **`body`**: JSON keys, XML tags, or multipart form fields.
|
|
20
|
+
3. **`header`**: HTTP request headers (`User-Agent`, `X-Forwarded-For`, `Authorization`).
|
|
21
|
+
4. **`path`**: Dynamic route path parameters (`/api/v1/users/{id}`).
|
|
22
|
+
5. **`cookie`**: Session identifiers and state cookies.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## 2. Canary-Safe Fuzzing Payloads
|
|
27
|
+
|
|
28
|
+
All dynamic injection tests must use non-destructive canary strings. Never inject destructive SQL drop commands or system shutdown calls:
|
|
29
|
+
|
|
30
|
+
### 2.1 SQL Injection Boundary Canary
|
|
31
|
+
- `replace`: `' OR '1'='1`
|
|
32
|
+
- `postfix`: `' OR 1=1--`
|
|
33
|
+
- `postfix`: `" OR ""="`
|
|
34
|
+
- *Oracle (Detection Criteria)*: Response returns records not belonging to the query scope, or database syntax error message is returned in the response body.
|
|
35
|
+
|
|
36
|
+
### 2.2 Command Injection Delimiter Canary
|
|
37
|
+
- `postfix`: `; echo ASC_CANARY_PROBE`
|
|
38
|
+
- `postfix`: `| echo ASC_CANARY_PROBE`
|
|
39
|
+
- `postfix`: `$(echo ASC_CANARY_PROBE)`
|
|
40
|
+
- *Oracle (Detection Criteria)*: String `ASC_CANARY_PROBE` appears reflected unescaped in response output or execution log.
|
|
41
|
+
|
|
42
|
+
### 2.3 Path Traversal Canary
|
|
43
|
+
- `replace`: `../../../../etc/passwd`
|
|
44
|
+
- `replace`: `..\..\..\windows\win.ini`
|
|
45
|
+
- `replace`: `....//....//....//etc/passwd` (filter bypass)
|
|
46
|
+
- *Oracle (Detection Criteria)*: Contents match `root:x:0:0` or `[fonts]`.
|
|
47
|
+
|
|
48
|
+
### 2.4 Generative Boundary Fuzzing (Denial-of-Service / Crash Probing)
|
|
49
|
+
- **Null Byte Injection**: `canary\0probe` (tests C-string termination bugs in native file/path handlers).
|
|
50
|
+
- **Extreme Integer Overflow**: `9007199254740993` ($2^{53}+1$), `-1`, `2147483648` ($2^{31}$).
|
|
51
|
+
- **Deeply Nested JSON Object**: `{"a":{"a":{"a":{"a": ... }}}}` (depth 100, tests parser stack exhaustion).
|
|
52
|
+
- **Excessive String Payload**: String of $100,000$ random alphanumeric characters (tests memory allocation limits and regex catastrophic backtracking / ReDoS).
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## 3. The Failure Oracle (Crash & Error Triage)
|
|
57
|
+
|
|
58
|
+
When fuzzing an endpoint, every server response is categorized against three automated oracles:
|
|
59
|
+
|
|
60
|
+
| Oracle Condition | Category | Severity | Remediation |
|
|
61
|
+
|---|---|---|---|
|
|
62
|
+
| Response status `500 Internal Server Error` with stack trace or unhandled exception. | Server Crash / Unhandled Sink | HIGH | Catch exception; return structured RFC 9457 error with HTTP 400 Bad Request. |
|
|
63
|
+
| Server hangs / request times out after $> 5000\text{ms}$ on malformed input. | ReDoS / Resource Starvation | HIGH | Set parser size limits; optimize non-backtracking regex (e.g. `re2`). |
|
|
64
|
+
| Injected canary string executed or private peer data returned. | Arbitrary Execution / Auth Bypass | CRITICAL | Parameterize query; enforce authorization policy boundary. |
|
|
65
|
+
| Server responds with HTTP `400 Bad Request` or `422 Unprocessable Entity` with safe JSON error. | Resilient Validation | PASS | Input boundary properly enforced. |
|
|
66
|
+
|