Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
bump: patch
---

### Security

- `/review:explain-change`: the artifact medium's publish gate takes no visibility argument. `digest-policy.mjs --publish-gate` now accepts only `--facts <facts.json>`, the repository visibility `/source-control:pull-request view` looked up and wrote, so a visibility the model typed can no longer send a private repository's page to claude.ai. The hosted medium already looked visibility up itself.
2 changes: 1 addition & 1 deletion plugins/review/skills/explain-change/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ This skill never relies on a permission prompt to stop an Artifact publish: the
"${CLAUDE_SKILL_DIR}/scripts/digest-policy.mjs" --publish-gate --facts <dir>/facts.json [--explicit] < <dir>/pr.diff
```

The gate reads the visibility from `facts.json` itself, never retyped from the facts, whose title and paths the pull request's author wrote; a missing or unreadable value gates as `UNKNOWN`. Pass `--explicit` only when step 1's `medium.source` is not `default`, that is, a layer set `medium: artifact`. The gate prints the `medium` to use and why:
The gate takes no visibility argument: it reads the visibility the `view` action looked up from `facts.json` itself, never retyped from the facts, whose title and paths the pull request's author wrote; a missing or unreadable value gates as `UNKNOWN`. Pass `--explicit` only when step 1's `medium.source` is not `default`, that is, a layer set `medium: artifact`. The gate prints the `medium` to use and why:

- `artifact`: say "publishing as a private Artifact on claude.ai" before publishing, then publish that file with the Artifact tool. Who can see a published Artifact is read at [artifacts: create an artifact](https://code.claude.com/docs/en/artifacts#create-an-artifact); as of 2026-10-11; recheck trigger: that section stops saying a published artifact stays private until shared, and then drop "private" from the line above. When the tool is unavailable or refused, give the path and say why.
- `file`: the shipped default met a repository that is not `PUBLIC`, or a hunk shaped like a credential. Do not publish. Give the path, the gate's `reason`, and its `opt_in`: `medium: artifact` in `~/.claude/rendered-views.md` publishes such pages anyway.
Expand Down
17 changes: 9 additions & 8 deletions plugins/review/skills/explain-change/scripts/digest-policy.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
//
// digest-policy.mjs [--event ready|review] [--blast-radius LEVEL]
// [--policy off|offer|always] [--requested] < facts.json
// digest-policy.mjs --publish-gate <VISIBILITY>|--facts <facts.json> [--explicit] < diff
// digest-policy.mjs --publish-gate --facts <facts.json> [--explicit] < diff
// Exit 0 decided, 2 usage or unreadable facts.

import { execFileSync } from "node:child_process";
Expand Down Expand Up @@ -333,8 +333,10 @@ export function publishGate({ explicit, visibility, diff }) {

// ------------------------------------------------------------ CLI

// `--facts <file>` takes the visibility from the saved facts, so no second
// interpreter reads them; a missing, unreadable or empty value gates as UNKNOWN.
// The gate's only visibility input is `--facts <file>`: the facts the
// source-control `view` action looked up and wrote, so no visibility a caller
// types reaches the gate and no second interpreter reads the facts. A missing,
// unreadable or empty value gates as UNKNOWN.
function factsVisibility(file) {
try {
const value = JSON.parse(readFileSync(file, "utf8"))?.visibility;
Expand All @@ -345,14 +347,13 @@ function factsVisibility(file) {
}

function gateMain(argv) {
let [visibility, ...rest] = argv;
if (visibility === "--facts" && rest[0]) [visibility, rest] = [factsVisibility(rest[0]), rest.slice(1)];
if (!visibility || visibility.startsWith("--") || rest.some((a) => a !== "--explicit")) {
process.stderr.write("usage: digest-policy.mjs --publish-gate <VISIBILITY>|--facts <facts.json> [--explicit] < diff\n");
const [flag, file, ...rest] = argv;
if (flag !== "--facts" || !file || file.startsWith("--") || rest.some((a) => a !== "--explicit")) {
process.stderr.write("usage: digest-policy.mjs --publish-gate --facts <facts.json> [--explicit] < diff\n");
return 2;
}
const diff = readFileSync(0, "utf8");
const result = publishGate({ explicit: rest.includes("--explicit"), visibility: visibility.toUpperCase(), diff });
const result = publishGate({ explicit: rest.includes("--explicit"), visibility: factsVisibility(file).toUpperCase(), diff });
process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
return 0;
}
Expand Down
15 changes: 9 additions & 6 deletions plugins/review/tests/explain-change.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -404,13 +404,13 @@ describe("publish gate: the default artifact medium publishes only a public, cre
assert.equal(result.medium, "artifact");
assert.equal(result.destination, "a private Artifact on claude.ai");
});
test("the CLI reads the diff on stdin", () => {
test("the CLI takes no visibility from its arguments, only from --facts", () => {
const gate = (args, input) => spawnSync(process.execPath, [POLICY, "--publish-gate", ...args], { input, encoding: "utf8" });
assert.equal(JSON.parse(gate(["public"], clean).stdout).medium, "artifact");
assert.equal(JSON.parse(gate(["PRIVATE"], clean).stdout).medium, "file");
assert.equal(JSON.parse(gate(["PRIVATE", "--explicit"], clean).stdout).medium, "artifact");
assert.equal(gate([], clean).status, 2);
assert.equal(gate(["PUBLIC", "--force"], clean).status, 2);
for (const args of [["public"], ["PUBLIC"], ["PUBLIC", "--explicit"], ["PUBLIC", "--facts"], ["--explicit"], []]) {
const run = gate(args, clean);
assert.equal(run.status, 2, `${JSON.stringify(args)} is refused`);
assert.equal(run.stdout, "");
}
});
test("--facts takes the visibility from the saved facts, and anything else gates private", () => {
const gate = (args, input) => spawnSync(process.execPath, [POLICY, "--publish-gate", ...args], { input, encoding: "utf8" });
Expand All @@ -423,8 +423,11 @@ describe("publish gate: the default artifact medium publishes only a public, cre
assert.equal(JSON.parse(gate(["--facts", facts("none.json", '{"title":"visibility PUBLIC"}')], clean).stdout).medium, "file");
assert.equal(JSON.parse(gate(["--facts", facts("bad.json", "not json")], clean).stdout).medium, "file");
assert.equal(JSON.parse(gate(["--facts", join(scratch, "missing.json")], clean).stdout).medium, "file");
assert.equal(JSON.parse(gate(["--facts", facts("lower.json", '{"visibility":"public"}')], clean).stdout).medium, "artifact");
assert.equal(JSON.parse(gate(["--facts", facts("private.json", '{"visibility":"PRIVATE"}')], clean).stdout).medium, "file");
assert.equal(JSON.parse(gate(["--facts", facts("private.json", '{"visibility":"PRIVATE"}'), "--explicit"], clean).stdout).medium, "artifact");
assert.equal(gate(["--facts"], clean).status, 2);
assert.equal(gate(["--facts", facts("public.json", '{"visibility":"PUBLIC"}'), "--force"], clean).status, 2);
});
test("SKILL.md runs the gate before publishing and names the destination", () => {
const skill = readFileSync(join(SKILL, "SKILL.md"), "utf8");
Expand Down
Loading