Skip to content

Commit b535361

Browse files
committed
test: verify native login protocol against isolated TLS peers
1 parent 11e0344 commit b535361

10 files changed

Lines changed: 641 additions & 7 deletions

File tree

‎.github/workflows/native-client.yml‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ concurrency:
1616

1717
jobs:
1818
linux-client:
19-
name: Pinned Linux build and offline smoke
19+
name: Pinned Linux build and synthetic protocol
2020
runs-on: ubuntu-24.04
2121
timeout-minutes: 90
2222
env:
@@ -46,9 +46,11 @@ jobs:
4646
set -euo pipefail
4747
rustup toolchain install 1.95.0 --profile minimal --no-self-update
4848
sudo apt-get update -y
49-
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends build-essential pkg-config libcap-dev bubblewrap
49+
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends build-essential pkg-config libcap-dev bubblewrap strace openssl iproute2
5050
rustc +1.95.0 --version --verbose
5151
df -h "$RUNNER_TEMP"
52+
- name: Synthetic TLS namespace preflight
53+
run: bash tools/session_store/protocol_smoke.sh /usr/bin/true --preflight
5254
- name: Offline namespace preflight
5355
run: |
5456
set -euo pipefail
@@ -95,3 +97,5 @@ jobs:
9597
-- /usr/bin/setpriv --reuid=65534 --regid=65534 --clear-groups \
9698
--bounding-set=-all --inh-caps=-all --ambient-caps=-all --no-new-privs \
9799
/usr/bin/python3 /work/check.py "$host_net"
100+
- name: Synthetic TLS device-code and cancellation
101+
run: bash tools/session_store/protocol_smoke.sh "$RUNNER_TEMP/native-source/codex-rs/target/dev-small/codex"

‎AI_NOTES.md‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,26 @@
1+
# Synthetic Native Login Protocol - 2026-10-14
2+
3+
- Added a CI-only harness for the pinned actual stdio app-server, fresh private
4+
CA/local TLS peer and supported development issuer override. No real provider,
5+
installed binary/profile, phone, medical data, model or therapy path is used.
6+
- Six bounded cases cover initialize, pending device-code polling, wrong/correct/
7+
repeated cancellation, process termination, independent trust/name failures,
8+
server refusal and malformed response. Strict request/header, syscall, private
9+
file budget and namespace/process/listener teardown guards fail closed.
10+
- Nine initial guard tests failed before implementation; all44 tooling tests,
11+
Ruff E/F and shell syntax now pass locally. A no-client TLS/network preflight
12+
precedes compilation. Actual Linux protocol and exact-source Verify results
13+
remain pending; publication is not deployment or real authentication.
14+
115
# Pinned Native Build Validation - 2026-10-14
216

17+
- Completed the exact-source native workflow at11e03445:169 native library tests,
18+
full CLI build, strict offline version/private-scratch and provenance gates
19+
passed. The single ignored outer entrypoint is parent-invoked. All35 Python
20+
cases passed. Both push/PR Verify workflows passed backend/storage/Android.
21+
Observed ELF digest was fa9607f213e252d25f01d2df2aa8ff42f3ab68ed3a9d4b27073dd2c083a4fc0f.
22+
These results do not establish authenticated access or production readiness.
23+
324
- The corrected tmpfs run built the identical ELF digest again and successfully
425
executed the exact quiet native --version offline. The strict scratch gate
526
then refused the native temporary directory mode. Pinned tempfile3.27.0's Unix

‎docs/DEVOPS.md‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,14 @@ Isolation preflight executes no client. Native login library tests and the actua
1919
minimal-root, nonroot version smoke. A success is build/provenance evidence only,
2020
not authenticated model access or production containment. No binary artifact,
2121
release, deployment, keyring/profile mount or real login is part of this workflow.
22-
Actual contained TLS/header/device-code/cancel tests and explicit runtime-change
23-
admission remain separate gates. Keep existing runtime and owner profile intact.
22+
The same workflow now includes a separate synthetic native protocol harness;
23+
see tools/session_store/README.md. It uses only a disposable private CA/loopback
24+
peer, the development build's supported issuer override, six bounded negative/
25+
cancel/termination cases and an independent namespace teardown check. Exact-source
26+
execution is a gate, not inferred from unit tests. No real provider login,
27+
token exchange, inference or production profile is involved. Explicit runtime-
28+
change admission and actual production containment remain separate gates.
29+
Keep existing runtime and owner profile intact.
2430

2531
## Atomic Session Candidate
2632

‎docs/INVARIANTS.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
orphan promotion, guaranteed session continuity or power-cut claim.
1111
- Standalone helper/source checks do not attest a full installed client, active
1212
containment or authorization. No runtime replacement follows from passing CI.
13+
- Synthetic native protocol runs use only a fresh private CA/local peer and
14+
development issuer override. They cannot broaden the independent HEAD-only
15+
public transport profile or authorize real login/provider token exchange.
1316

1417
## Transport Probe Isolation
1518

‎docs/PLAN.md‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,24 @@
11
# PLAN
22

3+
## Synthetic Native Protocol (2026-10-14)
4+
5+
- Exact-source native component tests/full CLI/offline version/provenance and
6+
push/PR Verify passed at11e03445. The candidate remains undeployed.
7+
- Implemented six CI-only local TLS protocol cases plus no-client preflight,
8+
identity/route/body/syscall/private-state guards and independent namespace
9+
teardown. All44 local tooling cases, Ruff and shell syntax passed. Actual
10+
compiled-client protocol and exact-source publication/CI remain gates.
11+
- No real account login/token exchange, profile controller, production gateway,
12+
authenticated inference, device history/chat or phone/therapy change.
13+
314
## Atomic Session Storage Candidate (2026-10-14)
415

516
- Original Rust file operations reproduced destructive interruption. The narrow
617
tempfile/sync/replace candidate passed10 parent tests and9 verifier/fetch cases;
718
source compatibility verifies clean application and exact tested helper bytes.
819
Local format/Clippy/Python checks passed; an independent Linux CI gate is added.
9-
- This is not a full upstream/client binary build, deployment or authenticated
10-
runtime. Resolve provider-rotation gaps and bounded serialized orphan admission,
20+
- Subsequent native-build validation passed; this is not deployment or an
21+
authenticated runtime. Resolve provider-rotation gaps and bounded serialized orphan admission,
1122
obtain runtime-change approval and capture the actual isolated client before
1223
real owner login. No old auth, host keyring, phone or therapy change.
1324

‎docs/SECURITY_REVIEW.md‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
# SECURITY REVIEW
22

3+
## Synthetic Native Login Protocol (2026-10-14)
4+
5+
- CI-only peers use fresh private TLS material in an isolated loopback-only
6+
network/PID/mount context. Nonroot/no-capabilities/no-new-privileges and cleared
7+
native environment are checked before execution; no host profile is mounted.
8+
- Exact synthetic POST bodies/routes and neutral/absent identity headers are
9+
admitted. No OAuth exchange or successful authorization is simulated. TLS trust
10+
and certificate-name failures, server refusal and malformed replies must fail.
11+
- Actual client execution/connection trace, private bounded scratch, cancellation
12+
polling silence, process/listener teardown and post-exit kernel namespace
13+
references are checked. CI is not a production cgroup/seccomp/gateway proof;
14+
bounded files are not a full native filename allowlist. No medical data or
15+
provider credential can enter this harness. Real login remains separate.
16+
317
## Offline Session Candidate (2026-10-14)
418

519
- File persistence candidate only, with source-hash admission and fixed patch

‎tools/session_store/README.md‎

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
Source-level repair for the pinned upstream file backend. **Not deployed and not
44
an authenticated runtime.** No client launcher, account/token import or provider
5-
request is included. Keep the existing runtime and empty owner profile unchanged.
5+
request to a real provider is included. Keep the existing runtime and owner
6+
profile unchanged. The CI-only synthetic protocol harness below is separate.
67

78
The helper writes a private sibling temporary file, syncs its contents, atomically
89
persists it over the destination, then syncs the parent directory on Unix. Before
@@ -74,6 +75,45 @@ different path/link/type, nonempty lock or nonprivate alias group is refused.
7475
Only counts are reported. This does not test a real login, TLS headers, model
7576
access or cancellation, and no existing owner profile is mounted.
7677

78+
## Synthetic Native Protocol
79+
80+
After compilation/version validation, `protocol_smoke.sh` runs the actual CLI's
81+
stdio app-server against a newly generated private CA and local TLS peer. The
82+
native development build's supported login-issuer override selects only
83+
`https://login.example.test:8443`. The source, native protocol and storage patch
84+
are unchanged. This does not establish the release build's issuer selection,
85+
production gateway behavior or real provider compatibility.
86+
87+
An early no-client preflight checks the same namespace, peer/trust setup and
88+
teardown before expensive compilation. Only loopback is enabled inside a fresh
89+
network namespace, with a file-only name mapping and no host resolver/profile.
90+
Trusted setup holds network-administration privileges only until loopback is up;
91+
the checker, TLS peer and client run as UID/GID65534, no supplementary groups,
92+
all capabilities cleared and no-new-privileges. Read-only runtime/test inputs,
93+
a128MiB private tmpfs and time/CPU/address-space/process/file-size limits bound
94+
the run. Host /tmp, keyrings, auth, configuration and histories are not mounted.
95+
96+
Six scenarios cover initialize/device-code/pending polling, wrong-ID/correct-ID/
97+
repeat cancellation, process-group termination, untrusted CA, trusted CA with a
98+
wrong certificate name, provider403 and malformed user-code JSON. Only two exact
99+
POST routes and synthetic bodies are accepted; OAuth token exchange is not
100+
allowed. Initialization and effective HTTP identities must be neutral, or absent
101+
for the native raw-auth client. Credential headers are refused.
102+
103+
A bounded syscall trace admits only the mounted client execution and loopback
104+
peer connection attempts. Each scenario checks private owner/modes, bounded
105+
file counts/bytes and absence of auth.json. This is a bounded scratch inventory,
106+
not a complete native filename allowlist or proof against malicious client code.
107+
Polling must stop after cancellation; process groups/listener threads must exit.
108+
An independent host-side kernel namespace-reference check follows Bubblewrap's
109+
PID-namespace teardown. Only count/status receipts are printed. Generated peer
110+
keys are removed by the wrapper; no binary or test-state artifact is uploaded.
111+
112+
Actual native protocol results remain pending until the exact-source workflow
113+
finishes. Synthetic codes are not credentials, successful cancellation is not
114+
authenticated inference, and none of this authorizes a real owner login or
115+
server runtime replacement.
116+
77117
## Limits
78118

79119
- Tests execute the actual Rust helper on synthetic files, including controlled

0 commit comments

Comments
 (0)