@cantinasecurity/apex-cli 0.1.34 → 0.1.36
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/.claude/skills/apex-cli/SKILL.md +40 -3
- package/.claude-plugin/marketplace.json +3 -3
- package/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/.mcp.claude.json +1 -1
- package/.mcp.codex.json +1 -1
- package/MARKETPLACE.md +1 -1
- package/README.md +50 -11
- package/dist/apex.js +6 -0
- package/dist/cvss.js +49 -0
- package/dist/help.js +2 -0
- package/package.json +1 -1
- package/skills/apex-cli/SKILL.md +40 -3
|
@@ -13,7 +13,11 @@ This skill is bundled with Apex CLI and can be installed into the current reposi
|
|
|
13
13
|
|
|
14
14
|
Use Apex through the MCP server when the `apex-*` tools are available. The tools installed by `apex setup` use the local stdio server and device login.
|
|
15
15
|
|
|
16
|
-
For a production MCP client that does not need local filesystem access, use the hosted Streamable HTTP endpoint at `https://ai.cantina.xyz/mcp`. Read the organization service key from `APEX_SERVICE_KEY` and supply it only as `Authorization: Bearer <TOKEN>`; never put the raw key in a tool argument, result, prompt, source file, or log. The hosted tools are `apex-credits`, `apex-workspaces`, `apex-scan`, `apex-status`, `apex-cancel-scan`, `apex-findings`, `apex-workspace-findings`, `apex-finding-tickets`, `apex-finding-link-ticket`, and `apex-finding-send`.
|
|
16
|
+
For a production MCP client that does not need local filesystem access, use the hosted Streamable HTTP endpoint at `https://ai.cantina.xyz/mcp`. Read the organization service key from `APEX_SERVICE_KEY` and supply it only as `Authorization: Bearer <TOKEN>`; never put the raw key in a tool argument, result, prompt, source file, or log. The hosted tools are `apex-credits`, `apex-workspaces`, `apex-scan`, `apex-black-start`, `apex-status`, `apex-cancel-scan`, `apex-findings`, `apex-workspace-findings`, `apex-finding-tickets`, `apex-finding-link-ticket`, and `apex-finding-send`.
|
|
17
|
+
|
|
18
|
+
OAuth-capable clients may instead use the hosted endpoint’s OAuth discovery and Cantina manager-consent flow. Let the client manage OAuth credentials; never pass them to tools, the REST API, or local CLI. Local stdio MCP continues to use device login.
|
|
19
|
+
|
|
20
|
+
Apex Black is a hosted-only workflow. Confirm the connected deployment advertises `apex-black-start` and the organization has beta access, then check `apex-credits`. Start only with authorization for all 1–16 exact HTTPS origins and acceptance of the 200 Standard credit cost, honoring authorization already provided in the session. Pass `targetUrls`, `authorizationAccepted: true`, and one stable `idempotencyKey`. Use the returned Bedrock `scanId` with `apex-status` and `apex-findings`. Identical retries replay stored remote-start failures, including `APEX_BLACK_START_FAILED`; retain durable IDs and contact support before trying another request. Do not fall back to a local Black scan mode or tool; neither exists.
|
|
17
21
|
|
|
18
22
|
For serverless, cron, or other explicit HTTP/JSON integrations, use the hosted Apex REST API instead of CLI or local stdio MCP. The hosted MCP and REST contract is documented at https://ai.cantina.xyz/docs/apex-api.
|
|
19
23
|
|
|
@@ -34,7 +38,7 @@ Parse the JSON from stdout only; do not merge stderr into stdout, because npm
|
|
|
34
38
|
may write warnings to stderr. `idempotent` means the existing guest session
|
|
35
39
|
resumed and it may already own a workspace.
|
|
36
40
|
|
|
37
|
-
|
|
41
|
+
Local stdio MCP workflow:
|
|
38
42
|
|
|
39
43
|
1. Start with `apex-auth-status`.
|
|
40
44
|
2. Always call `apex-trial-status` next, even when account authentication succeeded. When `claimAvailable` is true, do not call `apex-auth-start`; tell the user to run `apex claim` in a terminal first so the trial workspace, scans, and findings are kept. When the claim deadline has passed and `claimAvailable` is false, continue normal account authentication instead of steering the user to an expired claim.
|
|
@@ -64,7 +68,7 @@ If the Apex MCP server is not configured, fall back to the local CLI:
|
|
|
64
68
|
- For a headless REST adapter, read the service key from the secret-backed `APEX_SERVICE_KEY` environment variable, send it as a bearer token to `/api/apex/v1`, and redact it from errors and logs. Do not shell out to `apex` or launch local MCP from the adapter.
|
|
65
69
|
- Hosted API integrations can call `GET /api/apex/v1/credits` with `scans:create` scope to inspect the organization's current standard, audit, and Lite balances and effective scan-type availability. Treat the response as a point-in-time snapshot; scan creation remains authoritative.
|
|
66
70
|
- Hosted remote-repository scans require the GitHub repository to be connected to the service key's Apex organization. They reuse a linked active workspace or create and link one when no match exists; use optional `workspaceId` to disambiguate multiple matches and treat explicit workspace/repository mismatches as HTTP `409` setup errors. Local or non-Git REST scans use the documented source-upload flow; send `generateThreatModel: true` for the first scan of a newly created local workspace.
|
|
67
|
-
- Hosted scan triggers require `Idempotency-Key`. Reuse one stable key only for an identical transport/timeout/5xx retry. After correcting a definitive 4xx response, or for any new intended scan, use a new key.
|
|
71
|
+
- Hosted repository scan triggers require `Idempotency-Key`. Reuse one stable key only for an identical transport/timeout/5xx retry. After correcting a definitive 4xx response, or for any new intended repository scan, use a new key. Apex Black stored start failures follow the support escalation rule above; never change keys to bypass them.
|
|
68
72
|
- Use `--non-interactive` and `--no-open` for automation-friendly CLI calls.
|
|
69
73
|
- Use `--json` whenever structured output is helpful.
|
|
70
74
|
- `apex credits` reports standard credits plus audit, fix review, and Lite scan entitlements when Bedrock returns those balances.
|
|
@@ -116,3 +120,36 @@ If the Apex MCP server is not configured, fall back to the local CLI:
|
|
|
116
120
|
- Use `apex-finding-tickets` to read existing links. CLI fallback: `apex findings link-ticket <finding-ref> <linear|jira> <issue-key|url> --json`, then `apex findings tickets <finding-ref> --json`.
|
|
117
121
|
- Hosted MCP uses `findingId` (UUID) instead of `findingRef`, with no `cwd` or `scanId`. Linking requires explicit `findings:write`; listing requires `findings:read`. Default service-key scopes remain scans:create, scans:read, findings:read. Do not infer write permission from read access.
|
|
118
122
|
- Apex verifies the ticket through the connected integration and records the frontend link; it does not create or modify a provider ticket. Repeating the same association is safe. A different existing link or in-progress export is a conflict: do not replace it or create another ticket as a fallback. For ambiguous Jira sites, use the full issue URL.
|
|
123
|
+
|
|
124
|
+
### Workspace CVSS configuration
|
|
125
|
+
|
|
126
|
+
Use `apex workspace use <workspace>` to bind the intended existing workspace, then
|
|
127
|
+
`apex cvss get` to read its configuration and CVSS 3.1 policy template. To update it,
|
|
128
|
+
write a JSON file containing exactly `enabled` (boolean) and `policy` (the edited
|
|
129
|
+
template), then run `apex cvss set --file <configuration.json>`. Both commands emit
|
|
130
|
+
JSON and require an existing device-login account; they never initiate login,
|
|
131
|
+
create a workspace, or start a scan. Guest sessions are denied. `enabled: false`
|
|
132
|
+
disables CVSS scoring while preserving the supplied policy. This configures future
|
|
133
|
+
synthesis; it does not rescore historical findings.
|
|
134
|
+
|
|
135
|
+
CVSS administration is intentionally scripted CLI only for this release. No shell,
|
|
136
|
+
local MCP, hosted MCP, or organization service-key tool is added. Agents can invoke
|
|
137
|
+
these explicit terminal commands. Server deployment requires Bedrock CVSS API support for CLI bearer authentication.
|
|
138
|
+
|
|
139
|
+
Example (jq is used only to prepare the JSON file):
|
|
140
|
+
|
|
141
|
+
```sh
|
|
142
|
+
apex login
|
|
143
|
+
apex workspace use "<workspace name or prefix>"
|
|
144
|
+
apex cvss get > cvss-current.json
|
|
145
|
+
jq '.configuration // {enabled: true, policy: .template}' cvss-current.json > cvss.json
|
|
146
|
+
# Edit cvss.json, then save and verify:
|
|
147
|
+
apex cvss set --file cvss.json
|
|
148
|
+
apex cvss get
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
Keep `policy.version` at `3.1`. Supply a name, instructions, and all eight metrics
|
|
152
|
+
(AV, AC, PR, UI, S, C, I, A). Each metric has an `options` map with at least one
|
|
153
|
+
allowed value and nonempty guidance for each allowed value. Omit disallowed
|
|
154
|
+
values. If Audit Setup or another workspace update is active, wait for it to
|
|
155
|
+
finish before saving again.
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
},
|
|
7
7
|
"metadata": {
|
|
8
8
|
"description": "Cantina agent plugins for security review workflows.",
|
|
9
|
-
"version": "0.1.
|
|
9
|
+
"version": "0.1.36"
|
|
10
10
|
},
|
|
11
11
|
"plugins": [
|
|
12
12
|
{
|
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
"source": {
|
|
15
15
|
"source": "npm",
|
|
16
16
|
"package": "@cantinasecurity/apex-cli",
|
|
17
|
-
"version": "0.1.
|
|
17
|
+
"version": "0.1.36"
|
|
18
18
|
},
|
|
19
19
|
"description": "Run Apex security scans and review findings from Claude Code.",
|
|
20
|
-
"version": "0.1.
|
|
20
|
+
"version": "0.1.36",
|
|
21
21
|
"author": {
|
|
22
22
|
"name": "Cantina",
|
|
23
23
|
"email": "support@cantina.xyz"
|
package/.mcp.claude.json
CHANGED
package/.mcp.codex.json
CHANGED
package/MARKETPLACE.md
CHANGED
|
@@ -13,7 +13,7 @@ This package is prepared as both a Claude Code plugin and a Codex plugin. The pu
|
|
|
13
13
|
The plugin MCP configs launch the pinned npm CLI package with:
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
|
-
npx -y -p @cantinasecurity/apex-cli@0.1.
|
|
16
|
+
npx -y -p @cantinasecurity/apex-cli@0.1.36 apex-mcp
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
That keeps marketplace installs independent of a user's global `apex` install.
|
package/README.md
CHANGED
|
@@ -158,30 +158,30 @@ unclaimed local trial proof so `apex claim` can still use it.
|
|
|
158
158
|
Agent-safe copy/paste prompt (substitute the issued code):
|
|
159
159
|
|
|
160
160
|
```text
|
|
161
|
-
Install and run Cantina Apex CLI 0.1.
|
|
161
|
+
Install and run Cantina Apex CLI 0.1.36 to start one free standard security scan of this repository immediately.
|
|
162
162
|
|
|
163
163
|
Use this trial code only where <TRIAL_CODE> appears below: SPBT-DEVREL-XXXXXXXX
|
|
164
164
|
|
|
165
165
|
Run the commands yourself from the repository root; do not stop after setup or only explain the steps. Use terminal CLI commands only. Do not use an Apex MCP tool or run `apex setup`, `apex mcp`, `apex login`, `apex-auth-start`, or `apex-auth-wait`. Never use `--replace` or `--force`.
|
|
166
166
|
|
|
167
167
|
Use this exact command prefix for every Apex command:
|
|
168
|
-
npx -y -p @cantinasecurity/apex-cli@0.1.
|
|
168
|
+
npx -y -p @cantinasecurity/apex-cli@0.1.36 apex
|
|
169
169
|
|
|
170
170
|
1. Before redeeming, confirm every command will use the same persistent, user-accessible machine or container, HOME, filesystem, and repository root. Confirm Node.js 20+ and npx are available. If `APEX_BASE_URL` is set, continue only when its origin is `https://ai.cantina.xyz`. Run the exact prefix with `--help` and continue only if help lists both `redeem` and `claim`. If any check fails, STOP before sending the code; do not install system packages.
|
|
171
171
|
2. Redeem, with at most one response-loss recovery retry:
|
|
172
|
-
npx -y -p @cantinasecurity/apex-cli@0.1.
|
|
172
|
+
npx -y -p @cantinasecurity/apex-cli@0.1.36 apex redeem <TRIAL_CODE> --json
|
|
173
173
|
This terminal command is the only allowed tool call containing the code. Never echo or restate the code, store it in a file or environment variable, put it in a URL or MCP call, or include it in your response. Parse the JSON from stdout only; do not merge stderr into stdout, because npm may write warnings to stderr. Continue when the command exits 0 and stdout is JSON with `redeemed: true` and `outcome` equal to `redeemed` or `idempotent`. `idempotent` means the existing guest session resumed and it may already own a workspace. If and only if the first attempt ends with an ambiguous transport/connection failure or an interrupted/missing response and no typed server error code, retry this exact same command once on the same machine, HOME, and repository root. Never retry a typed server rejection and never make more than one recovery retry. If the allowed retry does not return a successful JSON outcome, STOP.
|
|
174
174
|
3. Immediately start exactly one scan; do not wait for another instruction:
|
|
175
|
-
npx -y -p @cantinasecurity/apex-cli@0.1.
|
|
175
|
+
npx -y -p @cantinasecurity/apex-cli@0.1.36 apex scan --mode standard --non-interactive --no-open --json
|
|
176
176
|
The CLI validates the complete guest local archive before it reserves a workspace. An unbound renamed checkout may recover only the sole empty guest workspace when no explicit workspace name was supplied. On any error or nonzero exit, STOP. After a successful scan JSON response, inspect `localPersistence.workspaceBindingSaved`. If it is `false`, the server scan already started: capture and report `binding.lastScanId`, then STOP; do not run status or findings until local repository permissions are repaired. Otherwise capture `binding.lastScanId` from the JSON as <SCAN_ID>; if it is absent, STOP.
|
|
177
177
|
4. About every 60 seconds, poll that exact scan:
|
|
178
|
-
npx -y -p @cantinasecurity/apex-cli@0.1.
|
|
178
|
+
npx -y -p @cantinasecurity/apex-cli@0.1.36 apex status --scan <SCAN_ID> --json
|
|
179
179
|
Read `progress.progress.status`. Wait while it is `created`, `pending`, `queued`, `starting`, `running`, `in_progress`, or `processing`. Continue on `completed`. STOP on `failed`, `cancelled`, a missing or unknown status, or a command failure.
|
|
180
180
|
5. Fetch that exact scan's findings:
|
|
181
|
-
npx -y -p @cantinasecurity/apex-cli@0.1.
|
|
181
|
+
npx -y -p @cantinasecurity/apex-cli@0.1.36 apex findings --scan <SCAN_ID> --json
|
|
182
182
|
On success, summarize findings by severity, most severe first, including identifier, title, status, and confidence. This command does not return file locations, so do not invent them. On failure, STOP.
|
|
183
183
|
6. Do not claim automatically. Tell me the claim deadline from step 2 and remind me to run this exact command myself from the same repository root, machine, and HOME:
|
|
184
|
-
npx -y -p @cantinasecurity/apex-cli@0.1.
|
|
184
|
+
npx -y -p @cantinasecurity/apex-cli@0.1.36 apex claim
|
|
185
185
|
It may open a browser so I can create or sign in to a Cantina account and keep the results. Claim moves the trial into the currently selected Cantina workspace when I can run scans there, or into my existing personal workspace. If the selected workspace cannot run scans, tell me to switch to one that can and retry before the claim deadline.
|
|
186
186
|
|
|
187
187
|
Never paste raw command transcripts. For any failure, report only the step, exit code, and sanitized error. Redact the trial code and every `apex_at_`, `apex_rt_`, or `apex_ct_` value from all reports.
|
|
@@ -266,6 +266,8 @@ Supported shell commands:
|
|
|
266
266
|
- `apex workspaces`
|
|
267
267
|
- `apex workspace`
|
|
268
268
|
- `apex workspace use <workspace-name|workspace-prefix|workspace-id>`
|
|
269
|
+
- `apex cvss get`
|
|
270
|
+
- `apex cvss set --file <configuration.json>`
|
|
269
271
|
- `apex cancel-scan [scan-id]`
|
|
270
272
|
- `apex status [--scan <scan-id>]`
|
|
271
273
|
- `apex doctor`
|
|
@@ -325,7 +327,9 @@ Service-key management is intentionally available only through the scripted CLI.
|
|
|
325
327
|
|
|
326
328
|
### Hosted HTTPS MCP
|
|
327
329
|
|
|
328
|
-
|
|
330
|
+
For a service-key connection, point your Streamable HTTP MCP client at `https://ai.cantina.xyz/mcp` and send the service key as `Authorization: Bearer <TOKEN>`. No local `apex-mcp` process, browser, TTY, or device-login session is required.
|
|
331
|
+
|
|
332
|
+
OAuth-capable clients can connect to the same hosted endpoint through its OAuth discovery flow. Sign in with Cantina, select an organization you manage, and approve the requested scopes. Keep OAuth tokens in the client’s credential store; they authenticate only this MCP resource, not the REST API or local CLI. See the [hosted OAuth setup guide](https://ai.cantina.xyz/docs/apex-api#hosted-mcp) for the supported connection flow.
|
|
329
333
|
|
|
330
334
|
Keep the key in the environment. For Codex:
|
|
331
335
|
|
|
@@ -352,7 +356,9 @@ Claude Code can expand the same environment variable from `.mcp.json`:
|
|
|
352
356
|
}
|
|
353
357
|
```
|
|
354
358
|
|
|
355
|
-
The hosted server exposes `apex-credits`, `apex-workspaces`, `apex-scan`, `apex-status`, `apex-cancel-scan`, `apex-findings`, `apex-workspace-findings`, `apex-finding-tickets`, `apex-finding-link-ticket`, and `apex-finding-send`. Ticket creation and linking require an explicit `findings:write` scope and a connected Linear/Jira integration.
|
|
359
|
+
The hosted server exposes `apex-credits`, `apex-workspaces`, `apex-scan`, `apex-black-start`, `apex-status`, `apex-cancel-scan`, `apex-findings`, `apex-workspace-findings`, `apex-finding-tickets`, `apex-finding-link-ticket`, and `apex-finding-send`. Ticket creation and linking require an explicit `findings:write` scope and a connected Linear/Jira integration. Hosted operations are scoped to the authenticated organization. Repository scans use connected GitHub repositories; Apex Black scans use explicitly authorized HTTPS origins. Use local stdio MCP for device auth, local filesystem/archive access, provider connection, setup, comments, feedback, fix reviews, and trial flows.
|
|
360
|
+
|
|
361
|
+
Apex Black is hosted-only: use `apex-black-start` when the connected deployment advertises it and the organization has Apex Black beta access. Check `apex-credits` first. Supply 1–16 exact HTTPS origins, a stable `idempotencyKey`, and `authorizationAccepted: true` only when the user has authorized every target and accepted the 200 Standard credit cost; honor authorization already provided in the session. Use the returned Bedrock `scanId` with `apex-status` and `apex-findings`. An identical retry replays a stored start failure, including `APEX_BLACK_START_FAILED`; retain its durable IDs and contact support before trying another request. Local CLI and stdio MCP do not expose this web-scan tool or a Black scan mode.
|
|
356
362
|
|
|
357
363
|
### Hosted REST API
|
|
358
364
|
|
|
@@ -663,7 +669,7 @@ Telemetry event posts do not include bearer tokens. The telemetry endpoint is `P
|
|
|
663
669
|
{
|
|
664
670
|
"schemaVersion": 1,
|
|
665
671
|
"event": "apex.invocation.completed",
|
|
666
|
-
"cliVersion": "0.1.
|
|
672
|
+
"cliVersion": "0.1.36",
|
|
667
673
|
"invocation": {
|
|
668
674
|
"surface": "mcp",
|
|
669
675
|
"command": "apex-scan",
|
|
@@ -694,7 +700,7 @@ The npm package also includes marketplace-ready plugin artifacts:
|
|
|
694
700
|
- `.claude-plugin/plugin.json` and `.mcp.claude.json` for Claude Code plugin installs
|
|
695
701
|
- `.claude-plugin/marketplace.json` for a Claude marketplace entry backed by the public npm package
|
|
696
702
|
|
|
697
|
-
These plugin installs launch the pinned npm package with `npx -y -p @cantinasecurity/apex-cli@0.1.
|
|
703
|
+
These plugin installs launch the pinned npm package with `npx -y -p @cantinasecurity/apex-cli@0.1.36 apex-mcp`, so users do not need to install `apex` globally before enabling the plugin.
|
|
698
704
|
|
|
699
705
|
The repository also includes `.agents/plugins/marketplace.json` for local Codex marketplace testing from a checkout.
|
|
700
706
|
|
|
@@ -731,3 +737,36 @@ To move between existing Apex workspaces from the CLI:
|
|
|
731
737
|
3. If the workspace name contains spaces, quote it, for example `apex workspace use "Core Platform"`.
|
|
732
738
|
4. Use `apex scans`, `apex status --scan <scan-id>`, `apex findings`, and `apex export findings` against that binding.
|
|
733
739
|
5. Use `apex findings --workspace --company <handle> --workspace-ref <ref> --finding-state open` for the workspace browser's cross-scan findings that still need review, without changing the local binding.
|
|
740
|
+
|
|
741
|
+
### Workspace CVSS configuration
|
|
742
|
+
|
|
743
|
+
Use `apex workspace use <workspace>` to bind the intended existing workspace, then
|
|
744
|
+
`apex cvss get` to read its configuration and CVSS 3.1 policy template. To update it,
|
|
745
|
+
write a JSON file containing exactly `enabled` (boolean) and `policy` (the edited
|
|
746
|
+
template), then run `apex cvss set --file <configuration.json>`. Both commands emit
|
|
747
|
+
JSON and require an existing device-login account; they never initiate login,
|
|
748
|
+
create a workspace, or start a scan. Guest sessions are denied. `enabled: false`
|
|
749
|
+
disables CVSS scoring while preserving the supplied policy. This configures future
|
|
750
|
+
synthesis; it does not rescore historical findings.
|
|
751
|
+
|
|
752
|
+
CVSS administration is intentionally scripted CLI only for this release. No shell,
|
|
753
|
+
local MCP, hosted MCP, or organization service-key tool is added. Agents can invoke
|
|
754
|
+
these explicit terminal commands. Server deployment requires Bedrock CVSS API support for CLI bearer authentication.
|
|
755
|
+
|
|
756
|
+
Example (jq is used only to prepare the JSON file):
|
|
757
|
+
|
|
758
|
+
```sh
|
|
759
|
+
apex login
|
|
760
|
+
apex workspace use "<workspace name or prefix>"
|
|
761
|
+
apex cvss get > cvss-current.json
|
|
762
|
+
jq '.configuration // {enabled: true, policy: .template}' cvss-current.json > cvss.json
|
|
763
|
+
# Edit cvss.json, then save and verify:
|
|
764
|
+
apex cvss set --file cvss.json
|
|
765
|
+
apex cvss get
|
|
766
|
+
```
|
|
767
|
+
|
|
768
|
+
Keep `policy.version` at `3.1`. Supply a name, instructions, and all eight metrics
|
|
769
|
+
(AV, AC, PR, UI, S, C, I, A). Each metric has an `options` map with at least one
|
|
770
|
+
allowed value and nonempty guidance for each allowed value. Omit disallowed
|
|
771
|
+
values. If Audit Setup or another workspace update is active, wait for it to
|
|
772
|
+
finish before saving again.
|
package/dist/apex.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { commandCvss } from "./cvss.js";
|
|
1
2
|
import { commandStartThreatModel, commandThreatModel, hasAuditSetupBeta, threatModelExitCode, terminalText } from "./threat-model.js";
|
|
2
3
|
import { getMe } from "./auth.js";
|
|
3
4
|
import { ApexApiClient, formatApiError } from "./api-client.js";
|
|
@@ -94,6 +95,11 @@ async function dispatch(parsed) {
|
|
|
94
95
|
case "workspaces":
|
|
95
96
|
await commandWorkspaces(client, cwd, parsed.flags);
|
|
96
97
|
return;
|
|
98
|
+
case "cvss":
|
|
99
|
+
if (parsed.args.length)
|
|
100
|
+
throw new Error("Unexpected CVSS arguments");
|
|
101
|
+
await commandCvss(client, cwd, parsed.flags, parsed.subcommand);
|
|
102
|
+
return;
|
|
97
103
|
case "workspace":
|
|
98
104
|
if (parsed.subcommand === "use") {
|
|
99
105
|
const workspaceRef = parsed.args.join(" ");
|
package/dist/cvss.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import { getMe } from "./auth.js";
|
|
5
|
+
import { getFlagString } from "./args.js";
|
|
6
|
+
import { printJson } from "./output.js";
|
|
7
|
+
import { loadWorkspaceBinding } from "./workspace-binding.js";
|
|
8
|
+
const inputSchema = z
|
|
9
|
+
.object({
|
|
10
|
+
enabled: z.boolean(),
|
|
11
|
+
policy: z.record(z.string(), z.unknown()),
|
|
12
|
+
})
|
|
13
|
+
.strict();
|
|
14
|
+
export async function commandCvss(client, cwd, flags, action) {
|
|
15
|
+
const file = getFlagString(flags, "file");
|
|
16
|
+
if (!["get", "set"].includes(action ?? "") ||
|
|
17
|
+
(action === "set" ? !file : file))
|
|
18
|
+
throw new Error("Usage: apex cvss get | apex cvss set --file <configuration.json>");
|
|
19
|
+
if (flags.company || flags["workspace-name"] || flags["workspace-ref"])
|
|
20
|
+
throw new Error("CVSS uses the bound workspace. Run `apex workspace use <workspace>` first.");
|
|
21
|
+
const binding = await loadWorkspaceBinding(cwd);
|
|
22
|
+
if (!binding)
|
|
23
|
+
throw new Error("Run `apex workspace use <workspace>` before configuring CVSS.");
|
|
24
|
+
let input;
|
|
25
|
+
if (action === "set") {
|
|
26
|
+
const raw = await readFile(path.resolve(cwd, file), "utf8");
|
|
27
|
+
if (Buffer.byteLength(raw) > 128 * 1024)
|
|
28
|
+
throw new Error("CVSS configuration is too large.");
|
|
29
|
+
input = inputSchema.parse(JSON.parse(raw));
|
|
30
|
+
}
|
|
31
|
+
const me = await getMe(client);
|
|
32
|
+
if (!me)
|
|
33
|
+
throw new Error("Run `apex login` before configuring CVSS.");
|
|
34
|
+
if ((await client.getCredentials())?.guest ||
|
|
35
|
+
me.user.role?.trim().toLowerCase() === "guest")
|
|
36
|
+
throw new Error("CVSS configuration requires a signed-in account.");
|
|
37
|
+
const response = await client.request(`/api/workspaces/${encodeURIComponent(binding.workspaceId)}/cvss`, action === "set" ? { method: "PUT", json: input } : {});
|
|
38
|
+
const payload = {
|
|
39
|
+
configuration: response.configuration
|
|
40
|
+
? {
|
|
41
|
+
enabled: response.configuration.enabled,
|
|
42
|
+
policy: response.configuration.policy,
|
|
43
|
+
}
|
|
44
|
+
: null,
|
|
45
|
+
template: response.template,
|
|
46
|
+
};
|
|
47
|
+
printJson(payload);
|
|
48
|
+
return payload;
|
|
49
|
+
}
|
package/dist/help.js
CHANGED
|
@@ -18,6 +18,8 @@ export const CLI_HELP_TEXT = `Usage:
|
|
|
18
18
|
Start a fix review scan for a Fix PR or current repository
|
|
19
19
|
apex export findings Export findings for the latest or selected scan
|
|
20
20
|
apex workspaces List accessible workspaces for the active company
|
|
21
|
+
apex cvss get Read workspace CVSS configuration and template (JSON)
|
|
22
|
+
apex cvss set --file <json> Update the bound workspace CVSS 3.1 rubric
|
|
21
23
|
apex workspace Show the workspace currently bound to this directory
|
|
22
24
|
apex workspace use <workspace-name|workspace-prefix|workspace-id>
|
|
23
25
|
Bind this directory to an existing Apex workspace
|
package/package.json
CHANGED
package/skills/apex-cli/SKILL.md
CHANGED
|
@@ -9,7 +9,11 @@ This skill is bundled with Apex CLI and can be installed into Codex with `apex s
|
|
|
9
9
|
|
|
10
10
|
Prefer the Apex MCP tools over running `apex` in the shell when the server is available. The tools installed by `apex setup` use the local stdio server and device login.
|
|
11
11
|
|
|
12
|
-
For a production MCP client that does not need local filesystem access, use the hosted Streamable HTTP endpoint at `https://ai.cantina.xyz/mcp`. Read the organization service key from `APEX_SERVICE_KEY` and supply it only as `Authorization: Bearer <TOKEN>`; never put the raw key in a tool argument, result, prompt, source file, or log. The hosted tools are `apex-credits`, `apex-workspaces`, `apex-scan`, `apex-status`, `apex-cancel-scan`, `apex-findings`, `apex-workspace-findings`, `apex-finding-tickets`, `apex-finding-link-ticket`, and `apex-finding-send`.
|
|
12
|
+
For a production MCP client that does not need local filesystem access, use the hosted Streamable HTTP endpoint at `https://ai.cantina.xyz/mcp`. Read the organization service key from `APEX_SERVICE_KEY` and supply it only as `Authorization: Bearer <TOKEN>`; never put the raw key in a tool argument, result, prompt, source file, or log. The hosted tools are `apex-credits`, `apex-workspaces`, `apex-scan`, `apex-black-start`, `apex-status`, `apex-cancel-scan`, `apex-findings`, `apex-workspace-findings`, `apex-finding-tickets`, `apex-finding-link-ticket`, and `apex-finding-send`.
|
|
13
|
+
|
|
14
|
+
OAuth-capable clients may instead use the hosted endpoint’s OAuth discovery and Cantina manager-consent flow. Let the client manage OAuth credentials; never pass them to tools, the REST API, or local CLI. Local stdio MCP continues to use device login.
|
|
15
|
+
|
|
16
|
+
Apex Black is a hosted-only workflow. Confirm the connected deployment advertises `apex-black-start` and the organization has beta access, then check `apex-credits`. Start only with authorization for all 1–16 exact HTTPS origins and acceptance of the 200 Standard credit cost, honoring authorization already provided in the session. Pass `targetUrls`, `authorizationAccepted: true`, and one stable `idempotencyKey`. Use the returned Bedrock `scanId` with `apex-status` and `apex-findings`. Identical retries replay stored remote-start failures, including `APEX_BLACK_START_FAILED`; retain durable IDs and contact support before trying another request. Do not fall back to a local Black scan mode or tool; neither exists.
|
|
13
17
|
|
|
14
18
|
For serverless, cron, or other explicit HTTP/JSON integrations, use the hosted Apex REST API instead of CLI or local stdio MCP. The hosted MCP and REST contract is documented at https://ai.cantina.xyz/docs/apex-api.
|
|
15
19
|
|
|
@@ -33,7 +37,7 @@ before passing the code when `APEX_BASE_URL` has any origin other than
|
|
|
33
37
|
because npm may write warnings to stderr. `idempotent` means the existing guest
|
|
34
38
|
session resumed and it may already own a workspace.
|
|
35
39
|
|
|
36
|
-
|
|
40
|
+
Local stdio MCP workflow:
|
|
37
41
|
|
|
38
42
|
1. Start with `apex-auth-status`.
|
|
39
43
|
2. Always call `apex-trial-status` next, even when account authentication succeeded. When `claimAvailable` is true, do not call `apex-auth-start`; tell the user to run `apex claim` in a terminal first so the trial workspace, scans, and findings are kept. When the claim deadline has passed and `claimAvailable` is false, continue normal account authentication instead of steering the user to an expired claim.
|
|
@@ -69,7 +73,7 @@ Guidelines:
|
|
|
69
73
|
- For a headless REST adapter, read the service key from the secret-backed `APEX_SERVICE_KEY` environment variable, send it as a bearer token to `/api/apex/v1`, and redact it from errors and logs. Do not shell out to `apex` or launch local MCP from the adapter.
|
|
70
74
|
- Hosted API integrations can call `GET /api/apex/v1/credits` with `scans:create` scope to inspect the organization's current standard, audit, and Lite balances and effective scan-type availability. Treat the response as a point-in-time snapshot; scan creation remains authoritative.
|
|
71
75
|
- Hosted remote-repository scans require the GitHub repository to be connected to the service key's Apex organization. They reuse a linked active workspace or create and link one when no match exists; use optional `workspaceId` to disambiguate multiple matches and treat explicit workspace/repository mismatches as HTTP `409` setup errors. Local or non-Git REST scans use the documented source-upload flow; send `generateThreatModel: true` for the first scan of a newly created local workspace.
|
|
72
|
-
- Hosted scan triggers require `Idempotency-Key`. Reuse one stable key only for an identical transport/timeout/5xx retry. After correcting a definitive 4xx response, or for any new intended scan, use a new key.
|
|
76
|
+
- Hosted repository scan triggers require `Idempotency-Key`. Reuse one stable key only for an identical transport/timeout/5xx retry. After correcting a definitive 4xx response, or for any new intended repository scan, use a new key. Apex Black stored start failures follow the support escalation rule above; never change keys to bypass them.
|
|
73
77
|
- `apex-credits` reports standard credits plus audit, fix review, and Lite scan entitlements when Bedrock returns those balances.
|
|
74
78
|
- `apex-scan` scans the provided `cwd` by default; pass `repoPaths` only when the user asks to scan explicit alternate roots.
|
|
75
79
|
- `apex-doctor` is read-only for guest sessions and reports the local snapshot plan without reserving a workspace. For account sessions it reports whether Apex will use remote materialization or a local snapshot upload for each selected source.
|
|
@@ -116,3 +120,36 @@ verify `apex-credits` without printing the credential.
|
|
|
116
120
|
- Use `apex-finding-tickets` to read existing links. CLI fallback: `apex findings link-ticket <finding-ref> <linear|jira> <issue-key|url> --json`, then `apex findings tickets <finding-ref> --json`.
|
|
117
121
|
- Hosted MCP uses `findingId` (UUID) instead of `findingRef`, with no `cwd` or `scanId`. Linking requires explicit `findings:write`; listing requires `findings:read`. Default service-key scopes remain scans:create, scans:read, findings:read. Do not infer write permission from read access.
|
|
118
122
|
- Apex verifies the ticket through the connected integration and records the frontend link; it does not create or modify a provider ticket. Repeating the same association is safe. A different existing link or in-progress export is a conflict: do not replace it or create another ticket as a fallback. For ambiguous Jira sites, use the full issue URL.
|
|
123
|
+
|
|
124
|
+
### Workspace CVSS configuration
|
|
125
|
+
|
|
126
|
+
Use `apex workspace use <workspace>` to bind the intended existing workspace, then
|
|
127
|
+
`apex cvss get` to read its configuration and CVSS 3.1 policy template. To update it,
|
|
128
|
+
write a JSON file containing exactly `enabled` (boolean) and `policy` (the edited
|
|
129
|
+
template), then run `apex cvss set --file <configuration.json>`. Both commands emit
|
|
130
|
+
JSON and require an existing device-login account; they never initiate login,
|
|
131
|
+
create a workspace, or start a scan. Guest sessions are denied. `enabled: false`
|
|
132
|
+
disables CVSS scoring while preserving the supplied policy. This configures future
|
|
133
|
+
synthesis; it does not rescore historical findings.
|
|
134
|
+
|
|
135
|
+
CVSS administration is intentionally scripted CLI only for this release. No shell,
|
|
136
|
+
local MCP, hosted MCP, or organization service-key tool is added. Agents can invoke
|
|
137
|
+
these explicit terminal commands. Server deployment requires Bedrock CVSS API support for CLI bearer authentication.
|
|
138
|
+
|
|
139
|
+
Example (jq is used only to prepare the JSON file):
|
|
140
|
+
|
|
141
|
+
```sh
|
|
142
|
+
apex login
|
|
143
|
+
apex workspace use "<workspace name or prefix>"
|
|
144
|
+
apex cvss get > cvss-current.json
|
|
145
|
+
jq '.configuration // {enabled: true, policy: .template}' cvss-current.json > cvss.json
|
|
146
|
+
# Edit cvss.json, then save and verify:
|
|
147
|
+
apex cvss set --file cvss.json
|
|
148
|
+
apex cvss get
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
Keep `policy.version` at `3.1`. Supply a name, instructions, and all eight metrics
|
|
152
|
+
(AV, AC, PR, UI, S, C, I, A). Each metric has an `options` map with at least one
|
|
153
|
+
allowed value and nonempty guidance for each allowed value. Omit disallowed
|
|
154
|
+
values. If Audit Setup or another workspace update is active, wait for it to
|
|
155
|
+
finish before saving again.
|