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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

- **A tightened deny or ask rule is not a widening, and a lifted denial is rated by what it restricted.** Replacing `deny: Bash(git push *)` with `deny: Bash(git *)`, or moving a rule from `ask` to `deny`, restricts at least as much, yet `diff` printed `low removed deny: Bash(git push *) → gone … 1 widening`, `verify`'s host comparison and drift named `deny_rule_removed`, and `check --format agent-boundary-json` returned `require_review` (with `SHIP-HOST-BOUNDARY-PERMISSION-DENY-REMOVED` for the deny). One predicate in the Claude Code rule model, read by every route, now holds a removed deny rule when a deny rule the same settings source still declares matches everything it matched, and a removed ask rule when a deny or ask rule of that source does: the same text, the same spelling or a decided lattice cover, never a carve-out, a rule Claude Code never consults, a padded rule, another tool's rule or a rule a `!` rule of its list may carve. A held removal is a row worded `… which this source still declares, matches everything it matched, so no denial is removed`, with no widening. A deny turned into an ask rule, a narrower deny, an undecided cover and a rule moved to another settings source still lift a restriction: a cloud session reads `.claude/settings.json` and not `.claude/settings.local.json`, so neither project file holds a rule everywhere the other did. `WebFetch(domain:*)` is read as the whole tool: `WebFetch` → `WebFetch(domain:*)` is a `high` widening instead of a narrowing that `check` allowed, and adding it blocks through `SHIP-HOST-BOUNDARY-PERMISSION-WILDCARD-ALLOW`, as adding `WebFetch` does. A bare `WebFetch` and a `domain:` rule no longer cover each other, since only the `domain:` form changes the sandbox's domain lists, so an added `WebFetch(domain:example.com)` beside an allowed `WebFetch` is a widening; a domain wildcard other than `domain:*` is undecided. A row that lifts a restriction is rated as an allow rule of the same text is, never below `medium`, so a removed `deny: Bash(*)` is `critical` and is read first. An `additionalDirectories` row names its directory in text and `--json`, where every entry read `additional_path`. No schema, contract or check ID moves. See the `a tightened deny or ask rule is not a widening` migration note in `STABILITY.md`. (#1036)
- **A workflow token widened outside every agent job is no longer counted as widening what the agent may do.** A workflow whose agent job (`analyze`, `anthropics/claude-code-action`, `contents: read`, `issues: read`) gained a sibling job that runs no agent (`publish`, `issues: write`) printed `1 change(s), 1 widening what the agent may do (⚠).`, and the Claude Code Stop hook listed it under "These rows widen what the agent can do", while the agent job's token was unchanged. The row still widens: its `direction`, `expands`, severity, the `workflow_write_*` drift signal, `review.summary`, `check` and `verify` are unchanged. Its `why` now says `publish gained the write scope issues, and this audit finds no agent launch or reusable workflow call in that job; analyze (agent launch) kept its token; widens a workflow job's token outside any agent job`, `diff` prints `1 change(s), 1 widening a workflow job's token outside any agent job (⚠).`, and the Stop hook names such rows under their own heading. The engine decides it once and fails closed: a scope gained in or inherited by a job with an agent launch (read or unread), a reusable workflow call or unreadable steps, any change to such a job's token, `write-all`, `pull_request_target`, inherited secrets, a gained agent rule or a step moved between jobs keeps the change the agent's. A workflow in which no job has any of those is labelled the same way. No JSON field or schema changes. ([STABILITY](STABILITY.md#workflow-job-scoped-widening-1011), #1011)
- **An `AGENTS.md` or `CLAUDE.md` under `.github/workflows/` is read as an instruction file, not parsed as a workflow.** The repository reader filed every source the boundary registry finds under `.github/workflows/` as a GitHub workflow, so the `AGENTS.md` Codex reads there and the `CLAUDE.md` Claude Code reads were parsed as workflow documents and recorded as `parse_failed` under host `github`. On `pydantic/pydantic-ai` PR #12653 that refused both inventories: `diff` printed `Cannot compare … base_inventory_incomplete; head_inventory_incomplete` with no row, hiding the PR's changes to `.github/workflows/bots.yml` and `ci.yml`, and `audit --host --save-baseline` refused any such repository. Where the Markdown was unchanged the comparison held, but still listed the file under `Not compared … parse_failed`, and `check` added `BOUNDARY-INPUT-INCOMPLETE`. Only a `.yml` or `.yaml` file directly in the root `.github/workflows/` is now a workflow, decided by one registry predicate that is exactly the shared adapter's root workflow globs, as `check` already decided for these files; case is folded as before. Anything else the registry enumerates there is read by its own adapter, as in any other directory: the instruction files under their adapters' hosts (`claude-code`, `codex` and `cursor` for `AGENTS.md`, `claude-code` for `CLAUDE.md`), so a prose edit is a changed source with no row, and a `.mcp.json`, `.codex/config.toml` or `.claude/hooks/hooks.json` below the directory, which the reader had published as an empty `github` workflow grant, is read as MCP, Codex or hook configuration. The public case is `comparable`, with its two workflow rows. Those sources' artifact host, kind and id change; a nested copy (`samples/x/.github/workflows/ci.yml`), every root workflow's grant id and `config_sha256`, `sources_expected` and the goldens do not. A baseline saved by 1.3.0 compares unchanged unless it holds one of those JSON or TOML files, whose `github` grant now reads as removed and its own grants as added. No schema, contract or check ID moves. (#1110)

### Changes

Expand Down
2 changes: 1 addition & 1 deletion docs/host-boundary-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ and `audit --host`.
| Claude Code | first-class | `.claude/settings.json`, `.claude/settings.local.json`, `.mcp.json` (the root one, a Claude Code plugin's, and a nested one nothing else selects), `CLAUDE.md`, Claude skills | permission modes/rules, sandbox/network, additional paths, MCP restrictions, plugins and their marketplaces (`extraKnownMarketplaces`), hooks, [settings it runs as commands and endpoint, trust and loader `env` entries](#claude-code-commands-and-env) |
| Cursor | first-class | `.cursor/cli.json`, `.cursor/mcp.json`, `.cursor/rules/**` | Shell/Read/Write rules, MCP declarations, instruction trust roots |
| VS Code MCP | first-class | `.vscode/mcp.json` | MCP servers; `sandbox` and per-server `sandboxEnabled`; `${input:…}` references by name, never value; `envFile` recorded as a limit; other top-level keys partial |
| Shared/GitHub | first-class | `AGENTS.md`, Shipgate policies/state, skills, `.github/workflows/*` | instruction/gate weakening, workflow permissions and triggers (the event context apart from job token scopes), reusable-call permission ceilings and the permissions of same-repository called workflows, remote step action references, named secret sources passed to reusable workflows, agent launches (documented agent action inputs, `run:` steps that are one plain `claude -p` / `codex exec` command, `run:` steps that mention an agent CLI in shell this audit does not parse, named as a limit) and `actions/checkout` refs |
| Shared/GitHub | first-class | `AGENTS.md`, Shipgate policies/state, skills, `.github/workflows/*.yml` and `*.yaml` (an `AGENTS.md` or `CLAUDE.md` in that directory is an instruction file, #1110) | instruction/gate weakening, workflow permissions and triggers (the event context apart from job token scopes), reusable-call permission ceilings and the permissions of same-repository called workflows, remote step action references, named secret sources passed to reusable workflows, agent launches (documented agent action inputs, `run:` steps that are one plain `claude -p` / `codex exec` command, `run:` steps that mention an agent CLI in shell this audit does not parse, named as a limit) and `actions/checkout` refs |

A registered adapter reports `complete`, `not_applicable`, `partial`, or
`experimental` coverage. A relevant malformed, unreadable, binary, oversized,
Expand Down
26 changes: 24 additions & 2 deletions src/agents_shipgate/core/boundary_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,27 @@ def matches(self, path: str) -> bool:
)


#: The workflow documents GitHub runs: a `.yml` or `.yaml` file directly in
#: the repository root's `.github/workflows/`. The shared adapter enumerates
#: them through these globs; its `**/` globs add the nested copies, which
#: never run.
GITHUB_WORKFLOW_GLOBS = (".github/workflows/*.yml", ".github/workflows/*.yaml")


def is_github_workflow_path(path: str) -> bool:
"""Whether ``path`` is a workflow document GitHub runs (#1110).

Exactly what :data:`GITHUB_WORKFLOW_GLOBS` match, folding case as every
predicate here does. Nothing else under `.github/workflows/` is a
workflow, a file in a subdirectory included: an `AGENTS.md` or
`CLAUDE.md` there is an instruction file its own adapter enumerates, as
it would be in any other directory.
"""

normalized = path.replace("\\", "/").removeprefix("./")
return any(glob_match_ci(pattern, normalized) for pattern in GITHUB_WORKFLOW_GLOBS)


BOUNDARY_ADAPTERS: tuple[BoundaryAdapterSpec, ...] = (
BoundaryAdapterSpec(
id="openshell",
Expand Down Expand Up @@ -100,8 +121,7 @@ def matches(self, path: str) -> bool:
"**/AGENTS.override.md",
".agents/skills/*/SKILL.md",
".agents/skills/**/SKILL.md",
".github/workflows/*.yml",
".github/workflows/*.yaml",
*GITHUB_WORKFLOW_GLOBS,
"**/.github/workflows/*.yml",
"**/.github/workflows/*.yaml",
".agents-shipgate/baseline*.json",
Expand Down Expand Up @@ -159,10 +179,12 @@ def is_agent_boundary_path(path: str) -> bool:

__all__ = [
"BOUNDARY_ADAPTERS",
"GITHUB_WORKFLOW_GLOBS",
"BoundaryAdapterSpec",
"boundary_adapters_for_path",
"boundary_hosts_for_path",
"is_agent_boundary_path",
"is_github_workflow_path",
]


Expand Down
13 changes: 10 additions & 3 deletions src/agents_shipgate/core/host_grants.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
is_claude_plugin_marketplace_path,
is_claude_plugin_reference_path,
is_explicit_boundary_file_path,
is_github_workflow_path,
is_hook_declaration_file_name,
is_plugin_manifest_path,
plugin_manifest_root,
Expand Down Expand Up @@ -5815,9 +5816,13 @@ def follow_hooks(


def _source_kind(path: str) -> str:
folded = path.casefold()
if folded.startswith(".github/workflows/"):
# Only a document GitHub runs is a workflow. Anything else the registry
# enumerates under `.github/workflows/` — an `AGENTS.md` or `CLAUDE.md` —
# is read as it would be in any other directory, never parsed as a
# workflow (#1110).
if is_github_workflow_path(path):
return "workflow"
folded = path.casefold()
if folded.endswith((".mcp.json", "/mcp.json")):
return "mcp"
if folded.endswith("hooks.json"):
Expand All @@ -5836,7 +5841,9 @@ def _source_kind(path: str) -> str:


def _audit_hosts(adapter_id: str, path: str, hosts: tuple[str, ...]) -> tuple[str, ...]:
if path.casefold().startswith(".github/workflows/"):
# The same predicate as the kind, so a source is `github` exactly when
# it is read as a workflow (#1110).
if is_github_workflow_path(path):
return ("github",)
if adapter_id == "vscode_mcp":
return ("vscode",)
Expand Down
14 changes: 13 additions & 1 deletion tests/shard_seconds.json
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,8 @@
"tests/test_capability_payload_v2.py": 4.7,
"tests/test_attest_approval.py": 0.2,
"tests/test_declared_policy_pack_boundary.py": 44.3,
"tests/test_packaged_default_policies.py": 0.2
"tests/test_packaged_default_policies.py": 0.2,
"tests/test_workflow_directory_instructions.py": 50.6
},
"measured_at": "cbff1ef0b101",
"measurement": {
Expand Down Expand Up @@ -688,6 +689,17 @@
"case_count": 9,
"command": "python -m pytest tests/test_packaged_default_policies.py --junitxml=packaged-default-policies.xml",
"time_basis": "JUnit testcase time; original full-suite measurements retained"
},
{
"source": "junit",
"measured_at": "26bfa733b324 with issue #1110 workflow-directory instruction files increment",
"report_sha256": "a8ac4ee259a453912d15c23829ed4094520ab526eae4a28867707e392564061a",
"files": {
"tests/test_workflow_directory_instructions.py": 50.6
},
"case_count": 23,
"command": "python -m pytest tests/test_workflow_directory_instructions.py --junitxml=workflow-directory-instructions.xml",
"time_basis": "JUnit testcase time; original full-suite measurements retained"
}
]
}
Loading
Loading