Repository navigation
integrations: readable egress denials, Dependabot alert powers, routed-model usage - #1822
Merged
Merged
Conversation
…pository only The `metadata:read` operation matched `GET /repos/*`, and `*` crosses `/`, so it let every GET under a repository through the proxy. A path with no power of its own, such as Dependabot alerts, then reached GitHub with a minted token that lacked the permission and failed as a GitHub 403. - `metadata:read` now matches the repository root (`segment-path:/repos/*/*`) and the metadata endpoints by name (events, forks, stats, rules, ...). - `compare`, `tarball`, `zipball` and the dependency graph move to `contents:read`, where GitHub puts them. - New powers `vulnerability_alerts:read` (list Dependabot alerts) and `vulnerability_alerts:write` (dismiss one). The minter maps the power name to the GitHub App permission of the same name. A GET that only the old catch-all let through is now refused at the proxy. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The minter turned `variables:read` into the App permission key `variables`, which GitHub does not have, so the clamp always dropped it and `gh variable list` failed. Map `variables` to `actions_variables`, in the minter and in the setup page's copy of the same mapping. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A request the session's grants do not permit got no readable answer:
HTTP/1 closed the connection, and HTTP/2 sent an empty 403 and dropped the
unread request body, so h2 reset the stream. `curl -sS` printed nothing or
"Stream error in the HTTP/2 framing layer", and an agent could not tell a
missing grant from a network fault.
Both protocols now answer a policy denial with a 403 (400 for an
unparseable GraphQL request) and a JSON body:
{"ok": false, "error": "egress_policy_denied", "message": "<method> <path> ..."}.
Slack clients read `ok`/`error`, GitHub clients read `message`. HTTP/2
reads the request body (up to 1 MiB) before it answers, so the stream
ends cleanly. HTTP/1 still closes the connection after the answer, and a
malformed or smuggling-shaped request still closes without one. A denial
is never a 2xx.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The wrappers built their curl arguments as a newline-separated string and split it with IFS. A value with a newline (a multiline Slack message, a Jira description) became two arguments: the field kept only its first line, and the rest went to curl as a URL. `slack api chat.update` saved a truncated message this way. Each wrapper now appends `--data-urlencode <field=value>` to its own argument list in a loop, which keeps every value whole. vanta still splits a `...MatchesAny` list on commas, vercel still rewrites `team=` to `teamId=`, and cortex still adds its paging defaults. A unittest runs the wrappers against a fake curl. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review of the previous commit found: - The new metadata globs (`/repos/*/events*` and the rest) used the plain form, where `*` crosses `/`, so `/repos/o/r/contents/src/events/x.ts` matched `metadata:read`. They are now `segment-path:/repos/*/*/<name>`. - Some endpoints sit under a different GitHub permission: `activity`, `codeowners/errors`, `community/profile` and commit `comments` need Contents read, `assignees` needs Issues read, `environments` needs Actions read, and `teams` needs Administration (dropped). - GETs the old catch-all covered and nothing else did: the root `contents` listing, and `topics`/`languages` with a query string. `compare`, `tarball` and `zipball` keep the plain form, because a ref can contain `/`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review of the previous commit found that HTTP/2 read the request body before it answered, with no deadline and into a buffer: a client that never ended its body never got the denial, and 64 such streams could hold 64 MiB. - HTTP/2 sends the complete denial first, then discards the body without keeping it (1 MiB, 2 s). A body that does not end gets `RST_STREAM(NO_ERROR)`, which RFC 9113 §8.1 allows after a complete response; the implicit reset h2 sends for an unread body is `CANCEL`, which curl reports as a framing error. The 413 path does the same. - HTTP/1 discards the unread part of a declared body (same limits) after the answer, so the close does not send a TCP RST ahead of it. - Only a request the grants do not cover tells the guest to ask for a grant. A Google credential request or a malformed GraphQL body says that no grant permits it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…he catalog A session on a routed model (OpenRouter) recorded zero tokens for every model call, and its run cost came from Claude Code's `total_cost_usd`, which prices every model with Anthropic's list. The harness read usage from the CLI's `assistant` lines. Those repeat the `message_start` usage, and a router sends zeros there; the real counts arrive in `message_delta`. For Anthropic models the same lines carried an `output_tokens` of about 1, so output tokens were under-counted too and now rise to the real numbers. - `GenerationLedger` keeps the usage of each streaming message, keyed by `parent_tool_use_id`: `message_start`, merged with each `message_delta` (larger value wins; Anthropic's counts are cumulative), emitted at `message_stop`. A turn that ends first (result, interrupt, crash) emits what its streams reported. An `assistant` line counts only for a message the CLI did not stream. - The orchestrator passes the routed model's catalog `pricing` as `ENGRAM_MODEL_ROUTER_PRICING`; a profile env var cannot set it. A routed session's `RunCost` is its turn's tokens at those prices, and no cost when the model has no prices. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The catalog derived a power's read/write access from its operation's HTTP method, and a method-less operation counted as write. Slack's Web API is POST-only and declares no methods, so every Slack power showed as "write" (`channels:read`, `users:read`, ...), and so did Datadog's `profiling:read`/`test_optimization:read` and Notion's `search:read`. The profile editor groups and presets powers by this label. `powerAccess`: `<resource>:read` reads, any other level writes, and only a power with no level takes its operation's access. The web's parser and the custom-connector editor use the same rule. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- `users:read` matched `/api/users.*` and `usergroups:read` matched `/api/usergroups.*`, which include writes (`users.setPresence`, `users.profile.set`, `usergroups.create`, `usergroups.update`). They now list their read methods. - Slack retired `files.upload` on 2025-11-12, so `slack upload` failed. It now calls `files.getUploadURLExternal`, sends the bytes to the returned `files.slack.com` URL, and shares the file with `files.completeUploadExternal`. The connector opens `files.slack.com` for that upload (`files:write`) and for downloading a file's `url_private` (`files:read`), and drops the `files.upload` operation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Four Linux-only tests still passed the old dedupe set, so the harness tests did not compile on Linux. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A long-running agent session that owned dependency upgrades hit five problems with integrations. Each one made the agent guess instead of act:
vulnerability_alerts. The request passed the proxy only through themetadata:readcatch-all, and GitHub refused it.vulnerability_alerts:readandvulnerability_alerts:write.metadata:readmatched every GET under a repository (GET /repos/*, where*crosses/).contents:read,issues:read,actions:read).CHANGELOG.md.403, or reset the stream withCANCEL, which curl reports as(92) Stream error in the HTTP/2 framing layer.slack historyprinted nothing.403and a JSON body:{"ok":false,"error":"egress_policy_denied","message":"<method> <path> …"}.RST_STREAM(NO_ERROR)(RFC 9113 §8.1).slack api chat.update text=…saved only the first line.message_start, merged with eachmessage_delta, emitted atmessage_stop. A turn that ends early emits what its streams reported.RunCostuses the router's catalog prices. The orchestrator passes them asENGRAM_MODEL_ROUTER_PRICING.While reading the minter, I also found that the
variables:readandvariables:writepowers minted the keyvariables. GitHub's key isactions_variables, so those grants never worked.Behaviour changes to note
output_tokensfrom theassistantlines, which repeat themessage_startvalue (about 1). It now reads the final count frommessage_delta. Token dashboards will show the jump. The new numbers are correct.RunCost. No cost is better than a wrong one.Review
An independent review of the first five commits found:
/;The later commits fix each of these.
Test plan
cargo nextestforengram-egress-proxy(203) andengram-git-github(14). This includes a new HTTP/2 test (denied request with a body: readable403+ JSON) and the rewritten HTTP/1 reject test (403, never a 2xx, body discarded).bun testconnectors + task-create (246),bun run typecheck.vitest(githubSetup),oxfmt --check,oxlint.python3 -m unittestfor integrations-cli. The newtest_cli_args.pyfails on the oldslackscript.cargo clippy -D warningson macOS for the proxy and the minter.engram-harness-claudeis Linux-only, and its tests and clippy did not run locally. CI's Linux lanes run them.🤖 Generated with Claude Code