Repository navigation
Security review: close all eighteen findings - #171
Merged
Merged
Conversation
- targets: refuse a host that is not an IP literal or ASCII LDH, or that
urllib would dial differently; refuse a name that does not resolve;
credentialed openers ignore environment proxies
- core: source URLs keep {key} in the path; action URLs take no query;
manual attestations of keys the contract reads from another source are
refused (attestation_denied)
- server: observer-only roles cannot read cases, contracts, certificates
or metrics; an empty bind host is refused; users.json is re-read on change
- backup: export writes through temp files and refuses links
- storage: migration 0006 widens amount_units to BIGINT on PostgreSQL
- publish: timeouts end the whole process tree
- compose: loopback publish, no default database password
Regression tests in tests/test_security_review.py.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…older Windows refuses to delete an open SQLite file, and the cleanups ran after the temporary directory had already been removed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…8 edges - targets: refuse IANA special-purpose ranges explicitly (F6); pin HTTPS connections to the addresses the check accepted, name kept for SNI and Host (F11); header_value_ok for header values - core: refuse a version_arg that cannot be a header before the claim, and any unsafe header before a request (F14); a different result key is not a change unless the confirmation re-reads the trigger or the result's version moved (F15); compare-and-swap an expired lease to 'recovering' and keep a stored outcome when settling it (F16); acceptance fact keys are protected from manual attestation - evidence: a fact clause reads the newest observation and honors verified and source (F17) - server: frame-ancestors 'none' and X-Frame-Options on the console (F18); observer-only credentials read no builder view (F8) - planner: a planner URL takes no query string (F3) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sykosyber
marked this pull request as ready for review
November 4, 2026 00:21
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
sykosyber
pushed a commit
that referenced
this pull request
Nov 4, 2026
…observer-only credentials off /api/certificates Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sykosyber
pushed a commit
that referenced
this pull request
Nov 4, 2026
…e, and the four probes #171 fixed are regression tests now 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.
Class: R
Agent-platform: claude
Admitted-by: none yet (draft; Mateo's review)
Before: six trust decisions in SyberWork could be steered from outside their boundary. A percent-escaped host passed the HTTPS guard and was dialed as loopback; a source URL could put the case input in its host; an action URL could store a secret in its query; an
observertoken could stall a case and read every case;syberwork backupwrote through a plantedmanifest.jsonlink; an environment proxy received credentialed requests. Five smaller defects (int4 reservations on PostgreSQL, publish timeouts that leave children running, Compose on all interfaces with a literal password, an empty bind address,users.jsonread once) sat beside them.After: each of those is refused or closed, and so are the review's seven remaining items (F6, F11, F14 to F18), with a regression test per finding in
tests/test_security_review.py. The golden traces and the wire are unchanged.Review ids are in brackets. The six high findings and the traced follow-ups were reproduced on
mainatf953b95before they were changed (a throwaway script against the package; the int4 abort against a live local PostgreSQL 16). Of the remaining items, F6 was reproduced onmain; F11 and F14 to F18 were confirmed by reading the code path the review names.The six high findings
1. Host check and dial target disagree [F1]
guard_request("https://%31%32%37.0.0.1/x")returned (the name failed DNS, which the guard allowed) whileurllib.request.Request(...).host == "127.0.0.1".syberlabs/targets.py):trusted_originaccepts only an IP literal or plain ASCII LDH labels (IDNA asxn--), and requires the hosturllib.request.Requestwould dial to equal the host it classified.guard_requestnow refuses a name it cannot resolve (or that resolves to nothing). It raisesurllib.error.URLError, so every caller keeps its existing unreachable code (planner_unavailable,source_unavailable/destination_unreachable,status_unavailable,metric_unavailable,PollFailed).refresh_fact,reconcile, the planner,settleandoutcomewere adjusted so that code is what they report and no request is made.HostCheckMatchesDialTarget(encoded loopback, encoded metadata IP, non-LDH and non-ASCII hosts refused without a lookup; DNS failure refused; an unresolvable source issource_unavailablewith no request).tests/test_witness.pypreviously asserted that a DNS failure was allowed; it now asserts the refusal.2. A source URL may put
{key}in the host [F2]install_source("s", {"url": "https://{key}.example.com/r", "auth_env": "T"})was stored.Work.install_source): exactly one{key}, in the path, no other braces, no query (the rulestatus_urlalready had). Finding 1's host rule refuses a braced host on its own too.SourceKeyStaysInThePath.3. A query string is stored as part of the action [F3]
registry("actions")returnedhttps://orders.example/po?api_key=s3cret.Work.install_action): the write URL takes no query and no template;status_urltakes no query.SYBERWORK_PLANNER_URLwith a query is nowplanner_unconfigured(tests/test_console.pyupdated). Publish and outcome URLs already refused one.trusted_originitself still accepts a query, because publish and settle build GitHub API reads with?per_page=at request time.ActionUrlCarriesNoQuery.4. An observer token can stall a case and read all of them [F7, F8]
part_numberfrom inventory, a supplier attestation ofpart_number(whatPOST /api/cases/{id}/factsdoes) made admission deny withuntrusted_fact_source:part_number.Work.attest, used by the facts route): a manual, unverified attestation of a key the case's contract relies on (a required fact, an argument binding such asfact:quote.id, or a resolution's evidence) is refused withattestation_denied, unless a required fact names that same source and does not ask for verification. Keys the contract never reads are still recorded unverified, as before (the existingHostileSchematest keeps passing). Admission itself is unchanged.syberwork/server.py):/api/cases*,/api/contracts*,/api/certificatesand/metrics/*need a role beyondobserver(403forbidden);GET /api/builder/*too (409forbidden, the builder's existing status for its writes)./api/me,/api/consoleand the sources role listing are unchanged.ObserverCannotStallOrRead.supplierandinventorycredentialsinitprints) can no longer open cases in the console; it still attests throughPOST /api/cases/{id}/factsgiven a case id, and still sees the Studio's source read roles. Fourtests/test_console.pychecks that let the supplier read cases now expect 403, andtests/console_browser.mjsattests as the supplier through the API (expectingquoteto be refused andsupplier_noteandattest_receiptto be recorded) and has the operator inspect the result. That browser script was not run here (no Playwright browser in this container), so CI's browser job is its first run.SYBERWORK_METRIC_TOKEN, docs/DEPLOY.md) must now be a credential with a role other thanobserver, for example the operator credentialinitprints.5. Backup export follows a symlink [F4]
snap/manifest.json -> victim,export_celloverwrotevictimwith the manifest.syberwork/backup.py): every snapshot file is written to a fresh temporary file in the same directory and moved over its name; a link or non-regular file at a name is refused withbackup_refused. Snapshot files are now created mode 0600.BackupDoesNotFollowLinks(POSIX; symlink creation needs a privilege on Windows).6. A proxy in the environment is baked in at import [F5]
syberwork.core.HTTPcarried aProxyHandlerbuilt fromhttp_proxy/https_proxyat import.targets.credentialed_openerbuilds the opener with an emptyProxyHandler;syberwork.core,syberlabs.publish(also used bysettleandoutcome) andsyberlabs.planneruse it. The GitHits client is unchanged (it already bypasses proxies for loopback and talks only to its public API).NoEnvironmentProxy(no proxy handler on any credentialed opener; a request made withhttp_proxyset never reaches the proxy).Traced follow-ups
amount_unitsint4 on PostgreSQL [F9]: migration0006alterseconomic_reservations.amount_unitstoBIGINTon PostgreSQL; SQLite's INTEGER is already 64-bit. Migrations may now be dialect-keyed. Tested live against PostgreSQL 16 (ReservationAmountsAre64Bit, 2^62+7 stored and summed); main aborted withNumericValueOutOfRange.tests/test_cell.pyexpects0006.publish.Command._runnow ends the command withchecks._stop(the process group on POSIX,taskkill /Ton Windows). Test:PublishTimeoutEndsTheTree(a grandchild's heartbeat stops).127.0.0.1:8766:8766; no default database password (SYBERWORK_DB_PASSWORDis required,scripts/compose_cell.shgenerates one for the CI boot).SYBERWORK_BIND: 0.0.0.0stays inside the container so Docker can forward. docs/DEPLOY.md updated, including that an existingsyberwork-dbvolume keeps the password it was created with.SYBERWORK_BIND[F12]:make_serverrefuses an empty host (main bound0.0.0.0), andsyberwork servetreats an empty variable as unset (127.0.0.1). Test:BindAndUsers.test_an_empty_host_never_binds.users.jsonread once [F13]:servepasses aUserFilethat re-reads the file when its mtime, size or inode changes; a missing or malformed file authenticates no file user (cell principals in the database still do). Test:BindAndUsers.test_users_json_changes_apply_without_a_restart.The review's remaining items
_public_ipnow refuses the IANA special-purpose ranges explicitly (192.0.0.0/24 including the PCP and TURN anycast addresses, 2001::/23, fec0::/10, 6to4, documentation and benchmarking ranges, and so on) and checks the IPv4 address inside a NAT64 address, instead of trustingis_global. Reproduced on main:192.0.0.9,2001:1::1andfec0::1were public. Test:SpecialPurposeAddressesAreNotPublic.connect, refuses the lot if any address is not public, and dials only those addresses; the name still drives SNI, certificate checks and Host.guard_requeststays as the early check that gives callers their codes. Test:ConnectionIsPinnedToTheCheckedAddress(the dial goes to the accepted address; a name that rebinds to loopback after the guard is never dialed).commitrefuses aversion_argvalue that is not a safe header value (invalid_argument) before the claim, so no effect starts;_executerefuses any header with a line break, control character or edge whitespace (invalid_header) before a request. Test:HeaderValuesAreChecked.pending/source_decision_unverified. No schema change. Test:ResolutionNeedsAChangedVersion. Behavior change to check: a contract with a different result key and no such confirmation now needs the result observed before the task is requested.lease_obligationcompare-and-swaps an expired lease to a newrecoveringstate with its own lease, so one worker recovers it and a worker that dies while recovering hands it on;settle_interruptedreturns the stored outcome (unknownstaysunknown, the budget stays held).queue_depthcountsrecovering. Test:InterruptedEffectsKeepTheirOutcome.verifiedandsourcewhen the clause names them. Its key is also protected from manual attestation, like the other keys a contract reads. No shipped contract uses the clause. Test:FactAcceptanceReadsTheNewestObservation.frame-ancestors 'none'andX-Frame-Options: DENY. Test:ConsoleCannotBeFramed.Not fixed here, and why
GitPush.applystill runsgit pushundersubprocess.run(timeout=...), which endsgitbut not a child such asssh. Same class as the publish fix; left for a small follow-up.Evidence (claim ceiling: Implemented and Tested)
Run on this branch in a Linux container, CPython 3.13.18, with
hypothesisandpsycopg[binary]3.3.7, and a local PostgreSQL 16 (SYBERWORK_POSTGRES_URLset):PYTHONPATH=. python3 scripts/run_shards.py: 1253 tests, 4 failures, 5 expected failuresPYTHONPATH=. python3 -m conformance.run: matched 23 golden tracesmainin this container: two Playwright browser tests (no browser installed) and two hidden-check staging tests. They are environmental and unrelated to this change.docker compose configresolves with the variable set and refuses without it), Windows, CPython 3.11/3.12. CI covers those.Coordination
No file overlap with #154, #164 or #163 (they touch
syberlabs/cli.pyandsyberlabs/factory/; none touchesjev_api). #170 does not touch these files either. Nothing here is deployed; merging and deploying are Mateo's call.Generated by Claude Code