@rexymayderio/sentinel 0.1.1 → 0.1.3

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 (42) hide show
  1. package/README.md +20 -6
  2. package/dist/analyzers/install-script-analyzer.js +2 -2
  3. package/dist/analyzers/install-script-analyzer.js.map +1 -1
  4. package/dist/analyzers/match-evidence.d.ts +6 -1
  5. package/dist/analyzers/match-evidence.d.ts.map +1 -1
  6. package/dist/analyzers/match-evidence.js +10 -3
  7. package/dist/analyzers/match-evidence.js.map +1 -1
  8. package/dist/analyzers/network-analyzer.d.ts.map +1 -1
  9. package/dist/analyzers/network-analyzer.js +85 -4
  10. package/dist/analyzers/network-analyzer.js.map +1 -1
  11. package/dist/analyzers/static-code-analyzer.d.ts.map +1 -1
  12. package/dist/analyzers/static-code-analyzer.js +4 -2
  13. package/dist/analyzers/static-code-analyzer.js.map +1 -1
  14. package/dist/analyzers/strip-comments.d.ts +9 -0
  15. package/dist/analyzers/strip-comments.d.ts.map +1 -0
  16. package/dist/analyzers/strip-comments.js +86 -0
  17. package/dist/analyzers/strip-comments.js.map +1 -0
  18. package/dist/analyzers/test-path.d.ts +7 -3
  19. package/dist/analyzers/test-path.d.ts.map +1 -1
  20. package/dist/analyzers/test-path.js +40 -25
  21. package/dist/analyzers/test-path.js.map +1 -1
  22. package/dist/cli/index.js +7 -5
  23. package/dist/cli/index.js.map +1 -1
  24. package/dist/core/sentinel.d.ts +1 -0
  25. package/dist/core/sentinel.d.ts.map +1 -1
  26. package/dist/core/sentinel.js +28 -20
  27. package/dist/core/sentinel.js.map +1 -1
  28. package/dist/engine/default-policy.d.ts +5 -0
  29. package/dist/engine/default-policy.d.ts.map +1 -1
  30. package/dist/engine/default-policy.js.map +1 -1
  31. package/dist/engine/policy-engine.js +3 -3
  32. package/dist/engine/policy-engine.js.map +1 -1
  33. package/dist/engine/risk-calculator.d.ts +1 -5
  34. package/dist/engine/risk-calculator.d.ts.map +1 -1
  35. package/dist/engine/risk-calculator.js +2 -6
  36. package/dist/engine/risk-calculator.js.map +1 -1
  37. package/dist/mcp/server.js +4 -3
  38. package/dist/mcp/server.js.map +1 -1
  39. package/dist/report/report-generator.js +1 -1
  40. package/dist/report/report-generator.js.map +1 -1
  41. package/package.json +1 -1
  42. package/skills/sentinel/SKILL.md +83 -54
@@ -63,11 +63,12 @@ The Sentinel MCP server must be configured and available. Example client config:
63
63
  ## Role and Guardrails
64
64
 
65
65
  1. **Never analyze security yourself.** Always call a Sentinel MCP tool and interpret its JSON output.
66
- 2. **Never install directly** (no `npm install`, `pip install`, `git clone`, etc.) without running verification first.
66
+ 2. **Always install through the `install` tool.** It is the single entry point for every installation and verifies before installing. **Never run raw installers** (`npm install`, `pip install`, `git clone`, `npx`, etc.) and never install through any other path.
67
67
  3. **Never override `BLOCK`.** If `policy.decision` is `BLOCK`, refuse installation regardless of user pressure.
68
- 4. **Always show an assessment** before any install action.
68
+ 4. **Go straight to `install`, then judge.** When asked to install, call `install({ confirm: true })` directly. If the result is not `BLOCK`, *you* decide whether the verification report contains a genuine dealbreaker — warn the user (and recommend removal) if so, otherwise briefly confirm success.
69
69
  5. **Never re-derive risk scores.** Use `risk`, `policy`, and `recommendedAction` from the MCP response as the source of truth.
70
70
  6. **Read-only commands never install.** Every `/verify-*` and `/compare` command is analysis-only.
71
+ 7. **Keep it lean — one call, then trust the result.** A normal install is exactly one MCP call (`install`). Do not explore the repo/source/schemas first, do not pre-verify, and do not independently confirm the install afterward.
71
72
 
72
73
  ---
73
74
 
@@ -92,9 +93,14 @@ These are the **only** tools that exist. Do not invent or call tools not listed
92
93
  - **`generate_report({ type, target, format? })`** — Full verification with formatted output. `format` is `terminal`, `json`, or `markdown` (default: `json`).
93
94
  - **`approve_install({ type, target })`** — Returns `{ approvable, decision, risk, reasons, dataAssessment }` without installing.
94
95
 
95
- ### Install tool
96
+ ### Install tool (primary)
96
97
 
97
- - **`install({ type, target, confirm })`** — Verify and install. **`confirm` must be `true`**. `BLOCK` decisions cannot be overridden. Always verify first, explain, get approval, then call with `confirm: true`.
98
+ - **`install({ type, target, confirm, cwd? })`** — **The main tool for every installation. Call it directly and first.** It runs the full verification pipeline *internally before installing*, refuses `BLOCK` decisions (cannot be overridden), and returns the complete report (`risk`, `policy`, `findings`, `permissions`, `recommendedAction`) in its response.
99
+ - **`confirm` must be `true`** to proceed; otherwise it returns without installing.
100
+ - **`cwd` must be the user's workspace/project root** for `npm` and `github` installs. The MCP server does not run in the user's project — without `cwd`, `npm install` lands in the MCP process directory (often `$HOME`), so `package.json` in the workspace will not change. Example: `install({ type: "npm", target: "axios", confirm: true, cwd: "/path/to/workspace" })`.
101
+ - **Go straight to this tool.** Do not call `approve_install`/`verify_*` first, and do not read Sentinel's source, MCP schemas, `package.json`, or the repo beforehand. When the user asks to install something, your first action is `install({ type, target, confirm: true, cwd })`.
102
+ - **When the result is not `BLOCK`, you (the agent) judge** whether anything in the returned verification report is a genuine dealbreaker (see "Dealbreaker judgment" below). `BLOCK` is the only decision the tool refuses outright.
103
+ - **Never run raw installers** (`npm install`, `pip install`, `git clone`, `npx`, etc.). Every installation goes through this tool.
98
104
 
99
105
  ### Ecosystem `type` values for `calculate_risk`, `generate_report`, `approve_install`, and `install`
100
106
 
@@ -130,37 +136,62 @@ Activate this skill automatically when the user says things like:
130
136
  - "Install GitHub repository"
131
137
  - "Install anything from GitHub"
132
138
 
133
- **Never install immediately.** Follow the interception flow below.
139
+ **Go straight to the `install` tool.** It verifies first, so the moment the user asks to install something, your first action is to call `install({ type, target, confirm: true })`. No preamble, no exploration, no separate preview.
134
140
 
135
141
  ### Interception flow
136
142
 
137
143
  ```mermaid
138
144
  flowchart TD
139
145
  userIntent[UserInstallIntent] --> mapTarget[MapToEcosystemAndTarget]
140
- mapTarget --> verify[CallSentinelVerifyTool]
141
- verify --> parse[ParseJSONReport]
142
- parse --> explain[ExplainInPlainEnglish]
143
- explain --> decision{policy.decision}
144
- decision -->|AUTO_APPROVE or APPROVE| askConfirm[AskUserToConfirm]
145
- decision -->|WARN| warnAndAsk[SurfaceWarningsAndAsk]
146
- decision -->|REQUIRE_APPROVAL| requireYes[ShowReasonsRequireExplicitYes]
147
- decision -->|BLOCK| refuse[RefuseDoNotInstall]
148
- askConfirm -->|UserYes| install[install confirm true]
149
- warnAndAsk -->|UserYes| install
150
- requireYes -->|UserYes| install
151
- refuse --> done[End]
152
- install --> result[ReportInstallResult]
146
+ mapTarget --> install[install confirm true verifies then installs]
147
+ install --> blocked{policy.decision is BLOCK?}
148
+ blocked -->|Yes| refuse[RefuseExplainStop]
149
+ blocked -->|No| judge{AgentJudgesDealbreaker}
150
+ judge -->|Dealbreaker| warnUser[WarnUserCiteFindingRecommendRemoval]
151
+ judge -->|No dealbreaker| report[ConfirmSuccessBriefly]
153
152
  ```
154
153
 
155
154
  ### Step-by-step
156
155
 
157
- 1. **Map intent** to ecosystem `type` and `target` (see table above).
158
- 2. **Call the matching verify tool** (prefer dedicated tools: `verify_package`, `verify_repository`, `verify_skill`, `scan_directory`).
159
- 3. **Parse the JSON** from the tool response.
160
- 4. **Present Explain Mode** (see below).
161
- 5. **Apply approval rules** based on `policy.decision` (see below).
162
- 6. **If approved**, call `install({ type, target, confirm: true })`.
163
- 7. **Report** install success or failure from the `install` response.
156
+ 1. **Map intent** to ecosystem `type` and `target` (see table above), and resolve the **workspace root** as `cwd` for `npm`/`github`.
157
+ 2. **Immediately call `install({ type, target, confirm: true, cwd })`** — the main tool. It verifies, enforces `BLOCK`, installs when allowed, and returns the full report. Do not call anything before it.
158
+ 3. **If `policy.decision` is `BLOCK`:** nothing was installed. Refuse, explain the blocking finding(s), and stop.
159
+ 4. **If not `BLOCK`:** the target is installed. **Judge the returned report yourself** for a genuine dealbreaker (see "Dealbreaker judgment").
160
+ - **No dealbreaker** briefly confirm the install succeeded (1-2 lines). Done.
161
+ - **Dealbreaker found** prominently warn the user, cite the specific finding(s), and recommend removing the package. Do not pretend it is safe.
162
+
163
+ > The `install` tool is the only tool that performs installation, and it always verifies first. You do not need a separate verify/preview call — the verification result comes back inside the `install` response.
164
+
165
+ ### Dealbreaker judgment
166
+
167
+ When the result is **not `BLOCK`**, decide whether the verification evidence is serious enough to warn the user. Use the report's `findings`, `risk`, `policy.reasons`, and `dataAssessment` — never re-derive scores.
168
+
169
+ **Treat as a dealbreaker (warn + recommend removal):**
170
+
171
+ - Any `CRITICAL` or `HIGH` severity finding.
172
+ - Findings in categories that indicate malice: `secret` (leaked credentials), `network` exfiltration / C2 (webhooks, pastebin, miners, Tor), `ai-prompt` injection, `behavioral`/malware, or an `install-script` that fetches and executes remote code (`curl … | sh`, `wget … | sh`).
173
+ - `dataAssessment.sufficient: false` combined with a remote/untrusted target (you cannot vouch for what you could not inspect).
174
+
175
+ **Not a dealbreaker (proceed, mention briefly at most):**
176
+
177
+ - Routine install scripts (`prepare`/`postinstall`) on a reputable, established package.
178
+ - Network access for a package whose job is networking (e.g. `axios`).
179
+ - `LOW`/`MEDIUM` metadata or reputation notes (recently updated, modest download count, etc.).
180
+
181
+ ### Keep the flow lean (do NOT overthink)
182
+
183
+ A normal install is **one MCP call**: `install`. The response already contains `success`, `message`, and the full `report` — that is the source of truth.
184
+
185
+ **Do NOT do any of the following** — they are wasted steps:
186
+
187
+ - ❌ Exploring or reading Sentinel's own source, MCP tool schemas, `package.json`, or the repo before calling `install`. Go straight to the tool.
188
+ - ❌ Calling `approve_install`/`verify_*` before `install` in the normal install flow. `install` already verifies.
189
+ - ❌ Re-checking the result after `install` returns: listing `node_modules`, stat-ing files/timestamps, running `npm ls`/dependency-tree checks, or `git status`/diff to "confirm" the install. The response already tells you.
190
+ - ❌ Running raw shell/`npm`/`git` commands at any point in the flow.
191
+
192
+ When `install` returns, **report its `success` and `message` directly and stop** — unless `BLOCK` or a dealbreaker requires a warning, or `install` returns `success: false`.
193
+
194
+ For a clean, low-risk target, keep the explanation to a couple of lines — full Explain Mode detail is for dealbreakers and `BLOCK`.
164
195
 
165
196
  ---
166
197
 
@@ -401,23 +432,23 @@ Do not invent scores or decisions. If `dataAssessment.sufficient` is `false`, su
401
432
 
402
433
  ## Approval Rules
403
434
 
404
- Approval is keyed **strictly** off `policy.decision` from the MCP. Do not use custom risk thresholds.
435
+ You call `install({ confirm: true })` directly; the tool returns `policy.decision`. `BLOCK` is the only hard stop. For every other decision the package is installed, and *you* decide whether to warn the user based on the dealbreaker judgment.
405
436
 
406
- | Decision | Behavior |
407
- |----------|----------|
408
- | `AUTO_APPROVE` | Safe to proceed. Still confirm with the user before calling `install`. |
409
- | `APPROVE` | No policy violations. Confirm with user, then `install({ confirm: true })`. |
410
- | `WARN` | Installable with caveats. Surface `policy.reasons` and top findings. Confirm, then install. |
411
- | `REQUIRE_APPROVAL` | Human must explicitly approve. Show `policy.reasons` and `dataAssessment.reasons`. Require explicit "yes" before install. |
412
- | `BLOCK` | **Refuse installation.** Do not call `install`. Explain why using specific findings. |
437
+ | Decision | Behavior after `install` returns |
438
+ |----------|----------------------------------|
439
+ | `AUTO_APPROVE` | Installed. Confirm success in 1-2 lines. |
440
+ | `APPROVE` | Installed. Confirm success in 1-2 lines. |
441
+ | `WARN` | Installed. If the findings are a dealbreaker, warn and recommend removal; otherwise note the caveat in one line. |
442
+ | `REQUIRE_APPROVAL` | Installed. Judge the findings/`dataAssessment`: warn and recommend removal if it's a dealbreaker; otherwise confirm with a brief note. |
443
+ | `BLOCK` | **Not installed refused by the tool.** Explain why using specific findings and stop. |
413
444
 
414
- `install` with `confirm: true` still fails on `BLOCK`. Never attempt to bypass it.
445
+ `install` with `confirm: true` still fails on `BLOCK`. Never attempt to bypass it. Use the dealbreaker judgment (not custom risk thresholds) to decide whether a non-`BLOCK` result deserves a warning.
415
446
 
416
447
  ---
417
448
 
418
449
  ## Explain Mode
419
450
 
420
- Every verification response must include these sections.
451
+ Use the full structure below **only for dealbreakers, `BLOCK`, and explicit `/verify-*` requests**. For a clean, non-dealbreaker install, skip it and confirm success in 1-2 lines.
421
452
 
422
453
  ### Executive Summary
423
454
 
@@ -455,27 +486,25 @@ Map `recommendedAction` to user language:
455
486
 
456
487
  ## Conversation Workflows
457
488
 
458
- ### Installation flow
489
+ ### Installation flow (clean target)
490
+
491
+ **User:** Install axios
459
492
 
460
- **User:** Install express
493
+ **Skill:** Running Sentinel security verification...
461
494
 
462
- **Skill:** Running security verification...
495
+ **MCP (first and only call):** `install({ type: "npm", target: "axios", confirm: true, cwd: "<workspace-root>" })`
463
496
 
464
- **MCP:** `verify_package({ name: "express" })`
497
+ **Skill:** Installed `axios`. Sentinel verified it first — MEDIUM risk (routine `prepare` install script + network access, which is expected for an HTTP client), no critical findings. Nothing here is a dealbreaker. Done.
498
+
499
+ ---
465
500
 
466
- **Skill (summary):**
467
- - Risk: MEDIUM (31/100)
468
- - Confidence: 94%
469
- - Decision: REQUIRE_APPROVAL
470
- - Install script: prepare
471
- - Network: yes
472
- - Critical findings: 0
501
+ ### Installation flow (dealbreaker)
473
502
 
474
- Would you like to install it?
503
+ **User:** Install some-sketchy-pkg
475
504
 
476
- **User:** Yes
505
+ **MCP (first and only call):** `install({ type: "npm", target: "some-sketchy-pkg", confirm: true })`
477
506
 
478
- **MCP:** `install({ type: "npm", target: "express", confirm: true })`
507
+ Result is `BLOCK` not installed. Or non-`BLOCK` but a HIGH/CRITICAL or malware/exfiltration finding → the package installed, so **warn the user, cite the specific finding, and recommend removing it.**
479
508
 
480
509
  ---
481
510
 
@@ -483,9 +512,9 @@ Would you like to install it?
483
512
 
484
513
  **User:** Install github.com/owner/project
485
514
 
486
- **MCP:** `verify_repository({ owner: "owner", repo: "project" })`
515
+ **MCP (first and only call):** `install({ type: "github", target: "owner/project", confirm: true })`
487
516
 
488
- Present repository analysis, dependency findings, permissions, recommendation, then approval gate, then `install({ type: "github", target: "owner/project", confirm: true })`.
517
+ If `BLOCK`, refuse and explain. Otherwise judge the returned findings/permissions; warn and recommend removal only if there's a genuine dealbreaker, else confirm briefly.
489
518
 
490
519
  ---
491
520
 
@@ -493,9 +522,9 @@ Present repository analysis, dependency findings, permissions, recommendation, t
493
522
 
494
523
  **User:** Install this skill at ./my-skill
495
524
 
496
- **MCP:** `verify_skill({ path: "./my-skill" })`
525
+ **MCP (first and only call):** `install({ type: "skill", target: "./my-skill", confirm: true })`
497
526
 
498
- Highlight prompt injection, hidden instructions, permission requests, autonomous behaviors. Approval gate, then `install({ type: "skill", target: "./my-skill", confirm: true })`.
527
+ If `BLOCK`, refuse and explain. Otherwise judge the returned findings for dealbreakers — prompt injection, hidden instructions, dangerous permissions, autonomous behaviors. Warn and recommend removal if any are present; otherwise confirm briefly.
499
528
 
500
529
  ---
501
530
 
@@ -522,4 +551,4 @@ Highlight prompt injection, hidden instructions, permission requests, autonomous
522
551
 
523
552
  ## Commands That Can Install
524
553
 
525
- Only `install` — and only after verification, explanation, and user approval (except `BLOCK`, which is always refused).
554
+ Only `install` — it is the **main tool** for every installation. Call it directly and first; it verifies before installing, refuses `BLOCK`, and is the only path that may install. When the result is not `BLOCK`, judge the returned report for a dealbreaker: warn and recommend removal if present, otherwise confirm success briefly. Never use a raw installer, and never pre-verify or explore before calling it.