@perrylink/dsh-skill-pack-security-provider 1.3.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.
Files changed (45) hide show
  1. package/README.md +93 -0
  2. package/cordis.patch.yml +10 -0
  3. package/lib/index.js +82 -0
  4. package/lib/types/index.d.ts +30 -0
  5. package/pack/skills/dependency-audit/SKILL.md +136 -0
  6. package/pack/skills/dependency-audit/references/license-and-lockfile.md +56 -0
  7. package/pack/skills/dependency-audit/references/pnpm-audit-reading.md +63 -0
  8. package/pack/skills/incident-response/SKILL.md +83 -0
  9. package/pack/skills/incident-response/references/runbook-and-postmortem.md +82 -0
  10. package/pack/skills/prompt-injection-review/SKILL.md +119 -0
  11. package/pack/skills/prompt-injection-review/references/injection-surfaces.md +74 -0
  12. package/pack/skills/secret-scan/SKILL.md +123 -0
  13. package/pack/skills/secret-scan/references/redaction-and-remediation.md +58 -0
  14. package/pack/skills/secret-scan/references/tool-usage.md +83 -0
  15. package/pack/skills/security-audit/SKILL.md +111 -0
  16. package/pack/skills/security-audit/references/report-template.md +53 -0
  17. package/pack/skills/security-audit/references/risk-classification.md +40 -0
  18. package/pack/skills/supply-chain-review/SKILL.md +96 -0
  19. package/pack/skills/supply-chain-review/references/install-script-checks.md +34 -0
  20. package/pack/skills/supply-chain-review/references/typosquat-and-reproducibility.md +71 -0
  21. package/pack/skills/threat-model/SKILL.md +96 -0
  22. package/pack/skills/threat-model/references/stride-and-attack-tree.md +76 -0
  23. package/pack/skills/vuln-intel/SKILL.md +93 -0
  24. package/pack/skills/vuln-intel/references/advisory-sources.md +45 -0
  25. package/pack/skills-en/dependency-audit/SKILL.md +135 -0
  26. package/pack/skills-en/dependency-audit/references/license-and-lockfile.md +56 -0
  27. package/pack/skills-en/dependency-audit/references/pnpm-audit-reading.md +63 -0
  28. package/pack/skills-en/incident-response/SKILL.md +83 -0
  29. package/pack/skills-en/incident-response/references/runbook-and-postmortem.md +82 -0
  30. package/pack/skills-en/prompt-injection-review/SKILL.md +118 -0
  31. package/pack/skills-en/prompt-injection-review/references/injection-surfaces.md +74 -0
  32. package/pack/skills-en/secret-scan/SKILL.md +122 -0
  33. package/pack/skills-en/secret-scan/references/redaction-and-remediation.md +58 -0
  34. package/pack/skills-en/secret-scan/references/tool-usage.md +83 -0
  35. package/pack/skills-en/security-audit/SKILL.md +109 -0
  36. package/pack/skills-en/security-audit/references/report-template.md +53 -0
  37. package/pack/skills-en/security-audit/references/risk-classification.md +40 -0
  38. package/pack/skills-en/supply-chain-review/SKILL.md +95 -0
  39. package/pack/skills-en/supply-chain-review/references/install-script-checks.md +34 -0
  40. package/pack/skills-en/supply-chain-review/references/typosquat-and-reproducibility.md +71 -0
  41. package/pack/skills-en/threat-model/SKILL.md +96 -0
  42. package/pack/skills-en/threat-model/references/stride-and-attack-tree.md +76 -0
  43. package/pack/skills-en/vuln-intel/SKILL.md +93 -0
  44. package/pack/skills-en/vuln-intel/references/advisory-sources.md +45 -0
  45. package/package.json +52 -0
@@ -0,0 +1,71 @@
1
+ # Typosquat judgment and reproducible builds (supply-chain-review/references/typosquat-and-reproducibility.md)
2
+
3
+ The complete checklists, threshold tables, and comment templates behind Sections 2, 3, and 4 of the main file.
4
+
5
+ ## Confusion-pair list (check common pairs first, then edit distance)
6
+
7
+ | Impersonated | Common variants |
8
+ |---|---|
9
+ | lodash | lodahs / lodas-h / l0dash / lodashx |
10
+ | react / react-dom | react-domm / reactjs-dom / raect-dom |
11
+ | axios | axois / axioss / axio-s |
12
+ | express | expres / expresss / experss |
13
+ | request | requests2 / request-promise-x |
14
+ | moment | momemt / momet / moment-js |
15
+
16
+ Edit-distance command (PowerShell or Node; a result ≤ 2 enters the suspect set):
17
+
18
+ ```sh
19
+ node -e "const lv=(a,b)=>{const m=a.length,n=b.length,d=Array.from({length:m+1},(_,i)=>[i,...Array(n).fill(0)]);for(let j=0;j<=n;j++)d[0][j]=j;for(let i=1;i<=m;i++)for(let j=1;j<=n;j++)d[i][j]=Math.min(d[i-1][j]+1,d[i][j-1]+1,d[i-1][j-1]+(a[i-1]===b[j-1]?0:1));return d[m][n]};console.log(lv(process.argv[1],process.argv[2]))" <new package> <popular package>
20
+ ```
21
+
22
+ Sample output: `2`
23
+ Criterion: edit distance ≤ 2 is a **necessary condition, not sufficient** — "short creation time / extremely low downloads" must stack on top before blocking.
24
+
25
+ ## npm view field notes
26
+
27
+ | Command | Field | Handling when missing |
28
+ |---|---|---|
29
+ | `npm view <package> time.created` | Creation time | No output = the package does not exist / registry unreachable — confirm the spelling first |
30
+ | `npm view <package> --json` → `downloads`/`weeklyDownloads` | Download counts | Some registries do not return it → record as "unknown", never conclude from it |
31
+ | `npm view <package> repository.url` | Source repository | Missing / suspicious fork → record, hand to dependency-audit item 4 |
32
+ | `npm view <package> dist.fileCount dist.tarball --json` | Package size and download origin | An abnormally large fileCount (> 1000) or a tarball host that is not `registry.npmjs.org` → record and review manually |
33
+
34
+ ## The three reproducible-build factors and their criteria
35
+
36
+ | Factor | Command | Pass criterion |
37
+ |---|---|---|
38
+ | Lockfile committed | `git ls-files -- '*lock*'` | At least one lockfile path in the output |
39
+ | CI frozen install | `grep -nE 'frozen-lockfile|npm ci' .github/workflows/*` | At least one hit |
40
+ | integrity fields | `grep -c 'integrity' <lockfile>` | Count > 0 and on the same order as the dependency entries |
41
+
42
+ The three-tier decision:
43
+
44
+ - **Pass**: all three factors present + no blocking item from Sections 1 and 2.
45
+ - **Request changes**: any one factor missing, or exactly one suspicious condition from Section 2.
46
+ - **Block**: any Section-1 blocking pattern; both Section-2 conditions at once; no lockfile with more than 20 new direct dependencies.
47
+
48
+ ## Additional re-checks (they do not change the three-tier threshold, but must accompany the verdict)
49
+
50
+ - **CI action pinning**: `git diff <base>...HEAD -- .github/workflows | grep -nE '^\+.*uses:'`. A new/changed `uses: <owner>/<repo>@v<number>` not pinned to a commit SHA (`@<40-hex>`) → request changes; read-only third-party actions that never touch secrets are recorded only.
51
+ - **Lockfile growth**: compare `git diff <base>...HEAD -- <lockfile> | grep -cE '^\+'` with the number of new direct dependencies; 1 declared dependency but +500 lines → record and inspect the diff manually.
52
+
53
+ ## PR comment templates
54
+
55
+ Pass:
56
+
57
+ ```
58
+ Dependency review: passed. Evidence: npm view <package> scripts shows no install script; creation time/downloads normal; lockfile + CI frozen install + integrity all present. False-positive exclusion: <package>'s build script is ecosystem convention (purpose-consistent, no credential touch).
59
+ ```
60
+
61
+ Request changes:
62
+
63
+ ```
64
+ Dependency review: request changes. <Specific gap> is not satisfied: <evidence command and output summary>. Please <add the lockfile / add frozen install / explain the download numbers> and I will re-review.
65
+ ```
66
+
67
+ Block:
68
+
69
+ ```
70
+ Dependency review: blocked. <Dangerous pattern / both typosquat conditions> hit: <evidence command and output summary>. Risk: <one-sentence consequence>. Suggestion: <switch package / pin a trusted source>.
71
+ ```
@@ -0,0 +1,96 @@
1
+ ---
2
+ name: threat-model
3
+ description: 'Lightweight threat modeling for new features/systems: fix the target, scope and trust boundaries, asset inventory, per-asset STRIDE table, optional attack tree, mitigations and priority — producing a threat-model document ready for design review. Use for design-stage security review of new features/changes, mapping trust boundaries, or drawing attack trees; not for unrelated pure bug fixes, and teams with an established modeling process need not run this flow.'
4
+ whenToUse: 'Use when the user asks for threat modeling of a new feature/system, design-stage security review, STRIDE analysis, attack-tree analysis, or wants security considered up front at design time. Pure implementation detail discussions and changes unrelated to trust boundaries do not trigger this skill.'
5
+ metadata:
6
+ pack: dsh-skill-pack-security
7
+ version: '1.3.0'
8
+ ---
9
+
10
+ # Threat modeling (threat-model)
11
+
12
+ This skill does **design-stage** lightweight threat modeling: for one change or one new component, it produces trust boundaries, a STRIDE threat table, and a mitigation list. It covers the modeling method only; tiering existing audit findings goes to `security-audit`, and looking up specific vulnerabilities goes to `vuln-intel`. The output carries no secrets and can go into design documents.
13
+
14
+ ## 1. Fix the modeling target (an unfixed target makes the model unreproducible)
15
+
16
+ ```sh
17
+ git rev-parse --show-toplevel
18
+ git log -1 --format='%H %cd' --date=iso-strict
19
+ ```
20
+
21
+ Expected sample output (use the actual output):
22
+
23
+ ```
24
+ D:\repo\example
25
+ a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0 2026-08-14T10:30:00+08:00
26
+ ```
27
+
28
+ Criterion: exit code 0 and the first line is an absolute path; the threat-model document header must record this commit hash so reviewers know which version the model targets.
29
+
30
+ ## 2. Scope: what changed, where the boundaries are
31
+
32
+ ```sh
33
+ git diff --stat <base>...HEAD
34
+ git diff --name-only <base>...HEAD
35
+ ```
36
+
37
+ Expected sample output: `src/auth/session.ts | 40 ++++`, followed by the changed file paths.
38
+ Criterion: the scope = the files and components this diff touches; **never model the whole repository** (a whole-repo model is too large and nobody reviews it). For a brand-new module with no diff, use `git ls-files -- '<module dir>'` instead.
39
+ Four trust-boundary classes; every asset must state its boundary: in-process (code within one process), inter-process (IPC/HTTP/RPC), system boundary (local machine/kernel/filesystem), external (third-party services/users/upstream data).
40
+
41
+ ## 3. Asset inventory (the rows of the STRIDE table)
42
+
43
+ ```sh
44
+ git ls-files -- 'package.json' 'pnpm-lock.yaml' '.env*' '.github/workflows/**' 'Dockerfile*' '*.tf' 'cordis.yml' '**/cordis.yml' '*.pem' '**/*.key'
45
+ ```
46
+
47
+ Expected sample output: one relative path per line; no matches = that class of asset does not exist.
48
+ Criterion: the inventory covers at least four classes — data (secrets, user data, configuration), code (the changed module), channels (APIs, messages, logs), hosts (CI, containers, external dependencies). Fill in whatever class is missing; do not list only the files in this diff.
49
+
50
+ ## 4. Per-asset STRIDE threat table
51
+
52
+ Ask the six questions for every asset from section 3 (full definitions and question prompts live in `references/stride-and-attack-tree.md`):
53
+
54
+ | Asset | S spoofing | T tampering | R repudiation | I info disclosure | D DoS | E elevation | Entry path | Mitigation |
55
+ |---|---|---|---|---|---|---|---|---|
56
+ | e.g. session token | forged token | tampered claims | no audit log | token in logs | session storm | swap identity | API lacks signature check | signature + least privilege |
57
+
58
+ Criterion: **every cell either names a threat or states "not applicable (reason)"** — a blank cell means no modeling happened; a threat must state "who, through which path, with what impact" — missing any one of the three downgrades it to "observation".
59
+ After filling the table, cross-check: does every asset's "entry path" cross a trust boundary? An asset whose paths cross no boundary means the boundary map is incomplete — go back to section 2.
60
+
61
+ ## 5. Attack tree (optional: only for high-risk surfaces)
62
+
63
+ ```sh
64
+ dot -Tpng attack-tree.dot -o attack-tree.png
65
+ # without graphviz, use an indented text tree instead (example in references)
66
+ ```
67
+
68
+ Expected sample output: exit code 0 and `attack-tree.png` produced.
69
+ Criterion: draw trees only for section-4 threats that are "high impact × multiple preconditions"; root = the attack goal, leaves = preconditions; **every leaf must be verifiable** (one command proves the precondition holds or not) — leaves that cannot be verified are labeled "unverified assumption". Both the `.dot` source and the rendered image go into the review material.
70
+
71
+ ## 6. Mitigations and priority
72
+
73
+ Pick mitigations from four directions (landing templates for each live in `references/stride-and-attack-tree.md`):
74
+
75
+ - Eliminate: change the design so the path does not exist (highest priority — ask "can we not build this" first in the review);
76
+ - Transfer: hand it to existing defenses (authentication to SSO, secrets to KMS/CI secrets);
77
+ - Mitigate: add checks at the boundary (signatures, authz, rate limits, redacted logs);
78
+ - Accept: state the reason and the residual risk, recorded as an "accepted risk".
79
+
80
+ Priority criterion = exploitability × impact (the `security-audit` three factors minus "exposed" — at design stage nothing is exposed yet).
81
+
82
+ ## 7. Deliverables and self-check
83
+
84
+ Deliverables: trust-boundary description (text or diagram) + asset inventory + STRIDE table + (optional) attack tree + mitigation list.
85
+ Self-check command (expected output: no matches; a match means a table row is unfinished):
86
+
87
+ ```sh
88
+ grep -nE '\| *TBD *\||待定' threat-model.md
89
+ ```
90
+
91
+ ## Division of labor with the other skills
92
+
93
+ - `security-audit`: full audits and tiering of existing repositories — high-risk paths found by this model go there for item-by-item verification.
94
+ - `vuln-intel`: when a third-party component referenced in the design has a CVE, look up its details and impact.
95
+ - `supply-chain-review`: when the modeled scope adds dependencies, run the quick supply-chain review on them.
96
+ - `secret-scan`: secret-class assets in the inventory go straight to it for scanning and redaction.
@@ -0,0 +1,76 @@
1
+ # STRIDE and attack-tree details (threat-model/references/stride-and-attack-tree.md)
2
+
3
+ Full definitions, question prompts, and templates for sections 4–6 of the main file.
4
+
5
+ ## The six STRIDE questions
6
+
7
+ | Category | Full name | Question to ask | Common entry paths |
8
+ |---|---|---|---|
9
+ | S | Spoofing | Who can impersonate a legitimate principal (user/service/package)? | unsigned APIs, forgeable tokens, unverified domains |
10
+ | T | Tampering | Who can change data/code/config without detection? | plaintext transport, caches without integrity checks, writable config files |
11
+ | R | Repudiation | After an incident, can we prove "who did what"? | no audit logs, logs deletable by same-level permissions |
12
+ | I | Information disclosure | Who can see data they should not? | secrets in logs, unauthorized endpoints, error echo |
13
+ | D | Denial of service | Who can make the service/flow unavailable? | unbounded queues, external calls without timeouts, unthrottled resources |
14
+ | E | Elevation of privilege | Who can gain permissions beyond the design? | unauthorized parameters, high-privilege default accounts, injectable config |
15
+
16
+ Criterion: a cell may state "not applicable (reason)", but **the reason must relate to the asset's properties** (e.g. "a static document has no write channel → T not applicable"); "feels fine" is not a reason.
17
+
18
+ ## The four trust-boundary classes
19
+
20
+ 1. **In-process**: code within one process — trusted by default, unless plugins/dynamic loading exist;
21
+ 2. **Inter-process**: IPC/HTTP/RPC/message queues — every crossing asks "who is on the other side, what credentials do they hold";
22
+ 3. **System boundary**: local filesystem, kernel, environment variables, container runtime;
23
+ 4. **External**: third-party APIs, user input, upstream repos/images — highest risk; all external input is treated as data by default (see the `prompt-injection-review` three questions).
24
+
25
+ ## Drawing attack trees
26
+
27
+ - Root = the attack goal ("obtain write access to X"), leaves = preconditions ("the service is unauthenticated").
28
+ - Every leaf states its verification: one command proving the precondition holds or not; unverifiable ones are labeled "unverified assumption".
29
+ - Indented text tree example:
30
+
31
+ ```text
32
+ Gain deployment access
33
+ ├─ OR: steal the CI token
34
+ │ ├─ precondition: plaintext .env in repo (verify: git grep -n 'TOKEN' -- '.env*')
35
+ │ └─ precondition: workflow uses pull_request_target + secrets (verify: git grep -n 'pull_request_target' -- '.github/workflows/**')
36
+ └─ OR: dependency poisoning
37
+ ├─ precondition: install scripts allowed (verify: npm view <pkg> scripts --json)
38
+ └─ precondition: actions not SHA-pinned (verify: git grep -nE 'uses: [A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+@v[0-9]' -- '.github/workflows/**')
39
+ ```
40
+
41
+ The `dot` form is isomorphic (both the `.dot` source and the `dot -Tpng` render go into the review material):
42
+
43
+ ```dot
44
+ digraph attack_tree {
45
+ goal [label="Gain deployment access"];
46
+ steal_token [label="Steal the CI token"];
47
+ poison_dep [label="Dependency poisoning"];
48
+ goal -> steal_token; goal -> poison_dep;
49
+ }
50
+ ```
51
+
52
+ ## Mitigation landing templates
53
+
54
+ | Direction | Template wording |
55
+ |---|---|
56
+ | Eliminate | "The path disappears with this design change: <change>; acceptance: <command> proves the path no longer exists" |
57
+ | Transfer | "Handed to <existing defense>; acceptance: <location of its config/docs>" |
58
+ | Mitigate | "Add <check> at <boundary>; acceptance: <command showing a bypass attempt is blocked>" |
59
+ | Accept | "Reason: <why>; residual risk: <description>; reviewer: <name>" |
60
+
61
+ ## Deliverable template
62
+
63
+ ```markdown
64
+ # <component> threat model
65
+ Target: <repo> @ <commit hash> (fixed on 2026-xx-xx)
66
+ Scope: <diff or module list>
67
+ ## Trust boundaries
68
+ (text or diagram; every asset states its boundary class)
69
+ ## Asset inventory
70
+ | Asset | Class (data/code/channel/host) | Boundary |
71
+ ## STRIDE table
72
+ (the main file's section-4 table)
73
+ ## Attack tree (optional)
74
+ ## Mitigation list
75
+ | Threat | Direction (eliminate/transfer/mitigate/accept) | Landing | Acceptance command |
76
+ ```
@@ -0,0 +1,93 @@
1
+ ---
2
+ name: vuln-intel
3
+ description: 'Vulnerability intelligence lookup and triage: query commands for the four authoritative sources NVD/CISA-KEV/GHSA/OSV, response interpretation, and misjudgment criteria — turning a CVE/GHSA id into an evidence-backed verdict of "actively exploited? × does it affect this project?". Use when given a CVE/GHSA id to look up details and impact, to judge active-exploitation status, or to write a vulnerability brief; not for id-less general vulnerability education.'
4
+ whenToUse: 'Use when the user gives a CVE/GHSA id and asks for details and impact, whether a vulnerability is actively exploited (KEV), its applicability to the current project/dependencies, or a vulnerability intelligence brief. General security learning without a specific id, and discussions unrelated to a specific vulnerability, do not trigger this skill.'
5
+ metadata:
6
+ pack: dsh-skill-pack-security
7
+ version: '1.3.0'
8
+ ---
9
+
10
+ # Vulnerability intelligence (vuln-intel)
11
+
12
+ Goal: turn one vulnerability id into a risk verdict **where every line carries its source command**. Only relay source data (severity is copied from NVD/GHSA, never inferred); the verdict structure = id + severity + actively exploited? + affects this project? + remediation advice.
13
+
14
+ ## 1. Tool readiness and rate limits
15
+
16
+ ```sh
17
+ curl --version; jq --version; gh --version
18
+ ```
19
+
20
+ Sample output: `curl 8.9.1` / `jq-1.7.1` / `gh version 2.61.0`.
21
+ Criterion: curl and jq must be available (every query is curl+jq); `gh` is optional (only for the authenticated query in section 4). Unauthenticated rate limits: NVD roughly 5 requests per 30 seconds, GitHub API 60 per hour — when batch querying, wait 6 seconds between requests; a 403/429 means rate-limited, not "the vulnerability does not exist".
22
+
23
+ ## 2. NVD (the CVE baseline: description, CVSS, references)
24
+
25
+ ```sh
26
+ curl -s 'https://services.nvd.nist.gov/rest/json/cves/2.0?cveId=CVE-2024-1234' | jq '.vulnerabilities[0].cve | {id, published, lastModified, metrics, references: [.references[].url]}'
27
+ ```
28
+
29
+ Expected sample output (use the actual output):
30
+
31
+ ```json
32
+ { "id": "CVE-2024-1234", "published": "2024-03-01T00:00:00.000", "lastModified": "2024-06-01T00:00:00.000", "metrics": { "cvssMetricV31": [ { "cvssData": { "baseSeverity": "HIGH", "baseScore": 8.1 } } ] }, "references": ["https://github.com/example/example-lib/security/advisories/GHSA-xxxx-yyyy-zzzz"] }
33
+ ```
34
+
35
+ Criterion: an empty `vulnerabilities` array = the id does not exist or is misspelled — re-check the id before concluding; copy CVSS `baseScore`/`baseSeverity` verbatim, never recompute; a `lastModified` much later than `published` = the entry was updated — treat the latest as authoritative.
36
+
37
+ ## 3. CISA KEV (the only authoritative actively-exploited criterion)
38
+
39
+ ```sh
40
+ curl -s 'https://www.cisa.gov/sites/default/files/feeds/known_exploited_vulnerabilities.json' | jq '.vulnerabilities[] | select(.cveID=="CVE-2024-1234")'
41
+ ```
42
+
43
+ Expected sample output (a hit):
44
+
45
+ ```json
46
+ { "cveID": "CVE-2024-1234", "vendorProject": "Example", "product": "example-lib", "vulnerabilityName": "Example RCE", "dateAdded": "2024-04-15", "knownRansomwareCampaignUse": "Unknown" }
47
+ ```
48
+
49
+ Criterion: **a hit = known active exploitation**, and the verdict upgrades to "fix immediately"; no hit ≠ not exploited — KEV entry lags, so the verdict states "not in KEV as of the query date". `knownRansomwareCampaignUse: Known` = ransomware is exploiting it — raise the priority further.
50
+
51
+ ## 4. GHSA (ecosystem-specific remediation and affected versions)
52
+
53
+ ```sh
54
+ curl -s 'https://api.github.com/advisories/GHSA-xxxx-yyyy-zzzz' | jq '{ghsa_id, severity, cvss, summary, vulnerabilities, references}'
55
+ # authenticated query (optional, higher rate limit): gh api graphql -f query='{ securityAdvisory(ghsaId:"GHSA-xxxx-yyyy-zzzz") { severity summary vulnerabilities { firstPatchedVersion { identifier } } } }'
56
+ ```
57
+
58
+ Expected sample output (use the actual output): `{ "ghsa_id": "GHSA-xxxx-yyyy-zzzz", "severity": "high", "vulnerabilities": [ { "package": { "name": "example-lib", "ecosystem": "npm" }, "first_patched_version": "2.3.1" } ] }`
59
+ Criterion: when GHSA `severity` disagrees with NVD, **record both** (different sources and scorers) — never let one overwrite the other; `first_patched_version` is the direct basis for remediation advice — without it write "no fixed version yet", never claim "upgrading fixes it".
60
+
61
+ ## 5. OSV (precise cross-ecosystem package version ranges)
62
+
63
+ ```sh
64
+ curl -s -X POST 'https://api.osv.dev/v1/query' -H 'Content-Type: application/json' -d '{"package":{"name":"example-lib","ecosystem":"npm"}}' | jq '.vulns[] | {id, aliases, summary, affected}'
65
+ ```
66
+
67
+ Expected sample output: `{ "id": "GHSA-xxxx-yyyy-zzzz", "aliases": ["CVE-2024-1234"], "summary": "...", "affected": [ { "ranges": [ { "events": [ { "introduced": "0" }, { "fixed": "2.3.1" } ] } ] } ] }`
68
+ Criterion: OSV's value is the **version-precise affected ranges** (`introduced`/`fixed` events); `aliases` cross-references sources (one entry is a CVE on NVD and a GHSA on GitHub). OSV has no entry ≠ no vulnerability — it only means that source has no data.
69
+
70
+ ## 6. Landing verdict: match against the current project's dependency tree
71
+
72
+ ```sh
73
+ pnpm why example-lib
74
+ grep -n '"example-lib' pnpm-lock.yaml
75
+ ```
76
+
77
+ Expected sample output: `dependencies: prod-dep 1.0.0 → example-lib 2.2.9`; the lockfile hit line carries the version.
78
+ Criterion: package not in the dependency tree = verdict "not applicable (this repository does not depend on it)" with the empty `pnpm why` output as evidence; in the tree and the version falls in the affected range = a finding, hand it to `dependency-audit` for the full remediation flow; version above `fixed` = already fixed, with the version line as evidence. Any "possible impact" without dependency-tree evidence goes into "observations".
79
+
80
+ ## 7. Brief template and self-check
81
+
82
+ Each verdict = id + severity (with source) + KEV hit or not (with query date) + project applicability (with command output) + remediation (with patched version). Multi-id tasks produce a table: id / severity / actively exploited / project impact / fix. The four-source comparison table, jq quick reference, and offline paths live in `references/advisory-sources.md`.
83
+ Self-check command (expected output: no matches; a match means the brief contains a source-less severity claim):
84
+
85
+ ```sh
86
+ grep -nE '^-[[:space:]]*(high|critical|严重|高危)' brief.md
87
+ ```
88
+
89
+ ## Division of labor with the other skills
90
+
91
+ - `dependency-audit`: the remediation after "affects this project" and full dependency audits belong to it.
92
+ - `security-audit`: when an audit finds a specific CVE, use this skill to look up details and fill them back into the audit report.
93
+ - `threat-model`: when a design references a component, look up its vulnerability history as attack-path evidence.
@@ -0,0 +1,45 @@
1
+ # Source comparison and quick reference (vuln-intel/references/advisory-sources.md)
2
+
3
+ The full comparison table and offline paths for sections 1–7 of the main file.
4
+
5
+ ## The four sources compared
6
+
7
+ | Source | Content | Strength | Limit | Unauthenticated rate limit |
8
+ |---|---|---|---|---|
9
+ | NVD `services.nvd.nist.gov` | CVE description, CVSS, references | authoritative ids, carries CVSS | entry lag; CVSS is a generic score, not project-specific | ~5 per 30 seconds |
10
+ | CISA KEV | list of known exploited vulnerabilities | the official active-exploitation criterion | only exploited ones, with delay | none (static JSON) |
11
+ | GitHub Advisories (GHSA) | in-ecosystem advisories, fixed versions, affected packages | most direct remediation advice | GitHub-centric ecosystem | 60 per hour |
12
+ | OSV `api.osv.dev` | cross-ecosystem precise version ranges | `introduced`/`fixed` precise to versions | no independent description, aggregates sources | no hard limit (be considerate) |
13
+
14
+ ## Common jq filter quick reference
15
+
16
+ ```sh
17
+ # NVD: only the CVSS 3.1 score
18
+ jq '.vulnerabilities[0].cve.metrics.cvssMetricV31[0].cvssData.baseScore'
19
+ # KEV: entries added on/after a date
20
+ jq '[.vulnerabilities[] | select(.dateAdded >= "2024-01-01")] | length'
21
+ # OSV: list all aliases (cross-source matching)
22
+ jq '.vulns[] | {id, aliases}'
23
+ # OSV: npm ecosystem only
24
+ curl -s -X POST 'https://api.osv.dev/v1/query' -H 'Content-Type: application/json' -d '{"package":{"name":"example-lib","ecosystem":"npm"}}' | jq '[.vulns[] | select(.affected[].package.ecosystem=="npm")]'
25
+ ```
26
+
27
+ Criterion: jq filters are view selection only — **they do not change the data**; never put a filtered-out field into the verdict (e.g. filtering out description and then claiming "this source has no description").
28
+
29
+ ## EPSS (optional reference, never tiers anything)
30
+
31
+ EPSS (`api.first.org/data/v1/epss?cve=CVE-2024-1234`) is a model score for "probability of exploitation within 30 days". Use it only to order remediation priority — **it does not change severity and does not replace KEV**; a model score is not a fact.
32
+
33
+ ## Offline paths
34
+
35
+ - NVD: download the official feeds (`https://nvd.nist.gov/vuln/data-feeds`, gzip JSON) and grep locally; state the feed date in the report.
36
+ - KEV: download the same JSON to a local cache (`curl -o kev.json <URL>`) and query with `jq`.
37
+ - OSV: `osv-scanner` supports `--offline` (with local OSV data), see `dependency-audit` section 6.
38
+ - Fully offline: the verdict must state "data as of <feed date>, not checked live".
39
+
40
+ ## Brief table template
41
+
42
+ | Id | Severity (source) | KEV (query date) | Project impact (command evidence) | Remediation |
43
+ |---|---|---|---|---|
44
+ | CVE-2024-1234 | HIGH (NVD) | not listed (2026-08-14) | not applicable: `pnpm why` empty | — |
45
+ | GHSA-xxxx-yyyy-zzzz | high (GHSA) | — | affected: example-lib 2.2.9 < 2.3.1 | upgrade to 2.3.1 |
package/package.json ADDED
@@ -0,0 +1,52 @@
1
+ {
2
+ "name": "@perrylink/dsh-skill-pack-security-provider",
3
+ "version": "1.3.0",
4
+ "description": "Optional provider plugin for dsh-skill-pack-security: registers the pack's skills/ (zh) or skills-en/ (en) edition on ctx.skills. Ships both editions embedded in pack/.",
5
+ "type": "module",
6
+ "main": "lib/index.js",
7
+ "types": "lib/types/index.d.ts",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/PerryLink/dsh-skill-pack-security.git",
11
+ "directory": "provider"
12
+ },
13
+ "files": [
14
+ "lib/index.js",
15
+ "lib/types/**/*.d.ts",
16
+ "pack/**",
17
+ "cordis.patch.yml"
18
+ ],
19
+ "dsh": {
20
+ "bundle": {
21
+ "patch": "./cordis.patch.yml"
22
+ }
23
+ },
24
+ "license": "Apache-2.0",
25
+ "keywords": [
26
+ "dsh",
27
+ "dsh-plugin",
28
+ "deepseek-harness",
29
+ "skill-pack",
30
+ "skills",
31
+ "security",
32
+ "security-audit",
33
+ "supply-chain"
34
+ ],
35
+ "peerDependencies": {
36
+ "@deepseek-ai/cordis": "^4.0.1",
37
+ "@deepseek-ai/dsh-skill-filesystem": "0.1.0-rc.6",
38
+ "@deepseek-ai/schemastery": "^3.18.1"
39
+ },
40
+ "devDependencies": {
41
+ "@deepseek-ai/cordis": "^4.0.1",
42
+ "@deepseek-ai/dsh-skill-filesystem": "0.1.0-rc.6",
43
+ "@deepseek-ai/schemastery": "^3.18.1",
44
+ "@types/node": "^22.15.0",
45
+ "typescript": "^5.7.0"
46
+ },
47
+ "scripts": {
48
+ "build": "tsc --noEmitOnError",
49
+ "typecheck": "tsc --noEmit",
50
+ "prepack": "node scripts/copy-skills.mjs"
51
+ }
52
+ }