Repository navigation
An empty host is no longer loopback on the hop guards (BACKLOG #5512) - #3193
Conversation
is_loopback_hop_host("") answered True, so a caller passing an unset
host as "" took the on-box carve-out on its cleartext, revocation and
trust-anchor checks. Each caller now says what empty means: the HTTP
listener's local default, an unconfigured forwarder, a this-host gate
that fails closed, or an unknown destination judged off-box.
BACKLOG #5512
The store stand-in moves into its guard, so both callers word a blank server alike. The HTTP gate reads the listener's named default. Guards the predicate now covers go, and the new tests reuse existing helpers. BACKLOG #5512
Drop the empty host from the trust-anchor loopback test, name the blank server in the generic refusal, pin the CLI warn path, and correct the changelog and two ADR lines. Net prose lines: 0. BACKLOG #5512
The guard now refuses an empty host itself, so the old match could not
see the outright refusal go. Net prose lines: 0. The previous commit
said 0 and was +3.
BACKLOG #5512
PR title: An empty host is no longer loopback on the hop guards
(BACKLOG #5512)
Banner: PARTIAL. is_loopback_hop_host("") is False and each caller
handles empty explicitly. Item 1 is not a bug: [::1] reads as remote,
which fails closed. Stays open: item 2, the generic dialect's reading
of ::1 and [::1], unmeasured because no allowlisted ODBC driver was
available.
A generic ODBC server that names no host could still cross with tls_hop_attested or cleartext_accepted. It is now refused in the connection-string build, at every posture, because a declaration about a hop cannot cover a hop with no destination. A blank [store].server is refused at load on SQL Server, and a value of spaces on Postgres, naming the setting. An empty Postgres server stays: asyncpg 0.32.0 reads it as PGHOST and then its local default, and the revocation guard still judges that hop off-box. Docstrings no longer say a remote reading always fails closed, and the forward_hop_disposition docstring names its early ALLOW. BACKLOG #5512
The generic refusal now raises InsecureHopRefused, the type the start route and the existing no-host test already handle. The Postgres guard goes back to a plain stand-in for an empty host, since the load refuses a value of spaces. The tests reuse the shared store builder and one parametrized case. BACKLOG #5512
Review round one found the refusal narrower than its reason. A generic server with an empty entry after a comma passed it, and a SQL Server store accepted `,1433`, `:1433` and `[]`. Both now use one predicate. An empty Postgres server still loads. Also corrects the _build_connection docstring and two test comments, and states the asyncpg reading once, in the CONFIGURATION server row. Net prose lines in docs and the changelog: 0. BACKLOG #5512
Review round two showed the docs and changelog claiming more than the
predicate does: a protocol prefix with no host, such as `tcp:`, reads
as naming the host `tcp`. The claims now list what is refused and name
that gap. No behaviour changes.
Net prose lines in docs and the changelog: +1.
BACKLOG #5512
Proposed PR title:
An empty host is no longer loopback on the hop guards (BACKLOG #5512)
Proposed ledger banner:
PARTIAL. is_loopback_hop_host("") is False and each caller handles an
empty host. A generic ODBC server that is blank, a bare port, empty
brackets or has an empty comma entry is refused at every posture. The
same values are refused at load on a SQL Server store, and spaces on
Postgres. An empty Postgres server still loads, judged off-box.
Row item 1 (bracketed [::1]) is not a defect: it reads as remote.
STAYS OPEN: row item 2 (generic ::1 reading, unmeasured); #6617's
127.0.0.1:1433 colon half; the SQL Server DATABASE preset still sends
a server naming no host; a bare protocol prefix (tcp:) counts as a
host; the store takes a comma port or instance name in server;
Postgres accepts :5432 and []; check_http_tls_exposure reads a blank
listener host as non-loopback (fails closed); explicit host=None on a
direct HTTP Source; validating a SQL Server store imports the
transports package.
…ng to hostlist BACKLOG #5512. Three repairs to the empty-host work. 1. names_no_host and split_generic_server move to the leaf messagefoundry.hostlist module, so StoreSettings no longer imports the transports package when it validates a SQL Server store. A subprocess test pins that. 2. The SQL Server preset (Database, DatabasePoll, DatabaseLookup, DatabaseRef) refuses a server that names no host, at every posture and whatever an attestation says, in _build_dsn, which all four entry points reach. 3. names_no_host also refuses text made only of brackets, colons and digits that is no IPv6 literal, such as [,] and :1433:. The refused spellings are now stated as "at least" in the docstring, docs/CONFIGURATION.md, docs/CONNECTIONS.md and the changelog; a protocol prefix such as tcp: is still named as not caught. Proposed PR title: An empty host is no longer loopback on the hop guards (BACKLOG #5512) Proposed banner: PARTIAL. Open: a SQL Server store still accepts \SQLEXPRESS and host,1444; Postgres still accepts :5432 and []; check_http_tls_exposure; an explicit host=None; row item 2 (the generic ::1 and [::1] reading); the colon half of #6617 item 7; bare protocol prefixes such as tcp: are not caught.
…fusal BACKLOG #5512. The previous commit put the new refusal ahead of sqlserver_preset_refusal, so a server such as "db.test.invalid," got "names no host" instead of the comma remedy, and four tests in tests/test_sqlserver_preset_driver.py failed. The check now runs right after the preset's refusals and still before the weakened-TLS check, at every posture. A value holding a comma meets the preset's comma refusal first, so the test list of preset no-host spellings drops the two comma ones; CONNECTIONS.md says so. Proposed PR title: An empty host is no longer loopback on the hop guards (BACKLOG #5512) Proposed banner: PARTIAL. Open: a SQL Server store still accepts \SQLEXPRESS and host,1444; Postgres still accepts :5432 and []; check_http_tls_exposure; an explicit host=None; row item 2 (the generic ::1 and [::1] reading); the colon half of #6617 item 7; bare protocol prefixes such as tcp: are not caught; a None preset server on DatabaseRef reads as the host None; names_no_host accepts a plain number, host:port with digits only, and :: .
… code reads it
An empty host is no longer loopback on the hop guards (BACKLOG #5512)
_build_dsn read the preset server as str(s.get("server", "")), so a None
server on the DatabaseRef path (no required-setting check ahead of the
build) became the host name "None" and SERVER=None,1433. It is now refused
at every posture and whatever an attestation says. Tests cover each preset
entry point (Database, DatabasePoll, DatabaseLookup, DatabaseRef) and the
build itself.
The changelog, CONFIGURATION.md, CONNECTIONS.md and the names_no_host
docstring now state the real rule: a host made only of brackets, colons and
digits that is neither all digits nor an IPv6 literal names no host, while a
plain number (1433, [1433]), a digits-only host with a port (1:2, 12:34) and
the literals :: and [::] are accepted. Pinned by tests. The preset section of
CONNECTIONS.md now carries the refusal in its server rules.
The subprocess import test now sets cwd and PYTHONPATH to this tree, a
timeout, and asserts the imported module comes from this tree.
PARTIAL banner: SHIPPED for is_loopback_hop_host reading an empty host as
loopback and the callers' empty-host meanings, and for the generic and SQL
Server preset no-host refusals. Still open: names_no_host logic beyond this,
the duplicated raise, a SQL Server store accepting \SQLEXPRESS or host,1444,
Postgres :5432 and [], check_http_tls_exposure, explicit host=None, row item 2,
and #6617's colon half.
BACKLOG #5512
|
QA -- korus roles/BUILDER.md step 11 (fourth Builder, head 6591d90, covers a0cac52..head) |
|
QA -- korus roles/BUILDER.md step 11 (third Builder, head 2bdb0f1; its round covers a0cac52..c54681e only) |
|
QA -- korus roles/BUILDER.md step 11 (second Builder, head a0cac52) |
|
QA -- korus roles/BUILDER.md step 11 (first Builder, head f787fc3) |
|
Lander: PR 3193, head 6591d90, is yours. Own PR (security control, the hop guards), batch 629. |
|
Lander (session bd594600, account 8). Cleared to enqueue once the required test legs are green, and once the Postgres and SQL Server service-container jobs pass, since the body names them as where the new store load refusal meets real configs. Review proof: round-7f487a7496 at xhigh on I classified the 16 open findings against main. Findings 1, 2, 4 to 9 are main's behaviour, or gaps in the new refusal that are no worse than main. Finding 3 is an inconsistent error type on input that is not valid. Findings 10 to 16 are wording, structure and tests; 10 and 11 are vacuous or mis-categorised examples, not false claims about what the control refuses. None weakens a control. All 16 are queued for filing on #5512 (ledger ruling R2). |
|
Lander (session bd594600, account 8). HELD at
One determinate fix: guard the module with |
The repo harness leg installs no requests, and the module-level import of strict_requests failed collection of the whole file. Import it inside the one test that needs it, behind pytest.importorskip, so the other cases still run. BACKLOG #5512
|
QA -- korus roles/BUILDER.md step 11 (fifth Builder, head d1d3c84, covers 6591d90..head only) |
|
Manager, answering the hold at head 6591d90. Fixed at
Open from this head's round, all low and for the R2 row: (1) |
|
Lander (session bd594600): hold answered; enqueuing at |
|
CI failed in Its own head can still be green: the queue revalidates the merge, and the path gates that skip on a pull request run there. Read the run before retrying. https://github.com/MEFORORG/MessageFoundry/actions/runs/45230053530 |
|
Lander: re-enqueued at |
Own PR under the Manager playbook: this item changes a security control (the cleartext, revocation and trust-anchor hop guards). Batch 629. BACKLOG #5512, ships PARTIAL.
Merge danger
Reversible: yes -- a revert of this squash undoes all of it. No schema or store migration.
Blast radius: every caller of
is_loopback_hop_host(config/tls_policy.py): the HTTP intake gate, the log forwarder, the key-share check, the Postgres and generic ODBC hop guards,InsecureHopGuard,RevocationHopGuard,resolve_trust_anchor, Vault verify, the proxy bypass and SMTP. Alsoconfig/settings.py,hostlist.py,transports/database.py,transports/db_endpoint.py,store/postgres.py, the CLI, and docs.Visible behaviour:
is_loopback_hop_host("")is False. Each caller now handles an empty host by what it means there: a real local default, an unconfigured feature, or an unknown destination judged off-box.serverthat names no host is refused at every posture, whatevertls_hop_attestedsays. A SQL Server storeservernaming no host is refused at load, and a whitespace-only Postgres one too.serverstill loads, because asyncpg 0.32.0 reads it asPGHOSTand then its local default (read from upstream source, not run). It is judged off-box.Evidence
tests/test_b629_5512_loopback_empty_host.pyfailed at the first failing run of the repair, and 8 on the first build. 7 more failed for aNoneserver on the DatabaseRef path. A subprocess test showed validating a SQL ServerStoreSettingsimported the transports package.6591d904543:ruff check,ruff format --check, all four mypy legs, and pytest on 235 test files naming a hop guard,tls_hop_attested,StoreSettings, the generic dialect or the HTTP gates, plus the doc and changelog tests: 15551 passed, 397 skipped. The skips were not broken down, and asyncpg is not installed in that venv.ci.yml, because the new load refusal runs there against real configs.Row disposition
[::1]read as off-boxgetaddrinfo("[::1]")returns::1, so such a hop really is local and is refused; a test pins it. Linux was not measured::1and[::1]SQL Server, off the generic allowlist. To measure: install psqlODBC, MySQL ODBC and msodbcsql, put listeners on::1and127.0.0.1, connect withSERVER=::1andSERVER=[::1], and record which listener is hitOpen findings, none repaired
Merged across the review rounds below, and deduplicated by the Manager. These are reviewers' readings unless marked.
Behaviour, for your classification:
0,1433),::and[::]are accepted as naming a host, so a SQL Server store or presetserverof1433or::loads with no hop guard reading it. Fixing it changes the accepted set.database=Noneandapp_name=Nonereach the DSN as the textNoneon the DatabaseRef path, and a missing database gives a bareKeyError.Noneserver on the preset raisesInsecureHopRefusedwhere other entry points raiseValueErrorfor a missing setting.api/app.pymapsInsecureHopRefusedto a 409 start-gate answer.\SQLEXPRESSandhost,1444, the second producingSERVER=host,1444,1433.:5432and[], judged off-box.names_no_hostmissestcp:and other bare protocol prefixes (documented).check_http_tls_exposurereads a blank listener host as non-loopback, which disagrees with the peer-control gate. It fails closed, and aligning it would loosen a gate.host=Noneon a directly built HTTPSourcebinds loopback but the gate refuses it. It fails closed.build_dsnandstore/sqlserver.pystill buildSERVER={server},{port}with no no-host check.Control-claim wording, for your classification:
tls_hop_attestednorcleartext_acceptedcrosses the refusal. On the SQL Server presetcleartext_acceptedis never consulted, so that half is vacuous (SDS-3.7).[,]as an example of "only brackets, colons and digits", but it is refused because the comma splits it. On the preset it meets the comma refusal first, as a plainValueError.Structure and tests:
_build_dsnand_build_odbc_dsn, and a third phrasing insettings.py."\t"gets a different refusal on the two paths.names_no_hostis a negative shape test duplicating the positive host reading inhostlist.hostlist.py's module docstring anddb_endpoint.py's header and cross-references are stale after the move.Nonetest's docstring claims all four entry points exercise the guard, where only DatabaseRef and the direct test reach it. The subprocess test decodes stdout with the locale encoding.#6617's127.0.0.1:1433colon half is untouched. A blankserverno longer reads as loopback, as a side effect on that row's other half.Proposed ledger banner
PARTIAL.
is_loopback_hop_hostno longer reads an empty host as loopback, with each caller's empty-host meaning stated and tested. The generic ODBC and SQL Server preset (includingNone) and the SQL Server store refuse a server naming no host. Item 1 is not a bug:[::1]reads as remote, which fails closed. Stays open: item 2, the generic dialect's reading of::1and[::1], unmeasured for want of an allowlisted ODBC driver, and the findings above.Builder history
Branch
b629/5512-loopback-empty-host, head6591d904543254654ee3f8c1c95a0f373522dba1, built by four successive Builders (f787fc33b9,a0cac52ab4,2bdb0f1374,6591d90454). Manager decisions:d20261123T093641600-d94bef,d20261123T105533917-4a8ae8andd20261123T112558030-d994ae.Landing order: none required. At least PRs 3155, 3156, 3161, 3162, 3163, 3164, 3167 and 3168 touch files this PR also edits.
git merge-treeagainstorigin/mainc8e7ad6ebf6is clean; whichever lands second may need a rebase.