Skip to content

Release 1 follow-on B: the declarations store fails closed, the declared broker's ceiling, and the trust line under a host (plan 034) - #87

Merged
brettheap merged 4 commits into
mainfrom
build/034-r1-followon-b
Oct 5, 2026
Merged

brettheap merged 4 commits into
mainfrom
build/034-r1-followon-b

Conversation

@brettheap

@brettheap brettheap commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Lane: openxfactory-4 (openXfactory-4-openDox_extraction)
Authored by lane openXfactory-3, delegated by lane openxfactory-4 (#656 6000630835)

Release 1's follow-on slice B, plan 034: the declarations side and the CLI trust line. Brett Heap's word after release 1 was "openDox-code follow-ons first (Recommended)" (openxFactory#656 comment 6000582654). Lane openxfactory-4 delegated this slice to lane openXfactory-3 in its follow-ons brief. The claim is openxFactory#656 comment 6000630835. Like openDox-code#86, this is a realization follow-on of #1144's 16.3a, so it carries the arc's trailer. Slice A, run by lane openxfactory-4's own writer, owns doxbench_binding.py and doxbench_trust.py. This PR edits neither; it imports MAX_JUDGED_MEMBERS from the first.

Release note. This lands on openDox-code main after 0.1.0. It reaches users only in a later release, which needs Brett's publish word, so release 1's pins do not move.

Sources and rulings:

  • F1: Copilot r4184739661 on openxFactory#1236, rated High. At T094's landing the holder recorded it as a release-1 accepted limit (READY 5996119122) and left it for this follow-on.
  • D5: openDox-code#86's deferred r4182645796 (the holder's ruling 5992038800, "Deferred to a follow-on").
  • F2: lane openxfactory-4's pre-review of openxFactory#1236. That PR's body lists it among its accepted limits and leaves it for an openDox-code follow-on.
  • Copilot and SonarCloud on this PR: each finding is classed fix-now or accepted limit under the convergence rule, openxFactory#656 comment 5988818366.

Each finding, its fix and its tests

"Red" means the case fails at 389e5a4a (main), run against main's own source. The pins and controls pass there too.

# Fix Tests
F1 DeclarationStore._open replaces the store's document_present look. Only "no such file", or a file where a directory belongs on the way, is absence. Anything else in the document's place is refused by name, as IntakeRefused, in the refusal an unreadable document gets (doxbench_binding.cannot_read), naming what the path is: the declarations document at "<path>" cannot be read (a directory, not a regular file). The same goes for a FIFO, a socket, a symbolic link, or a character or block device. The look is os.lstat, so a FIFO is refused without being opened. The open is O_RDONLY | O_NONBLOCK | O_NOFOLLOW | O_CLOEXEC, and os.fstat on the descriptor decides, so whatever replaced the file after the look is refused for what it is, and nothing is ever read from it or waited on. The bytes are read through that descriptor and parsed in read_settings_document's words (_parsed). A document that vanishes between the look and the open is refused, as main refused one that vanished between its look and its read. A platform without O_NOFOLLOW or O_NONBLOCK opens no document (Copilot r4187659916, below). doxbench_binding.document_present is unchanged. tests/test_doxbench_intake_store_kinds.py. Red: test_F1_a_non_regular_path_is_refused_by_every_read (15: pending_binding_ids, get, list, broker and read_back, each over a directory, a FIFO and a socket); test_F1_the_governed_hosts_policy_admits_nothing_over_it (3, with a stand-in of openxFactory's GovernedBindingTrust as T094 landed it at 36908480, asked through verdict_for and intake_verdict_for); test_F1_no_write_lands_over_it (6: propose and declare_broker × 3); test_F1_a_fifo_in_the_documents_place_is_never_opened; test_F1_a_link_that_appears_after_the_link_rule_looked_is_never_read[dangling, a-file-outside]; test_F1_a_file_replaced_after_the_look_is_judged_by_its_descriptor[directory, fifo]; test_F1_a_file_replaced_by_a_link_after_the_look_is_never_read_through; test_F1_a_document_removed_after_the_look_is_not_read_as_none; test_F1_a_platform_without_the_opens_guards_opens_no_document[no-nofollow, no-nonblock, neither]. Pins and controls: test_F1_a_link_in_the_documents_place_is_unreadable_not_absent[dangling, a-directory, a-fifo] (#86's N1 already refuses these); test_F1_no_document_is_still_no_document; test_F1_a_look_that_fails_is_never_absence; test_F1_a_regular_document_still_reads; test_F1_the_port_factorys_pending_set_still_reads_a_refusal_as_empty (3); test_F1_the_declarations_parse_refuses_in_the_bindings_stores_words (4).
D5 BrokerDeclaration refuses more members than doxbench_binding.MAX_JUDGED_MEMBERS (256), which it reads from that module when a broker is declared and never restates. The refusal reads a broker declaration declares 257 broker command members, more than the 256 judged in one document; name the broker program and its fixed leading arguments only. It is held at construction, so from_record (every read of the store) and declare_broker (the write) both refuse, and no write can cross it. So the shape of the bindings store's r4182645752 (slice A's) cannot arise here. The console intake's surface reads the broker through read_back and offers nothing over a refused document, so broker_command_refused never scans more than 256 declared members. tests/test_doxbench_intake_broker_ceiling.py. Red: test_D5_a_broker_past_the_ceiling_is_refused_by_name (ceiling + 1); test_D5_the_ceiling_is_imported_never_restated (with the ceiling patched to 3: 3 read, 4 refused); test_D5_a_document_whose_broker_passes_the_ceiling_is_refused[broker, get, pending_binding_ids, read_back]; test_D5_no_write_crosses_the_ceiling. Control: test_D5_a_broker_at_the_ceiling_is_read (exactly 256).
F2 _trusted_line(binding, recording) takes the TrustRecording. Where the policy recorded nothing (recorded is false: a host's policy whose record() answers nothing, as openxFactory's governed one does), the line is trusted "<id>" by the host's trust policy for "<root>" (TRUSTED_BY_THE_HOSTS_POLICY). Where a record was written, it is byte for byte trusted "<id>" on this machine for "<root>". add, edit, set-credential and trust each pass their own recording. tests/test_cli_model_binding_trusted_line.py. Red: test_F2_a_host_that_recorded_nothing_is_named_as_what_trusts_it[add, edit, set-credential, trust] (the exact line, no "on this machine", and nothing written to the state directory). Byte-identity pins, exact-string: test_F2_a_record_written_on_this_machine_keeps_its_exact_line[add, edit, set-credential, trust].

F1's dangling link: unreadable, not absent

The brief asked whether a dangling symbolic link at the declarations path counts as absent or unreadable. This PR reads it as unreadable, which fails closed, for three reasons.

  1. F1's purpose. A path that exists (lstat succeeds) but names nothing that can be read is not "no document". Read as absent, it declares nothing pending, and the governed host trusts every binding: the hole F1 closes.
  2. It is already the store's rule for a link a clone carries. The link rule (T100 follow-on: the trust store's review findings (plan 034) #86's N1) refuses a link at the document's name, or at ideation/ or ideation/dashboard/, before anything is read, whatever the link names, a missing target included. test_F1_a_link_in_the_documents_place_is_unreadable_not_absent[dangling] pins that, and it passes at main too.
  3. The read path now judges a link as itself, so the decision does not rest on N1's look alone. A dangling link that appears after that look is refused as a symbolic link, not a regular file. That is test_F1_a_link_that_appears_after_the_link_rule_looked_is_never_read[dangling], red at main, where the link read as no document and the binding was trusted.

No concrete reason for the other reading was found: a dangling link is no more an operator's "nothing declared" than a directory is.

Behavior changes an operator sees

  • A directory, a FIFO, a socket or a device at the declarations path is refused by name: the declarations document at "<path>" cannot be read (a directory, not a regular file). So is a link that appears there after the link rule looked. Under openxFactory's governed host, every binding then reads untrusted with that reason ("its declarations document cannot be read (…)"), until the path holds the document again or nothing.
  • The console intake's surface is not offered over such a path, as before. Its writes (propose, declare_broker) are refused by name. At main, a directory there raised a raw IsADirectoryError from the write, a socket a raw OSError, and a FIFO hung the write, which opens the path for append and waits for a reader.
  • doxbench_intake.pending_binding_ids, the port factory's own question, which passes over pending bindings, still reads any refusal as nothing pending, for the reason its docstring gives, so a hosted console is not taken down.
  • A declared broker of more than 256 members is refused by name, both when it is read and when it is declared.
  • Under a host whose policy records nothing, add, edit, set-credential and trust end with trusted "<id>" by the host's trust policy for "<root>". Standalone, the line is unchanged.
  • On a platform without O_NOFOLLOW or O_NONBLOCK, a declarations document that is there is refused by name. No CI runner and no deployment is such a platform.

Evidence

  • Full suite, locally, at the final head bc610409: 5265 passed, 177 skipped, 0 failed (1176.96 s). It ran in a venv installed as validate installs it (pip install --only-binary :all: -c constraints-cpython312-linux.txt -e ".[runtime,test]"), with LANG=C.UTF-8 and a short TMPDIR, as python -m pytest -q --junitxml=… --basetemp=… -p no:cacheprovider. Main 389e5a4a, the same way: 5202 passed, 177 skipped. The 177 skips are the database-backed cases on a machine with no OPENDOX_TEST_DATABASE_URL; CI runs them against its postgres:16 service. The difference is the 63 new cases.
  • CI at the final head: validate succeeded (run 37361225935, job 111936023214) with 5431 passed, 11 skipped and triple: selected=5442 passed=5431 skipped=11 failures=0 errors=0, a margin of 1465 on both floors. acceptance succeeded (job 111936023743), and so did SonarCloud Code Analysis. At e50cc3ff, with 60 of the 63 cases, the same job read selected=5439 passed=5428 skipped=11, so every new case runs on the runner and passes, and none skips.
  • Red at main: the three new files run against 389e5a4a's own source give 45 failed, 18 passed. Every behavior case fails there. The 18 that pass are the pins and controls named in the table.
  • Mutants: 22, every one killed, on the final source (bc610409). Each edits the source at the final head, and runs against the new file for its fix, and against tests/test_model_binding_trust.py if it survived that. None did.
Mutant Killed by
F1-a: the look's kind guard dropped, so a socket or a FIFO is opened test_F1_a_non_regular_path_is_refused_by_every_read[broker-socket]
F1-b: the descriptor's kind guard dropped test_F1_a_file_replaced_after_the_look_is_judged_by_its_descriptor[directory]
F1-c: O_NONBLOCK dropped from the open test_F1_a_file_replaced_after_the_look_is_judged_by_its_descriptor[fifo] (the open waits, and the case's 20-second limit fails it)
F1-d: O_NOFOLLOW dropped from the open test_F1_a_file_replaced_by_a_link_after_the_look_is_never_read_through
F1-e: the look follows links (stat for lstat) test_F1_a_link_that_appears_after_the_link_rule_looked_is_never_read[dangling]
F1-f: the guard negated to the old reading, a non-regular path is absent test_F1_a_non_regular_path_is_refused_by_every_read[broker-directory]
F1-g: every failed look is absence test_F1_a_look_that_fails_is_never_absence
F1-h: a document removed after the look is absence test_F1_a_document_removed_after_the_look_is_not_read_as_none
F1-i: a kind misnamed (a FIFO called a directory) test_F1_a_non_regular_path_is_refused_by_every_read[broker-fifo]
F1-j: the parse's refusal words drift from the bindings store's test_F1_the_declarations_parse_refuses_in_the_bindings_stores_words[not-utf-8]
F1-k: the refusal not in an unreadable document's form 29 cases, the 15 of test_F1_a_non_regular_path_is_refused_by_every_read among them
F1-l: a platform without the open's guards opens unguarded test_F1_a_platform_without_the_opens_guards_opens_no_document[no-nofollow]
D5-a: the ceiling dropped test_D5_a_broker_past_the_ceiling_is_refused_by_name
D5-b: the ceiling off by one (>=) test_D5_a_broker_at_the_ceiling_is_read
D5-c: the ceiling restated as 256, not imported test_D5_the_ceiling_is_imported_never_restated
F2-a: reverted, always "on this machine" test_F2_a_host_that_recorded_nothing_is_named_as_what_trusts_it[add]
F2-b: the guard negated test_F2_a_host_that_recorded_nothing_is_named_as_what_trusts_it[add]
F2-c: always the host's wording test_F2_a_record_written_on_this_machine_keeps_its_exact_line[add]
F2-d to F2-g: one verb's line ignores its recording (add, edit, set-credential, trust) test_F2_a_host_that_recorded_nothing_is_named_as_what_trusts_it[add], [edit], [set-credential] and [trust] in turn; trust's mutant also fails [set-credential], which runs trust first

Copilot

  • Round 1, review 5419251779 at e50cc3ff, "Changes recommended", one finding. r4187659916 (High): O_NOFOLLOW and O_NONBLOCK fell back to 0 on a platform without them. Fix now in ecbe72f0. Such a platform opens no declarations document; one that is there is refused by name. This matches runtime.local_git_adapter.NO_FOLLOW_WALK_IS_AVAILABLE's own rule. Answered (4187698785) and resolved. The review's overview also names parent-directory link races, with no thread of its own. That one is proposed below as an accepted limit.
  • Round 2, review 5419325120 at ecbe72f0, "Needs a closer look", no findings.
  • Round 3, review 5419371864 at bc610409 (the final head), "Needs a closer look", no findings. Copilot reviewed each pushed head on its own, under the repository's Copilot review rule. A reviewer-API request at bc610409 (19:12:21Z) registered none, since that head was already reviewed. 0 of 1 threads are unresolved.

SonarCloud

  • At e50cc3ff and ecbe72f0, the quality gate passed with 11 new issues, each classed as a Copilot finding would be, and each fixed now in bc610409. One was python:S1192: "declarations document" was written three times, and is now one constant, _DOCUMENT, with the words unchanged. Ten were python:S5778: exception tests holding more than one call that could raise. Each store, record and argv is now built before its pytest.raises block.
  • At bc610409 (analysis 19:09:54Z), the quality gate passed with 0 open issues.

Accepted limits (proposed; the holder rules at READY)

  • A link swapped in for ideation/ or ideation/dashboard/ while the store reads (Copilot round 1's overview). The look and the open follow links in directories on the way, and O_NOFOLLOW guards only the document's own name. A clone cannot deliver this: the link rule refuses any link on the way within the checkout's own path before the read, so only a process racing the read could put one there. Whatever is opened through such a link is still judged by its descriptor's type. Reading through it yields nothing the repository could not have written in its own declarations document. The write path's equivalent race belongs to T100 follow-on: the trust store's review findings (plan 034) #86's N1 and write_settings_document (slice A's file), and is unchanged here. The follow-on would be a walk of ideation/dashboard/ component by component, with dir_fd and O_NOFOLLOW, for both the read and the write.

For the holder

  • list's trust line (_trust_lines) still reads "trusted on this machine" for a binding a host's verdict trusts. F2's finding named the line the acts print (_trusted_line), so list is unchanged here. It is the same class, and could be a follow-on.
  • The bindings document still reads a non-regular path as absent (doxbench_binding.document_present, slice A's file). There, absent means no binding is used, which is the safe direction, so F1's hazard does not arise.
  • _parsed repeats read_settings_document's four refusal sentences rather than calling it, because that function reads by path and this store reads only through the descriptor it judged. test_F1_the_declarations_parse_refuses_in_the_bindings_stores_words holds the two stores to the same words. A shared helper that takes text would need a change to doxbench_binding.py, which is slice A's file.
  • The triple pin's floors are not moved, as T100 follow-on: the trust store's review findings (plan 034) #86 left them. The 63 cases raise selected and passed by 63 and skip nothing on the runner, so EXPECT_SKIPPED stays 11.
  • Path.resolve() raises RuntimeError on a checkout root that is itself a looping link, before any policy is asked (resolved_root). That is pre-existing and outside this slice.

Commits

  • 6ca46e8a: F1, D5 and F2, with their tests.
  • e50cc3ff: a document removed after the look is refused, not read as none.
  • ecbe72f0: Copilot r4187659916, a platform without the open's guards opens no declarations document.
  • bc610409: SonarCloud's new issues.

Lane: openxfactory-4 (openXfactory-4-openDox_extraction)
Arc: neutral-product-standalone-operability

🤖 Generated with Claude Code

brettheap and others added 2 commits October 5, 2026 18:54
…red broker's ceiling, and the trust line under a host (plan 034)

Slice B of the release-1 follow-ons, delegated by lane openxfactory-4
(openxFactory#656 comment 6000630835, on Brett Heap's word 6000582654).

F1, Copilot r4184739661 on openxFactory#1236 (High). DeclarationStore
read a directory, a FIFO or a socket at the declarations path as "no
document", so nothing was pending and a host policy keyed on the pending
set (openxFactory's governed one) trusted every binding. The store's read
path now treats only "no such file" (or a file where a directory belongs
on the way) as absence. Anything else in the document's place is refused
by name with the refusal an unreadable document gets, naming what it is.
A link is judged as itself, so a dangling one is unreadable, not absent.
The read is judged on what was opened, as MachineTrust reads its own
store: an lstat look that never opens what is no regular file, an open
with O_NONBLOCK and O_NOFOLLOW, and fstat on the descriptor, which is
then read and parsed in read_settings_document's words.
doxbench_binding.document_present is unchanged.

D5, openDox-code#86's deferred r4182645796. BrokerDeclaration refuses
more members than doxbench_binding.MAX_JUDGED_MEMBERS (imported, never
restated), by name, at construction, so from_record (the read) and
declare_broker (the write) both refuse it.

F2, the pre-review of openxFactory#1236. _trusted_line takes the
TrustRecording: where the policy recorded nothing, the line names the
host's trust policy instead of "on this machine". Where a machine record
was written, the line is byte-identical.

Tests, each red-first where it is a behavior change (41 of 58 fail at
389e5a4; the 17 others are controls and pins):
tests/test_doxbench_intake_store_kinds.py (F1),
tests/test_doxbench_intake_broker_ceiling.py (D5),
tests/test_cli_model_binding_trusted_line.py (F2).

Arc: neutral-product-standalone-operability
Lane: openxfactory-3

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…as none (plan 034)

The declarations store's look (lstat) saw a regular document, and the
open then found nothing: that race read as "no document", which under a
host policy keyed on the pending set trusts every binding. Main refused
the same race (its read raised "cannot be read"), so the open's failure
is now refused as unreadable, whatever its cause. Only the look's own
"no such file", or a file where a directory belongs on the way, is the
document's absence.

Two cases: a document removed between the look and the open is refused
(red at 389e5a4, where the store took no look of its own to race), and a
look the system refuses for another reason, a looping link on the way,
is never absence (a control, green at 389e5a4 too).

Arc: neutral-product-standalone-operability
Lane: openxfactory-3

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 5, 2026 18:56
@sourcery-ai

sourcery-ai Bot commented Oct 5, 2026

Copy link
Copy Markdown

Reviewer's Guide

This follow-on hardens declarations intake against fail-open filesystem states, caps declared broker arguments using the existing shared judgment limit, and corrects CLI trust output to distinguish locally recorded trust from host-policy admission, with focused regression and boundary tests.

Sequence diagram for recorded versus host-policy trust output

sequenceDiagram
    participant CLI
    participant TrustPolicy
    participant TrustRecording
    participant Output
    CLI->>TrustPolicy: _record_trust(binding, args)
    TrustPolicy-->>CLI: TrustRecording
    CLI->>Output: _trusted_line(binding, recording)
    alt recording.recorded
        Output-->>CLI: trusted binding on this machine for repository
    else host policy admitted without recording
        Output-->>CLI: trusted binding by the host's trust policy for repository
    end
Loading

Flow diagram for fail-closed declarations intake

flowchart TD
    A[DeclarationStore._load] --> B[DeclarationStore._open]
    B --> C{Path is absent?}
    C -->|Yes| D[Return empty declarations]
    C -->|No| E{Opened object is regular file?}
    E -->|No| F[_not_a_regular_file]
    E -->|Yes| G[DeclarationStore._read]
    G --> H[DeclarationStore._parsed]
    F --> I[IntakeRefused]
    G --> I
    H --> I
Loading

File-Level Changes

Change Details Files
Make declarations-store reads fail closed for every present non-regular path while preserving safe absent-path behavior.
  • Replace path-based reads with lstat/open/fstat/read through a judged descriptor.
  • Reject directories, FIFOs, sockets, devices, and links with explicit unreadable-document errors, including race-safe replacement handling.
  • Preserve YAML parsing and refusal wording while ensuring writes first reject unsafe existing paths.
src/opendox/doxbench_intake.py
tests/test_doxbench_intake_store_kinds.py
Enforce the shared broker command-size ceiling for declarations.
  • Validate broker argv length against doxbench_binding.MAX_JUDGED_MEMBERS at construction.
  • Apply the validation to both deserialized declarations and broker declarations being written.
  • Add boundary, dynamic-import, read-surface, and no-write-crossing coverage.
src/opendox/doxbench_intake.py
tests/test_doxbench_intake_broker_ceiling.py
Make CLI trust disclosures accurately identify the source of trust.
  • Pass the complete TrustRecording to the disclosure helper instead of only its verdict.
  • Report “on this machine” only when a local trust record was written.
  • Name the host trust policy when its verdict admits the binding without recording locally, across add, edit, set-credential, and trust.
src/opendox/cli_model_binding.py
tests/test_cli_model_binding_trusted_line.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The declarations open remains vulnerable to parent-symlink races and silently loses required guards on unsupported platforms.

Review effort: Balanced
Findings: 1 High severity

Open (1)
What changed in this PR

Hardens declarations intake and corrects CLI trust reporting.

Changes:

  • Rejects non-regular or raced declarations documents.
  • Caps declared broker arguments.
  • Distinguishes machine-recorded trust from host-policy trust.
File Description
src/​opendox/​doxbench_intake.py Hardens document reads and broker limits.
src/​opendox/​cli_model_binding.py Corrects trust-source output.
tests/​test_doxbench_intake_store_kinds.py Tests fail-closed document handling.
tests/​test_doxbench_intake_broker_ceiling.py Tests broker argument limits.
tests/​test_cli_model_binding_trusted_line.py Tests trust-source reporting.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/opendox/doxbench_intake.py Resolved
…declarations document (plan 034)

Copilot r4187659916 on openDox-code#87 (High), classed fix-now under the
convergence rule (openxFactory#656 comment 5988818366): O_NOFOLLOW and
O_NONBLOCK fell back to 0 where a platform lacks them, so the open could
follow a link, or wait on a FIFO, put in the document's place after the
look. They are the guard itself, as runtime.local_git_adapter's
NO_FOLLOW_WALK_IS_AVAILABLE already holds for its walk. Where either is
missing, a document that is there is now refused by name, as an
unreadable one, and is never opened; nothing there is still nothing.
Every CI runner and deployment is Linux, which has both.

Three cases (no O_NOFOLLOW, no O_NONBLOCK, neither), each red at
389e5a4, where the document was read by its name.

Arc: neutral-product-standalone-operability
Lane: openxfactory-3

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 5, 2026 19:04

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

Security-sensitive filesystem race handling and cross-platform behavior warrant final human review.

Review effort: Balanced
Findings: None

Resolved since last review (1)

Copilot AI balanced review requested due to automatic review settings October 5, 2026 19:08
…an 034)

Each classed as a Copilot finding would be, under the convergence rule
(openxFactory#656 comment 5988818366), and each fixed now:

- python:S1192, "declarations document" written three times in
  doxbench_intake.py: one constant, _DOCUMENT, names the document in
  every refusal (the link rule's, an unreadable document's, and a
  non-regular path's). The words are unchanged.
- python:S5778, ten exception tests holding more than one call that
  could raise: each store, record and argv is built before the
  pytest.raises block, so the block holds the one call under test.

No behavior changes; the three new test files pass unchanged in what
they assert.

Arc: neutral-product-standalone-operability
Lane: openxfactory-3

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sonarqubecloud

sonarqubecloud Bot commented Oct 5, 2026

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

Security-sensitive filesystem race handling and its accepted limits warrant final human review.

Review effort: Balanced
Findings: None

@sourcery-ai

sourcery-ai Bot commented Oct 5, 2026

Copy link
Copy Markdown

Sorry @brettheap, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 1 day and 23 hours by commenting @sourcery-ai review. Upgrade to get a review now.

@brettheap

Copy link
Copy Markdown
Contributor Author

READY at bc61040 — Lane: openxfactory-4 (openXfactory-4-openDox_extraction)

Holder: lane openXfactory-3's release-1 follow-on slice B. The authority is Brett Heap's word 6000582654, and the claim is 6000630835. It is an arc follow-on of 16.3a, with Arc: neutral-product-standalone-operability. It lands after 0.1.0, reaches users only in a later release, and moves no release-1 pin.

  • F1 (Copilot r4184739661 on openxFactory#1236). DeclarationStore now refuses, by name, an existing declarations path that is not a regular file. That covers a directory, a FIFO and a dangling link. Before, it read as "no document", and a governed host then trusted every binding.
    • A platform without O_NOFOLLOW or O_NONBLOCK opens no declarations document at all (r4187659916, fixed).
  • D5 (T100 follow-on: the trust store's review findings (plan 034) #86's r4182645796). The declared broker is held to MAX_JUDGED_MEMBERS, refused by name.
  • F2. Under a host policy that records nothing, the trust line names what actually trusts the binding, not "on this machine". The standalone wording is byte-identical.
  • Accepted limit, ruled by the holder under the convergence rule (5988818366): the parent-directory link race. It is a race only. N1 already refuses any link a clone carries, and nothing outside the repository is gained.
  • Gates.
    • CI validate (run 37361225935) reads selected 5442, passed 5431, skipped 11.
    • SonarCloud's quality gate is OK.
    • Copilot's rounds 2 and 3 found nothing, and there are 0 unresolved threads.
    • 22 of 22 mutants are killed.
    • Red-first: 45 of 63 new cases fail on 389e5a4a.
    • No closing keyword.
  • Beside slice A, T100 follow-on 2: #86's deferred trust-store items D1-D4 and D6 (plan 034) #88. The two merge cleanly, and their combined new cases give 90 passed on the merged tree. T100 follow-on 2: #86's deferred trust-store items D1-D4 and D6 (plan 034) #88 lands first; this one follows.

@brettheap
brettheap merged commit a9ac96f into main Oct 5, 2026
5 checks passed
@brettheap

Copy link
Copy Markdown
Contributor Author

Lane: openxfactory-4 (openXfactory-4-openDox_extraction)

LANDED — lane openxfactory-4, 2026-10-05T19:33:25Z, PR #87 → a9ac96f (opensoft/openDox-code main; plain gate)

Brett: land phase 1 / phase 2 PRs when green

brettheap added a commit that referenced this pull request Oct 6, 2026
… (plan 038) (#89)

Lane: openxfactory-4 (openXfactory-4-openDox_extraction)
Arc: neutral-product-standalone-operability

## T010 [oDc]: R2Q17 (a)'s required-check change

Plan 038 (`038-opendox-document-tool-self-maintenance`). This is the CI owner's first of five ordered edits to `.github/workflows/validate.yml`: T010, then T017, T051, T067 and T080 (decision N-4).

- **Realizes**: 15.1b (part), 15.5 (part, the platform).
- **Falsifier**: the job's own run on the PR, quoted: the live proof step green, the suite's selected/passed/skipped counts unchanged.
- **Ruled**: R2Q17. The answer is (a), openxFactory#656 `6003486656`: *"This required-check change is made by this word"*. The plan was ruled at #656 `6013547504`. **Decisions**: N-4, OQ-H15-21.

## What changes in the required `validate` job

- **`runs-on: ubuntu-24.04`**, pinned. It was `ubuntu-latest`, which moves to 26.04 in a window that opens 2026-10-19. The move waits for T068's measurement (decision N-18).
- **`provision the sandbox`** (new step). It installs `bubblewrap` with apt and sets `kernel.apparmor_restrict_unprivileged_userns=0` (actions/runner-images#10443). It prints the image's default value before changing it.
- **`prove the sandbox live`** (new step). It runs before the package install, so it runs before the suite.
  - bwrap is run at the FIXED path `/usr/bin/bwrap`, never through PATH (OQ-H15-21). The step refuses a missing or setuid binary. A setuid bwrap would pass without unprivileged user namespaces.
  - It records `bwrap --version`, the package version and the kernel.
  - **Run 1 must succeed.** It writes to its tmpfs and reads the write back. It passes all three flags that set OQ-H15-21's version floor (`--json-status-fd`, `--disable-userns`, `--size`), so a bwrap below the floor stops at "Unknown option".
  - **Run 2 must be refused a write outside its tmpfs.** It runs over a host directory the runner can write, bound read-only. It must see the directory, write to its own tmpfs, and fail the write into the directory: exit 42 exactly. The step then checks on the host that nothing landed.
- **The switch: `OPENDOX_TEST_SANDBOX_REQUIRED: "1"`**, exported at job level, so every step of `validate` sees it.
  - Under it, with `CI` set, a sandbox case that finds no live sandbox FAILS rather than skips. This mirrors `tests_runtime/conftest.py`'s `_skip_or_fail`.
  - T048's `tests/sandbox_required.py` is the helper that reads it. T067's shell step can read the same switch.
  - **Why this name.** `plan.md`, `tasks.md` and `data-model.md` declare no variable. `grep -nE 'OPENDOX_[A-Z_]*(SANDBOX|REQUIRED)|SANDBOX_REQUIRED|sandbox_required'` finds only the helper module's name, at `tasks.md:914` and `:922`. The name follows this repository's test-harness switches (`OPENDOX_TEST_DATABASE_URL`, `OPENDOX_TEST_HOME`), which sit apart from the runtime's closed `SETTING_NAMES`. So no guard mistakes it for an operator setting, and `tests_runtime/conftest.py`'s per-case clearing leaves it alone.
- `EXPECT_SKIPPED` stays `"11"`, and `MIN_SELECTED` and `MIN_PASSED` are unchanged. No step script names the test runner or `pip install`, so the one-run and one-install guards in `tests_runtime/test_deploy_shape.py` still hold. The new step names do not start with "install".

## The falsifier: this PR's own run

The run is [37446196804](https://github.com/opensoft/openDox-code/actions/runs/37446196804) (`pull_request`, head `d63e3860`), validate job `112211500317`, conclusion **success**. `acceptance` also passed.

The runner image:
```
Image: ubuntu-24.04
Version: 20260927.320.1
```

The `provision the sandbox` step:
```
image default: kernel.apparmor_restrict_unprivileged_userns=1
Unpacking bubblewrap (0.9.0-1ubuntu0.3) ...
Setting up bubblewrap (0.9.0-1ubuntu0.3) ...
kernel.apparmor_restrict_unprivileged_userns = 0
```

The `prove the sandbox live` step, **green**:
```
bwrap: /usr/bin/bwrap, bubblewrap 0.9.0, package 0.9.0-1ubuntu0.3, kernel 6.17.0-1022-azure
kernel.apparmor_restrict_unprivileged_userns=0
json-status: { "child-pid": 3248, "cgroup-namespace": 4026532339, "ipc-namespace": 4026532337, "mnt-namespace": 4026532268, "net-namespace": 4026532340, "pid-namespace": 4026532338, "uts-namespace": 4026532336 } { "exit-code": 0 }
live: the sandbox ran and its tmpfs took a write
sh: 4: cannot create /home/runner/work/_temp/sandbox-escape-probe/escaped: Read-only file system
refused: the write outside its tmpfs failed, and the host directory is unchanged
```

The suite, then `Pin the triple`:
```
5458 passed, 11 skipped, 2 warnings in 814.24s (0:13:34)
triple: selected=5469 passed=5458 skipped=11 failures=0 errors=0
pins:   selected>=3977 (margin 1492) passed>=3966 (margin 1492) skipped==11
```

**The counts are unchanged against `main`.** No `validate` run had ever covered `main`'s tip `a9ac96f9`: #87's tested head `bc610409` did not contain #88. So `validate` was dispatched on `main` for this comparison: [37445317621](https://github.com/opensoft/openDox-code/actions/runs/37445317621) (`workflow_dispatch`, `a9ac96f9`, success, same runner image).
```
5458 passed, 11 skipped, 2 warnings in 813.22s (0:13:33)
triple: selected=5469 passed=5458 skipped=11 failures=0 errors=0
```
Both read selected 5469, passed 5458 and skipped 11. A second run of this head, dispatched on the branch, read the same: [37446067746](https://github.com/opensoft/openDox-code/actions/runs/37446067746), `selected=5469 passed=5458 skipped=11 failures=0 errors=0`, with the proof green.

## Mutants: each new guard, killed on a real runner

Each mutant was a one-line edit on a throwaway branch, dispatched once. The branches were deleted afterwards and none was ever proposed. Each went red at `prove the sandbox live`, so the suite never ran.

| mutant | run | the step's refusal |
|---|---|---|
| M1: drop the sysctl | [37446262428](https://github.com/opensoft/openDox-code/actions/runs/37446262428) | `kernel.apparmor_restrict_unprivileged_userns=1`, `bwrap: loopback: Failed RTM_NEWADDR: Operation not permitted`, `the sandbox did not run (bwrap exited 1), so this runner has no live sandbox` |
| M2: bind the probe directory read-write (`--bind`) | [37446266135](https://github.com/opensoft/openDox-code/actions/runs/37446266135) | `the escape run exited 0, not 42: 0 means the write landed, …` |
| M3: `sudo chmod u+s /usr/bin/bwrap` after the install | [37446269880](https://github.com/opensoft/openDox-code/actions/runs/37446269880) | `/usr/bin/bwrap is setuid, so this proof would not exercise unprivileged user namespaces` |

M1 also measures what R2Q17 assumed. The pinned image ships the AppArmor restriction on, and without the sysctl bwrap cannot set up its namespaces.

## Local checks (checks, not the falsifier)

- `actionlint` 1.7.12 with shellcheck: clean. One SC2016 is disabled at its line with the reason: `$1` belongs to the inner `sh -c`.
- The proof step's own script, extracted from the workflow and run against stub bwraps:
  - a working stub passes (rc 0);
  - a stub that lets the write land, exiting 0, is refused (rc 1);
  - a stub that lets the write land but exits 42 is refused by the host check (rc 1);
  - a stub that cannot create namespaces is refused (rc 1).
- `tests/test_triple_pin.py`, `tests_runtime/test_deploy_shape.py` and `tests/test_release_workflow.py`: 246 passed.
- The full suite, in a venv built with this job's install command, with no PostgreSQL and `CI` unset: `5292 passed, 177 skipped` (5469 selected). The skips are the database-backed cases, which skip without a database outside CI.

## Files changed

- `.github/workflows/validate.yml`: the `validate` job's comment block, `runs-on`, job-level `env`, and the two new steps. No other file.

## What is NOT done here

- **No test reads `OPENDOX_TEST_SANDBOX_REQUIRED` yet.** T048 (lane openXfactory-3) adds `tests/sandbox_required.py` and the sandbox cases that it gates. Until then the switch changes no outcome, which is why the counts are identical.
- The product's own fixed bwrap path and version-floor enforcement is T048's `check_pack_sandbox.py`. This PR only records the runner's version and uses the floor's flags in CI.
- The floors `MIN_SELECTED` and `MIN_PASSED` are T017's and T051's. F15.1's shell block in this job is T067's. AT-R2's `acceptance` job is T080's. The `acceptance` job is untouched and still runs on `ubuntu-latest`.
- The 26.04 measurement is T068's, and the move off 24.04 is a separate required-check change (N-18).
- There is no macOS job, as ruled.
- The ruleset is unchanged. The required context is still `validate`, and this PR changes what that job does.

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


Arc: neutral-product-standalone-operability
Lane: openxfactory-4 (openXfactory-4-openDox_extraction)
Co-Authored-By: Claude Opus 5.5 (1M context) <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.

2 participants