Skip to content

chore(repo): Every package is at version 0.2.2 - #65

Merged
sodre merged 1 commit into
mainfrom
release/0.2.2
Nov 25, 2026
Merged

sodre merged 1 commit into
mainfrom
release/0.2.2

Conversation

@sodre

@sodre sodre commented Nov 25, 2026

Copy link
Copy Markdown
Member

Closes #64

Summary

Countersign 0.2.2 brings the Gateway's egress proxy (#55): an operator can send the Gateway's upstream connections through an HTTP CONNECT proxy, rule by rule. It also fixes a grant worker killed when glibc's malloc opened a file (#63). Neither changes an existing setup: egress_proxy is opt-in, and the fix needs no setting.

Every version source moves from 0.2.1 to 0.2.2, as in #45:

 Cargo.toml                       workspace version, and the `=` pins on countersign-pki and countersign-protocol
 Cargo.lock                       the five workspace crates only
 packages/widget/package.json
 packages/companion/package.json  the version publish_desktop.py checks against the tag
 recipe/recipe.yaml
-0.2.1
+0.2.2

It is a patch release, as 0.2.1 was for its features: every addition is opt-in. After the merge, the squash commit on main is tagged v0.2.2, which starts the registry, distribution and documentation workflows. All of v0.2.1's tag workflows passed, so no publisher needs setting up first.

Evidence

Criterion Ticked Shown by
Every version source is at 0.2.2 yes python3 scripts/registry_release.py check --tag v0.2.2
registry_release.py check passes and cargo metadata --locked accepts the lockfile yes python3 scripts/registry_release.py check --tag v0.2.2; cargo metadata --locked
The squash commit on main is tagged v0.2.2, and the tag's workflows pass no Not run: the tag follows the merge

On dae7a8c: python3 scripts/registry_release.py check --tag v0.2.2, exit 0; cargo metadata --locked --format-version 1, exit 0. pnpm-lock.yaml holds no workspace versions, so it does not change; CI's pnpm install --frozen-lockfile checks that.

Not run: the tag's workflows, which start when the tag is pushed after the merge.

Merge Danger

Door: two-way for the merge, which only changes version strings. The tag after it is one-way: crates.io and npm keep 0.2.2 once uploaded.

Blast Radius: every published package.

The merge ships nothing. The tag publishes the five crates, @zeroae/countersign-widget, the npm desktop packages, the desktop installers, and the countersign-gateway and countersign-broker images tagged v0.2.2.

Reviews

No review ran: the change is version strings only, as in #45

Tracking

Epic: none
Spec: none
Ticket: #64 Countersign 0.2.2 is released
Flag: none

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sodre
sodre merged commit 59f95a9 into main Nov 25, 2026
36 checks passed
sodre added a commit that referenced this pull request Nov 25, 2026
…rator's egress proxy is in git (#66)

Closes #49

## Summary

The text of the spec "Reach protected sites through an operator's egress
proxy" is in the repository at
`docs/specs/E2-49-reach-protected-sites-through-an-operator-s-egress-proxy.md`,
as the issue held it when the spec closed. Nothing changes for anyone
using the product.

```text
docs/specs/
└── E2-49-reach-protected-sites-through-an-operator-s-egress-proxy.md   # accepted, exported 2026-11-24
```

Before this closing, each of the spec's 53 user stories was mapped to
the test, static check or live run that proves it (the table under
Evidence). On `d5b15ba`, the squash of #55, seven stories (8, 11, 17,
21, 37, 38 and 42) held but were only partly tested: a Gateway broken on
purpose still passed every test. #61 added their cases, building #60, a
sub-issue of this spec that is now done. Story 52's Fargate step stays
out of scope, as the spec's Out of Scope says.

#61's body named "the pull request that closes #49", and GitHub read
that as a closing keyword: #49 closed when #61 merged. It was reopened
so that this pull request closes it, as `docs/agents/issue-tracker.md`
("Closing a spec") asks.

The verification also found #62: on x86-64, a grant worker was killed
when glibc's malloc opened a file, which failed #61's `curl` job. #63
fixed it, and both are in Countersign 0.2.2 (`v0.2.2`). #62 has no
milestone, so it never held this spec open.

## Evidence

| Criterion | Ticked | Shown by |
|---|---|---|
| Every sub-issue of #49 is closed | yes | `export-spec.py 49` |
| No issue but the spec is open in E2 | yes | `export-spec.py 49` |
| The spec has no release flag | yes | The spec's Further Notes:
"**Flag: none.**" |
| The file's text after its header is the issue's body | yes | The
comparison below |
| Every user story is proven by a test, a static check or a live run |
yes | The user-story table below |

No test or guard is new here: the seven cases #61 added were each shown
red there against a Gateway broken on purpose, and green against the
real one.

`python3 .claude/plugins/foresight/scripts/export-spec.py 49`, run on
59f95a9 after #61 and #65 merged: `wrote … as accepted: every sub-issue
is closed and only specs are open in E2 Reach protected sites through an
operator's egress proxy, so the pull request that adds this file closes
#49`. The sub-issues are #50, #51, #52, #53 and #60, all closed. The
text it wrote after the header is the same as the committed file's; only
its export day differed, so the committed file, exported 2026-11-24,
stands. A comparison of the file's text after its header with `gh issue
view 49 --json body`, CRLF read as LF: 20104 bytes in each, the same.

Not run: nothing.

<details>
<summary>The 53 user stories of #49: 39 Test, 12 Static, 10 Live run
(eight stories have two verdicts), 0 Partial, 0 Gap</summary>

Checked on `main` at 59f95a9, the squash of #65 (Countersign 0.2.2),
which holds #55's egress proxy and #61's cases for the stories marked
(#61).

- **The runtime test** is `crates/countersign-gateway/tests/runtime.py`.
Line numbers below are at 59f95a9. On 59f95a9, CI's *Sidecar mTLS* run
[45638935969](https://github.com/zeroae/countersign/actions/runs/45638935969)
passed it in all four jobs (`gateway-arm64`, `curl`, and
`gateway-filter-sandbox` on x86-64 and arm64). Each job printed
`sidecar/shared Gateway mTLS passed`, `sidecar/shared Gateway mTLS
through the egress proxy passed` and `sidecar/shared Gateway without a
usable egress proxy failed closed`, and `gateway-arm64` ran the silent
egress proxy's step under both worker sandboxes.
- **The Compose run** is the `compose_demo.py --squid --verify` output
posted on #52, from 5d76a8b with Squid 6.14. #55's body records a pass
on d84d66d too, but that run's output was not posted.
- **Documents:** a Static row whose proof is a document was checked by
reading that document on `main`. CI's `mkdocs build --strict` checks
only its links, not its words.

| # | Story (shortened) | Verdict | What proves it | Notes |
|---|---|---|---|---|
| 1 | Set `egress_proxy` once and every site goes through it | Test |
Proxied pass. `egress.take() == through_egress` (734). Every failing
rule's CONNECT is recorded by the test proxy (760–783). | One
`egress_proxy` line; every rule but `direct` goes through it. |
| 2 | Every destination uses the egress proxy by default | Test | Same
pass. The rules `site` and `refused` … `wrong` have no `egress` field
(516) and reach the proxy (734, 760–783). | |
| 3 | `"egress": "direct"` on one rule; one Gateway serves both routes |
Test | `res = request(user, to=direct)` returns the fingerprint, then
`assert egress.take() == [], 'A direct destination went through the
egress proxy'` (735–738). | #55's red run: route choice broken to always
use the proxy → 502. |
| 4 | No egress proxy: configuration and behaviour unchanged | Test |
Direct passes `sidecar/shared Gateway mTLS passed`. Their assertions are
unchanged from before #55; the diff only refactors the grant fixture.
The shared pass adds `"egress": "direct"` (535–538). | |
| 5 | The Gateway sends the site's name to the egress proxy | Test |
`assert egress.take() == [f'CONNECT {host} HTTP/1.1'] * len(users)`
(731–734), with `host = 'site.test:<port>'`. | |
| 6 | No resolution on a proxied route, for a network with no external
DNS | Test | `assert resolved.returncode == 2, ('The Gateway could
resolve the site itself', resolved)` (571–575) runs under the Gateway's
own NSS environment, and the proxied pass then succeeds. | Proves the
Gateway cannot resolve `site.test` and works anyway. It does not prove
the Gateway never tries a lookup, which the story does not need. |
| 7 | A private site through the proxy, with a rule that has no
`private_networks` | Test; Live run | Runtime: the `site` rule loses
`private_networks` (512) and the site is at the host's interface
address. Compose: the site is at 172.31.0.2 and the rule has no
`private_networks` (#52 run, `docs/develop.md`). | Whether the runtime
test's address is private depends on the host. The Compose run's address
always is. |
| 8 | A wildcard rule works through the egress proxy | Test (#61) | A
proxied rule `*.wild.test:<port>` without `private_networks`:
`reads_site(user, wild)` for each user, then `assert egress.take() ==
[f'CONNECT {wild} HTTP/1.1'] * len(users)` (740–742). | #61's red runs:
a wildcard rule refused on a proxied route at request time (403) and at
load (the Gateway exits). |
| 9 | Startup refused when a proxied rule has `private_networks` | Test
| `egress_configuration`: `error = refused('http://proxy.test:3128',
**base)` (438). `refuses()` asserts a non-zero exit and no stdout from
both `env` and `serve` (403–412). | #55's red run: `serve` started
(`TimeoutExpired`). |
| 10 | That error names the rule and both fixes | Test | `assert
re.search(r'\bsite\b', error) and 'private_networks' in error` and
`assert 'remove' in error and '"egress": "direct"' in error` (439–440).
| |
| 11 | Adding `egress_proxy`: every undecided private rule stops startup
| Test (#61) | `egress_configuration`: `[rule, second]`, the private
rule second. `refuses()` from `env` and `serve`, then `assert
re.search(r'\bsecond\b', error) and 'private_networks' in error`
(441–446). | #61's red run: the check limited to the first rule let
`serve` start. |
| 12 | An `https` egress proxy URL refused at startup | Test | `error =
refused('https://proxy.test:3128')`, then `assert 'egress_proxy' in
error and 'https' in error` (418–419). | |
| 13 | An egress proxy URL with credentials refused at startup | Test |
`assert 'egress_proxy' in error and 'credentials' in error and 'secret'
not in error` for `user:secret@` and `user@` (420–422). | The error also
does not echo the secret. |
| 14 | An unknown `egress` value fails loading | Test | `refused(...,
egress=value)` for `'proxy', 'default', 'Direct', 'none', '', None,
True, ['direct']`, with and without an egress proxy (447–449). | |
| 15 | `env` refuses what `serve` refuses | Test | `refuses()`: `assert
results[0].stderr == results[1].stderr` across `env` and `serve` (409).
Every refusal above goes through it, and so does the
wildcard-with-`private_networks` rule (430–433). | |
| 16 | Startup logs which destinations leave address policy to the proxy
| Test | `wait_for_log(rf'Gateway egress proxy localhost:<port> carries
the address policy of destinations: ' + ', '.join(['site', *failing,
'wild', 'ungranted']))`, a full match that leaves out `direct`
(620–622). | |
| 17 | The egress proxy's name resolved on every connection | Test (#61)
| `egress_proxy` is `http://proxy.test:<port>`, resolved only through
the Gateway's hosts file. The name moves to a second egress proxy on
127.0.0.2: `assert moved.take() == [f'CONNECT {host} HTTP/1.1'], 'The
Gateway did not follow the egress proxy'`. Moved back: `'The Gateway did
not follow the egress proxy back'` (748–758). | #61's red run: resolving
once and caching fails at `The Gateway did not follow the egress proxy`.
|
| 18 | The egress proxy allowed on a private address | Test; Live run |
The test proxy listens on 127.0.0.1, the address the Gateway's hosts
file gives `proxy.test`, inside the special-use blocks, and is reached
with no `private_networks` (511, 549). In Compose, Squid is on the
private backend network, where Squid logs the Gateway as 192.168.32.5. |
|
| 19 | `denied_networks` still applied to the proxy's address | Test |
Unusable pass with `denied_networks: ['127.0.0.0/8', '::1/128']` (930):
`proxy_unavailable`, then `assert not egress.accepted_since(seen), 'The
egress proxy saw a connection'` (682–685). | #55's red run: with the
filter removed, the egress proxy saw a connection. |
| 20 | A refusal by the proxy reported as `proxy_denied` | Test; Live
run | `fails_through_egress(failing['refused'], 'proxy_denied')` asserts
`headers.get('countersign-error') == error` (656, 760). In Compose:
`TCP_DENIED/403` → `proxy_denied`. | |
| 21 | An unreachable or silent proxy reported as `proxy_unavailable` |
Test (#61) | Unreachable: unusable pass. Closed, not HTTP, kept open:
`closed`, `garbled`, `banner`, `stub`. Silent: `runtime.py
--silent-egress-proxy`, `fails_through_egress(failing['silent'],
'proxy_unavailable', timeout=130)` (675–680). It runs in `e2e.yml`'s
`gateway-arm64` step "Fail a CONNECT through a silent egress proxy at
the Gateway's deadline", under both worker sandboxes. | Takes the
120-second deadline. #61's red run: with the deadline mapped to
`upstream_failure`, the case fails. |
| 22 | The proxy's "cannot reach the site" (5xx) reported as
`upstream_failure` | Test; Live run |
`fails_through_egress(failing['unreachable'], 'upstream_failure')`
(773). In Compose, Squid's `TCP_TUNNEL/503` with the site stopped →
`upstream_failure`. | |
| 23 | Each failure carries `Countersign-Request-ID` | Test |
`fails_through_egress`: `assert request_id, (to, answer)`, then
`wait_for_log(rf'Gateway CONNECT {request_id} {error}')` (657–661). The
Compose run matches each ID to the Gateway's log line. | |
| 24 | The operator guide says how to set the egress proxy | Static |
`docs/operate.md`, "Reach sites through an egress proxy": the example
configuration and its fields. | |
| 25 | The guide says where resolution and address policy happen on each
route | Static | The same section's table, with rows "Who resolves the
site's name" and "Who checks the site's addresses". | |
| 26 | Example Squid ACLs, blocking metadata, link-local and loopback |
Static | The same section's `squid` block: `to_metadata`,
`to_link_local`, `to_loopback`, each denied before any allow. | `squid
-k parse` on these rules was a one-off run in #55's review, recorded in
its body. The demo's `squid.conf` has the same rules, so the Compose run
exercises them. |
| 27 | The guide shows how to pin a private site to its prefixes |
Static | The same block: `billing_prefixes` and `billing_outside`, with
`http_access deny billing billing_outside`, and the paragraph on how
`dst` matches. | The test with mixed answers was a one-off run in #55's
review on Squid 6.14. |
| 28 | The configuration reference describes `egress_proxy` and `egress`
| Static | `docs/reference/config.md`: the `egress_proxy` row (Gateway
fields) and the `egress` row (destination fields). | |
| 29 | The troubleshooting table covers the two new error values |
Static | `docs/operate.md`, troubleshooting row "CONNECT returns 502":
`proxy_denied`, `proxy_unavailable`, and `upstream_failure` on a proxied
route. | |
| 30 | The egress proxy works in shared mode as in a sidecar | Test |
`for shared in (False,True)` runs the proxied and unusable passes in
both modes (922–931). CI prints `shared Gateway mTLS through the egress
proxy passed`. | |
| 31 | Workload client configuration unchanged on both routes | Test |
One `request()` (same `--proxy`, `--proxy-cacert`, `--cacert`) reads
`site.test` (proxied) and `direct.test` (direct) in one pass (623–628,
725–738). | |
| 32 | A proxied failure ends with a status and an error value, never a
hang, once the proxy has answered | Test | `banner`, `stub` and `lf`
answer and keep the connection open. Each must give its 502 inside
`connect`'s 8-second socket timeout (768–771). | #55's red run: against
the old read loop, each one timed out. |
| 33 | The proxy's own error page kept from the job | Test | `assert
body == b'' and b'egress proxy' not in answer` (660), on every negative
case. The test proxy sends `ERROR_PAGE` with each 403 and 503 (250–251,
289, 303). | |
| 34 | Prompt, grant and cutoff work the same on a proxied route | Test;
Live run | Grant: the site returns the approved certificate's
fingerprint (727–730). Cutoff: the lease cutoff runs in the proxied pass
(805–827). Prompt: in the Compose run, the Companion approval reaches
the site through Squid. | The runtime test's grant authority stands in
for the prompt, so only the Compose run covers the prompt itself. |
| 35 | Revoking a grant cuts a proxied connection as a direct one | Test
| Shared proxied pass: `broker.retired['bob'].set()`, then `assert
site.cutoff.wait(1)` (831–840), before the proxied pass returns
(841–843). | |
| 36 | Never a fallback from the egress proxy to a direct connection |
Test | `assert not site.accepted_since(seen), (to, 'The site saw a
connection', answer)` in every `fails_through_egress` case (651). The
unusable pass gives the Gateway a working direct route and checks that
it went unused (549–550, 573). | #55's red run: a direct fallback added
on purpose was caught. A silent proxy is story 21's case, which #61
added. |
| 37 | Site certificate checked against the hostname and the rule's
roots before any signature | Test (#61) | `for name in ('wrong',
'untrusted')`: the request fails, `egress.take()` records the allowed
tunnel, and `assert failing[name] not in broker.signatures` (778–782).
`untrusted`'s `roots` is another CA. | #61's red run: with trust loaded
from another rule's roots, the request succeeded. |
| 38 | A site still needs its destination rule at the Gateway and the
Broker | Test (#61) | `refused_before_egress(unlisted)` (a grant, no
rule) and `refused_before_egress(ungranted)` (a rule, no grant). Each
asserts `HTTP/1.1 403`, then `'The egress proxy saw a connection'` and
`'The site saw a connection'` are both false (667–673, 745–747). | #61's
red runs: the rule check bypassed gives 200; a tunnel opened on a
refused admission is seen by the egress proxy. |
| 39 | The egress proxy carries only encrypted bytes | Test; Live run |
The test proxy pumps raw bytes to a TLS site that requires a client
certificate (`site_tls.verify_mode=ssl.CERT_REQUIRED`), and the grant
authority asserts `body['tls'] == 'tls13'` on each signature (218). A
clear-text byte after the CONNECT head would break that handshake. In
Compose: Squid has no `ssl-bump`, logs `TCP_TUNNEL/200`, and the site
saw the approved fingerprint. | |
| 40 | Grant worker and worker sandbox unchanged | Static; Test | #55's
diff touches no file under `runtime/worker.rs` or `worker_sandbox.rs`.
The proxied leg is in the supervisor (`egress::tunnel` from
`connect_request`). The proxied passes run under both sandboxes in CI
(`gateway-filter-sandbox`). | #63 later changed `worker_sandbox.rs` for
a glibc malloc read (#62), which the egress proxy did not cause: the
same kill could come on a direct route. |
| 41 | ADR 0003 says which checks move to the proxy and which stay |
Static | `docs/adr/0003-…md`, `status: accepted`. Decisions 3 (move), 4
(stay) and 6 (the proxy's own address). | |
| 42 | The Gateway ignores proxy environment variables on this leg |
Test (#61) | `ignored` pass, as before. In the proxied passes, the six
variables name a dead address beside `egress_proxy` (563–569), and every
proxied request still succeeds. | #61's red run: `egress::tunnel`
preferring `HTTPS_PROXY` fails the first proxied request with 502. |
| 43 | The design record's resolution paragraph names both routes |
Static | `docs/specs/2026-11-17-countersign-design.md`: "A destination
takes one of two routes. On a direct route … On a route through the
operator's egress proxy (ADR 0003) …". | |
| 44 | The runtime test sends a request through a test-only CONNECT
proxy on every pull request | Static | `.github/workflows/e2e.yml` (`on:
[push, pull_request]`), step `timeout 120 python
crates/countersign-gateway/tests/runtime.py …` and
`scripts/filter-sandbox-container.sh`. The proxied passes always run
(`main`, 922–931). | |
| 45 | That test proves the site saw nothing when the proxy refused or
was unreachable | Test | As story 36: line 651 for `refused`, `closed`,
`garbled`, `banner`, `stub`, `lf` and `unreachable`, and both unusable
passes. | |
| 46 | That test proves the proxy got the site's name, not an address |
Test | As stories 5 and 6 (575, 734). | |
| 47 | That test runs one Gateway with a proxied and a direct
destination | Test | As story 3 (735–738). | |
| 48 | That test rejects a wrong-hostname certificate through an allowed
tunnel | Test | `wrong` (778–782). `assert egress.take() == [f'CONNECT
{failing["wrong"]} HTTP/1.1'], 'The egress proxy refused the tunnel'`
proves that the tunnel was allowed. | #55's red run: with the site
certified for `wrong.test`, a signature was made. |
| 49 | A Compose variant with a real Squid to run before a release |
Live run | `compose_demo.py --squid --verify`, the run posted on #52
(5d76a8b, Squid 6.14, exit 0). `docs/develop.md`, "Qualify the Gateway
against a real Squid". | |
| 50 | That variant correlates Squid's log, the site's certificate and
the Workload's read from one run | Live run | #52 run: `Squid tunneled
the Workload's CONNECT: … TCP_TUNNEL/200 … CONNECT site.test:9444 …
HIER_DIRECT/172.31.0.2`, `Compose mTLS accepted selected SHA-256
5d01b2…` and `Job page matched the fingerprint the site received with
the approval`. The checks are `Squid.logged` and `verify` in
`compose_demo.py`. | The posted run is on 5d76a8b. Between it and
d84d66d, `compose_demo.py` did not change on the default path. |
| 51 | The glossary defines egress proxy | Static | `GLOSSARY.md`:
**Egress proxy**, _Avoid_: upstream proxy, outbound proxy, Squid. |
Landed with #53. |
| 52 | #46's reporter has a documented, passing Compose configuration |
Live run | The #52 run, plus `docs/develop.md` and
`examples/demo-integrator/{compose.squid.yaml,squid.conf}`. | Repeating
it on Fargate is out of scope: "Repeating the run on Fargate 1.4.0 with
the filter sandbox. The reporter does that from the documented Compose
configuration; Countersign's part ends at Compose for now." #52's live
step (a comment on #46) is a separate matter. |
| 53 | The demo walkthrough is unchanged unless the Squid variant is
asked for | Static; Live run | `examples/demo-integrator/compose.yaml`
is unchanged by #55, and `--squid` is an opt-in `store_true` flag. #55's
body: the default `--verify` passed on 17525c6, and the default `docker
compose config` was identical before and after. | After 17525c6,
`compose_demo.py` changed only inside `Squid.configure`. |

**Summary:** 53 stories, each proved: by test, statically, by the live
run, or by a mix of these. No story is excluded whole. Only story 52's
Fargate step is out of scope. Stories 8, 11, 17, 21, 37, 38 and 42 were
Partial or Gaps on d5b15ba, the squash of #55; #61 added their cases,
each red once against a Gateway broken on purpose.

</details>

## Merge Danger

**Door:** two-way. A revert removes the file, and #49 is reopened by
hand.

**Blast Radius:** none.

The merge ships no image, release or infrastructure, and no flag. The
handbook excludes `docs/specs/` (`mkdocs.yml`, `exclude_docs`).

## Reviews

<details>
<summary>No review ran: the file is the issue's text, checked byte for
byte</summary>

</details>

## Tracking

Epic: E2 Reach protected sites through an operator's egress proxy
Spec: #49 Reach protected sites through an operator's egress proxy
Ticket: none
Flag: none

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Countersign 0.2.2 is released

1 participant