@sentry/warden 0.21.0 → 0.23.0
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/.oxlintrc.json +169 -0
- package/CHANGELOG.md +390 -0
- package/README.md +4 -4
- package/dist/cli/args.d.ts +6 -2
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +175 -207
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/commands/add.d.ts.map +1 -1
- package/dist/cli/commands/add.js +16 -5
- package/dist/cli/commands/add.js.map +1 -1
- package/dist/cli/commands/build.d.ts +13 -0
- package/dist/cli/commands/build.d.ts.map +1 -0
- package/dist/cli/commands/build.js +384 -0
- package/dist/cli/commands/build.js.map +1 -0
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +10 -2
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/runs.d.ts.map +1 -1
- package/dist/cli/commands/runs.js +79 -15
- package/dist/cli/commands/runs.js.map +1 -1
- package/dist/cli/commands/sync.d.ts.map +1 -1
- package/dist/cli/commands/sync.js +4 -1
- package/dist/cli/commands/sync.js.map +1 -1
- package/dist/cli/context.d.ts.map +1 -1
- package/dist/cli/context.js +8 -1
- package/dist/cli/context.js.map +1 -1
- package/dist/cli/files.d.ts.map +1 -1
- package/dist/cli/files.js +27 -9
- package/dist/cli/files.js.map +1 -1
- package/dist/cli/help.d.ts +4 -0
- package/dist/cli/help.d.ts.map +1 -0
- package/dist/cli/help.js +448 -0
- package/dist/cli/help.js.map +1 -0
- package/dist/cli/index.js +2 -13
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/input.d.ts +12 -0
- package/dist/cli/input.d.ts.map +1 -1
- package/dist/cli/input.js +60 -0
- package/dist/cli/input.js.map +1 -1
- package/dist/cli/log-cleanup.d.ts.map +1 -1
- package/dist/cli/log-cleanup.js +4 -0
- package/dist/cli/log-cleanup.js.map +1 -1
- package/dist/cli/main.d.ts +39 -2
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +482 -100
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/output/box.js +1 -1
- package/dist/cli/output/formatters.d.ts +10 -2
- package/dist/cli/output/formatters.d.ts.map +1 -1
- package/dist/cli/output/formatters.js +32 -9
- package/dist/cli/output/formatters.js.map +1 -1
- package/dist/cli/output/index.d.ts +2 -2
- package/dist/cli/output/index.d.ts.map +1 -1
- package/dist/cli/output/index.js +2 -2
- package/dist/cli/output/index.js.map +1 -1
- package/dist/cli/output/ink-runner.d.ts +3 -1
- package/dist/cli/output/ink-runner.d.ts.map +1 -1
- package/dist/cli/output/ink-runner.js +79 -25
- package/dist/cli/output/ink-runner.js.map +1 -1
- package/dist/cli/output/jsonl-schema-gen.d.ts.map +1 -1
- package/dist/cli/output/jsonl-schema-gen.js +4 -2
- package/dist/cli/output/jsonl-schema-gen.js.map +1 -1
- package/dist/cli/output/jsonl.d.ts +147 -4
- package/dist/cli/output/jsonl.d.ts.map +1 -1
- package/dist/cli/output/jsonl.js +183 -7
- package/dist/cli/output/jsonl.js.map +1 -1
- package/dist/cli/output/live-status.d.ts +48 -0
- package/dist/cli/output/live-status.d.ts.map +1 -0
- package/dist/cli/output/live-status.js +173 -0
- package/dist/cli/output/live-status.js.map +1 -0
- package/dist/cli/output/reporter.d.ts +4 -0
- package/dist/cli/output/reporter.d.ts.map +1 -1
- package/dist/cli/output/reporter.js +20 -3
- package/dist/cli/output/reporter.js.map +1 -1
- package/dist/cli/output/tasks.d.ts +11 -5
- package/dist/cli/output/tasks.d.ts.map +1 -1
- package/dist/cli/output/tasks.js +126 -68
- package/dist/cli/output/tasks.js.map +1 -1
- package/dist/cli/signals.d.ts +15 -0
- package/dist/cli/signals.d.ts.map +1 -0
- package/dist/cli/signals.js +26 -0
- package/dist/cli/signals.js.map +1 -0
- package/dist/config/loader.d.ts +48 -7
- package/dist/config/loader.d.ts.map +1 -1
- package/dist/config/loader.js +228 -32
- package/dist/config/loader.js.map +1 -1
- package/dist/config/schema.d.ts +55 -0
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/schema.js +34 -2
- package/dist/config/schema.js.map +1 -1
- package/dist/diff/context.d.ts +9 -2
- package/dist/diff/context.d.ts.map +1 -1
- package/dist/diff/context.js +65 -17
- package/dist/diff/context.js.map +1 -1
- package/dist/evals/runner.d.ts.map +1 -1
- package/dist/evals/runner.js +16 -0
- package/dist/evals/runner.js.map +1 -1
- package/dist/event/context.d.ts.map +1 -1
- package/dist/event/context.js +1 -0
- package/dist/event/context.js.map +1 -1
- package/dist/event/schedule-context.d.ts.map +1 -1
- package/dist/event/schedule-context.js +1 -0
- package/dist/event/schedule-context.js.map +1 -1
- package/dist/index.d.ts +6 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/output/dedup.d.ts +8 -11
- package/dist/output/dedup.d.ts.map +1 -1
- package/dist/output/dedup.js +39 -37
- package/dist/output/dedup.js.map +1 -1
- package/dist/output/github-checks.d.ts +1 -0
- package/dist/output/github-checks.d.ts.map +1 -1
- package/dist/output/github-checks.js +9 -7
- package/dist/output/github-checks.js.map +1 -1
- package/dist/sdk/analyze.d.ts.map +1 -1
- package/dist/sdk/analyze.js +166 -276
- package/dist/sdk/analyze.js.map +1 -1
- package/dist/sdk/circuit-breaker.d.ts +26 -0
- package/dist/sdk/circuit-breaker.d.ts.map +1 -0
- package/dist/sdk/circuit-breaker.js +53 -0
- package/dist/sdk/circuit-breaker.js.map +1 -0
- package/dist/sdk/errors.d.ts +5 -0
- package/dist/sdk/errors.d.ts.map +1 -1
- package/dist/sdk/errors.js +27 -0
- package/dist/sdk/errors.js.map +1 -1
- package/dist/sdk/extract.d.ts +18 -9
- package/dist/sdk/extract.d.ts.map +1 -1
- package/dist/sdk/extract.js +95 -87
- package/dist/sdk/extract.js.map +1 -1
- package/dist/sdk/fix-quality.d.ts +5 -0
- package/dist/sdk/fix-quality.d.ts.map +1 -1
- package/dist/sdk/fix-quality.js +42 -23
- package/dist/sdk/fix-quality.js.map +1 -1
- package/dist/sdk/haiku.d.ts +6 -0
- package/dist/sdk/haiku.d.ts.map +1 -1
- package/dist/sdk/haiku.js +75 -49
- package/dist/sdk/haiku.js.map +1 -1
- package/dist/sdk/json-output.d.ts +31 -0
- package/dist/sdk/json-output.d.ts.map +1 -0
- package/dist/sdk/json-output.js +98 -0
- package/dist/sdk/json-output.js.map +1 -0
- package/dist/sdk/model-pricing.json +56 -16
- package/dist/sdk/post-process.d.ts +29 -0
- package/dist/sdk/post-process.d.ts.map +1 -0
- package/dist/sdk/post-process.js +65 -0
- package/dist/sdk/post-process.js.map +1 -0
- package/dist/sdk/prepare.d.ts.map +1 -1
- package/dist/sdk/prepare.js +4 -1
- package/dist/sdk/prepare.js.map +1 -1
- package/dist/sdk/pricing.d.ts +18 -0
- package/dist/sdk/pricing.d.ts.map +1 -1
- package/dist/sdk/pricing.js +108 -3
- package/dist/sdk/pricing.js.map +1 -1
- package/dist/sdk/prompt-sections.d.ts +56 -0
- package/dist/sdk/prompt-sections.d.ts.map +1 -0
- package/dist/sdk/prompt-sections.js +118 -0
- package/dist/sdk/prompt-sections.js.map +1 -0
- package/dist/sdk/prompt.d.ts +2 -17
- package/dist/sdk/prompt.d.ts.map +1 -1
- package/dist/sdk/prompt.js +15 -37
- package/dist/sdk/prompt.js.map +1 -1
- package/dist/sdk/report-files.d.ts +15 -0
- package/dist/sdk/report-files.d.ts.map +1 -0
- package/dist/sdk/report-files.js +20 -0
- package/dist/sdk/report-files.js.map +1 -0
- package/dist/sdk/runner.d.ts +9 -1
- package/dist/sdk/runner.d.ts.map +1 -1
- package/dist/sdk/runner.js +6 -0
- package/dist/sdk/runner.js.map +1 -1
- package/dist/sdk/runtimes/claude.d.ts +3 -0
- package/dist/sdk/runtimes/claude.d.ts.map +1 -0
- package/dist/sdk/runtimes/claude.js +376 -0
- package/dist/sdk/runtimes/claude.js.map +1 -0
- package/dist/sdk/runtimes/index.d.ts +12 -0
- package/dist/sdk/runtimes/index.d.ts.map +1 -0
- package/dist/sdk/runtimes/index.js +22 -0
- package/dist/sdk/runtimes/index.js.map +1 -0
- package/dist/sdk/runtimes/types.d.ts +116 -0
- package/dist/sdk/runtimes/types.d.ts.map +1 -0
- package/dist/sdk/runtimes/types.js +17 -0
- package/dist/sdk/runtimes/types.js.map +1 -0
- package/dist/sdk/types.d.ts +42 -2
- package/dist/sdk/types.d.ts.map +1 -1
- package/dist/sdk/types.js.map +1 -1
- package/dist/sdk/usage.d.ts +21 -6
- package/dist/sdk/usage.d.ts.map +1 -1
- package/dist/sdk/usage.js +36 -23
- package/dist/sdk/usage.js.map +1 -1
- package/dist/sdk/verify.d.ts +25 -0
- package/dist/sdk/verify.d.ts.map +1 -0
- package/dist/sdk/verify.js +226 -0
- package/dist/sdk/verify.js.map +1 -0
- package/dist/skill-builder/agentic.d.ts +33 -0
- package/dist/skill-builder/agentic.d.ts.map +1 -0
- package/dist/skill-builder/agentic.js +240 -0
- package/dist/skill-builder/agentic.js.map +1 -0
- package/dist/skill-builder/authoring-provider.d.ts +5 -0
- package/dist/skill-builder/authoring-provider.d.ts.map +1 -0
- package/dist/skill-builder/authoring-provider.js +70 -0
- package/dist/skill-builder/authoring-provider.js.map +1 -0
- package/dist/skill-builder/definition.d.ts +46 -0
- package/dist/skill-builder/definition.d.ts.map +1 -0
- package/dist/skill-builder/definition.js +171 -0
- package/dist/skill-builder/definition.js.map +1 -0
- package/dist/skill-builder/outline-contract.d.ts +113 -0
- package/dist/skill-builder/outline-contract.d.ts.map +1 -0
- package/dist/skill-builder/outline-contract.js +73 -0
- package/dist/skill-builder/outline-contract.js.map +1 -0
- package/dist/skill-builder/outline-state.d.ts +158 -0
- package/dist/skill-builder/outline-state.d.ts.map +1 -0
- package/dist/skill-builder/outline-state.js +87 -0
- package/dist/skill-builder/outline-state.js.map +1 -0
- package/dist/skill-builder/outline.d.ts +36 -0
- package/dist/skill-builder/outline.d.ts.map +1 -0
- package/dist/skill-builder/outline.js +345 -0
- package/dist/skill-builder/outline.js.map +1 -0
- package/dist/skill-builder/skill-contract.d.ts +97 -0
- package/dist/skill-builder/skill-contract.d.ts.map +1 -0
- package/dist/skill-builder/skill-contract.js +58 -0
- package/dist/skill-builder/skill-contract.js.map +1 -0
- package/dist/skill-builder/skill-prompts.d.ts +61 -0
- package/dist/skill-builder/skill-prompts.d.ts.map +1 -0
- package/dist/skill-builder/skill-prompts.js +285 -0
- package/dist/skill-builder/skill-prompts.js.map +1 -0
- package/dist/skill-builder/skill.d.ts +23 -0
- package/dist/skill-builder/skill.d.ts.map +1 -0
- package/dist/skill-builder/skill.js +563 -0
- package/dist/skill-builder/skill.js.map +1 -0
- package/dist/skills/index.d.ts +2 -2
- package/dist/skills/index.d.ts.map +1 -1
- package/dist/skills/index.js +1 -1
- package/dist/skills/index.js.map +1 -1
- package/dist/skills/loader.d.ts +20 -6
- package/dist/skills/loader.d.ts.map +1 -1
- package/dist/skills/loader.js +88 -141
- package/dist/skills/loader.js.map +1 -1
- package/dist/skills/remote.d.ts +11 -7
- package/dist/skills/remote.d.ts.map +1 -1
- package/dist/skills/remote.js +62 -162
- package/dist/skills/remote.js.map +1 -1
- package/dist/triggers/matcher.d.ts.map +1 -1
- package/dist/triggers/matcher.js +28 -15
- package/dist/triggers/matcher.js.map +1 -1
- package/dist/types/index.d.ts +41 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +24 -0
- package/dist/types/index.js.map +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/path.d.ts +17 -0
- package/dist/utils/path.d.ts.map +1 -0
- package/dist/utils/path.js +36 -0
- package/dist/utils/path.js.map +1 -0
- package/package.json +8 -8
- package/policies/README.md +22 -0
- package/policies/code-comments.md +20 -0
- package/policies/policy-template.md +14 -0
- package/skills/warden/SKILL.md +5 -5
- package/skills/warden/SOURCES.md +39 -0
- package/skills/warden/SPEC.md +112 -0
- package/skills/warden/references/cli-reference.md +11 -4
- package/skills/warden/references/config-schema.md +38 -13
- package/skills/warden/references/configuration.md +29 -8
- package/skills/warden-sweep/SKILL.md +43 -365
- package/skills/warden-sweep/SOURCES.md +43 -0
- package/skills/warden-sweep/SPEC.md +126 -0
- package/skills/warden-sweep/references/issue-phase.md +24 -0
- package/skills/warden-sweep/references/organize-phase.md +31 -0
- package/skills/warden-sweep/references/patch-phase.md +142 -0
- package/skills/warden-sweep/references/resume-and-artifacts.md +51 -0
- package/skills/warden-sweep/references/scan-phase.md +46 -0
- package/skills/warden-sweep/references/script-interfaces.md +127 -0
- package/skills/warden-sweep/references/verify-phase.md +69 -0
- package/src/builtin-skills/security-review/SKILL.md +81 -0
- package/src/builtin-skills/security-review/SPEC.md +77 -0
- package/src/builtin-skills/security-review/references/github-workflows.md +186 -0
- package/src/builtin-skills/security-review/references/javascript-typescript.md +69 -0
- package/src/builtin-skills/security-review/references/python.md +70 -0
- package/src/internal-skills/skill-writer/EVAL.md +124 -0
- package/src/internal-skills/skill-writer/SKILL.md +159 -0
- package/src/internal-skills/skill-writer/SOURCES.md +94 -0
- package/src/internal-skills/skill-writer/SPEC.md +153 -0
- package/src/internal-skills/skill-writer/references/artifact-layouts/argument-driven-skill-layout.md +32 -0
- package/src/internal-skills/skill-writer/references/artifact-layouts/asset-template-skill-layout.md +30 -0
- package/src/internal-skills/skill-writer/references/artifact-layouts/inline-skill-layout.md +28 -0
- package/src/internal-skills/skill-writer/references/artifact-layouts/reference-backed-skill-layout.md +35 -0
- package/src/internal-skills/skill-writer/references/artifact-layouts/script-backed-skill-layout.md +31 -0
- package/src/internal-skills/skill-writer/references/authoring-path.md +91 -0
- package/src/internal-skills/skill-writer/references/claude-code/argument-substitutions.md +20 -0
- package/src/internal-skills/skill-writer/references/claude-code/dynamic-context.md +16 -0
- package/src/internal-skills/skill-writer/references/claude-code/frontmatter-and-invocation.md +33 -0
- package/src/internal-skills/skill-writer/references/claude-code/hook-backed-skills.md +28 -0
- package/src/internal-skills/skill-writer/references/claude-code/subagent-fork-skills.md +22 -0
- package/src/internal-skills/skill-writer/references/description-optimization.md +28 -0
- package/src/internal-skills/skill-writer/references/design-principles.md +74 -0
- package/src/internal-skills/skill-writer/references/evaluation-path.md +73 -0
- package/src/internal-skills/skill-writer/references/examples/documentation-skill.md +70 -0
- package/src/internal-skills/skill-writer/references/examples/evaluator-loop-skill.md +38 -0
- package/src/internal-skills/skill-writer/references/examples/hook-backed-skill.md +39 -0
- package/src/internal-skills/skill-writer/references/examples/router-skill.md +41 -0
- package/src/internal-skills/skill-writer/references/examples/security-review-skill.md +69 -0
- package/src/internal-skills/skill-writer/references/examples/subagent-fork-skill.md +39 -0
- package/src/internal-skills/skill-writer/references/examples/workflow-process-skill.md +65 -0
- package/src/internal-skills/skill-writer/references/execution-shapes.md +68 -0
- package/src/internal-skills/skill-writer/references/iteration-evidence.md +82 -0
- package/src/internal-skills/skill-writer/references/iteration-path.md +40 -0
- package/src/internal-skills/skill-writer/references/mode-selection.md +67 -0
- package/src/internal-skills/skill-writer/references/output-contracts.md +68 -0
- package/src/internal-skills/skill-writer/references/reference-architecture.md +71 -0
- package/src/internal-skills/skill-writer/references/registration-validation.md +67 -0
- package/src/internal-skills/skill-writer/references/source-discovery.md +60 -0
- package/src/internal-skills/skill-writer/references/spec-template.md +118 -0
- package/src/internal-skills/skill-writer/references/structure-troubleshooting.md +111 -0
- package/src/internal-skills/skill-writer/references/synthesis-path.md +119 -0
- package/src/internal-skills/skill-writer/references/workflow-mechanics/evaluator-loops.md +25 -0
- package/src/internal-skills/skill-writer/references/workflow-mechanics/orchestrator-workers.md +25 -0
- package/src/internal-skills/skill-writer/references/workflow-mechanics/parallel-workflows.md +21 -0
- package/src/internal-skills/skill-writer/references/workflow-mechanics/plan-validate-execute.md +26 -0
- package/src/internal-skills/skill-writer/references/workflow-mechanics/prompt-chaining.md +24 -0
- package/src/internal-skills/skill-writer/references/workflow-mechanics/routing-workflows.md +28 -0
- package/src/internal-skills/skill-writer/references/workflow-mechanics/validation-loops.md +26 -0
- package/src/internal-skills/skill-writer/scripts/quick_validate.py +158 -0
- package/src/internal-skills/skill-writer/scripts/quick_validate_test.py +79 -0
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
# GitHub Workflow Security Notes
|
|
2
|
+
|
|
3
|
+
Use this when reviewing GitHub Actions workflows, local actions, reusable workflows, or scripts/config loaded by workflows. This reference adapts the dedicated workflow-security prior art for the broad `security-review` skill; keep findings exploit-oriented, not style-oriented.
|
|
4
|
+
|
|
5
|
+
## Contents
|
|
6
|
+
|
|
7
|
+
- [Review Map](#review-map)
|
|
8
|
+
- [Reportable Patterns](#reportable-patterns)
|
|
9
|
+
- [False-Positive Controls](#false-positive-controls)
|
|
10
|
+
- [Verification Checklist](#verification-checklist)
|
|
11
|
+
- [Minimal Examples](#minimal-examples)
|
|
12
|
+
|
|
13
|
+
## Review Map
|
|
14
|
+
|
|
15
|
+
Start with the effective execution graph:
|
|
16
|
+
|
|
17
|
+
1. Identify the trigger: `pull_request`, `pull_request_target`, `workflow_run`, `workflow_dispatch`, `workflow_call`, `issue_comment`, `discussion`, `label`, `push`, `release`, or `schedule`.
|
|
18
|
+
2. Mark who controls each input: fork PR code, PR title/body, branch names, changed filenames, comments, labels, discussion text, manual inputs, reusable-workflow inputs, artifacts, caches, local actions, and checked-out refs.
|
|
19
|
+
3. Follow every boundary: `uses: ./.github/actions/...`, `uses: ./.github/workflows/...`, composite action steps, repo-local scripts, Makefiles, package commands, artifacts, caches, and downloaded tools.
|
|
20
|
+
4. Mark privileges at the point of execution: `secrets.*`, PATs, deploy keys, registry tokens, `id-token: write`, `GITHUB_TOKEN` write scopes, release/package/deploy authority, and self-hosted runners.
|
|
21
|
+
5. Report only when untrusted or caller-controlled code/data reaches privileged execution, credentials, trusted artifacts, releases/packages/deployments, or sensitive runners.
|
|
22
|
+
|
|
23
|
+
In-scope files include `.github/workflows/*.yml`, `.github/workflows/*.yaml`, `.github/actions/**/action.yml`, `.github/actions/**/action.yaml`, repository-root `action.yml`/`action.yaml`, and any scripts/config files loaded by those workflows.
|
|
24
|
+
|
|
25
|
+
## Reportable Patterns
|
|
26
|
+
|
|
27
|
+
| Pattern | Report When | Safer Shape |
|
|
28
|
+
|---------|-------------|-------------|
|
|
29
|
+
| Privileged PR checkout | `pull_request_target`, privileged `workflow_run`, or similar trusted context checks out, imports, builds, tests, or executes PR-controlled refs while trusted tokens/secrets are available | Use `pull_request` for untrusted code, or keep `pull_request_target` metadata-only |
|
|
30
|
+
| Expression injection | Attacker/caller-controlled `${{ }}` reaches `run:`, composite shell steps, `bash -c`, `node -e`, `python -c`, `actions/github-script`, `actions/script`, or workflow command files | Move values to `env:`, read native variables, quote/validate, and avoid interpreter strings |
|
|
31
|
+
| Manual or reusable input RCE | Free-form `workflow_dispatch` or `workflow_call` input reaches release, deploy, publish, signing, PR creation, OIDC, PAT, or secret-bearing commands | Use finite input types, allowlists, argv APIs, and least privilege |
|
|
32
|
+
| Comment/chatops abuse | `issue_comment`, discussion, label, or slash-command workflows execute privileged commands without a trusted actor gate, or use comment text as shell/script input | Verify owner/member/collaborator/team permission and parse arguments as data |
|
|
33
|
+
| Approval TOCTOU | Maintainer approval occurs, then the workflow re-resolves `pull_request.head.sha`, `head_ref`, or PR refs at run time before privileged checkout/execution | Pin the exact SHA approved by the maintainer, or require re-approval after every push |
|
|
34
|
+
| Reusable/local action trust crossing | Caller grants secrets/write scopes while a callee or local composite action executes caller-controlled inputs or PR-controlled files | Pass narrow secrets, define callee permissions, validate inputs, keep local actions on trusted code |
|
|
35
|
+
| Artifact/cache trust crossing | Privileged `workflow_run`, release, or deploy job executes or trusts artifacts/caches produced by untrusted PR jobs | Treat artifacts/caches as untrusted data; validate, sign, or partition trust scopes |
|
|
36
|
+
| Artifact credential leak | `upload-artifact` uploads the workspace/root, `.git/`, home credential files, Docker/npm config, or similar after credentials were written | Upload only build outputs; set `persist-credentials: false`; exclude credential paths |
|
|
37
|
+
| Self-hosted runner exposure | PR-reachable or comment-triggered jobs run untrusted code on persistent, internal, signing, deploy, or otherwise sensitive self-hosted runners | Keep untrusted code on GitHub-hosted runners or require a strong approval gate |
|
|
38
|
+
| Mutable action supply chain | Third-party `uses: owner/action@tag`, branch, partial SHA, or mutable reusable workflow runs in a job with secrets, OIDC, write token, release, deploy, package, or signing power | Pin third-party actions and reusable workflows to a 40-character commit SHA |
|
|
39
|
+
| AI agent config poisoning | Privileged workflows run coding/review agents on PR-controlled checkouts or instruction files such as `AGENTS.md`, `CLAUDE.md`, or Copilot instructions | Run agents in unprivileged PR context, protect instruction files, and avoid write/secrets in poisoned contexts |
|
|
40
|
+
|
|
41
|
+
### Expression Injection Sources
|
|
42
|
+
|
|
43
|
+
Treat these as untrusted when the trigger is externally reachable, manually triggerable, or callable:
|
|
44
|
+
|
|
45
|
+
- PR title/body, issue title/body, comment body, review body, discussion title/body, label names, branch names, commit messages, changed filenames, and changed-file lists.
|
|
46
|
+
- `inputs.*` and `github.event.inputs.*` from `workflow_dispatch`.
|
|
47
|
+
- `inputs.*` from `workflow_call`, including values passed through visible caller workflows.
|
|
48
|
+
- Action outputs or env vars derived from the values above.
|
|
49
|
+
|
|
50
|
+
Usually not injectable by themselves: PR numbers, numeric IDs, full commit SHAs, booleans, base-repository constants, and hardcoded shell-safe `choice` inputs. Re-check them if later code reinterprets the value as shell, JavaScript, Python, package-manager flags, or another code-like language.
|
|
51
|
+
|
|
52
|
+
Dangerous sinks include:
|
|
53
|
+
|
|
54
|
+
- `run: echo "${{ github.event.pull_request.title }}"`
|
|
55
|
+
- `actions/github-script` or `actions/script` `script:` bodies containing `${{ github.event.* }}` or `${{ inputs.* }}`
|
|
56
|
+
- `echo "key=${{ github.event.comment.body }}" >> $GITHUB_OUTPUT`, `$GITHUB_ENV`, `$GITHUB_STEP_SUMMARY`, or `$GITHUB_PATH`
|
|
57
|
+
- `npx semver -i ${{ inputs.bump }} "$CURRENT"`, `gh pr create --fill ${{ inputs.pr_options }}`, `docker build -t ${{ inputs.tag }}`, `git checkout ${{ inputs.ref }}`
|
|
58
|
+
- Composite action shell steps that interpolate `${{ inputs.* }}` from an externally reachable caller
|
|
59
|
+
|
|
60
|
+
### Privileged PR Context
|
|
61
|
+
|
|
62
|
+
High-signal indicators:
|
|
63
|
+
|
|
64
|
+
- `on: pull_request_target` plus `actions/checkout` with `ref: ${{ github.event.pull_request.head.sha }}`, `github.head_ref`, `github.event.pull_request.head.ref`, `repository: ${{ github.event.pull_request.head.repo.full_name }}`, `refs/pull/...`, or custom `git fetch` of PR refs.
|
|
65
|
+
- Build/test/package commands after PR checkout: `npm install`, `pnpm install`, `npm test`, `pip install`, `tox`, `pytest`, `make`, `cargo`, `go test`, `bundle`, `gradle`, `mvn`.
|
|
66
|
+
- Local actions, scripts, Makefiles, package lifecycle hooks, or config files loaded from the PR checkout.
|
|
67
|
+
- `persist-credentials` omitted or true before untrusted code runs.
|
|
68
|
+
- Write scopes, secrets, OIDC, package publishing, release creation, deployments, or agent write access available in the same job.
|
|
69
|
+
|
|
70
|
+
Do not report `pull_request_target` that only labels, comments, or reads metadata without checking out or loading PR-controlled files.
|
|
71
|
+
|
|
72
|
+
### Reusable Workflows, Artifacts, Caches, And Credentials
|
|
73
|
+
|
|
74
|
+
Trace cross-file flows before reporting:
|
|
75
|
+
|
|
76
|
+
- `workflow_call` callers that pass secrets/write permissions into a callee that executes caller-controlled inputs.
|
|
77
|
+
- Reusable workflows that reference `secrets.X` without declaring `X` under `on.workflow_call.secrets`, other than `GITHUB_TOKEN`; this hides the secret surface and pressures callers into `secrets: inherit`.
|
|
78
|
+
- Reusable workflows without top-level or job-level `permissions:` when the callee needs a narrower scope than callers commonly grant.
|
|
79
|
+
- `workflow_run` jobs that download artifacts from untrusted PR workflows and execute scripts, import code, publish packages, or make trusted comments without validation.
|
|
80
|
+
- Caches shared from untrusted PR jobs into privileged jobs, including eviction-and-replace poisoning of expected cache keys.
|
|
81
|
+
- `actions/upload-artifact` whose `path:` includes `.`, `./`, `${{ github.workspace }}`, `.git/`, `~/.docker/config.json`, `~/.npmrc`, `~/.gitconfig`, `~/.aws/credentials`, or other credential-bearing paths after checkout/login/setup steps.
|
|
82
|
+
- `id-token: write` where untrusted refs can satisfy visible cloud OIDC trust policies.
|
|
83
|
+
|
|
84
|
+
Permissions and secrets are amplifiers. Tie them to the untrusted execution or leak path.
|
|
85
|
+
|
|
86
|
+
### Mutable Action References
|
|
87
|
+
|
|
88
|
+
Report mutable third-party actions only when job privilege makes compromise security-relevant. CVE-2025-30066 (`tj-actions/changed-files`) and related 2025 supply-chain incidents showed that tag rewrites can leak secrets at scale.
|
|
89
|
+
|
|
90
|
+
Severity guide:
|
|
91
|
+
|
|
92
|
+
| Shape | Severity |
|
|
93
|
+
|-------|----------|
|
|
94
|
+
| Mutable third-party ref in package publishing, release signing, protected-branch push, production deploy, or token-minting job | high |
|
|
95
|
+
| Mutable third-party ref with secrets, OIDC, or non-trivial write-scoped `GITHUB_TOKEN` | medium |
|
|
96
|
+
| Pinned action that downloads and executes mutable remote scripts in a privileged job | medium, or high when the downloaded payload runs inside the privileged step |
|
|
97
|
+
| Mutable third-party ref in public read-only CI with no secrets and no write scopes | no finding unless adjacent to another traced workflow risk |
|
|
98
|
+
|
|
99
|
+
First-party `actions/*` and `github/*` actions on version tags are not findings by themselves. Same-repo or vendored actions are not third-party supply-chain findings, but can still be unsafe if they are loaded from PR-controlled checkouts.
|
|
100
|
+
|
|
101
|
+
## False-Positive Controls
|
|
102
|
+
|
|
103
|
+
- Broad `permissions:` alone is not a vulnerability. Report it only as part of untrusted execution, credential exposure, artifact trust, or privileged side effect.
|
|
104
|
+
- Plain `pull_request` normally has restricted token and no base secrets for forks. Trace downstream artifacts/caches before escalating.
|
|
105
|
+
- `${{ }}` in `if:`, ordinary `with:`, or `env:` is not a sink unless the receiving action or a later shell/script interprets it as code. `actions/github-script` `with: script:` is a code sink.
|
|
106
|
+
- `env:` is only safe when the later shell/script uses native variables with quoting or validation. `echo '${{ env.BODY }}'` is still expression expansion.
|
|
107
|
+
- Hardcoded `choice`, `boolean`, `number`, and `environment` workflow inputs are usually safe when used only in `if:`, ordinary `with:`, or safely quoted `env:` contexts.
|
|
108
|
+
- Comment/body parsing is not a bug unless it triggers meaningful execution or privileged state change.
|
|
109
|
+
- `CONTRIBUTOR` is not equivalent to `MEMBER`, `OWNER`, or `COLLABORATOR` for chatops authorization.
|
|
110
|
+
- `persist-credentials: false` reduces `.git/config` token theft, but does not protect unrelated secrets, PATs, OIDC, or registry credentials.
|
|
111
|
+
- Do not invent external action internals. If source is unavailable, report the unresolved trust assumption as medium confidence at most.
|
|
112
|
+
|
|
113
|
+
## Verification Checklist
|
|
114
|
+
|
|
115
|
+
Before reporting:
|
|
116
|
+
|
|
117
|
+
1. Confirm the trigger can be reached by the attacker or lower-privileged caller you name.
|
|
118
|
+
2. Identify the exact attacker-controlled or caller-controlled value.
|
|
119
|
+
3. Identify the sink: shell/script execution, local action, package lifecycle hook, artifact/cache trust, credential-bearing upload, mutable action, or sensitive runner.
|
|
120
|
+
4. Follow local actions, reusable workflows, scripts, package commands, and workflow-produced artifacts/caches.
|
|
121
|
+
5. Confirm secrets, token scopes, OIDC, deploy/release/package authority, or runner sensitivity at the sink.
|
|
122
|
+
6. Check actor gates, branch/fork guards, finite input types, SHA pinning, `persist-credentials: false`, artifact path narrowing, and cloud trust-policy constraints.
|
|
123
|
+
7. Anchor the finding to the changed workflow line, and name the crossed boundary plus concrete impact.
|
|
124
|
+
|
|
125
|
+
## Minimal Examples
|
|
126
|
+
|
|
127
|
+
**Report: privileged PR checkout**
|
|
128
|
+
|
|
129
|
+
```yaml
|
|
130
|
+
on: pull_request_target
|
|
131
|
+
permissions: write-all
|
|
132
|
+
jobs:
|
|
133
|
+
test:
|
|
134
|
+
runs-on: ubuntu-latest
|
|
135
|
+
steps:
|
|
136
|
+
- uses: actions/checkout@v4
|
|
137
|
+
with:
|
|
138
|
+
ref: ${{ github.event.pull_request.head.sha }}
|
|
139
|
+
- run: pnpm install
|
|
140
|
+
- run: pnpm test
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Risk: fork code controls package scripts while the job has trusted-repository permissions.
|
|
144
|
+
|
|
145
|
+
**Report: github-script injection**
|
|
146
|
+
|
|
147
|
+
```yaml
|
|
148
|
+
on: issues
|
|
149
|
+
jobs:
|
|
150
|
+
comment:
|
|
151
|
+
steps:
|
|
152
|
+
- uses: actions/github-script@v7
|
|
153
|
+
with:
|
|
154
|
+
script: |
|
|
155
|
+
github.rest.issues.createComment({
|
|
156
|
+
body: `hello ${{ github.event.issue.title }}`
|
|
157
|
+
})
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
Risk: the issue title is expanded into JavaScript before `actions/github-script` runs.
|
|
161
|
+
|
|
162
|
+
**Report: workspace artifact leak**
|
|
163
|
+
|
|
164
|
+
```yaml
|
|
165
|
+
steps:
|
|
166
|
+
- uses: actions/checkout@v4
|
|
167
|
+
- uses: actions/upload-artifact@v4
|
|
168
|
+
with:
|
|
169
|
+
path: .
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
Risk: `.git/config` can contain persisted checkout credentials, and public-repo artifacts can expose them.
|
|
173
|
+
|
|
174
|
+
**Do not report: metadata-only target workflow**
|
|
175
|
+
|
|
176
|
+
```yaml
|
|
177
|
+
on: pull_request_target
|
|
178
|
+
permissions:
|
|
179
|
+
pull-requests: write
|
|
180
|
+
jobs:
|
|
181
|
+
label:
|
|
182
|
+
steps:
|
|
183
|
+
- run: gh pr edit "$PR" --add-label needs-review
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
No PR-controlled code or text reaches execution. Broad token scope alone is not enough.
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# JavaScript And TypeScript Security Notes
|
|
2
|
+
|
|
3
|
+
Use this when reviewing JavaScript, TypeScript, Node, React, Next.js, or browser code. These examples refine the core skill; they do not add new reporting scope.
|
|
4
|
+
|
|
5
|
+
## Server-Side Entry Points
|
|
6
|
+
|
|
7
|
+
- Next.js route handlers, Server Actions, API routes, tRPC/RPC handlers, Express/Fastify/Koa routes, webhook handlers, queue consumers, and CLI/service functions can be security boundaries.
|
|
8
|
+
- Treat Server Actions as callable server entry points. UI visibility, hidden form fields, and client components are not authorization.
|
|
9
|
+
- Next.js `middleware.ts` is not enough proof of authorization for sensitive mutations. Verify handler-level auth and resource-level authorization.
|
|
10
|
+
- For service handlers, do not trust caller-controlled headers such as `x-user-id`, `x-org-id`, `x-forwarded-*`, or internal-only flags unless a trusted gateway verifies them.
|
|
11
|
+
|
|
12
|
+
## High-Signal Patterns
|
|
13
|
+
|
|
14
|
+
| Pattern | Vulnerable | Safer |
|
|
15
|
+
|---------|------------|-------|
|
|
16
|
+
| Server Action authz | `"use server"` mutation trusts `userId`, `teamId`, `role`, hidden fields, or form args | Load session in the action, scope by server-side tenant, enforce permission |
|
|
17
|
+
| SQL injection | `prisma.$queryRawUnsafe(\`...${id}\`)`, string-built SQL, concatenated `where` clauses | Tagged templates, query parameters, ORM filters scoped to the authenticated tenant |
|
|
18
|
+
| Command injection | `exec("git " + branch)`, `spawn(cmd, args, {shell: true})` with user input | `execFile`/`spawn` with fixed binary, fixed argument positions, and strict allowlists |
|
|
19
|
+
| XSS | `innerHTML`, `dangerouslySetInnerHTML`, `unsafeHTML`, unsafe Markdown HTML, inline script JSON with user data | Text rendering, vetted sanitizer, escaping `<` in inline JSON, no dangerous URL schemes |
|
|
20
|
+
| SSRF | `fetch(req.query.url)`, image/preview/proxy fetchers using user URLs, redirect-following after first-hop validation | Exact host allowlist, private-IP blocking, DNS rebinding defenses, redirect revalidation or manual redirects |
|
|
21
|
+
| Open redirect | `redirect(searchParams.get("next"))`, prefix/substring URL checks in login or OAuth flows | Relative-path allowlist or exact origin/path allowlist after URL normalization |
|
|
22
|
+
| Path traversal | `path.join(root, userPath)` without realpath containment, archive extraction by entry name | Normalize and resolve real paths, verify containment, generate server-side filenames |
|
|
23
|
+
| Webhook forgery | State-changing webhook parses JSON before verifying signature or skips timestamp/replay checks | Verify raw body signature, timestamp freshness, replay/idempotency, and provider secret before side effects |
|
|
24
|
+
| Secrets exposure | Secrets in client components, `NEXT_PUBLIC_*`, serialized props, logs, or error responses | Server-only reads, redacted logs, safe error messages, no hardcoded production fallback |
|
|
25
|
+
|
|
26
|
+
## False-Positive Controls
|
|
27
|
+
|
|
28
|
+
- React text interpolation escapes by default. Report only escape hatches or dangerous URL/script contexts.
|
|
29
|
+
- Prisma/Drizzle/Knex query builders can parameterize values. Verify the specific API before reporting SQL injection.
|
|
30
|
+
- `crypto.randomUUID()` and `crypto.getRandomValues()` are suitable for security randomness; `Math.random()` is not.
|
|
31
|
+
- `jsonwebtoken.verify` can be safe when algorithms, issuer/audience, expiry, and key selection are pinned appropriately.
|
|
32
|
+
- DOMPurify or equivalent sanitizers can mitigate HTML injection when configured for the target context.
|
|
33
|
+
|
|
34
|
+
## Minimal Examples
|
|
35
|
+
|
|
36
|
+
**Report: cross-tenant lookup**
|
|
37
|
+
|
|
38
|
+
```ts
|
|
39
|
+
const invoice = await db.invoice.findUnique({ where: { id: params.invoiceId } });
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Require: server-derived tenant scope such as `accountId: session.accountId`, plus permission checks.
|
|
43
|
+
|
|
44
|
+
**Report: Server Action trusts caller fields**
|
|
45
|
+
|
|
46
|
+
```ts
|
|
47
|
+
"use server";
|
|
48
|
+
export async function setRole(userId: string, role: string) {
|
|
49
|
+
await db.user.update({ where: { id: userId }, data: { role } });
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Require: load session in the action and prove caller can mutate that tenant user.
|
|
54
|
+
|
|
55
|
+
**Report: inline JSON script breakout**
|
|
56
|
+
|
|
57
|
+
```tsx
|
|
58
|
+
<script dangerouslySetInnerHTML={{ __html: `window.__DATA__=${JSON.stringify(data)}` }} />
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Risk: `</script>` breakout. Require: escape `<` or `</script` before embedding.
|
|
62
|
+
|
|
63
|
+
**Do not report: parameterized query**
|
|
64
|
+
|
|
65
|
+
```ts
|
|
66
|
+
await db.$queryRaw`SELECT * FROM invoices WHERE id = ${invoiceId} AND account_id = ${accountId}`;
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
This is not SQL injection if the tagged template parameterizes values and `accountId` is trusted from the authenticated session.
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# Python Security Notes
|
|
2
|
+
|
|
3
|
+
Use this when reviewing Python, Django, Flask, FastAPI, Celery, or Python service code. These examples refine the core skill; they do not add new reporting scope.
|
|
4
|
+
|
|
5
|
+
## Server-Side Entry Points
|
|
6
|
+
|
|
7
|
+
- Django views, DRF viewsets, Flask/FastAPI routes, GraphQL resolvers, webhook handlers, Celery tasks, management commands, and service-layer functions can cross trust boundaries.
|
|
8
|
+
- For background jobs and tasks, verify the caller, queue, payload signing, tenant context, and idempotency before assuming input is trusted.
|
|
9
|
+
- Decorators can prove authentication only if they wrap the effective handler. Still verify object-level authorization.
|
|
10
|
+
- DRF/FastAPI auth dependencies prove identity, not ownership of route params or body IDs.
|
|
11
|
+
|
|
12
|
+
## High-Signal Patterns
|
|
13
|
+
|
|
14
|
+
| Pattern | Vulnerable | Safer |
|
|
15
|
+
|---------|------------|-------|
|
|
16
|
+
| SQL injection | `cursor.execute(f"...{request.GET['q']}...")`, string-built raw SQL | Parameterized queries, ORM filters, strict enum allowlists for identifiers |
|
|
17
|
+
| Command injection | `os.system`, `subprocess.run(..., shell=True)`, shell strings with request data | `subprocess.run([fixed_binary, fixed_arg])`, strict allowlists, no shell |
|
|
18
|
+
| Path traversal | `open(base / request.args["name"])`, `send_file(user_path)`, unsafe archive extraction | `Path.resolve()` containment checks, generated filenames, safe storage APIs |
|
|
19
|
+
| SSRF | `requests.get(request.GET["url"])`, preview/proxy fetchers, redirect-following after first-hop validation | Exact host allowlist, block private/link-local IPs, disable or revalidate redirects |
|
|
20
|
+
| Open redirect | `redirect(request.GET["next"])`, login/callback redirects with weak host checks | Relative-path allowlist or framework helper with exact allowed hosts |
|
|
21
|
+
| Unsafe deserialization | `pickle.loads`, `yaml.load` without `SafeLoader`, model/job loaders on uploaded data | JSON or typed schemas, `yaml.safe_load`, signed trusted artifacts only |
|
|
22
|
+
| XSS | Jinja/Django `|safe`, `Markup`, disabled autoescape, raw HTML from user content | Autoescaping, vetted sanitizer, context-correct escaping |
|
|
23
|
+
| Authz bypass | `Model.objects.get(id=request.GET["id"])` on tenant data | Scope by authenticated user/org/account and enforce permissions before returning or mutating |
|
|
24
|
+
| Task trust confusion | Celery task mutates `invoice_id`, `user_id`, or `account_id` queued from a request without rechecking scope | Pass server-derived actor/tenant context and re-check before mutation |
|
|
25
|
+
| Secrets exposure | Logging tokens, cookies, auth headers, signed URLs, stack traces, or env secrets | Redacted logging, generic errors, server-only secret access |
|
|
26
|
+
|
|
27
|
+
## False-Positive Controls
|
|
28
|
+
|
|
29
|
+
- Django and SQLAlchemy ORM filters usually parameterize values. Raw SQL and string-built identifiers need closer review.
|
|
30
|
+
- Django and Jinja autoescape ordinary template interpolation by default. Report only unsafe filters, raw HTML, or disabled autoescape.
|
|
31
|
+
- `secrets` and `os.urandom` are suitable for security randomness; `random` is not.
|
|
32
|
+
- `yaml.safe_load` is the safe default for untrusted YAML; `yaml.load` may still be safe only when an explicit safe loader is used.
|
|
33
|
+
- `Path.resolve()` containment checks can mitigate traversal when they compare the resolved child against the resolved allowed root.
|
|
34
|
+
|
|
35
|
+
## Minimal Examples
|
|
36
|
+
|
|
37
|
+
**Report: object-level authorization bypass**
|
|
38
|
+
|
|
39
|
+
```python
|
|
40
|
+
invoice = Invoice.objects.get(id=request.GET["invoice_id"])
|
|
41
|
+
return JsonResponse({"total": invoice.total, "email": invoice.customer.email})
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Require: authenticated account/org scope and permission before returning sensitive data.
|
|
45
|
+
|
|
46
|
+
**Report: task loses tenant context**
|
|
47
|
+
|
|
48
|
+
```python
|
|
49
|
+
@shared_task
|
|
50
|
+
def approve_invoice(invoice_id: str):
|
|
51
|
+
Invoice.objects.filter(id=invoice_id).update(status="approved")
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Require: reload trusted actor/tenant context and enforce permission.
|
|
55
|
+
|
|
56
|
+
**Report: unsafe uploaded state**
|
|
57
|
+
|
|
58
|
+
```python
|
|
59
|
+
state = pickle.loads(base64.b64decode(request.POST["state"]))
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Risk: unsafe deserialization. Require: trusted, signature-verified artifact before deserialization.
|
|
63
|
+
|
|
64
|
+
**Do not report: scoped ORM query**
|
|
65
|
+
|
|
66
|
+
```python
|
|
67
|
+
invoice = Invoice.objects.get(id=invoice_id, account_id=request.user.account_id)
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
This is not an authorization bypass if `request.user.account_id` is trusted and the caller is authenticated for that account.
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# Skill Writer Eval Prompts
|
|
2
|
+
|
|
3
|
+
Use these prompts when deeper evaluation matters (high-risk, regression tracking, or explicit request).
|
|
4
|
+
These are optional guidance artifacts, not required outputs for every skill.
|
|
5
|
+
|
|
6
|
+
## Advanced Shape Selection Eval
|
|
7
|
+
|
|
8
|
+
```text
|
|
9
|
+
Update or create the requested skill and select the simplest adequate execution shape.
|
|
10
|
+
|
|
11
|
+
For every scenario:
|
|
12
|
+
- name the skill class
|
|
13
|
+
- name the primary execution shape
|
|
14
|
+
- explain why simpler shapes were rejected only if you choose an advanced shape
|
|
15
|
+
- add portability notes if you use provider-specific mechanics
|
|
16
|
+
|
|
17
|
+
Scenarios:
|
|
18
|
+
|
|
19
|
+
1. "Create a skill that triages billing, refund, and technical-support requests into distinct downstream guidance."
|
|
20
|
+
Expected shape signal: `router`
|
|
21
|
+
|
|
22
|
+
2. "Create a skill that gives SQL naming conventions and query-style preferences for this repo."
|
|
23
|
+
Expected shape signal: `inline-guidance` or `reference-backed-expert`, not router or subagent
|
|
24
|
+
|
|
25
|
+
3. "Create a skill that runs a self-contained investigation in isolated context and returns a concise findings summary."
|
|
26
|
+
Expected shape signal: `subagent-fork`
|
|
27
|
+
|
|
28
|
+
4. "Create a skill that must block risky Bash commands with deterministic validation before they run."
|
|
29
|
+
Expected shape signal: `hook-backed`
|
|
30
|
+
|
|
31
|
+
5. "Create a skill that drafts a proposal, critiques it against a rubric, and revises until it passes."
|
|
32
|
+
Expected shape signal: `evaluator-optimizer`
|
|
33
|
+
|
|
34
|
+
Hard fail if:
|
|
35
|
+
- no explicit execution shape is selected
|
|
36
|
+
- an advanced shape is chosen without justification
|
|
37
|
+
- a provider-specific mechanic is used without portability notes
|
|
38
|
+
- a passive guidance skill is incorrectly put into `context: fork`
|
|
39
|
+
- a bundled reference file is added without a direct routing entry in `SKILL.md`
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Integration/Documentation Depth Eval
|
|
43
|
+
|
|
44
|
+
```text
|
|
45
|
+
Synthesize a new skill named `pi-agent-integration-eval` for working with `@mariozechner/pi-agent-core` as a consumer in downstream libraries.
|
|
46
|
+
|
|
47
|
+
Primary objective: produce a non-surface-level integration skill that covers API surface, known issues/workarounds, and common real-world use cases.
|
|
48
|
+
|
|
49
|
+
Scope:
|
|
50
|
+
- Source root: `<pi-mono-root>/packages/agent`
|
|
51
|
+
- This is for USING Pi in another library, not editing Pi internals.
|
|
52
|
+
|
|
53
|
+
Mandatory source retrieval:
|
|
54
|
+
- README, CHANGELOG
|
|
55
|
+
- `src/index.ts`, `src/agent.ts`, `src/agent-loop.ts`, `src/types.ts`, `src/proxy.ts`
|
|
56
|
+
- `test/agent.test.ts`, `test/agent-loop.test.ts`
|
|
57
|
+
- In-repo usage scan for key APIs (for example Agent, agentLoop, streamProxy, convertToLlm, transformContext, steer, followUp, continue)
|
|
58
|
+
|
|
59
|
+
Required depth artifacts:
|
|
60
|
+
- focused references covering API surface, at least 6 concrete downstream use cases, and at least 8 failure modes with fixes/workarounds
|
|
61
|
+
- a focused integration-patterns or examples reference with happy path, robust variant, and anti-pattern + correction
|
|
62
|
+
|
|
63
|
+
Depth gates (hard fail if missing):
|
|
64
|
+
- Coverage matrix includes: API surface, options/config, runtime lifecycle, event semantics, queue semantics, failure modes, version variance, downstream usage patterns.
|
|
65
|
+
- Any partial coverage includes explicit next retrieval actions.
|
|
66
|
+
- Qualitative depth rubric includes pass/fail for API/workaround/use-case/gap handling.
|
|
67
|
+
- Run validator and report output.
|
|
68
|
+
|
|
69
|
+
Output sections:
|
|
70
|
+
1) Summary
|
|
71
|
+
2) Changes Made
|
|
72
|
+
3) Validation Results
|
|
73
|
+
4) Open Gaps
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Pass/Fail Rubric
|
|
77
|
+
|
|
78
|
+
Pass only if all required artifacts exist and have the requested depth.
|
|
79
|
+
Fail if API mapping is partial, workaround guidance is shallow, or use cases are generic and not actionable.
|
|
80
|
+
Fail if completion is claimed with unresolved high-impact gaps and no next retrieval actions.
|
|
81
|
+
Fail if the selected execution shape is more complex than necessary and the writeup does not justify it.
|
|
82
|
+
Fail if bundled reference files are hidden behind vague bucket docs instead of clear routed leaves.
|
|
83
|
+
|
|
84
|
+
## Optional Deep-Eval Pattern
|
|
85
|
+
|
|
86
|
+
When you need stronger confidence, run this sequence:
|
|
87
|
+
|
|
88
|
+
1. Use a fixed prompt set (positives + negatives).
|
|
89
|
+
2. Capture deterministic traces (`codex exec --json`).
|
|
90
|
+
3. Apply rubric/schema checks where practical (`--output-schema`).
|
|
91
|
+
4. Compare baseline vs candidate and report deltas.
|
|
92
|
+
|
|
93
|
+
## Isolated Eval Runbook
|
|
94
|
+
|
|
95
|
+
Run the eval in a temporary isolated workspace (copy of repo in `/tmp`):
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
EVAL_DIR=/tmp/sentry-skills-eval-run
|
|
99
|
+
rm -rf "$EVAL_DIR"
|
|
100
|
+
mkdir -p "$EVAL_DIR"
|
|
101
|
+
rsync -a "<repo-root>/"/ "$EVAL_DIR"/
|
|
102
|
+
|
|
103
|
+
codex exec \
|
|
104
|
+
--ephemeral \
|
|
105
|
+
--full-auto \
|
|
106
|
+
--sandbox workspace-write \
|
|
107
|
+
--skip-git-repo-check \
|
|
108
|
+
--add-dir "<pi-mono-root>" \
|
|
109
|
+
-C "$EVAL_DIR" \
|
|
110
|
+
"$(cat <eval-prompt-file>)"
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Where `<eval-prompt-file>` contains the exact eval prompt from this file.
|
|
114
|
+
|
|
115
|
+
Validate the generated skill output:
|
|
116
|
+
|
|
117
|
+
**Requires**: The `uv` CLI for python package management, install guide at https://docs.astral.sh/uv/getting-started/installation/
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
uv run "<skill-writer-root>/scripts/quick_validate.py" \
|
|
121
|
+
/tmp/sentry-skills-eval-run/.agents/skills/pi-agent-integration-eval \
|
|
122
|
+
--skill-class integration-documentation \
|
|
123
|
+
--strict-depth
|
|
124
|
+
```
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: skill-writer
|
|
3
|
+
description: Create, synthesize, and iteratively improve agent skills following the Agent Skills specification. Use when asked to "create a skill", "write a skill", "synthesize sources into a skill", "improve a skill from positive/negative examples", "update a skill", or "maintain skill docs and registration". Handles source capture, depth gates, authoring, registration, and validation.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Skill Writer
|
|
7
|
+
|
|
8
|
+
Use this as the single canonical workflow for skill creation and improvement.
|
|
9
|
+
Primary success condition: maximize high-value input coverage before authoring while minimizing wasted runtime tokens.
|
|
10
|
+
|
|
11
|
+
Load only the path(s) required for the task. `SKILL.md` is the primary router: every bundled reference file should have a direct "open when..." reason here.
|
|
12
|
+
|
|
13
|
+
## Core Workflow References
|
|
14
|
+
|
|
15
|
+
| Open when you need to... | Read |
|
|
16
|
+
|--------------------------|------|
|
|
17
|
+
| choose the minimum workflow path for create, update, iterate, or research-first work | `references/mode-selection.md` |
|
|
18
|
+
| choose the simplest adequate execution shape before deciding files | `references/execution-shapes.md` |
|
|
19
|
+
| apply writing constraints for depth, concision, and portability | `references/design-principles.md` |
|
|
20
|
+
| decide what belongs in `SKILL.md`, `references/`, `SPEC.md`, or subfolders | `references/reference-architecture.md` |
|
|
21
|
+
| create or update the maintenance contract for a skill | `references/spec-template.md` |
|
|
22
|
+
| find missing high-signal sources, including history and regressions | `references/source-discovery.md` |
|
|
23
|
+
| run the full synthesis pass with depth gates and source capture | `references/synthesis-path.md` |
|
|
24
|
+
| author or update `SKILL.md`, `SPEC.md`, and supporting files | `references/authoring-path.md` |
|
|
25
|
+
| improve trigger language and false-positive/false-negative behavior | `references/description-optimization.md` |
|
|
26
|
+
| iterate from positive, negative, or fix examples | `references/iteration-path.md` |
|
|
27
|
+
| store persistent working and holdout examples for future revisions | `references/iteration-evidence.md` |
|
|
28
|
+
| choose a response template, schema, or output contract | `references/output-contracts.md` |
|
|
29
|
+
| troubleshoot overloaded layouts, hidden refs, or other structure failures | `references/structure-troubleshooting.md` |
|
|
30
|
+
| verify a risky, disputed, or explicitly requested change | `references/evaluation-path.md` |
|
|
31
|
+
| register the skill and run final validation checks | `references/registration-validation.md` |
|
|
32
|
+
|
|
33
|
+
## Artifact Layout References
|
|
34
|
+
|
|
35
|
+
| Open when you need to... | Read |
|
|
36
|
+
|--------------------------|------|
|
|
37
|
+
| keep the whole skill inline in one coherent `SKILL.md` | `references/artifact-layouts/inline-skill-layout.md` |
|
|
38
|
+
| split optional deep knowledge into focused routed references | `references/artifact-layouts/reference-backed-skill-layout.md` |
|
|
39
|
+
| add scripts for deterministic automation or validation | `references/artifact-layouts/script-backed-skill-layout.md` |
|
|
40
|
+
| define a skill that is usually invoked with explicit arguments | `references/artifact-layouts/argument-driven-skill-layout.md` |
|
|
41
|
+
| ship reusable templates, schemas, or other static assets | `references/artifact-layouts/asset-template-skill-layout.md` |
|
|
42
|
+
|
|
43
|
+
## Workflow Mechanic References
|
|
44
|
+
|
|
45
|
+
| Open when you need to... | Read |
|
|
46
|
+
|--------------------------|------|
|
|
47
|
+
| break a task into fixed ordered steps | `references/workflow-mechanics/prompt-chaining.md` |
|
|
48
|
+
| classify requests and route them to different downstream paths | `references/workflow-mechanics/routing-workflows.md` |
|
|
49
|
+
| split independent work into parallel units or votes | `references/workflow-mechanics/parallel-workflows.md` |
|
|
50
|
+
| discover work units dynamically and coordinate worker outputs | `references/workflow-mechanics/orchestrator-workers.md` |
|
|
51
|
+
| critique and revise output against a rubric | `references/workflow-mechanics/evaluator-loops.md` |
|
|
52
|
+
| run validate-fix-repeat checks during authoring or execution | `references/workflow-mechanics/validation-loops.md` |
|
|
53
|
+
| validate a plan before executing a risky action | `references/workflow-mechanics/plan-validate-execute.md` |
|
|
54
|
+
|
|
55
|
+
## Claude Code References
|
|
56
|
+
|
|
57
|
+
| Open when you need to... | Read |
|
|
58
|
+
|--------------------------|------|
|
|
59
|
+
| use Claude-specific frontmatter or invocation controls | `references/claude-code/frontmatter-and-invocation.md` |
|
|
60
|
+
| use Claude argument fields or substitution variables | `references/claude-code/argument-substitutions.md` |
|
|
61
|
+
| build a skill that runs in isolated `context: fork` | `references/claude-code/subagent-fork-skills.md` |
|
|
62
|
+
| build a skill that uses Claude hooks for deterministic enforcement | `references/claude-code/hook-backed-skills.md` |
|
|
63
|
+
| use Claude shell preprocessing for dynamic context injection | `references/claude-code/dynamic-context.md` |
|
|
64
|
+
|
|
65
|
+
## Example Profiles
|
|
66
|
+
|
|
67
|
+
| Open when you need to... | Read |
|
|
68
|
+
|--------------------------|------|
|
|
69
|
+
| see the expected depth for a documentation-heavy skill | `references/examples/documentation-skill.md` |
|
|
70
|
+
| see the expected depth for a security-review skill | `references/examples/security-review-skill.md` |
|
|
71
|
+
| see the expected depth for a workflow-process skill | `references/examples/workflow-process-skill.md` |
|
|
72
|
+
| see what a good routed skill looks like | `references/examples/router-skill.md` |
|
|
73
|
+
| see what a good evaluator-loop skill looks like | `references/examples/evaluator-loop-skill.md` |
|
|
74
|
+
| see what a good subagent-fork skill looks like | `references/examples/subagent-fork-skill.md` |
|
|
75
|
+
| see what a good hook-backed skill looks like | `references/examples/hook-backed-skill.md` |
|
|
76
|
+
|
|
77
|
+
## Step 1: Resolve target, path, and shape
|
|
78
|
+
|
|
79
|
+
1. Resolve the intended operation (`create`, `update`, `synthesize`, `iterate`) and inspect workspace prior art before choosing where files belong.
|
|
80
|
+
2. Choose the target skill root from observed conventions. If the canonical location is still unclear after inspection, ask one direct question before editing files.
|
|
81
|
+
3. Read `references/mode-selection.md` to choose the minimum required workflow paths.
|
|
82
|
+
4. Read `references/execution-shapes.md` to choose the primary execution shape.
|
|
83
|
+
5. Default to the simplest adequate shape. If selecting a more complex shape, record why simpler shapes were rejected.
|
|
84
|
+
6. Load only the exact artifact-layout, workflow-mechanic, and provider-specific leaf files required by that shape.
|
|
85
|
+
7. Record portability implications before using provider-specific mechanics.
|
|
86
|
+
|
|
87
|
+
## Step 2: Run synthesis when needed
|
|
88
|
+
|
|
89
|
+
Read `references/synthesis-path.md`.
|
|
90
|
+
|
|
91
|
+
1. Use this path for new skills, material changes, and research-first planning.
|
|
92
|
+
2. Collect and score relevant sources with provenance.
|
|
93
|
+
3. Read `references/source-discovery.md` when source material is thin, stale, or ambiguous.
|
|
94
|
+
4. Produce source-backed decisions and coverage/gap status, including the class and execution-shape choice.
|
|
95
|
+
5. Load example profiles only when they add concrete depth for the selected class or shape.
|
|
96
|
+
6. If the skill uses provider-specific mechanics, include current official provider docs and capture usage constraints.
|
|
97
|
+
7. Do not move to authoring until depth gates pass.
|
|
98
|
+
|
|
99
|
+
## Step 3: Run iteration first when improving from outcomes/examples
|
|
100
|
+
|
|
101
|
+
Read `references/iteration-path.md` first when selected path includes `iteration` (for example operation `iterate`).
|
|
102
|
+
|
|
103
|
+
1. Capture and anonymize examples with provenance.
|
|
104
|
+
2. Read `references/iteration-evidence.md` when examples should persist beyond the current turn.
|
|
105
|
+
3. Re-evaluate skill behavior against working and holdout slices.
|
|
106
|
+
4. Propose improvements from positive/negative/fix evidence.
|
|
107
|
+
5. Carry concrete behavior deltas into authoring.
|
|
108
|
+
|
|
109
|
+
Skip this step when selected path does not include `iteration`.
|
|
110
|
+
|
|
111
|
+
## Step 4: Author or update skill artifacts
|
|
112
|
+
|
|
113
|
+
Read `references/authoring-path.md`.
|
|
114
|
+
|
|
115
|
+
1. Write or update `SKILL.md` in imperative voice with trigger-rich description.
|
|
116
|
+
2. Keep `SKILL.md` as the runtime router, not an encyclopedia.
|
|
117
|
+
3. Read `references/reference-architecture.md` before adding bulk instructions or new reference files.
|
|
118
|
+
4. Create or update `SPEC.md` using `references/spec-template.md` when creating a new skill or materially changing its contract.
|
|
119
|
+
5. Create focused reference files, subfolders, scripts, and assets only when each one has a clear "open when..." reason.
|
|
120
|
+
6. If you add a bundled reference file, add a direct routing entry for it in this `SKILL.md`.
|
|
121
|
+
7. Prefer checklists, tables, templates, and input/output examples over explanatory prose.
|
|
122
|
+
8. Follow only the specific artifact-layout, workflow-mechanic, Claude-specific, and output-contract references selected for this skill.
|
|
123
|
+
9. For advanced execution shapes, add the required routing, delegation, or safety contracts before considering the skill complete.
|
|
124
|
+
10. For authoring/generator skills, include transformed examples in references:
|
|
125
|
+
- happy-path
|
|
126
|
+
- secure/robust variant
|
|
127
|
+
- anti-pattern + corrected version
|
|
128
|
+
|
|
129
|
+
## Step 5: Optimize description quality
|
|
130
|
+
|
|
131
|
+
Read `references/description-optimization.md`.
|
|
132
|
+
|
|
133
|
+
1. Validate should-trigger and should-not-trigger query sets.
|
|
134
|
+
2. Reduce false positives and false negatives with targeted description edits.
|
|
135
|
+
3. Keep trigger language generic across providers unless the skill is intentionally provider-specific.
|
|
136
|
+
|
|
137
|
+
## Step 6: Evaluate only when needed
|
|
138
|
+
|
|
139
|
+
1. Read `references/evaluation-path.md` only when the user asks for evaluation, the change is high-risk, or the architecture choice is non-obvious.
|
|
140
|
+
2. If you run evaluation, start with the lightweight qualitative check.
|
|
141
|
+
3. Run deeper evals only when requested or risk warrants it.
|
|
142
|
+
4. Record outcomes and unresolved risks when evaluation is run.
|
|
143
|
+
|
|
144
|
+
## Step 7: Register and validate
|
|
145
|
+
|
|
146
|
+
Read `references/registration-validation.md`.
|
|
147
|
+
|
|
148
|
+
1. Apply repository registration steps for the active layout you verified in the workspace.
|
|
149
|
+
2. Run quick validation with strict depth gates.
|
|
150
|
+
3. Reject shallow outputs that fail depth gates or required artifact checks.
|
|
151
|
+
|
|
152
|
+
## Output format
|
|
153
|
+
|
|
154
|
+
Return:
|
|
155
|
+
|
|
156
|
+
1. `Summary`
|
|
157
|
+
2. `Changes Made`
|
|
158
|
+
3. `Validation Results`
|
|
159
|
+
4. `Open Gaps`
|