From 4523d793ba96da6696e1c2d7e9cd355c4c9a44d8 Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Sat, 3 Oct 2026 23:01:49 +0000 Subject: [PATCH 01/22] Managed-host cut O1a: evidence-bound rotation route standing + qualification bootstrap The family-keyed rotation answer (gunbc.bmc_implementation_dispatch rotation_route_for_family, BmcRotationRoute, megarac_rotation_route_frontier) is deleted. Its replacement is a sealed BmcRotationRouteStanding bound to one controller endpoint, one firmware build and the evidence that grounds it, with the plan's bootstrap crossed only by the separately authorized route-qualification effect (census row, dry realization over gunbc.bmc_model BmcWorld). Co-Authored-By: Claude Opus 5.5 (1M context) --- dag/gunbc/auth/privileged_effect_census.dag | 24 + dag/gunbc/bmc/bmc_implementation_dispatch.dag | 94 +--- dag/gunbc/bmc_model.dag | 67 ++- .../machine_intake/bmc_rotation_route.dag | 473 ++++++++++++++---- .../bmc_rotation_route_evidence.dag | 104 ++++ ...tation_route_forged_probe_witness_test.dag | 62 +++ ...intake_bmc_rotation_route_witness_test.dag | 403 ++++++++++++--- 7 files changed, 965 insertions(+), 262 deletions(-) create mode 100644 dag/gunbc/machine_intake/bmc_rotation_route_evidence.dag create mode 100644 dag/test/claim/machine_intake/machine_intake_bmc_rotation_route_forged_probe_witness_test.dag diff --git a/dag/gunbc/auth/privileged_effect_census.dag b/dag/gunbc/auth/privileged_effect_census.dag index db8742b465c..e75921646ea 100644 --- a/dag/gunbc/auth/privileged_effect_census.dag +++ b/dag/gunbc/auth/privileged_effect_census.dag @@ -583,6 +583,30 @@ data privileged_effect_census: List = [ realized: RealizedRunSelected, divergence_reason: none, }, + // ROTATION ROUTE QUALIFICATION (cut O1a). Grounding a controller's account-write route is its own + // effect, separate from the rotation Apply that consumes the route: one executed account-write + // request per controller and build. IRREVERSIBLE, AND SAID SO: an account write over an unqualified + // route can leave an account enabled holding a password nobody stored, and the exposure window it + // opens is not undone by a reapply (artifacts/bmc/mtcollins1-bmc-user3-route-2026-09-13.txt, steps + // b1 and b1r). It applies a credential to one controller account, so its reach is one resource. No + // dispatched run carries it: in this cut it is modeled, with a dry realization only. The realization + // takes an operator-approved capability (gunbc.auth.approval_broker Redemption) bound to the exact + // controller, build and request, which is what the selection is expected to return. + PrivilegedEffectSite { + site: site(module_path: "gunbc.machine_intake_bmc_rotation_route", decl_name: "qualify_rotation_route"), + effect: PrivilegedEffect { + subject: "qualify a BMC account-write route: execute one account-write request on one controller at one firmware build and read it back" as NonEmptyStr, + frequency: DeviceOnce, + reversibility: IrreversibleEffect { what_is_lost: "an account write over an unqualified route can leave an account enabled holding an unstored password; the exposure window is not undone by a reapply" as NonEmptyStr }, + surface: ApiSurface, + workload_identity: WorkloadIdentityUnbindable { cause: "no dispatched run carries route qualification; in cut O1a it is modeled with a dry realization only" as NonEmptyStr }, + minted_reach: MintsResourceScopedCredential, + billing: NoBillingConsequence, + witness_discharge: NoWitnessDischarge, + }, + realized: RealizedApprovalCapability, + divergence_reason: none, + }, PrivilegedEffectSite { site: site(module_path: "gunbc.machine_intake_mtcollins1_boot_run", decl_name: "mtcollins1_boot_wet"), effect: mtcollins1_boot_effect(), diff --git a/dag/gunbc/bmc/bmc_implementation_dispatch.dag b/dag/gunbc/bmc/bmc_implementation_dispatch.dag index 30a783863b3..fc0853bf967 100644 --- a/dag/gunbc/bmc/bmc_implementation_dispatch.dag +++ b/dag/gunbc/bmc/bmc_implementation_dispatch.dag @@ -1,9 +1,7 @@ module gunbc.bmc_implementation_dispatch -import std.types { List, NonEmptyStr, String } +import std.types { List } import std.credentials { FactoryLogin } -import std.dissolution { DissolutionCondition, unbound_dissolution } -import std.decl_ref { DeclarationRef, decl_field_ref } import extdeps.bmc.endpoint { AmiMegaRac, BmcFirmwareFamily, BmcProtocol, OpenBmc } import extdeps.bmc.openbmc { HostStorageBlind, @@ -21,16 +19,11 @@ import extdeps.bmc.megarac { megarac_factory_login, megarac_supported_protocols_ // OpenBMC module import the MegaRAC one — the 'a Chrome change must not require editing // Safari's module' violation named in DESIGN §3, and the reason those functions now live here. // Each is an exhaustive match, so a third implementation refuses to compile here and nowhere -// else; that is the census. THAT SENTENCE IS LOAD-BEARING AND IT IS WHY rotation_route_for_family -// LANDED HERE RATHER THAN IN machine_intake (review 63250, gunbc#10952). It was first authored in -// gunbc.machine_intake_bmc_rotation_route as a fourth `match family` -- which would have made -// "here and nowhere else" false the moment it merged, and split the third-implementation census -// across two modules with no cross-reference. The route table is realization keyed on firmware -// family and cites only extdeps.bmc facts, so this is its home by the same reasoning that moved -// the gunbc#9678 arms out of extdeps.bmc.openbmc. What stayed behind is the part that is NOT -// family-keyed: rotation_application_for_route maps a route to a machine_intake -// CredentialRotationApplication, so hoisting it would make this peripheral dispatch module depend -// on machine_intake and invert the layering it exists to keep straight. Every arm returns what its implementation module CITES at the +// else; that is the census. The rotation route is NOT a family-keyed fold and does not live here: +// committed evidence contradicts any family-grain answer (an IPMI user-management rotation executed +// on one MegaRAC build, a Redfish read and no account write on another), so it is a sealed standing +// bound to one controller, one firmware build and its evidence, in +// gunbc.machine_intake_bmc_rotation_route BmcRotationRouteStanding. Every arm returns what its implementation module CITES at the // family grain: MegaRAC's published admin/admin default and IPMI-only protocol floor come from // extdeps.bmc.megarac, whose scope note explains why Redfish presence is a build-scoped fact // carried on the build binding, never here. @@ -62,78 +55,3 @@ fn bmc_firmware_host_storage_visibility(family: BmcFirmwareFamily) -> RedfishHos AmiMegaRac => megarac_host_storage_visibility_floor } } - -// THE AVAILABLE ARM CARRIES REFERENCES, NOT A SENTENCE ABOUT THEM (review 63263). It was a single -// path_note String spelling out the method, the path template, the JSON member, the operation name -// and the executing tool -- and every one of those is ALREADY a modeled fact: the argv is -// `operation SetAccountPassword` on the redfish.Http service, the action shape is the -// SetAccountPassword arm of RedfishSystemAction, and the provenance is the call site in -// gunbc.tools.bmc_onboard. A String leaf hiding named parts is anemic modeling (DESIGN §2), and a -// symbol cited INSIDE a string literal is unreachable from the Node tree, so unlike a -// DeclarationRef it is not harvested by the citation checker -- it can rot with neither end touched. -// -// THE REFS ARE BUILT BY std.decl_ref's OWN CONSTRUCTOR, not spelled as record literals here (review -// 63521). That module's annotation states the rule: a module needing a DeclarationRef imports the -// constructor from the type's own module and never re-mints it. Spelling the literal inline is the -// same re-invention DESIGN §2 forbids, one layer down from the prose leaf this arm already replaced. -// -// AND IT WOULD NOT HAVE SURVIVED ITS OWN FRONTIER. rotation_route_consumption_frontier promises an -// actuator that DERIVES the rotation by calling this table; that actuator needs the operation, not -// a description of it, so the arm would have been rewritten rather than consumed -- §6's reviewer -// test answered "no" on the one arm that is supposed to work. -type BmcRotationRoute - = RotationRouteRedfishAccountService { transport_operation: DeclarationRef, action_shape: DeclarationRef } - | RotationRouteUnavailable { family_note: NonEmptyStr, detail: NonEmptyStr } - -// THE MEGARAC ARM IS UNAVAILABLE AND THAT IS A GROUNDED STATEMENT, NOT A GAP LEFT BLANK. -// extdeps.bmc.megarac declares its own admission rule in its scope note: its REST operation rows -// are "the SP-X interface shape AS EXECUTED on that build - the one place a single-build execution -// grounds a family-grain row - and carry that provenance explicitly". Six operations are rostered -// there and every one was executed against the controller. NO USER-MANAGEMENT OPERATION HAS BEEN -// EXECUTED, so authoring one would put an unexecuted row beside six executed ones under a rule that -// admits only the executed -- the module contradicting itself in its own file. AMI publishes no -// SP-X API reference to cite instead; the module's external authority is a product page. -// -// AND ONE ATTEMPT IS KNOWN TO HAVE REACHED SOMETHING. gunbc#10630 records a rotation attempt whose -// REST path answered "attempt to set previous password" against a policy-conforming secret -- a -// DECIDED response, so an endpoint exists, parses the field and applies a history policy to it. The -// request that produced it was never committed and cannot be recovered from any diff, which is -// filed as gunbc.recurring_failure_mode.ad_hoc_hardware_probe_produces_no_receipt. So the honest -// state is not "MegaRAC cannot rotate" -- it is "we have seen it answer and we cannot say how we -// asked". -fn rotation_route_for_family(family: BmcFirmwareFamily) -> BmcRotationRoute { - match family { - OpenBmc => RotationRouteRedfishAccountService { - transport_operation: decl_field_ref( - module_path: "extdeps.bmc.http", - decl_name: "redfish.Http", - field_name: "SetAccountPassword", - ), - action_shape: decl_field_ref( - module_path: "extdeps.bmc.types", - decl_name: "RedfishSystemAction", - field_name: "SetAccountPassword", - ), - } - AmiMegaRac => RotationRouteUnavailable { - family_note: "AMI MegaRAC serves an SP-X-style /api/ surface and no Redfish service root" as NonEmptyStr, - detail: "no executed user-management operation exists on extdeps.bmc.megarac, whose scope note admits an operation row only as executed; a rotation attempt has answered a password-history refusal, so an endpoint exists, but the request that reached it was never committed" as NonEmptyStr, - } - } -} - -// WHAT RETIRES THE UNAVAILABLE ARM, NAMED AS THE CAPABILITY RATHER THAN AS THE ROW IT WOULD ADD. -// Adding a megarac_op_user_password row is the ARTIFACT; the capability is an EXECUTED user- -// management request against a MegaRAC controller whose request shape and response are committed as -// evidence, which is what that module's own admission rule requires and what neither prior attempt -// produced. Until that exists the arm stays Unavailable. -// -// WHAT THAT DOES NOT YET MEAN, because the first draft said it did: this sentence previously read -// "and the Arrival phase stays unsatisfied for every MegaRAC unit". No unit's Arrival phase reads -// this table today -- BmcCredentialRotationObservation takes `rotation` as a SUPPLIED field -- so -// that was a claim about the terminal architecture in the present tense, the same DESIGN §4b(1) -// inflation corrected in gunbc.machine_intake_bmc_rotation_route. The Arrival consequence arrives -// with the actuator named in rotation_route_consumption_frontier, not with this row. -data megarac_rotation_route_frontier: DissolutionCondition = unbound_dissolution( - description: "dissolves when an executed MegaRAC user-management request against a live controller commits its request shape and response as evidence, so extdeps.bmc.megarac may roster the operation under its as-executed admission rule and this arm can return a route; NOT satisfied by authoring an operation row from AMI documentation, from the srv3/srv4 Redfish shape, or from the uncommitted attempt recorded in gunbc#10630" as NonEmptyStr, -) diff --git a/dag/gunbc/bmc_model.dag b/dag/gunbc/bmc_model.dag index 1df19736a6e..2bbb9af7cea 100644 --- a/dag/gunbc/bmc_model.dag +++ b/dag/gunbc/bmc_model.dag @@ -3,7 +3,8 @@ module gunbc.bmc_model import std.types { Bool, Int, List } import std.measure { Second, second, second_count } import v2.std.optional { Present, Absent } -import v2.std.algebra { filter } +import v2.std.algebra { any, filter } +import extdeps.bmc.ipmi_channel { IpmiUserId } import extdeps.bmc.ipmi_chassis_control { IpmiChassisControlAction, IpmiChassisPowerDown, IpmiChassisPowerUp, IpmiChassisPowerCycle, IpmiChassisHardReset, } @@ -72,13 +73,14 @@ type BmcWorld { booted_via_override: Bool sol_drop_after_boot: Second? web: BmcWebWorld + ipmi_users: List } fn bmc_world(power: BmcPower) -> BmcWorld { BmcWorld { power: power, pending: [], fired: [], boot_override: BootOverrideNone, sel: [], sol_session_open: false, cycle_off_interval: second(count: 5), host_booted_at: none, booted_via_override: false, sol_drop_after_boot: none, - web: bmc_web_world_untouched, + web: bmc_web_world_untouched, ipmi_users: [], } } @@ -146,7 +148,7 @@ fn bmc_with_power(world: BmcWorld, power: BmcPower) -> BmcWorld { power: power, pending: world.pending, fired: world.fired, boot_override: world.boot_override, sel: world.sel, sol_session_open: world.sol_session_open, cycle_off_interval: world.cycle_off_interval, host_booted_at: world.host_booted_at, booted_via_override: world.booted_via_override, sol_drop_after_boot: world.sol_drop_after_boot, - web: world.web, + web: world.web, ipmi_users: world.ipmi_users, } } @@ -155,7 +157,7 @@ fn bmc_with_web(world: BmcWorld, web: BmcWebWorld) -> BmcWorld { power: world.power, pending: world.pending, fired: world.fired, boot_override: world.boot_override, sel: world.sel, sol_session_open: world.sol_session_open, cycle_off_interval: world.cycle_off_interval, host_booted_at: world.host_booted_at, booted_via_override: world.booted_via_override, sol_drop_after_boot: world.sol_drop_after_boot, - web: web, + web: web, ipmi_users: world.ipmi_users, } } @@ -264,7 +266,7 @@ fn bmc_with_override(world: BmcWorld, over: BmcBootOverride) -> BmcWorld { power: world.power, pending: world.pending, fired: world.fired, boot_override: over, sel: world.sel, sol_session_open: world.sol_session_open, cycle_off_interval: world.cycle_off_interval, host_booted_at: world.host_booted_at, booted_via_override: world.booted_via_override, sol_drop_after_boot: world.sol_drop_after_boot, - web: world.web, + web: world.web, ipmi_users: world.ipmi_users, } } @@ -273,7 +275,7 @@ fn bmc_with_sol_session(world: BmcWorld, open: Bool) -> BmcWorld { power: world.power, pending: world.pending, fired: world.fired, boot_override: world.boot_override, sel: world.sel, sol_session_open: open, cycle_off_interval: world.cycle_off_interval, host_booted_at: world.host_booted_at, booted_via_override: world.booted_via_override, sol_drop_after_boot: world.sol_drop_after_boot, - web: world.web, + web: world.web, ipmi_users: world.ipmi_users, } } @@ -282,7 +284,7 @@ fn bmc_with_pending(world: BmcWorld, pending: List, fired: Li power: world.power, pending: pending, fired: fired, boot_override: world.boot_override, sel: world.sel, sol_session_open: world.sol_session_open, cycle_off_interval: world.cycle_off_interval, host_booted_at: world.host_booted_at, booted_via_override: world.booted_via_override, sol_drop_after_boot: world.sol_drop_after_boot, - web: world.web, + web: world.web, ipmi_users: world.ipmi_users, } } @@ -298,7 +300,7 @@ fn bmc_host_boots(world: BmcWorld, now: Second) -> BmcWorld { power: BmcPowerOn, pending: pending, fired: world.fired, boot_override: BootOverrideNone, sel: world.sel, sol_session_open: world.sol_session_open, cycle_off_interval: world.cycle_off_interval, host_booted_at: Present { value: now }, booted_via_override: via, sol_drop_after_boot: world.sol_drop_after_boot, - web: world.web, + web: world.web, ipmi_users: world.ipmi_users, } } @@ -399,10 +401,57 @@ fn bmc_with_sol_drop_after_boot(world: BmcWorld, after: Second) -> BmcWorld { power: world.power, pending: world.pending, fired: world.fired, boot_override: world.boot_override, sel: world.sel, sol_session_open: world.sol_session_open, cycle_off_interval: world.cycle_off_interval, host_booted_at: world.host_booted_at, booted_via_override: world.booted_via_override, sol_drop_after_boot: Present { value: after }, - web: world.web, + web: world.web, ipmi_users: world.ipmi_users, } } fn bmc_sol_drop_fired(world: BmcWorld) -> Bool { !all(world.fired, e => match e.event { BmcSolSessionDropped {} => false _ => true }) } + +// ── IPMI USER PASSWORD ─────────────────────────────────────────────────────────────────────────── +// +// THE CONTROLLER'S IPMI USER TABLE, AS FAR AS A PASSWORD WRITE TOUCHES IT. A world starts with no +// users, so every write against an untouched world is refused by construction. The transition is the +// Set User Password command of the public IPMI v2.0 specification (App NetFn, command 47h, operation +// "set password"): it addresses a user by id and replaces that user's password, and it changes +// nothing else. Whether the user is enabled or what privilege it holds is a separate command, so it is +// not changed here. A write to an id the table does not hold changes nothing and is not completed. +type BmcIpmiUser { + id: IpmiUserId + password: String +} + +type BmcIpmiSetUserPasswordStep { + world: BmcWorld + completed: Bool +} + +fn bmc_with_ipmi_users(world: BmcWorld, users: List) -> BmcWorld { + BmcWorld { + power: world.power, pending: world.pending, fired: world.fired, boot_override: world.boot_override, sel: world.sel, + sol_session_open: world.sol_session_open, cycle_off_interval: world.cycle_off_interval, + host_booted_at: world.host_booted_at, booted_via_override: world.booted_via_override, sol_drop_after_boot: world.sol_drop_after_boot, + web: world.web, ipmi_users: users, + } +} + +fn bmc_ipmi_set_user_password(world: BmcWorld, user: IpmiUserId, password: String) -> BmcIpmiSetUserPasswordStep { + if any(world.ipmi_users, u => (u.id as Int) == (user as Int)) { + BmcIpmiSetUserPasswordStep { + world: bmc_with_ipmi_users( + world: world, + users: map(world.ipmi_users, u => if (u.id as Int) == (user as Int) { BmcIpmiUser { id: u.id, password: password } } else { u }), + ), + completed: true, + } + } else { + BmcIpmiSetUserPasswordStep { world: world, completed: false } + } +} + +// Whether the controller would authenticate this user with this password: the readback a write is +// judged by, independent of the write's own completion. +fn bmc_ipmi_user_accepts(world: BmcWorld, user: IpmiUserId, password: String) -> Bool { + any(world.ipmi_users, u => (u.id as Int) == (user as Int) && u.password == password) +} diff --git a/dag/gunbc/machine_intake/bmc_rotation_route.dag b/dag/gunbc/machine_intake/bmc_rotation_route.dag index 62fe1e8c05e..ae4f93b6e06 100644 --- a/dag/gunbc/machine_intake/bmc_rotation_route.dag +++ b/dag/gunbc/machine_intake/bmc_rotation_route.dag @@ -1,117 +1,408 @@ module gunbc.machine_intake_bmc_rotation_route -import std.types { NonEmptyStr, String } +import std.types { Bool, NonEmptyStr, String } import std.disposition { Disposition, Terminal } import std.dissolution { DissolutionCondition, unbound_dissolution } -import gunbc.bmc_implementation_dispatch { - BmcRotationRoute, - RotationRouteRedfishAccountService, - RotationRouteUnavailable, -} +import std.decl_ref { DeclarationRef, decl_ref, decl_field_ref } +import std.content_hash { content_hash_of_value } +import extdeps.external_authority { ExternalAuthority } +import extdeps.bmc.endpoint { BmcControllerEndpoint } +import extdeps.bmc.capability { BmcFirmwareReleaseIdentity, bmc_firmware_release_identity_eq } +import extdeps.bmc.access_profile { BmcAccessSurface } +import extdeps.bmc.ipmi_channel { IpmiUserId } +import gunbc.machine_intake_receipt { EvidenceRef } import gunbc.machine_intake_bmc_secure { CredentialRotationApplication, AccountManagementUnavailable, } +import gunbc.auth.approval_capability { ProposeApprove, ProposeDeny } +import gunbc.auth.approval_broker { Redemption, RedemptionAdmitted, RedemptionRefused, redemption_refusal_reason } +import gunbc.bmc_model { BmcWorld, bmc_ipmi_set_user_password, bmc_ipmi_user_accepts } -// THIS ROW WAS A TYPE ERROR AND IT COMPILED ANYWAY (review 63271). It read -// `Disposition = SingleAuthority`, and SingleAuthority is an arm of ConstructionMechanism, not of -// Disposition -- which has exactly Terminal and Scaffold. Every other `: Disposition =` site in the -// corpus uses one of those two. -// -// THE REVIEW CALLED THE CONSEQUENCE "the module therefore does not compile". IT DOES COMPILE, and -// that is the worse finding rather than a lesser one. This session's own run resolved the closure -// containing this row and failed only on a wrong function name, and gunbc#10952 was green on all -// four required checks with the row present. The reason is a rostered below-floor defect: a wrong -// COPRODUCT value is accepted into a declared field with no diagnostic, while the same check fires -// for primitives and unresolved names. So the ordinary compiler floor -- "values inhabit declared -// types" (DESIGN §4b) -- did not hold, and a plainly wrong row rode four green checks. -// -// The value is Terminal because this module is not scaffolding: it holds one fold that binds a -// route to the application the adjudication refuses on, and there is no construction it dissolves -// into. data bmc_rotation_route_disposition: Disposition = Terminal { - reason: "The route-to-application binding is the terminal form: gunbc.bmc_implementation_dispatch decides the route by firmware family, and this module maps that route to the machine_intake CredentialRotationApplication the adjudication refuses on. Nothing here is staged pending a different construction." as NonEmptyStr, + reason: "The rotation route standing is the terminal form of the AccessDiscover route answer (docs/plans/managed-host-untangle.md, cut O1a): one sealed standing per controller and firmware build, bound to the evidence that grounds it, and the separate qualification effect that is the only crossing from a candidate to an executed-request grounding. It replaces the family-keyed rotation answer that gunbc.bmc_implementation_dispatch used to give; nothing here is staged pending a different construction." as NonEmptyStr, } -// BINDING A ROUTE TO THE APPLICATION THE ADJUDICATION REFUSES ON. The family-keyed dispatch that -// picks the route is NOT here: it is gunbc.bmc_implementation_dispatch rotation_route_for_family, -// alongside the three other family-keyed folds. +// ── THE ROUTE STANDING: one controller, one firmware build, the evidence ──────────────────────── // -// THE FIRST VERSION OF THIS MODULE OWNED THAT DISPATCH AND THAT WAS A FORK (review 63250). The -// block comment argued at length that a realization dispatch belongs peripheral to both extdeps -// modules rather than inside either -- which is correct DESIGN §3 reasoning and was the wrong -// conclusion, because the corpus had ALREADY built that peripheral home and the argument never -// mentioned it. gunbc.bmc_implementation_dispatch says of itself that a third implementation -// "refuses to compile here and nowhere else; that is the census", and a fourth `match family` over -// here falsified that sentence the moment it landed -- splitting the third-implementation census -// across two modules with no cross-reference between them. gunbc#9678 already paid for this exact -// fork once, in the other direction. +// WHY NOT A FAMILY-KEYED ANSWER. The answer this replaces matched on BmcFirmwareFamily and said +// "unavailable" for every AMI MegaRAC. Committed evidence contradicts a family-grain answer in both +// directions, and is exactly this and no wider: on mtcollins1 (MegaRAC 0.32) an IPMI Set User +// Password request was EXECUTED and answered successfully (artifacts/bmc/mtcollins1-bmc-user3-route- +// 2026-09-13.txt); on mtjade1 a Redfish Manager READ is committed, which proves a Redfish surface and +// proves no account write and no IPMI user-management request on that controller. So a route is a +// fact about ONE controller at ONE build, and an executed request on one controller authorizes +// nothing on another, even of the same family. // -// SO THE DISPATCH MOVED AND THE SPLIT IS AT THE LAYER BOUNDARY, not at a convenience line. What is -// keyed on BmcFirmwareFamily and cites only extdeps.bmc facts went to the dispatch home. What -// remains here is the part that is not family-keyed at all: mapping a route to a machine_intake -// CredentialRotationApplication. Hoisting that would make the peripheral dispatch module import -// machine_intake and invert the layering it exists to keep straight. +// THE ACCOUNT-WRITE REQUEST SHAPE, named as the request a route would make. IpmiSetUserPassword is +// the public IPMI v2.0 Set User Password command (App NetFn, command 47h) addressed to one user id, +// over the controller's IPMI LAN route; it is what mtcollins1 executed. RedfishAccountPasswordWrite +// names the modeled Redfish account-password operation and action shape by reference; on MegaRAC it +// is only ever a candidate today, because no AccountService write has been executed on any MegaRAC +// controller this repository has receipts for. +type BmcAccountWriteRequest + = IpmiSetUserPassword { user: IpmiUserId } + | RedfishAccountPasswordWrite { transport_operation: DeclarationRef, action_shape: DeclarationRef } + +// WHY A CANDIDATE IS WORTH TRYING. Either a surface was observed on THIS controller (the read surface +// and the receipt of the read), or a public standard defines the operation. Neither grounds a route: +// a surface read proves the surface answers reads, not that an account write over it succeeds. +type RouteCandidateEvidence + = ObservedSurfaceRead { surface: BmcAccessSurface, receipt: EvidenceRef } + | PublicStandardOperation { authority: ExternalAuthority } + +// THE FOUR STATES, in the plan's bootstrap order: RouteUngrounded -> RouteQualificationCandidate -> +// RouteGroundedByExecutedRequest, plus a route grounded by a source cited for this build. Only the +// two Grounded arms admit an ordinary rotation Apply (admit_rotation_apply). +type BmcRotationRouteGrounding + = RouteGroundedByExecutedRequest { request: BmcAccountWriteRequest, request_receipt: EvidenceRef, response_receipt: EvidenceRef } + | RouteGroundedByCitedSource { request: BmcAccountWriteRequest, citation: ExternalAuthority } + | RouteQualificationCandidate { request: BmcAccountWriteRequest, evidence: RouteCandidateEvidence } + | RouteUngrounded + +// SEALED: the endpoint and build are joined to their grounding only by the mints in this module, so +// no other module can pair one controller's executed request with another controller or build. The +// grounding coproduct itself is not sealed (sole_constructor is discarded on a coproduct right-hand +// side), which is why every consumer takes the STANDING, never a bare grounding. +type BmcRotationRouteStanding sole_constructor { + endpoint: BmcControllerEndpoint + firmware: BmcFirmwareReleaseIdentity + grounding: BmcRotationRouteGrounding +} + +// ── THE MINTS ─────────────────────────────────────────────────────────────────────────────────── + +// Nothing is known about this controller's account-write route. Open: it asserts nothing. +fn rotation_route_ungrounded(endpoint: BmcControllerEndpoint, firmware: BmcFirmwareReleaseIdentity) -> BmcRotationRouteStanding { + BmcRotationRouteStanding { endpoint: endpoint, firmware: firmware, grounding: RouteUngrounded } +} + +// A request worth qualifying, and why. Open: a candidate authorizes nothing by itself, and the only +// way out of it is qualify_rotation_route. +fn rotation_route_candidate( + endpoint: BmcControllerEndpoint, + firmware: BmcFirmwareReleaseIdentity, + request: BmcAccountWriteRequest, + evidence: RouteCandidateEvidence, +) -> BmcRotationRouteStanding { + BmcRotationRouteStanding { + endpoint: endpoint, + firmware: firmware, + grounding: RouteQualificationCandidate { request: request, evidence: evidence }, + } +} + +// A request that was EXECUTED on this controller and build before the qualification effect existed, +// with its committed request and response receipts. Admitted only to the unit evidence row that +// carries such a receipt; every new grounding goes through qualify_rotation_route. +fn rotation_route_from_committed_execution( + endpoint: BmcControllerEndpoint, + firmware: BmcFirmwareReleaseIdentity, + request: BmcAccountWriteRequest, + request_receipt: EvidenceRef, + response_receipt: EvidenceRef, +) -> BmcRotationRouteStanding + admit_callers: [ + decl_ref(module_path: "gunbc.machine_intake_bmc_rotation_route_evidence", decl_name: "mtcollins1_rotation_route_standing"), + ] +{ + BmcRotationRouteStanding { + endpoint: endpoint, + firmware: firmware, + grounding: RouteGroundedByExecutedRequest { request: request, request_receipt: request_receipt, response_receipt: response_receipt }, + } +} + +// A request grounded by a source cited FOR THIS BUILD. No such source exists for any controller this +// repository drives today, so the mint is admitted only to the witness that exercises the arm; a row +// citing a real build-scoped source is added to this list beside the row that cites it. +fn rotation_route_from_citation( + endpoint: BmcControllerEndpoint, + firmware: BmcFirmwareReleaseIdentity, + request: BmcAccountWriteRequest, + citation: ExternalAuthority, +) -> BmcRotationRouteStanding + admit_callers: [ + decl_ref(module_path: "test.claim.machine_intake_bmc_rotation_route_witness_test", decl_name: "a_cited_route_admits_apply_and_is_bound_to_its_build"), + ] +{ + BmcRotationRouteStanding { + endpoint: endpoint, + firmware: firmware, + grounding: RouteGroundedByCitedSource { request: request, citation: citation }, + } +} + +fn rotation_route_is_grounded(standing: BmcRotationRouteStanding) -> Bool { + match standing.grounding { + RouteGroundedByExecutedRequest { request: _, request_receipt: _, response_receipt: _ } => true + RouteGroundedByCitedSource { request: _, citation: _ } => true + RouteQualificationCandidate { request: _, evidence: _ } => false + RouteUngrounded => false + } +} + +fn account_write_request_text(request: BmcAccountWriteRequest) -> NonEmptyStr { + match request { + IpmiSetUserPassword { user: u } => join(["IPMI Set User Password (App 47h) user ", to_string(u as Int)], "") as NonEmptyStr + RedfishAccountPasswordWrite { transport_operation: op, action_shape: _ } => + join(["Redfish account password write via ", op.module_path as String, " ", op.decl_name as String], "") as NonEmptyStr + } +} + +// THE IDENTITY an approval for this controller, build and request must name. An approval for another +// controller, another build or another request is a different decision and is refused. +fn rotation_route_request_identity(standing: BmcRotationRouteStanding, request: BmcAccountWriteRequest) -> NonEmptyStr { + join( + [standing.endpoint.host as String, "|", standing.firmware.raw_version as String, "|", account_write_request_text(request: request) as String], + "", + ) as NonEmptyStr +} + +// ── THE ROUTE-QUALIFICATION EFFECT: the only crossing from candidate to executed grounding ────── // -// THE ROUTE IS KEYED ON AN OBSERVATION, NEVER ON AN EXPECTATION, and that constraint binds the -// caller of the dispatch rather than this fold. The family comes from a -// workflow-layer receipt -- for the held unit, gunbc.machine_intake_mtcollins1_access_observation, -// which carries family AmiMegaRac with committed raw bytes and a digest, and which established -// Redfish absence against a discriminating control: five Redfish paths refused over TLS while the -// same host answered 200 on its web root, so "no Redfish service" is separated from "host -// unreachable". extdeps.ampere.mt_collins_product_brief.bmc holds only an EXPECTATION and forbids -// its own promotion; nothing here may read it, and this module never takes a family from it. - -// THE REFUSAL IS PRODUCED BEFORE ANY CONTROLLER WRITE, WHICH IS THE WHOLE POINT OF PUTTING THE -// ROUTE AHEAD OF THE ATTEMPT. An unavailable route yields AccountManagementUnavailable, which -// gunbc.machine_intake_bmc_secure adjudicates into a typed, located BmcSecure refusal whose owner -// is derived rather than authored. It does not silently skip, and it is not filed as a hardware -// defect: bmc_secure_refusal_owner routes an access state to a PartsHold rather than to the return -// clock, because a firmware we cannot yet drive is not a defect of the unit the seller shipped. +// GROUNDING A ROUTE IS ITS OWN EFFECT, NOT THE APPLY. The rotation Apply consumes a grounded route, +// so it cannot produce the premise that admits it. Qualification is a separately authorized +// privileged effect: it is classified by executing gunbc.auth.authorization_pattern_selection +// select_authorization_pattern in gunbc.auth.privileged_effect_census (its row names this function), +// and the pattern that classification selects is an operator-approved capability per controller. So +// the effect takes a Redemption from gunbc.auth.approval_broker and refuses unless it is an admitted +// APPROVE whose authority is route qualification and whose request revision names this exact +// controller, build and request. An approval of the ROTATION is a different authority and does not +// qualify a route. +data route_qualification_authority: NonEmptyStr = "gunbc.bmc.rotation-route-qualification" as NonEmptyStr + +data rotation_apply_authority: NonEmptyStr = "gunbc.bmc.credential-rotation" as NonEmptyStr + +// WHAT THE REQUEST ANSWERED, minted only by a realization of the request. Sealed, so a caller cannot +// author a response the controller never gave and present it to qualify_rotation_route. The one +// realization in this cut is the dry one over gunbc.bmc_model BmcWorld; there is no live call and no +// workflow entry. The live realization is a second mint here, beside this one, and lands with the +// first per-controller operator go-ahead (route_qualification_live_frontier). +type RouteQualificationResponse sole_constructor { + request: BmcAccountWriteRequest + request_receipt: EvidenceRef + response_receipt: EvidenceRef + completed: Bool + readback_accepted: Bool +} + +type DryRouteQualificationStep { + world: BmcWorld + response: RouteQualificationResponse? +} + +// THE DRY REALIZATION. The request is the IPMI Set User Password transition of gunbc.bmc_model; the +// readback is that model's authentication of the same user with the same password, independent of +// the write's completion. The receipts digest the rendered request and response; the password is +// never rendered into either. A request the model does not carry (the Redfish account write: the +// model holds no Redfish account surface) yields no response, so the qualification refuses rather +// than reading a success from nothing. +fn dry_route_qualification_request(world: BmcWorld, request: BmcAccountWriteRequest, password: String) -> DryRouteQualificationStep { + match request { + RedfishAccountPasswordWrite { transport_operation: _, action_shape: _ } => DryRouteQualificationStep { world: world, response: none } + IpmiSetUserPassword { user: u } => { + let step = bmc_ipmi_set_user_password(world: world, user: u, password: password) + let accepted = bmc_ipmi_user_accepts(world: step.world, user: u, password: password) + let request_text = join(["dry ", account_write_request_text(request: request) as String, ", password length ", to_string(length(password))], "") as NonEmptyStr + let response_text = join( + [request_text as String, " -> completed=", if step.completed { "true" } else { "false" }, " readback=", if accepted { "accepted" } else { "refused" }], + "", + ) as NonEmptyStr + DryRouteQualificationStep { + world: step.world, + response: Present { + value: RouteQualificationResponse { + request: request, + request_receipt: EvidenceRef { label: request_text, digest: content_hash_of_value(value: request_text) }, + response_receipt: EvidenceRef { label: response_text, digest: content_hash_of_value(value: response_text) }, + completed: step.completed, + readback_accepted: accepted, + }, + }, + } + } + } +} + +type RouteQualificationRefusal + = QualificationSubjectNotACandidate + | QualificationApprovalRefused { cause: String } + | QualificationApprovalDenied + | QualificationApprovalForAnotherAuthority { authority: NonEmptyStr } + | QualificationApprovalForAnotherRequest { approved: NonEmptyStr, requested: NonEmptyStr } + | QualificationResponseForAnotherRequest + | QualificationRequestUnrealized + | QualificationRequestNotCompleted { response_receipt: EvidenceRef } + | QualificationReadbackRefused { response_receipt: EvidenceRef } + +type RouteQualificationOutcome + = RouteQualified { standing: BmcRotationRouteStanding } + | RouteQualificationRefused { standing: BmcRotationRouteStanding, cause: RouteQualificationRefusal } + +fn account_write_request_eq(a: BmcAccountWriteRequest, b: BmcAccountWriteRequest) -> Bool { + (account_write_request_text(request: a) as String) == (account_write_request_text(request: b) as String) +} + +fn qualification_approval_refusal(standing: BmcRotationRouteStanding, request: BmcAccountWriteRequest, approval: Redemption) -> RouteQualificationRefusal? { + match approval { + RedemptionRefused { cause: c } => Present { value: QualificationApprovalRefused { cause: redemption_refusal_reason(r: c) } } + RedemptionAdmitted { claims: cl, decided_by: _ } => + match cl.decision { + ProposeDeny => Present { value: QualificationApprovalDenied } + ProposeApprove => + if cl.authority != route_qualification_authority { + Present { value: QualificationApprovalForAnotherAuthority { authority: cl.authority } } + } else if cl.request_revision != rotation_route_request_identity(standing: standing, request: request) { + Present { value: QualificationApprovalForAnotherRequest { approved: cl.request_revision, requested: rotation_route_request_identity(standing: standing, request: request) } } + } else { + none + } + } + } +} + +// THE EFFECT'S DECISION over what the realization answered. Refuses, keeping the candidate, unless +// the subject is a candidate, the approval discharges this exact request, the response answers that +// request, the request completed, and the independent readback accepted. Only then does the standing +// become grounded by an executed request carrying the request and response receipts. +fn qualify_rotation_route( + standing: BmcRotationRouteStanding, + approval: Redemption, + response: RouteQualificationResponse?, +) -> RouteQualificationOutcome { + match standing.grounding { + RouteGroundedByExecutedRequest { request: _, request_receipt: _, response_receipt: _ } => + RouteQualificationRefused { standing: standing, cause: QualificationSubjectNotACandidate } + RouteGroundedByCitedSource { request: _, citation: _ } => + RouteQualificationRefused { standing: standing, cause: QualificationSubjectNotACandidate } + RouteUngrounded => RouteQualificationRefused { standing: standing, cause: QualificationSubjectNotACandidate } + RouteQualificationCandidate { request: req, evidence: _ } => + match qualification_approval_refusal(standing: standing, request: req, approval: approval) { + Present { value: refusal } => RouteQualificationRefused { standing: standing, cause: refusal } + Absent => + match response { + Absent => RouteQualificationRefused { standing: standing, cause: QualificationRequestUnrealized } + Present { value: r } => + if !account_write_request_eq(a: r.request, b: req) { + RouteQualificationRefused { standing: standing, cause: QualificationResponseForAnotherRequest } + } else if !r.completed { + RouteQualificationRefused { standing: standing, cause: QualificationRequestNotCompleted { response_receipt: r.response_receipt } } + } else if !r.readback_accepted { + RouteQualificationRefused { standing: standing, cause: QualificationReadbackRefused { response_receipt: r.response_receipt } } + } else { + RouteQualified { + standing: BmcRotationRouteStanding { + endpoint: standing.endpoint, + firmware: standing.firmware, + grounding: RouteGroundedByExecutedRequest { request: req, request_receipt: r.request_receipt, response_receipt: r.response_receipt }, + }, + } + } + } + } + } +} + +data route_qualification_live_frontier: DissolutionCondition = unbound_dissolution( + description: "dissolves when a live realization of the route-qualification request mints RouteQualificationResponse beside dry_route_qualification_request from a transport call against the controller, under that controller's own operator go-ahead redeemed through gunbc.auth.approval_broker, with request and response bytes committed as content-addressed evidence; NOT satisfied by the dry realization over gunbc.bmc_model BmcWorld, by a workflow entry that has not executed, or by a receipt that names no controller and build" as NonEmptyStr, +) + +// ── THE ORDINARY ROTATION APPLY CONSUMES ONLY A GROUNDED ROUTE ────────────────────────────────── // -// THE SENTENCE ABOVE IS ABOUT THE VALUE THIS FOLD RETURNS, NOT ABOUT ANY UNIT'S ARRIVAL PHASE, and -// the first draft of this block asserted the latter in the PRESENT TENSE (review 63236). It read -// "a unit whose firmware has no rotation transport FAILS ITS ARRIVAL PHASE and is never certified -// as secured". That is not true today and nothing here makes it true: BmcCredentialRotationObservation -// takes `rotation` as a SUPPLIED field, so no unit's arrival phase consults this table. The claim -// described the terminal architecture and wore the tense of the current one, which is DESIGN §4b(1) -// rung inflation -- the executed evidence is this module's witness fold and nothing else, and a -// sentence about arrival phases cited that evidence for a claim it does not support. - -// WHO CONSUMES THIS TABLE, AND BY WHAT ROUTE (DESIGN §3c). The only executing consumer of -// rotation_application_for_route is test.claim.machine_intake_bmc_rotation_route_witness_test, -// which exercises both arms rather than asserting they exist. That is the honest state and it is -// stated rather than left to be discovered, because a declaration whose consumption is described -// in a PR body and absent from the diff is exactly §3c's red. +// The admission the BmcSecure Apply (cut O1b) takes before any account write. The route is checked +// BEFORE the approval, so an ungrounded or candidate route refuses even beside a valid operator +// approval of the rotation: approving a rotation is not grounding a route. A route grounded on one +// controller or build refuses a write to another, so mtcollins1's executed IPMI route can never +// authorize mtjade1. +type RotationApplyAdmission + = RotationApplyAdmitted { standing: BmcRotationRouteStanding, request: BmcAccountWriteRequest, decided_by: NonEmptyStr } + | RotationApplyRouteNotGrounded { standing: BmcRotationRouteStanding } + | RotationApplyRouteForAnotherController { route_endpoint: BmcControllerEndpoint, target_endpoint: BmcControllerEndpoint } + | RotationApplyRouteForAnotherBuild { route_firmware: BmcFirmwareReleaseIdentity, target_firmware: BmcFirmwareReleaseIdentity } + | RotationApplyApprovalRefused { cause: String } + | RotationApplyApprovalForAnotherAuthority { authority: NonEmptyStr } + +fn grounded_request(standing: BmcRotationRouteStanding) -> BmcAccountWriteRequest? { + match standing.grounding { + RouteGroundedByExecutedRequest { request: r, request_receipt: _, response_receipt: _ } => Present { value: r } + RouteGroundedByCitedSource { request: r, citation: _ } => Present { value: r } + RouteQualificationCandidate { request: _, evidence: _ } => none + RouteUngrounded => none + } +} + +fn admit_rotation_apply( + standing: BmcRotationRouteStanding, + target_endpoint: BmcControllerEndpoint, + target_firmware: BmcFirmwareReleaseIdentity, + approval: Redemption, +) -> RotationApplyAdmission { + match grounded_request(standing: standing) { + Absent => RotationApplyRouteNotGrounded { standing: standing } + Present { value: request } => + if (standing.endpoint.host as String) != (target_endpoint.host as String) { + RotationApplyRouteForAnotherController { route_endpoint: standing.endpoint, target_endpoint: target_endpoint } + } else if !bmc_firmware_release_identity_eq(a: standing.firmware, b: target_firmware) { + RotationApplyRouteForAnotherBuild { route_firmware: standing.firmware, target_firmware: target_firmware } + } else { + match approval { + RedemptionRefused { cause: c } => RotationApplyApprovalRefused { cause: redemption_refusal_reason(r: c) } + RedemptionAdmitted { claims: cl, decided_by: by } => + match cl.decision { + ProposeDeny => RotationApplyApprovalRefused { cause: "the operator denied the rotation" } + ProposeApprove => + if cl.authority != rotation_apply_authority { + RotationApplyApprovalForAnotherAuthority { authority: cl.authority } + } else { + RotationApplyAdmitted { standing: standing, request: request, decided_by: by } + } + } + } + } + } +} + +// ── THE ADJUDICATION'S APPLICATION ARM, from the standing ────────────────────────────────────── // -// THE CLAIM IS A NAMED JOIN AND NOT AN ABSENCE, WHICH IS THE FORM THAT SURVIVES. An earlier draft -// opened this block with "Today: nobody in production" -- a live open-world negative with no -// producer that can re-derive it and no consumer whose addition contradicts it, so it would have -// gone silently false the moment an actuator landed. The sentence that replaced it names the -// consumer, and a named join is falsified MECHANICALLY when a caller appears, because its identity -// is reachable through the namespace tree. That is DESIGN §3's cite-the-symbol-rather-than-the- -// position rule applied to a claim about a population, and §3c asks for exactly this: name the -// consumer and the route, never assert the absence of consumers. +// An ungrounded or candidate route yields AccountManagementUnavailable naming the controller, build +// and state, which gunbc.machine_intake_bmc_secure adjudicates into a typed, located BmcSecure refusal +// before any controller write. A grounded route yields none: the application is what the actuator +// then does over it. // -// THIS IS THE ADMISSIBLE MIDDLE STATE -- consumed by a NAMED consumer landing in a NAMED later -// change -- and the trigger is stated here rather than borrowed from -// gunbc.bmc_implementation_dispatch megarac_rotation_route_frontier, which answers a different -// question: that row dissolves the UNAVAILABLE ARM and says nothing about whether any caller -// exists, so citing it for consumption would be one dissolution condition doing two jobs. (It was -// cited here as "the frontier below" until the arm it guards moved to the dispatch home, which is -// what DESIGN §3 means by naming the symbol rather than the position -- a positional citation is -// invalidated by an edit that never touches either end.) +// WHO CONSUMES THIS, AND BY WHAT ROUTE (DESIGN §3c). The executing consumer today is +// test.claim.machine_intake_bmc_rotation_route_witness_test; the named later consumer is the cut O1c +// arrival convergence, which derives the rotation field from this standing inside AccessDiscover +// rather than receiving it as a supplied argument (rotation_route_consumption_frontier). data rotation_route_consumption_frontier: DissolutionCondition = unbound_dissolution( - description: "dissolves when the effectful rotation actuator named in gunbc.machine_intake_bmc_secure -- the producer of BmcCredentialRotationObservation, gated on the gunbc.bmc_onboarding split -- derives the rotation field by calling rotation_application_for_route on the family read from the controller, rather than receiving it as a supplied argument; at that point a MegaRAC unit's Arrival phase genuinely fails on this table and the present-tense claim becomes authorable. NOT satisfied by this module typechecking, by the witness exercising both arms, or by any caller that passes a route it constructed itself rather than one this table returned" as NonEmptyStr, + description: "dissolves when the cut O1c arrival convergence (gunbc.machine_intake_arrival_converge) derives the BmcCredentialRotationObservation rotation field by calling rotation_application_for_standing on the route standing derived inside AccessDiscover for the controller and build it observed, rather than receiving rotation as a supplied argument; NOT satisfied by this module typechecking, by the witness exercising the arms, or by a caller that passes a standing for another controller or build" as NonEmptyStr, ) -fn rotation_application_for_route(route: BmcRotationRoute) -> CredentialRotationApplication? { - match route { - RotationRouteRedfishAccountService { transport_operation: _, action_shape: _ } => none - RotationRouteUnavailable { family_note: f, detail: d } => + +fn rotation_application_for_standing(standing: BmcRotationRouteStanding) -> CredentialRotationApplication? { + let subject = join([standing.endpoint.host as String, " at firmware ", standing.firmware.raw_version as String], "") + match standing.grounding { + RouteGroundedByExecutedRequest { request: _, request_receipt: _, response_receipt: _ } => none + RouteGroundedByCitedSource { request: _, citation: _ } => none + RouteQualificationCandidate { request: r, evidence: _ } => + Present { + value: AccountManagementUnavailable { + detail: join([subject, ": the account-write route is only a qualification candidate (", account_write_request_text(request: r) as String, "); no executed request or build-scoped citation grounds it"], "") as NonEmptyStr, + }, + } + RouteUngrounded => Present { value: AccountManagementUnavailable { - detail: join([f as String, ": ", d as String], "") as NonEmptyStr, + detail: join([subject, ": no account-write route is grounded for this controller and build"], "") as NonEmptyStr, }, } } } + +// The modeled Redfish account-password operation and action shape, by reference, for a candidate +// naming an observed Redfish surface. +fn redfish_account_password_write() -> BmcAccountWriteRequest { + RedfishAccountPasswordWrite { + transport_operation: decl_field_ref(module_path: "extdeps.bmc.http", decl_name: "redfish.Http", field_name: "SetAccountPassword"), + action_shape: decl_field_ref(module_path: "extdeps.bmc.types", decl_name: "RedfishSystemAction", field_name: "SetAccountPassword"), + } +} diff --git a/dag/gunbc/machine_intake/bmc_rotation_route_evidence.dag b/dag/gunbc/machine_intake/bmc_rotation_route_evidence.dag new file mode 100644 index 00000000000..af12bfd8bfa --- /dev/null +++ b/dag/gunbc/machine_intake/bmc_rotation_route_evidence.dag @@ -0,0 +1,104 @@ +module gunbc.machine_intake_bmc_rotation_route_evidence + +import std.types { NonEmptyStr, String } +import std.content_hash { Sha256Hash } +import std.content_hash { sha256_hex_digest } +import extdeps.bmc.endpoint { BmcControllerEndpoint } +import extdeps.bmc.capability { bmc_firmware_release_identity_of_wire } +import extdeps.bmc.access_profile { SurfaceManagerIdentity } +import extdeps.network.ipv4 { render_ipv4_address } +import gunbc.machine_intake_receipt { EvidenceRef } +import gunbc.machine_intake_bmc_first_contact_standing { FamilyObserved, FamilyUnobserved } +import gunbc.machine_intake_bmc_firmware_family_discriminator { discriminate_family, family_standing_from_discrimination } +import gunbc.machine_intake_mtjade1_factory_network { + ObservedBmcNetwork, BmcNetworkObservedStatic, BmcNetworkObservedDhcpLease, BmcNetworkUnobserved, +} +import gunbc.machine_intake_mtjade1_access_observation { + RecordedManagerIdentityObservation, RecordedManagerDecoded, RecordedManagerRefused, + read_mtjade1_recorded_manager_identity, +} +import gunbc.machine_intake_mtcollins1_access_observation { mtcollins1_endpoint, mtcollins1_firmware } +import gunbc.machine_intake_mtcollins1_bmc_secure_observation { mtcollins1_user3_route_evidence } +import gunbc.machine_intake_bmc_rotation_route { + BmcRotationRouteStanding, IpmiSetUserPassword, ObservedSurfaceRead, + rotation_route_candidate, rotation_route_from_committed_execution, redfish_account_password_write, +} + +// THE ROTATION ROUTE STANDING OF EACH CONTROLLER THIS FLEET HAS EVIDENCE FOR, derived from that +// evidence and nothing wider (docs/plans/managed-host-untangle.md, cut O1a). One function per unit, +// each reading only its own unit's committed receipts. A unit with no row has no route standing. + +// MTCOLLINS1 (192.168.1.228, AMI MegaRAC 0.32): GROUNDED BY AN EXECUTED REQUEST. Step (c) of the +// committed transcript set user 3's password with the IPMI Set User Password command, after the +// store round-trip, and the controller answered "Set User Password command successful"; step (d) +// then authenticated as that user over IPMI and the web API at the same address. The request and +// its response are both recorded in that one transcript, so both receipts name it: the transcript +// is the request receipt and the response receipt, at its committed digest. It is consumed for the +// same rotation by gunbc.machine_intake_mtcollins1_bmc_secure_observation as RotationApplied. +fn mtcollins1_rotation_route_standing() -> BmcRotationRouteStanding { + rotation_route_from_committed_execution( + endpoint: mtcollins1_endpoint, + firmware: mtcollins1_firmware, + request: IpmiSetUserPassword { user: 3 }, + request_receipt: mtcollins1_user3_route_evidence, + response_receipt: mtcollins1_user3_route_evidence, + ) +} + +// MTJADE1: AT MOST A CANDIDATE, AND ONLY WHEN ITS MANAGER READ BINDS. The committed Redfish +// GET /redfish/v1/Managers/Self proves the controller serves a Redfish Manager surface at the address +// it was read on and reports the firmware build it reports. It proves no AccountService write and no +// IPMI user-management request on this controller, so the standing is a qualification candidate for +// the Redfish account-password write naming that observed surface -- never grounded. The build is +// read from the capture (its FirmwareVersion) and the family from the same capture's discrimination, +// so a capture that does not decode, does not bind to this unit's observed link, or does not +// discriminate a family yields no standing rather than a stand-in. +fn mtjade1_observed_endpoint(network: ObservedBmcNetwork) -> BmcControllerEndpoint? { + match network { + BmcNetworkObservedStatic { address: a, prefix: _, gateway: _, link: _, basis: _ } => Present { value: BmcControllerEndpoint { host: render_ipv4_address(addr: a) } } + BmcNetworkObservedDhcpLease { address: a, prefix: _, basis: _ } => Present { value: BmcControllerEndpoint { host: render_ipv4_address(addr: a) } } + BmcNetworkUnobserved { discriminator: _ } => none + } +} + +fn manager_read_receipt(read: RecordedManagerIdentityObservation) -> EvidenceRef? { + match sha256_hex_digest(hex: read.capture_sha256 as String) { + Absent => none + Present { value: d } => Present { value: EvidenceRef { label: read.capture_path, digest: Sha256Hash(d) } } + } +} + +fn rotation_route_standing_from_manager_read(read: RecordedManagerIdentityObservation) -> BmcRotationRouteStanding? { + match read.decoded { + RecordedManagerRefused { gap: _ } => none + RecordedManagerDecoded { observation: o } => + match family_standing_from_discrimination(discrimination: discriminate_family(observation: o)) { + FamilyUnobserved { discriminator: _ } => none + FamilyObserved { family: f } => + if length(o.firmware_version) == 0 { + none + } else { + match mtjade1_observed_endpoint(network: read.endpoint) { + Absent => none + Present { value: endpoint } => + match manager_read_receipt(read: read) { + Absent => none + Present { value: receipt } => + Present { + value: rotation_route_candidate( + endpoint: endpoint, + firmware: bmc_firmware_release_identity_of_wire(family: f, wire: o.firmware_version as NonEmptyStr), + request: redfish_account_password_write(), + evidence: ObservedSurfaceRead { surface: SurfaceManagerIdentity, receipt: receipt }, + ), + } + } + } + } + } + } +} + +fn mtjade1_rotation_route_standing() -> BmcRotationRouteStanding? uses fs: std.resources.Filesystem { + rotation_route_standing_from_manager_read(read: read_mtjade1_recorded_manager_identity()) +} diff --git a/dag/test/claim/machine_intake/machine_intake_bmc_rotation_route_forged_probe_witness_test.dag b/dag/test/claim/machine_intake/machine_intake_bmc_rotation_route_forged_probe_witness_test.dag new file mode 100644 index 00000000000..a3a65886a93 --- /dev/null +++ b/dag/test/claim/machine_intake/machine_intake_bmc_rotation_route_forged_probe_witness_test.dag @@ -0,0 +1,62 @@ +module test.claim.machine_intake_bmc_rotation_route_forged_probe_witness + +import v2.std.algebra { filter } +import std.types { String, Bool, Int, List } +import v2.std.live_tree { LiveTreeDisposition, SubstrateInputsOnly } +import gunbc.compile_diagnostic_census { + CompileDiagnosticCensus, CompileDiagnosticCensusRow, CensusObserved, CensusNotRunnable, +} + +data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly + +// THE ROTATION ROUTE SEALS, ENROLLED AS EXECUTED REDS (cut O1a). The probe source below authors a +// grounded BmcRotationRouteStanding and a RouteQualificationResponse outside their module, and calls +// the committed-execution and citation mints from a caller neither admits. This witness hands that +// source to the compiler through the diagnostic-census harness and requires the refusal CLASS at each +// SUBJECT by name, so a probe refusing for any other reason measures another wall; the class-scoped +// control shows a clean source reading the same module through its real producer emits neither class. +data forged_probe_source: String = "module probe_rotation_route_forged\n\nimport std.types { Bool, NonEmptyStr }\nimport std.content_hash { content_hash_of_value }\nimport extdeps.uri { uri_https }\nimport extdeps.external_authority { ExternalAuthority }\nimport gunbc.machine_intake_receipt { EvidenceRef }\nimport gunbc.machine_intake_mtcollins1_access_observation { mtcollins1_endpoint, mtcollins1_firmware }\nimport gunbc.machine_intake_mtcollins1_bmc_secure_observation { mtcollins1_user3_route_evidence }\nimport gunbc.machine_intake_bmc_rotation_route {\n BmcRotationRouteStanding, RouteQualificationResponse, IpmiSetUserPassword, RouteGroundedByExecutedRequest,\n rotation_route_from_committed_execution, rotation_route_from_citation,\n}\n\nfn forged_grounded_standing() -> BmcRotationRouteStanding {\n BmcRotationRouteStanding {\n endpoint: mtcollins1_endpoint,\n firmware: mtcollins1_firmware,\n grounding: RouteGroundedByExecutedRequest { request: IpmiSetUserPassword { user: 3 }, request_receipt: mtcollins1_user3_route_evidence, response_receipt: mtcollins1_user3_route_evidence },\n }\n}\n\nfn forged_response() -> RouteQualificationResponse {\n RouteQualificationResponse {\n request: IpmiSetUserPassword { user: 3 },\n request_receipt: mtcollins1_user3_route_evidence,\n response_receipt: mtcollins1_user3_route_evidence,\n completed: true,\n readback_accepted: true,\n }\n}\n\nfn forged_committed_execution() -> BmcRotationRouteStanding {\n rotation_route_from_committed_execution(\n endpoint: mtcollins1_endpoint,\n firmware: mtcollins1_firmware,\n request: IpmiSetUserPassword { user: 3 },\n request_receipt: mtcollins1_user3_route_evidence,\n response_receipt: mtcollins1_user3_route_evidence,\n )\n}\n\nfn forged_citation() -> BmcRotationRouteStanding {\n rotation_route_from_citation(\n endpoint: mtcollins1_endpoint,\n firmware: mtcollins1_firmware,\n request: IpmiSetUserPassword { user: 3 },\n citation: ExternalAuthority { uri: uri_https(locator: \"example.invalid/forged\") },\n )\n}\n" + +data harness_control_source: String = "module probe_rotation_route_harness_control\nimport gunbc.machine_intake_bmc_rotation_route { BmcRotationRouteStanding }\nimport gunbc.machine_intake_bmc_rotation_route_evidence { mtcollins1_rotation_route_standing }\nfn standing() -> BmcRotationRouteStanding { mtcollins1_rotation_route_standing() }\n" + +fn probe() -> CompileDiagnosticCensus { + compile_dag_diagnostic_census(forged_probe_source) +} + +fn blocking_count_for_class_and_subject(c: CompileDiagnosticCensus, wanted: String, subject: String) -> Int { + match c { + CensusNotRunnable { cause: _ } => -1 + CensusObserved { rows: rows } => + rows + |> filter(r => (r.diagnostic_class as String) == wanted && r.subject_name == subject && r.blocking) + |> fold(init: 0, f: (acc, r) => acc + r.count) + } +} + +fn blocking_count_for_class(c: CompileDiagnosticCensus, wanted: String) -> Int { + match c { + CensusNotRunnable { cause: _ } => -1 + CensusObserved { rows: rows } => + rows |> filter(r => (r.diagnostic_class as String) == wanted && r.blocking) |> fold(init: 0, f: (acc, r) => acc + r.count) + } +} + +test fn the_harness_runs_and_a_clean_source_emits_neither_wall_class() -> Bool { + let c = compile_dag_diagnostic_census(harness_control_source) + blocking_count_for_class(c: c, wanted: "SoleConstructorViolation") == 0 + && blocking_count_for_class(c: c, wanted: "ConstructorCallAdmissionRefused") == 0 +} + +// A grounded standing and a qualification response cannot be authored outside their module. +test fn a_forged_route_standing_and_response_are_refused_at_their_literals() -> Bool { + let c = probe() + blocking_count_for_class_and_subject(c: c, wanted: "SoleConstructorViolation", subject: "BmcRotationRouteStanding") >= 1 + && blocking_count_for_class_and_subject(c: c, wanted: "SoleConstructorViolation", subject: "RouteQualificationResponse") >= 1 +} + +// The committed-execution and citation mints refuse a caller outside their admitted roots. +test fn the_grounding_mints_refuse_an_outside_caller() -> Bool { + let c = probe() + blocking_count_for_class_and_subject(c: c, wanted: "ConstructorCallAdmissionRefused", subject: "rotation_route_from_committed_execution") >= 1 + && blocking_count_for_class_and_subject(c: c, wanted: "ConstructorCallAdmissionRefused", subject: "rotation_route_from_citation") >= 1 +} diff --git a/dag/test/claim/machine_intake/machine_intake_bmc_rotation_route_witness_test.dag b/dag/test/claim/machine_intake/machine_intake_bmc_rotation_route_witness_test.dag index d0291509384..5fec06346f2 100644 --- a/dag/test/claim/machine_intake/machine_intake_bmc_rotation_route_witness_test.dag +++ b/dag/test/claim/machine_intake/machine_intake_bmc_rotation_route_witness_test.dag @@ -1,97 +1,352 @@ module test.claim.machine_intake_bmc_rotation_route_witness_test -import std.types { Bool, NonEmptyStr } -import std.decl_ref { NamedField, decl_field_eq } -import v2.std.live_tree { LiveTreeDisposition, SubstrateInputsOnly } -import extdeps.bmc.endpoint { OpenBmc, AmiMegaRac } +import std.types { Bool, NonEmptyStr, String, Timestamp } +import std.scoped_authorization { AttemptIdentity } +import std.content_hash { content_hash_of_value } +import v2.std.live_tree { LiveTreeDisposition, ReadsLiveTree } +import v2.std.algebra { filter, length } +import extdeps.uri { uri_https } +import extdeps.external_authority { ExternalAuthority } +import extdeps.crypto.mac { MacKeyId } +import extdeps.bmc.endpoint { AmiMegaRac, OpenBmc, BmcControllerEndpoint } +import extdeps.bmc.capability { BmcFirmwareReleaseIdentity, bmc_firmware_release_identity_of_wire } +import extdeps.bmc.access_profile { SurfaceManagerIdentity, SurfaceAccountManagement } +import gunbc.machine_intake_receipt { EvidenceRef } import gunbc.machine_intake_bmc_secure { - CredentialRotationApplication, AccountManagementUnavailable, - RotationApplied, RotationNotAttempted, + CredentialRotationApplication, AccountManagementUnavailable, RotationApplied, RotationNotAttempted, } -import gunbc.bmc_implementation_dispatch { - BmcRotationRoute, RotationRouteRedfishAccountService, RotationRouteUnavailable, - rotation_route_for_family, +import gunbc.auth.approval_capability { ApprovalCapabilityClaims, ProposeApprove, approval_capability_protocol } +import gunbc.auth.approval_broker { Redemption, RedemptionAdmitted } +import gunbc.auth.authorization_pattern_selection { OperatorApprovedCapability, PatternSelected, select_authorization_pattern } +import gunbc.auth.privileged_effect_census { Conforms, privileged_effect_census, site_verdict } +import gunbc.bmc_model { BmcWorld, BmcIpmiUser, BmcPowerOn, bmc_world, bmc_with_ipmi_users, bmc_ipmi_user_accepts } +import gunbc.machine_intake_mtcollins1_access_observation { mtcollins1_endpoint, mtcollins1_firmware } +import gunbc.machine_intake_mtcollins1_bmc_secure_observation { mtcollins1_user3_route_digest } +import gunbc.machine_intake_mtjade1_access_observation { read_mtjade1_recorded_manager_identity } +import gunbc.machine_intake_bmc_rotation_route { + BmcRotationRouteStanding, BmcAccountWriteRequest, IpmiSetUserPassword, RedfishAccountPasswordWrite, + ObservedSurfaceRead, PublicStandardOperation, + RouteGroundedByExecutedRequest, RouteGroundedByCitedSource, RouteQualificationCandidate, RouteUngrounded, + RouteQualified, RouteQualificationRefused, + QualificationSubjectNotACandidate, QualificationApprovalRefused, QualificationApprovalDenied, + QualificationApprovalForAnotherAuthority, QualificationApprovalForAnotherRequest, + QualificationResponseForAnotherRequest, QualificationRequestUnrealized, + QualificationRequestNotCompleted, QualificationReadbackRefused, + RotationApplyAdmitted, RotationApplyRouteNotGrounded, RotationApplyRouteForAnotherController, + RotationApplyRouteForAnotherBuild, RotationApplyApprovalRefused, RotationApplyApprovalForAnotherAuthority, + route_qualification_authority, rotation_apply_authority, + rotation_route_ungrounded, rotation_route_candidate, rotation_route_from_citation, + rotation_route_request_identity, rotation_route_is_grounded, + dry_route_qualification_request, qualify_rotation_route, admit_rotation_apply, + rotation_application_for_standing, redfish_account_password_write, +} +import gunbc.machine_intake_bmc_rotation_route_evidence { + mtcollins1_rotation_route_standing, mtjade1_rotation_route_standing, rotation_route_standing_from_manager_read, +} + +data live_tree_disposition: LiveTreeDisposition = ReadsLiveTree + +// ── supplied values at the approval boundary ──────────────────────────────────────────────────── +// The approval is SUPPLIED as an admitted Redemption (gunbc.auth.approval_broker); its own producer +// and every refusal it makes are witnessed in test.claim.approval_broker_witness_test. What these +// claims discriminate is which authority and which request revision the route admission reads. +fn approval(authority: NonEmptyStr, revision: NonEmptyStr) -> Redemption { + RedemptionAdmitted { + claims: ApprovalCapabilityClaims { + protocol: approval_capability_protocol, + issuer: "gunbc-approval-broker" as NonEmptyStr, + audience: "srv1" as NonEmptyStr, + authority: authority, + escalation_id: "route-witness-1" as NonEmptyStr, + request_revision: revision, + decision: ProposeApprove, + attempt: "attempt-1" as AttemptIdentity, + issued_at: "2026-10-03T00:00:00Z", + expires_at: "2026-10-03T00:15:00Z", + key_id: "broker-2026-10" as MacKeyId, + }, + decided_by: "operator" as NonEmptyStr, + } +} + +fn rotation_approval() -> Redemption { + approval(authority: rotation_apply_authority, revision: "rotate" as NonEmptyStr) +} + +// A synthetic MegaRAC controller and build for the qualification bootstrap; no unit row is made from +// it, so the dry run grounds nothing any production consumer reads. +data lab_endpoint: BmcControllerEndpoint = BmcControllerEndpoint { host: "198.51.100.7" } + +fn lab_firmware() -> BmcFirmwareReleaseIdentity { + bmc_firmware_release_identity_of_wire(family: AmiMegaRac, wire: "0.32" as NonEmptyStr) +} + +data lab_surface_receipt: EvidenceRef = EvidenceRef { + label: "lab IPMI user list read", + digest: content_hash_of_value(value: "lab IPMI user list read" as NonEmptyStr), +} + +fn lab_candidate(request: BmcAccountWriteRequest) -> BmcRotationRouteStanding { + rotation_route_candidate( + endpoint: lab_endpoint, + firmware: lab_firmware(), + request: request, + evidence: ObservedSurfaceRead { surface: SurfaceAccountManagement, receipt: lab_surface_receipt }, + ) } -import gunbc.machine_intake_bmc_rotation_route { rotation_application_for_route } -data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly +fn lab_world_with_user3() -> BmcWorld { + bmc_with_ipmi_users(world: bmc_world(power: BmcPowerOn), users: [BmcIpmiUser { id: 3, password: "factory" }]) +} -// THE DISCRIMINATING PAIR. Both arms are exercised against the SAME fold, because a witness that -// only ever asks the unavailable arm cannot tell a correct route table from one that refuses -// everything -- and refusing everything would also make a MegaRAC unit fail Arrival, for the wrong -// reason, invisibly. +fn qualification_approval_for(standing: BmcRotationRouteStanding, request: BmcAccountWriteRequest) -> Redemption { + approval(authority: route_qualification_authority, revision: rotation_route_request_identity(standing: standing, request: request)) +} -test fn megarac_has_no_rotation_route_today() -> Bool { - match rotation_route_for_family(family: AmiMegaRac) { - RotationRouteUnavailable { family_note: _, detail: _ } => true - RotationRouteRedfishAccountService { transport_operation: _, action_shape: _ } => false +fn qualify_lab(world: BmcWorld, request: BmcAccountWriteRequest, approval_value: Redemption) -> BmcRotationRouteStanding? { + let candidate = lab_candidate(request: request) + match qualify_rotation_route(standing: candidate, approval: approval_value, response: dry_route_qualification_request(world: world, request: request, password: "new-Secret!1").response) { + RouteQualified { standing: s } => Present { value: s } + RouteQualificationRefused { standing: _, cause: _ } => none } } -test fn openbmc_routes_to_redfish_account_service() -> Bool { - match rotation_route_for_family(family: OpenBmc) { - RotationRouteRedfishAccountService { transport_operation: _, action_shape: _ } => true - RotationRouteUnavailable { family_note: _, detail: _ } => false +fn refusal_of(world: BmcWorld, request: BmcAccountWriteRequest, approval_value: Redemption) -> String { + let candidate = lab_candidate(request: request) + match qualify_rotation_route(standing: candidate, approval: approval_value, response: dry_route_qualification_request(world: world, request: request, password: "new-Secret!1").response) { + RouteQualified { standing: _ } => "qualified" + RouteQualificationRefused { standing: _, cause: c } => + match c { + QualificationSubjectNotACandidate => "not-a-candidate" + QualificationApprovalRefused { cause: _ } => "approval-refused" + QualificationApprovalDenied => "approval-denied" + QualificationApprovalForAnotherAuthority { authority: _ } => "another-authority" + QualificationApprovalForAnotherRequest { approved: _, requested: _ } => "another-request" + QualificationResponseForAnotherRequest => "response-for-another-request" + QualificationRequestUnrealized => "unrealized" + QualificationRequestNotCompleted { response_receipt: _ } => "not-completed" + QualificationReadbackRefused { response_receipt: _ } => "readback-refused" + } } } -// THE AVAILABLE ARM'S PAYLOAD IS READ, NOT MERELY CARRIED. Review 63263 found the arm holding a -// prose path_note that no consumer touched -- dead data by §4c's own test. Replacing the sentence -// with DeclarationRefs only fixes half of that: a reference nothing reads is still unconsumed. So -// the witness destructures the arm and asserts the operation it names. -// -// AND THE FIRST VERSION OF THIS CHECK DID NOT CHECK THE OPERATION (review 63271). It asserted -// module_path and decl_name on both refs and never touched `field` -- which is the ONLY position -// the operation name lives in. So a table returning NamedField { field_name: "DeleteAccount" } -// would have GREENED, while the comment above it claimed a wrong operation would red. That is a -// check whose subject is narrower than its stated claim, which is the §4b(1) inflation this PR has -// now corrected three times in three different rows: the claim must equal what the evidence -// executes. The field is now compared through std.decl_ref decl_field_eq, so the assertion and the -// sentence describe the same test. -// -// AND THE FIRST FIX RE-INVENTED THE COMPARISON IT NEEDED (review 63521). It hand-rolled a -// decl_field_name fold over DeclField when std.decl_ref already owns decl_field_eq, whose module -// states the rule in its own annotation: a module needing a DeclarationRef imports the constructor -// from the type's own module and never re-mints it. DESIGN §2 -- net concepts must not grow by -// re-invention. The WholeDeclaration arm compounded it by returning "" , a fabricated plausible -// value where the canonical surface refuses to conflate the two shapes (§5); it compared false and -// stayed fail-closed here, which was luck of the call site rather than a property of the helper. - -test fn the_openbmc_route_names_the_set_account_password_operation() -> Bool { - match rotation_route_for_family(family: OpenBmc) { - RotationRouteRedfishAccountService { transport_operation: op, action_shape: act } => - op.module_path == "extdeps.bmc.http" - && op.decl_name == "redfish.Http" - && decl_field_eq(a: op.field, b: NamedField { field_name: "SetAccountPassword" as NonEmptyStr }) - && act.module_path == "extdeps.bmc.types" - && act.decl_name == "RedfishSystemAction" - && decl_field_eq(a: act.field, b: NamedField { field_name: "SetAccountPassword" as NonEmptyStr }) - RotationRouteUnavailable { family_note: _, detail: _ } => false +fn apply_verdict(standing: BmcRotationRouteStanding, target: BmcControllerEndpoint, firmware: BmcFirmwareReleaseIdentity, approval_value: Redemption) -> String { + match admit_rotation_apply(standing: standing, target_endpoint: target, target_firmware: firmware, approval: approval_value) { + RotationApplyAdmitted { standing: _, request: _, decided_by: _ } => "admitted" + RotationApplyRouteNotGrounded { standing: _ } => "route-not-grounded" + RotationApplyRouteForAnotherController { route_endpoint: _, target_endpoint: _ } => "another-controller" + RotationApplyRouteForAnotherBuild { route_firmware: _, target_firmware: _ } => "another-build" + RotationApplyApprovalRefused { cause: _ } => "approval-refused" + RotationApplyApprovalForAnotherAuthority { authority: _ } => "another-authority" } } -// THE ARM THAT MATTERS FOR SAFETY: an unavailable route must yield the application arm the -// adjudication refuses on, so a MegaRAC unit cannot reach a controller write at all. A route table -// that returned `none` here would let the caller proceed with RotationNotAttempted and adjudicate -// into a DIFFERENT refusal, which would read as "nobody tried" rather than "there is no way to try". -test fn an_unavailable_route_yields_account_management_unavailable() -> Bool { - match rotation_application_for_route(route: rotation_route_for_family(family: AmiMegaRac)) { - Present { value: app } => - match app { - AccountManagementUnavailable { detail: _ } => true - RotationApplied { reference: _, applied_at: _, evidence: _ } => false - RotationNotAttempted => false - } +fn grounding_kind(standing: BmcRotationRouteStanding) -> String { + match standing.grounding { + RouteGroundedByExecutedRequest { request: _, request_receipt: _, response_receipt: _ } => "executed" + RouteGroundedByCitedSource { request: _, citation: _ } => "cited" + RouteQualificationCandidate { request: _, evidence: _ } => "candidate" + RouteUngrounded => "ungrounded" + } +} + +// ── rows from evidence ────────────────────────────────────────────────────────────────────────── + +// mtcollins1 is grounded by its executed IPMI Set User Password on user 3, bound to its own +// controller and build, with both receipts naming the committed transcript at its digest. +test fn mtcollins1_is_grounded_by_its_executed_ipmi_request() -> Bool { + let s = mtcollins1_rotation_route_standing() + (s.endpoint.host as String) == "192.168.1.228" + && (s.firmware.raw_version as String) == "0.32" + && match s.grounding { + RouteGroundedByExecutedRequest { request: r, request_receipt: q, response_receipt: p } => + match r { + IpmiSetUserPassword { user: u } => (u as Int) == 3 + RedfishAccountPasswordWrite { transport_operation: _, action_shape: _ } => false + } + && q.digest == mtcollins1_user3_route_digest + && p.digest == mtcollins1_user3_route_digest + RouteGroundedByCitedSource { request: _, citation: _ } => false + RouteQualificationCandidate { request: _, evidence: _ } => false + RouteUngrounded => false + } +} + +// mtjade1 is at most a candidate: the committed Manager read (the real path: read, hashed, decoded, +// bound to the unit's link, discriminated) yields a candidate naming the observed Manager surface and +// the build the capture reports, and never a grounded route. +test fn mtjade1_is_a_candidate_naming_its_observed_redfish_manager_surface() -> Bool { + match mtjade1_rotation_route_standing() { + Absent => false + Present { value: s } => + (s.endpoint.host as String) == "10.0.7.2" + && (s.firmware.raw_version as String) == "2.11.104000" + && !rotation_route_is_grounded(standing: s) + && match s.grounding { + RouteQualificationCandidate { request: r, evidence: e } => + match r { + RedfishAccountPasswordWrite { transport_operation: _, action_shape: _ } => true + IpmiSetUserPassword { user: _ } => false + } + && match e { + ObservedSurfaceRead { surface: sf, receipt: _ } => match sf { SurfaceManagerIdentity => true _ => false } + PublicStandardOperation { authority: _ } => false + } + RouteGroundedByExecutedRequest { request: _, request_receipt: _, response_receipt: _ } => false + RouteGroundedByCitedSource { request: _, citation: _ } => false + RouteUngrounded => false + } + } +} + +// CONTROL: two AmiMegaRac controllers with different observed and executed surfaces produce +// different route standings. Same family, different grounding: a family-keyed answer cannot pass. +test fn two_megarac_controllers_with_different_surfaces_have_different_standings() -> Bool { + match mtjade1_rotation_route_standing() { Absent => false + Present { value: jade } => + let collins = mtcollins1_rotation_route_standing() + collins.firmware.family == AmiMegaRac + && jade.firmware.family == AmiMegaRac + && grounding_kind(standing: collins) == "executed" + && grounding_kind(standing: jade) == "candidate" } } -// AND THE POSITIVE CONTROL ON THAT SAME FOLD: a route that EXISTS must not manufacture a refusal. -// Without this, an implementation that returned AccountManagementUnavailable unconditionally would -// pass the test above and silently block the OpenBMC fleet too. -test fn an_available_route_yields_no_refusal_application() -> Bool { - match rotation_application_for_route(route: rotation_route_for_family(family: OpenBmc)) { - Absent => true - Present { value: _ } => false +// CONTROL: a Manager GET alone cannot construct an account-write route. The only standing the +// Manager read can produce is a candidate; the rotation Apply refuses it even beside an operator +// approval of the rotation, and the adjudication's application arm is AccountManagementUnavailable. +test fn a_manager_get_alone_cannot_construct_an_account_write_route() -> Bool { + match rotation_route_standing_from_manager_read(read: read_mtjade1_recorded_manager_identity()) { + Absent => false + Present { value: s } => + !rotation_route_is_grounded(standing: s) + && apply_verdict(standing: s, target: s.endpoint, firmware: s.firmware, approval_value: rotation_approval()) == "route-not-grounded" + && match rotation_application_for_standing(standing: s) { + Present { value: app } => match app { + AccountManagementUnavailable { detail: _ } => true + RotationApplied { reference: _, applied_at: _, evidence: _ } => false + RotationNotAttempted => false + } + Absent => false + } + } +} + +// CONTROL: RouteUngrounded + operator approval of the rotation + an ordinary Apply -> refused, and +// refused for the ROUTE. Positive control on the same fold: mtcollins1's grounded route with the same +// approval, aimed at its own controller and build, is admitted. +test fn an_ungrounded_route_with_rotation_approval_is_refused_and_a_grounded_one_is_admitted() -> Bool { + let ungrounded = rotation_route_ungrounded(endpoint: mtcollins1_endpoint, firmware: mtcollins1_firmware) + apply_verdict(standing: ungrounded, target: mtcollins1_endpoint, firmware: mtcollins1_firmware, approval_value: rotation_approval()) == "route-not-grounded" + && apply_verdict(standing: mtcollins1_rotation_route_standing(), target: mtcollins1_endpoint, firmware: mtcollins1_firmware, approval_value: rotation_approval()) == "admitted" +} + +// An IPMI route grounded on mtcollins1 does not authorize mtjade1, nor mtcollins1 at another build, +// nor a write approved under the route-qualification authority instead of the rotation's. +test fn mtcollins1s_grounded_route_does_not_authorize_another_controller_build_or_authority() -> Bool { + match mtjade1_rotation_route_standing() { + Absent => false + Present { value: jade } => + let collins = mtcollins1_rotation_route_standing() + apply_verdict(standing: collins, target: jade.endpoint, firmware: jade.firmware, approval_value: rotation_approval()) == "another-controller" + && apply_verdict(standing: collins, target: mtcollins1_endpoint, firmware: bmc_firmware_release_identity_of_wire(family: AmiMegaRac, wire: "0.33" as NonEmptyStr), approval_value: rotation_approval()) == "another-build" + && apply_verdict(standing: collins, target: mtcollins1_endpoint, firmware: mtcollins1_firmware, approval_value: approval(authority: route_qualification_authority, revision: "rotate" as NonEmptyStr)) == "another-authority" + } +} + +// ── the qualification bootstrap, over the dry realization ─────────────────────────────────────── + +// Candidate -> grounded by executed request, crossed by the qualification effect alone: the approval +// names route qualification and this exact controller, build and request; the dry Set User Password +// completes and the independent readback accepts the new password. The grounded standing carries the +// dry request and response receipts, and is then admitted for an ordinary rotation Apply. +test fn the_qualification_effect_grounds_a_candidate_from_its_request_and_response() -> Bool { + let request = IpmiSetUserPassword { user: 3 } + let step = dry_route_qualification_request(world: lab_world_with_user3(), request: request, password: "new-Secret!1") + bmc_ipmi_user_accepts(world: step.world, user: 3, password: "new-Secret!1") + && !bmc_ipmi_user_accepts(world: step.world, user: 3, password: "factory") + && match qualify_lab(world: lab_world_with_user3(), request: request, approval_value: qualification_approval_for(standing: lab_candidate(request: request), request: request)) { + Absent => false + Present { value: s } => + grounding_kind(standing: s) == "executed" + && (s.endpoint.host as String) == (lab_endpoint.host as String) + && apply_verdict(standing: s, target: lab_endpoint, firmware: lab_firmware(), approval_value: rotation_approval()) == "admitted" + } +} + +// Every way across that is not the qualification effect over a completed, read-back request +// approved for exactly this request, refuses and keeps the candidate. +test fn the_qualification_effect_refuses_every_other_crossing() -> Bool { + let ipmi = IpmiSetUserPassword { user: 3 } + let right = qualification_approval_for(standing: lab_candidate(request: ipmi), request: ipmi) + refusal_of(world: lab_world_with_user3(), request: ipmi, approval_value: rotation_approval()) == "another-authority" + && refusal_of(world: lab_world_with_user3(), request: ipmi, approval_value: approval(authority: route_qualification_authority, revision: "another controller" as NonEmptyStr)) == "another-request" + && refusal_of(world: bmc_world(power: BmcPowerOn), request: ipmi, approval_value: right) == "not-completed" + && refusal_of(world: lab_world_with_user3(), request: redfish_account_password_write(), approval_value: qualification_approval_for(standing: lab_candidate(request: redfish_account_password_write()), request: redfish_account_password_write())) == "unrealized" + && match qualify_rotation_route( + standing: rotation_route_ungrounded(endpoint: lab_endpoint, firmware: lab_firmware()), + approval: right, + response: dry_route_qualification_request(world: lab_world_with_user3(), request: ipmi, password: "x").response, + ) { + RouteQualificationRefused { standing: _, cause: c } => match c { QualificationSubjectNotACandidate => true _ => false } + RouteQualified { standing: _ } => false + } + && match qualify_rotation_route( + standing: lab_candidate(request: ipmi), + approval: right, + response: dry_route_qualification_request(world: lab_world_with_user3(), request: IpmiSetUserPassword { user: 4 }, password: "x").response, + ) { + RouteQualificationRefused { standing: _, cause: c } => match c { QualificationResponseForAnotherRequest => true _ => false } + RouteQualified { standing: _ } => false + } +} + +// THE CITED ARM: a route grounded by a source cited for this build admits an Apply on that build and +// refuses the same controller at another build. +test fn a_cited_route_admits_apply_and_is_bound_to_its_build() -> Bool { + let s = rotation_route_from_citation( + endpoint: lab_endpoint, + firmware: lab_firmware(), + request: IpmiSetUserPassword { user: 3 }, + citation: ExternalAuthority { uri: uri_https(locator: "example.invalid/route-witness-citation" as NonEmptyStr) }, + ) + grounding_kind(standing: s) == "cited" + && apply_verdict(standing: s, target: lab_endpoint, firmware: lab_firmware(), approval_value: rotation_approval()) == "admitted" + && apply_verdict(standing: s, target: lab_endpoint, firmware: bmc_firmware_release_identity_of_wire(family: AmiMegaRac, wire: "0.33" as NonEmptyStr), approval_value: rotation_approval()) == "another-build" +} + +fn is_account_management_unavailable(a: CredentialRotationApplication?) -> Bool { + match a { + Present { value: app } => match app { + AccountManagementUnavailable { detail: _ } => true + RotationApplied { reference: _, applied_at: _, evidence: _ } => false + RotationNotAttempted => false + } + Absent => false } } + +// The adjudication's application arm: ungrounded and candidate yield AccountManagementUnavailable, a +// grounded route yields none. +test fn the_application_arm_refuses_only_an_ungrounded_route() -> Bool { + is_account_management_unavailable(a: rotation_application_for_standing(standing: rotation_route_ungrounded(endpoint: mtcollins1_endpoint, firmware: mtcollins1_firmware))) + && is_account_management_unavailable(a: rotation_application_for_standing(standing: lab_candidate(request: IpmiSetUserPassword { user: 3 }))) + && match rotation_application_for_standing(standing: mtcollins1_rotation_route_standing()) { Absent => true Present { value: _ } => false } +} + +// ── the qualification effect's authorization, by executing the selection ──────────────────────── + +// The census row for qualify_rotation_route is classified by EXECUTING select_authorization_pattern +// over its stated characteristics: the selection returns the operator-approved capability, and the +// row's realization (an admitted Redemption) conforms to it. +test fn the_qualification_effect_is_classified_operator_approved_and_conforms() -> Bool { + let rows = filter(privileged_effect_census, r => (r.site.module_path as String) == "gunbc.machine_intake_bmc_rotation_route" && (r.site.decl_name as String) == "qualify_rotation_route") + length(rows) == 1 + && all(rows, r => + match select_authorization_pattern(e: r.effect) { + PatternSelected { pattern: p, receipt: _ } => match p { OperatorApprovedCapability => true _ => false } + _ => false + } + && match site_verdict(row: r).conformance { Conforms => true _ => false }) +} From a987c3cc13c319a02d838931296b77a4649cc673 Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Sat, 3 Oct 2026 23:40:40 +0000 Subject: [PATCH 02/22] Census: hoist the route-qualification row's reasoning to module grain (annotation inside a list literal refuses) Co-Authored-By: Claude Opus 5.5 (1M context) --- dag/gunbc/auth/privileged_effect_census.dag | 42 +++++++++++---------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/dag/gunbc/auth/privileged_effect_census.dag b/dag/gunbc/auth/privileged_effect_census.dag index e75921646ea..2c01dc277ec 100644 --- a/dag/gunbc/auth/privileged_effect_census.dag +++ b/dag/gunbc/auth/privileged_effect_census.dag @@ -288,6 +288,28 @@ fn mtcollins1_host_reset_effect() -> PrivilegedEffect { ) } +// ROTATION ROUTE QUALIFICATION (cut O1a). Grounding a controller's account-write route is its own +// effect, separate from the rotation Apply that consumes the route: one executed account-write +// request per controller and build. IRREVERSIBLE, AND SAID SO: an account write over an unqualified +// route can leave an account enabled holding a password nobody stored, and the exposure window it +// opens is not undone by a reapply (artifacts/bmc/mtcollins1-bmc-user3-route-2026-09-13.txt, steps +// b1 and b1r). It applies a credential to one controller account, so its reach is one resource. No +// dispatched run carries it: in this cut it is modeled, with a dry realization only. The realization +// takes an operator-approved capability (gunbc.auth.approval_broker Redemption) bound to the exact +// controller, build and request, which is what the selection is expected to return. +fn route_qualification_effect() -> PrivilegedEffect { + PrivilegedEffect { + subject: "qualify a BMC account-write route: execute one account-write request on one controller at one firmware build and read it back" as NonEmptyStr, + frequency: DeviceOnce, + reversibility: IrreversibleEffect { what_is_lost: "an account write over an unqualified route can leave an account enabled holding an unstored password; the exposure window is not undone by a reapply" as NonEmptyStr }, + surface: ApiSurface, + workload_identity: WorkloadIdentityUnbindable { cause: "no dispatched run carries route qualification; in cut O1a it is modeled with a dry realization only" as NonEmptyStr }, + minted_reach: MintsResourceScopedCredential, + billing: NoBillingConsequence, + witness_discharge: NoWitnessDischarge, + } +} + // ── INTERLOCKS: the state an effect's parameters are honest only under ───────────────────────── // A row's reversibility can depend on a fact about the world rather than about the call: the boot // above is reversible by reapply only while nobody is working on the unit. That condition is not a @@ -583,27 +605,9 @@ data privileged_effect_census: List = [ realized: RealizedRunSelected, divergence_reason: none, }, - // ROTATION ROUTE QUALIFICATION (cut O1a). Grounding a controller's account-write route is its own - // effect, separate from the rotation Apply that consumes the route: one executed account-write - // request per controller and build. IRREVERSIBLE, AND SAID SO: an account write over an unqualified - // route can leave an account enabled holding a password nobody stored, and the exposure window it - // opens is not undone by a reapply (artifacts/bmc/mtcollins1-bmc-user3-route-2026-09-13.txt, steps - // b1 and b1r). It applies a credential to one controller account, so its reach is one resource. No - // dispatched run carries it: in this cut it is modeled, with a dry realization only. The realization - // takes an operator-approved capability (gunbc.auth.approval_broker Redemption) bound to the exact - // controller, build and request, which is what the selection is expected to return. PrivilegedEffectSite { site: site(module_path: "gunbc.machine_intake_bmc_rotation_route", decl_name: "qualify_rotation_route"), - effect: PrivilegedEffect { - subject: "qualify a BMC account-write route: execute one account-write request on one controller at one firmware build and read it back" as NonEmptyStr, - frequency: DeviceOnce, - reversibility: IrreversibleEffect { what_is_lost: "an account write over an unqualified route can leave an account enabled holding an unstored password; the exposure window is not undone by a reapply" as NonEmptyStr }, - surface: ApiSurface, - workload_identity: WorkloadIdentityUnbindable { cause: "no dispatched run carries route qualification; in cut O1a it is modeled with a dry realization only" as NonEmptyStr }, - minted_reach: MintsResourceScopedCredential, - billing: NoBillingConsequence, - witness_discharge: NoWitnessDischarge, - }, + effect: route_qualification_effect(), realized: RealizedApprovalCapability, divergence_reason: none, }, From c05714a2ce53a5f36f847823b06b0c05c37139bb Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Sun, 4 Oct 2026 01:10:45 +0000 Subject: [PATCH 03/22] Rotation Apply: bind the approval to the controller, build and request; type every refusal (review 75181) Co-Authored-By: Claude Opus 5.5 (1M context) --- .../machine_intake/bmc_rotation_route.dag | 20 ++++-- ...intake_bmc_rotation_route_witness_test.dag | 70 +++++++++++++++---- 2 files changed, 70 insertions(+), 20 deletions(-) diff --git a/dag/gunbc/machine_intake/bmc_rotation_route.dag b/dag/gunbc/machine_intake/bmc_rotation_route.dag index ae4f93b6e06..9ea1362b486 100644 --- a/dag/gunbc/machine_intake/bmc_rotation_route.dag +++ b/dag/gunbc/machine_intake/bmc_rotation_route.dag @@ -16,7 +16,7 @@ import gunbc.machine_intake_bmc_secure { AccountManagementUnavailable, } import gunbc.auth.approval_capability { ProposeApprove, ProposeDeny } -import gunbc.auth.approval_broker { Redemption, RedemptionAdmitted, RedemptionRefused, redemption_refusal_reason } +import gunbc.auth.approval_broker { Redemption, RedemptionAdmitted, RedemptionRefused, RedemptionRefusal } import gunbc.bmc_model { BmcWorld, bmc_ipmi_set_user_password, bmc_ipmi_user_accepts } data bmc_rotation_route_disposition: Disposition = Terminal { @@ -227,7 +227,7 @@ fn dry_route_qualification_request(world: BmcWorld, request: BmcAccountWriteRequ type RouteQualificationRefusal = QualificationSubjectNotACandidate - | QualificationApprovalRefused { cause: String } + | QualificationApprovalRefused { cause: RedemptionRefusal } | QualificationApprovalDenied | QualificationApprovalForAnotherAuthority { authority: NonEmptyStr } | QualificationApprovalForAnotherRequest { approved: NonEmptyStr, requested: NonEmptyStr } @@ -246,7 +246,7 @@ fn account_write_request_eq(a: BmcAccountWriteRequest, b: BmcAccountWriteRequest fn qualification_approval_refusal(standing: BmcRotationRouteStanding, request: BmcAccountWriteRequest, approval: Redemption) -> RouteQualificationRefusal? { match approval { - RedemptionRefused { cause: c } => Present { value: QualificationApprovalRefused { cause: redemption_refusal_reason(r: c) } } + RedemptionRefused { cause: c } => Present { value: QualificationApprovalRefused { cause: c } } RedemptionAdmitted { claims: cl, decided_by: _ } => match cl.decision { ProposeDeny => Present { value: QualificationApprovalDenied } @@ -314,14 +314,18 @@ data route_qualification_live_frontier: DissolutionCondition = unbound_dissoluti // BEFORE the approval, so an ungrounded or candidate route refuses even beside a valid operator // approval of the rotation: approving a rotation is not grounding a route. A route grounded on one // controller or build refuses a write to another, so mtcollins1's executed IPMI route can never -// authorize mtjade1. +// authorize mtjade1. The approval must name the rotation authority AND this exact controller, build +// and request (rotation_route_request_identity): an approval given for one controller is a different +// decision on every other, refused as RotationApplyApprovalForAnotherRequest. type RotationApplyAdmission = RotationApplyAdmitted { standing: BmcRotationRouteStanding, request: BmcAccountWriteRequest, decided_by: NonEmptyStr } | RotationApplyRouteNotGrounded { standing: BmcRotationRouteStanding } | RotationApplyRouteForAnotherController { route_endpoint: BmcControllerEndpoint, target_endpoint: BmcControllerEndpoint } | RotationApplyRouteForAnotherBuild { route_firmware: BmcFirmwareReleaseIdentity, target_firmware: BmcFirmwareReleaseIdentity } - | RotationApplyApprovalRefused { cause: String } + | RotationApplyApprovalRefused { cause: RedemptionRefusal } + | RotationApplyApprovalDenied | RotationApplyApprovalForAnotherAuthority { authority: NonEmptyStr } + | RotationApplyApprovalForAnotherRequest { approved: NonEmptyStr, requested: NonEmptyStr } fn grounded_request(standing: BmcRotationRouteStanding) -> BmcAccountWriteRequest? { match standing.grounding { @@ -347,13 +351,15 @@ fn admit_rotation_apply( RotationApplyRouteForAnotherBuild { route_firmware: standing.firmware, target_firmware: target_firmware } } else { match approval { - RedemptionRefused { cause: c } => RotationApplyApprovalRefused { cause: redemption_refusal_reason(r: c) } + RedemptionRefused { cause: c } => RotationApplyApprovalRefused { cause: c } RedemptionAdmitted { claims: cl, decided_by: by } => match cl.decision { - ProposeDeny => RotationApplyApprovalRefused { cause: "the operator denied the rotation" } + ProposeDeny => RotationApplyApprovalDenied ProposeApprove => if cl.authority != rotation_apply_authority { RotationApplyApprovalForAnotherAuthority { authority: cl.authority } + } else if cl.request_revision != rotation_route_request_identity(standing: standing, request: request) { + RotationApplyApprovalForAnotherRequest { approved: cl.request_revision, requested: rotation_route_request_identity(standing: standing, request: request) } } else { RotationApplyAdmitted { standing: standing, request: request, decided_by: by } } diff --git a/dag/test/claim/machine_intake/machine_intake_bmc_rotation_route_witness_test.dag b/dag/test/claim/machine_intake/machine_intake_bmc_rotation_route_witness_test.dag index 5fec06346f2..98bfcc02586 100644 --- a/dag/test/claim/machine_intake/machine_intake_bmc_rotation_route_witness_test.dag +++ b/dag/test/claim/machine_intake/machine_intake_bmc_rotation_route_witness_test.dag @@ -15,7 +15,7 @@ import gunbc.machine_intake_receipt { EvidenceRef } import gunbc.machine_intake_bmc_secure { CredentialRotationApplication, AccountManagementUnavailable, RotationApplied, RotationNotAttempted, } -import gunbc.auth.approval_capability { ApprovalCapabilityClaims, ProposeApprove, approval_capability_protocol } +import gunbc.auth.approval_capability { ApprovalCapabilityClaims, ProposeApprove, ProposeDeny, approval_capability_protocol } import gunbc.auth.approval_broker { Redemption, RedemptionAdmitted } import gunbc.auth.authorization_pattern_selection { OperatorApprovedCapability, PatternSelected, select_authorization_pattern } import gunbc.auth.privileged_effect_census { Conforms, privileged_effect_census, site_verdict } @@ -33,7 +33,8 @@ import gunbc.machine_intake_bmc_rotation_route { QualificationResponseForAnotherRequest, QualificationRequestUnrealized, QualificationRequestNotCompleted, QualificationReadbackRefused, RotationApplyAdmitted, RotationApplyRouteNotGrounded, RotationApplyRouteForAnotherController, - RotationApplyRouteForAnotherBuild, RotationApplyApprovalRefused, RotationApplyApprovalForAnotherAuthority, + RotationApplyRouteForAnotherBuild, RotationApplyApprovalRefused, RotationApplyApprovalDenied, + RotationApplyApprovalForAnotherAuthority, RotationApplyApprovalForAnotherRequest, route_qualification_authority, rotation_apply_authority, rotation_route_ungrounded, rotation_route_candidate, rotation_route_from_citation, rotation_route_request_identity, rotation_route_is_grounded, @@ -69,8 +70,18 @@ fn approval(authority: NonEmptyStr, revision: NonEmptyStr) -> Redemption { } } -fn rotation_approval() -> Redemption { - approval(authority: rotation_apply_authority, revision: "rotate" as NonEmptyStr) +fn standing_request(s: BmcRotationRouteStanding) -> BmcAccountWriteRequest { + match s.grounding { + RouteGroundedByExecutedRequest { request: r, request_receipt: _, response_receipt: _ } => r + RouteGroundedByCitedSource { request: r, citation: _ } => r + RouteQualificationCandidate { request: r, evidence: _ } => r + RouteUngrounded => IpmiSetUserPassword { user: 3 } + } +} + +// An operator approval of the ROTATION of this exact controller, build and request. +fn rotation_approval_for(s: BmcRotationRouteStanding) -> Redemption { + approval(authority: rotation_apply_authority, revision: rotation_route_request_identity(standing: s, request: standing_request(s: s))) } // A synthetic MegaRAC controller and build for the qualification bootstrap; no unit row is made from @@ -137,7 +148,9 @@ fn apply_verdict(standing: BmcRotationRouteStanding, target: BmcControllerEndpoi RotationApplyRouteForAnotherController { route_endpoint: _, target_endpoint: _ } => "another-controller" RotationApplyRouteForAnotherBuild { route_firmware: _, target_firmware: _ } => "another-build" RotationApplyApprovalRefused { cause: _ } => "approval-refused" + RotationApplyApprovalDenied => "approval-denied" RotationApplyApprovalForAnotherAuthority { authority: _ } => "another-authority" + RotationApplyApprovalForAnotherRequest { approved: _, requested: _ } => "another-request" } } @@ -221,7 +234,7 @@ test fn a_manager_get_alone_cannot_construct_an_account_write_route() -> Bool { Absent => false Present { value: s } => !rotation_route_is_grounded(standing: s) - && apply_verdict(standing: s, target: s.endpoint, firmware: s.firmware, approval_value: rotation_approval()) == "route-not-grounded" + && apply_verdict(standing: s, target: s.endpoint, firmware: s.firmware, approval_value: rotation_approval_for(s: s)) == "route-not-grounded" && match rotation_application_for_standing(standing: s) { Present { value: app } => match app { AccountManagementUnavailable { detail: _ } => true @@ -238,8 +251,8 @@ test fn a_manager_get_alone_cannot_construct_an_account_write_route() -> Bool { // approval, aimed at its own controller and build, is admitted. test fn an_ungrounded_route_with_rotation_approval_is_refused_and_a_grounded_one_is_admitted() -> Bool { let ungrounded = rotation_route_ungrounded(endpoint: mtcollins1_endpoint, firmware: mtcollins1_firmware) - apply_verdict(standing: ungrounded, target: mtcollins1_endpoint, firmware: mtcollins1_firmware, approval_value: rotation_approval()) == "route-not-grounded" - && apply_verdict(standing: mtcollins1_rotation_route_standing(), target: mtcollins1_endpoint, firmware: mtcollins1_firmware, approval_value: rotation_approval()) == "admitted" + apply_verdict(standing: ungrounded, target: mtcollins1_endpoint, firmware: mtcollins1_firmware, approval_value: rotation_approval_for(s: ungrounded)) == "route-not-grounded" + && apply_verdict(standing: mtcollins1_rotation_route_standing(), target: mtcollins1_endpoint, firmware: mtcollins1_firmware, approval_value: rotation_approval_for(s: mtcollins1_rotation_route_standing())) == "admitted" } // An IPMI route grounded on mtcollins1 does not authorize mtjade1, nor mtcollins1 at another build, @@ -249,8 +262,8 @@ test fn mtcollins1s_grounded_route_does_not_authorize_another_controller_build_o Absent => false Present { value: jade } => let collins = mtcollins1_rotation_route_standing() - apply_verdict(standing: collins, target: jade.endpoint, firmware: jade.firmware, approval_value: rotation_approval()) == "another-controller" - && apply_verdict(standing: collins, target: mtcollins1_endpoint, firmware: bmc_firmware_release_identity_of_wire(family: AmiMegaRac, wire: "0.33" as NonEmptyStr), approval_value: rotation_approval()) == "another-build" + apply_verdict(standing: collins, target: jade.endpoint, firmware: jade.firmware, approval_value: rotation_approval_for(s: collins)) == "another-controller" + && apply_verdict(standing: collins, target: mtcollins1_endpoint, firmware: bmc_firmware_release_identity_of_wire(family: AmiMegaRac, wire: "0.33" as NonEmptyStr), approval_value: rotation_approval_for(s: collins)) == "another-build" && apply_verdict(standing: collins, target: mtcollins1_endpoint, firmware: mtcollins1_firmware, approval_value: approval(authority: route_qualification_authority, revision: "rotate" as NonEmptyStr)) == "another-authority" } } @@ -271,7 +284,7 @@ test fn the_qualification_effect_grounds_a_candidate_from_its_request_and_respon Present { value: s } => grounding_kind(standing: s) == "executed" && (s.endpoint.host as String) == (lab_endpoint.host as String) - && apply_verdict(standing: s, target: lab_endpoint, firmware: lab_firmware(), approval_value: rotation_approval()) == "admitted" + && apply_verdict(standing: s, target: lab_endpoint, firmware: lab_firmware(), approval_value: rotation_approval_for(s: s)) == "admitted" } } @@ -280,7 +293,7 @@ test fn the_qualification_effect_grounds_a_candidate_from_its_request_and_respon test fn the_qualification_effect_refuses_every_other_crossing() -> Bool { let ipmi = IpmiSetUserPassword { user: 3 } let right = qualification_approval_for(standing: lab_candidate(request: ipmi), request: ipmi) - refusal_of(world: lab_world_with_user3(), request: ipmi, approval_value: rotation_approval()) == "another-authority" + refusal_of(world: lab_world_with_user3(), request: ipmi, approval_value: rotation_approval_for(s: lab_candidate(request: ipmi))) == "another-authority" && refusal_of(world: lab_world_with_user3(), request: ipmi, approval_value: approval(authority: route_qualification_authority, revision: "another controller" as NonEmptyStr)) == "another-request" && refusal_of(world: bmc_world(power: BmcPowerOn), request: ipmi, approval_value: right) == "not-completed" && refusal_of(world: lab_world_with_user3(), request: redfish_account_password_write(), approval_value: qualification_approval_for(standing: lab_candidate(request: redfish_account_password_write()), request: redfish_account_password_write())) == "unrealized" @@ -312,8 +325,8 @@ test fn a_cited_route_admits_apply_and_is_bound_to_its_build() -> Bool { citation: ExternalAuthority { uri: uri_https(locator: "example.invalid/route-witness-citation" as NonEmptyStr) }, ) grounding_kind(standing: s) == "cited" - && apply_verdict(standing: s, target: lab_endpoint, firmware: lab_firmware(), approval_value: rotation_approval()) == "admitted" - && apply_verdict(standing: s, target: lab_endpoint, firmware: bmc_firmware_release_identity_of_wire(family: AmiMegaRac, wire: "0.33" as NonEmptyStr), approval_value: rotation_approval()) == "another-build" + && apply_verdict(standing: s, target: lab_endpoint, firmware: lab_firmware(), approval_value: rotation_approval_for(s: s)) == "admitted" + && apply_verdict(standing: s, target: lab_endpoint, firmware: bmc_firmware_release_identity_of_wire(family: AmiMegaRac, wire: "0.33" as NonEmptyStr), approval_value: rotation_approval_for(s: s)) == "another-build" } fn is_account_management_unavailable(a: CredentialRotationApplication?) -> Bool { @@ -350,3 +363,34 @@ test fn the_qualification_effect_is_classified_operator_approved_and_conforms() } && match site_verdict(row: r).conformance { Conforms => true _ => false }) } + +// AN APPROVAL IS BOUND TO ITS CONTROLLER, BUILD AND REQUEST (review 75181). An admitted approval of +// mtcollins1's rotation, reused for another controller whose route is grounded under the same +// authority, is a different decision and refuses; the same approval re-minted for the other +// controller's own identity is admitted; and a denial is its own typed arm. +test fn a_rotation_approval_for_one_controller_does_not_admit_another() -> Bool { + let request = IpmiSetUserPassword { user: 3 } + match qualify_lab(world: lab_world_with_user3(), request: request, approval_value: qualification_approval_for(standing: lab_candidate(request: request), request: request)) { + Absent => false + Present { value: lab } => + let denied = RedemptionAdmitted { + claims: ApprovalCapabilityClaims { + protocol: approval_capability_protocol, + issuer: "gunbc-approval-broker" as NonEmptyStr, + audience: "srv1" as NonEmptyStr, + authority: rotation_apply_authority, + escalation_id: "route-witness-2" as NonEmptyStr, + request_revision: rotation_route_request_identity(standing: lab, request: request), + decision: ProposeDeny, + attempt: "attempt-2" as AttemptIdentity, + issued_at: "2026-10-03T00:00:00Z", + expires_at: "2026-10-03T00:15:00Z", + key_id: "broker-2026-10" as MacKeyId, + }, + decided_by: "operator" as NonEmptyStr, + } + apply_verdict(standing: lab, target: lab_endpoint, firmware: lab_firmware(), approval_value: rotation_approval_for(s: mtcollins1_rotation_route_standing())) == "another-request" + && apply_verdict(standing: lab, target: lab_endpoint, firmware: lab_firmware(), approval_value: rotation_approval_for(s: lab)) == "admitted" + && apply_verdict(standing: lab, target: lab_endpoint, firmware: lab_firmware(), approval_value: denied) == "approval-denied" + } +} From afcc512e9c1dd413ed21e7ef1416c7999ba4c94d Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Sun, 4 Oct 2026 03:21:10 +0000 Subject: [PATCH 04/22] Route module sits below bmc_secure: drop the rotation-event mapping; frontier retires with O1b's Apply Co-Authored-By: Claude Opus 5.5 (1M context) --- .../machine_intake/bmc_rotation_route.dag | 42 ++++--------------- ...intake_bmc_rotation_route_witness_test.dag | 34 +-------------- 2 files changed, 9 insertions(+), 67 deletions(-) diff --git a/dag/gunbc/machine_intake/bmc_rotation_route.dag b/dag/gunbc/machine_intake/bmc_rotation_route.dag index 9ea1362b486..86a885b8ad3 100644 --- a/dag/gunbc/machine_intake/bmc_rotation_route.dag +++ b/dag/gunbc/machine_intake/bmc_rotation_route.dag @@ -11,10 +11,6 @@ import extdeps.bmc.capability { BmcFirmwareReleaseIdentity, bmc_firmware_release import extdeps.bmc.access_profile { BmcAccessSurface } import extdeps.bmc.ipmi_channel { IpmiUserId } import gunbc.machine_intake_receipt { EvidenceRef } -import gunbc.machine_intake_bmc_secure { - CredentialRotationApplication, - AccountManagementUnavailable, -} import gunbc.auth.approval_capability { ProposeApprove, ProposeDeny } import gunbc.auth.approval_broker { Redemption, RedemptionAdmitted, RedemptionRefused, RedemptionRefusal } import gunbc.bmc_model { BmcWorld, bmc_ipmi_set_user_password, bmc_ipmi_user_accepts } @@ -369,41 +365,17 @@ fn admit_rotation_apply( } } -// ── THE ADJUDICATION'S APPLICATION ARM, from the standing ────────────────────────────────────── -// -// An ungrounded or candidate route yields AccountManagementUnavailable naming the controller, build -// and state, which gunbc.machine_intake_bmc_secure adjudicates into a typed, located BmcSecure refusal -// before any controller write. A grounded route yields none: the application is what the actuator -// then does over it. +// ── WHO CONSUMES THE ADMISSION, AND BY WHAT ROUTE (DESIGN §3c) ──────────────────────────────── // -// WHO CONSUMES THIS, AND BY WHAT ROUTE (DESIGN §3c). The executing consumer today is -// test.claim.machine_intake_bmc_rotation_route_witness_test; the named later consumer is the cut O1c -// arrival convergence, which derives the rotation field from this standing inside AccessDiscover -// rather than receiving it as a supplied argument (rotation_route_consumption_frontier). +// THIS MODULE SITS BELOW gunbc.machine_intake_bmc_secure AND IMPORTS NOTHING FROM IT. The BmcSecure +// Apply (cut O1b) imports admit_rotation_apply and refuses on any arm but RotationApplyAdmitted, so +// the refusal for an ungrounded route is that module's to type; mapping a route onto its rotation-event +// vocabulary here would make the import graph cyclic the moment O1b lands. The executing consumer +// today is test.claim.machine_intake_bmc_rotation_route_witness_test. data rotation_route_consumption_frontier: DissolutionCondition = unbound_dissolution( - description: "dissolves when the cut O1c arrival convergence (gunbc.machine_intake_arrival_converge) derives the BmcCredentialRotationObservation rotation field by calling rotation_application_for_standing on the route standing derived inside AccessDiscover for the controller and build it observed, rather than receiving rotation as a supplied argument; NOT satisfied by this module typechecking, by the witness exercising the arms, or by a caller that passes a standing for another controller or build" as NonEmptyStr, + description: "dissolves when the cut O1b BmcSecure Apply in gunbc.machine_intake_bmc_secure calls admit_rotation_apply on the route standing for the controller and build it writes, and refuses before any account write on every arm other than RotationApplyAdmitted; NOT satisfied by this module typechecking, by the witness exercising the arms, or by an Apply that receives an admission it did not compute from the standing" as NonEmptyStr, ) -fn rotation_application_for_standing(standing: BmcRotationRouteStanding) -> CredentialRotationApplication? { - let subject = join([standing.endpoint.host as String, " at firmware ", standing.firmware.raw_version as String], "") - match standing.grounding { - RouteGroundedByExecutedRequest { request: _, request_receipt: _, response_receipt: _ } => none - RouteGroundedByCitedSource { request: _, citation: _ } => none - RouteQualificationCandidate { request: r, evidence: _ } => - Present { - value: AccountManagementUnavailable { - detail: join([subject, ": the account-write route is only a qualification candidate (", account_write_request_text(request: r) as String, "); no executed request or build-scoped citation grounds it"], "") as NonEmptyStr, - }, - } - RouteUngrounded => - Present { - value: AccountManagementUnavailable { - detail: join([subject, ": no account-write route is grounded for this controller and build"], "") as NonEmptyStr, - }, - } - } -} - // The modeled Redfish account-password operation and action shape, by reference, for a candidate // naming an observed Redfish surface. fn redfish_account_password_write() -> BmcAccountWriteRequest { diff --git a/dag/test/claim/machine_intake/machine_intake_bmc_rotation_route_witness_test.dag b/dag/test/claim/machine_intake/machine_intake_bmc_rotation_route_witness_test.dag index 98bfcc02586..0ef56252272 100644 --- a/dag/test/claim/machine_intake/machine_intake_bmc_rotation_route_witness_test.dag +++ b/dag/test/claim/machine_intake/machine_intake_bmc_rotation_route_witness_test.dag @@ -12,9 +12,6 @@ import extdeps.bmc.endpoint { AmiMegaRac, OpenBmc, BmcControllerEndpoint } import extdeps.bmc.capability { BmcFirmwareReleaseIdentity, bmc_firmware_release_identity_of_wire } import extdeps.bmc.access_profile { SurfaceManagerIdentity, SurfaceAccountManagement } import gunbc.machine_intake_receipt { EvidenceRef } -import gunbc.machine_intake_bmc_secure { - CredentialRotationApplication, AccountManagementUnavailable, RotationApplied, RotationNotAttempted, -} import gunbc.auth.approval_capability { ApprovalCapabilityClaims, ProposeApprove, ProposeDeny, approval_capability_protocol } import gunbc.auth.approval_broker { Redemption, RedemptionAdmitted } import gunbc.auth.authorization_pattern_selection { OperatorApprovedCapability, PatternSelected, select_authorization_pattern } @@ -39,7 +36,7 @@ import gunbc.machine_intake_bmc_rotation_route { rotation_route_ungrounded, rotation_route_candidate, rotation_route_from_citation, rotation_route_request_identity, rotation_route_is_grounded, dry_route_qualification_request, qualify_rotation_route, admit_rotation_apply, - rotation_application_for_standing, redfish_account_password_write, + redfish_account_password_write, } import gunbc.machine_intake_bmc_rotation_route_evidence { mtcollins1_rotation_route_standing, mtjade1_rotation_route_standing, rotation_route_standing_from_manager_read, @@ -228,21 +225,13 @@ test fn two_megarac_controllers_with_different_surfaces_have_different_standings // CONTROL: a Manager GET alone cannot construct an account-write route. The only standing the // Manager read can produce is a candidate; the rotation Apply refuses it even beside an operator -// approval of the rotation, and the adjudication's application arm is AccountManagementUnavailable. +// approval of the rotation. test fn a_manager_get_alone_cannot_construct_an_account_write_route() -> Bool { match rotation_route_standing_from_manager_read(read: read_mtjade1_recorded_manager_identity()) { Absent => false Present { value: s } => !rotation_route_is_grounded(standing: s) && apply_verdict(standing: s, target: s.endpoint, firmware: s.firmware, approval_value: rotation_approval_for(s: s)) == "route-not-grounded" - && match rotation_application_for_standing(standing: s) { - Present { value: app } => match app { - AccountManagementUnavailable { detail: _ } => true - RotationApplied { reference: _, applied_at: _, evidence: _ } => false - RotationNotAttempted => false - } - Absent => false - } } } @@ -329,25 +318,6 @@ test fn a_cited_route_admits_apply_and_is_bound_to_its_build() -> Bool { && apply_verdict(standing: s, target: lab_endpoint, firmware: bmc_firmware_release_identity_of_wire(family: AmiMegaRac, wire: "0.33" as NonEmptyStr), approval_value: rotation_approval_for(s: s)) == "another-build" } -fn is_account_management_unavailable(a: CredentialRotationApplication?) -> Bool { - match a { - Present { value: app } => match app { - AccountManagementUnavailable { detail: _ } => true - RotationApplied { reference: _, applied_at: _, evidence: _ } => false - RotationNotAttempted => false - } - Absent => false - } -} - -// The adjudication's application arm: ungrounded and candidate yield AccountManagementUnavailable, a -// grounded route yields none. -test fn the_application_arm_refuses_only_an_ungrounded_route() -> Bool { - is_account_management_unavailable(a: rotation_application_for_standing(standing: rotation_route_ungrounded(endpoint: mtcollins1_endpoint, firmware: mtcollins1_firmware))) - && is_account_management_unavailable(a: rotation_application_for_standing(standing: lab_candidate(request: IpmiSetUserPassword { user: 3 }))) - && match rotation_application_for_standing(standing: mtcollins1_rotation_route_standing()) { Absent => true Present { value: _ } => false } -} - // ── the qualification effect's authorization, by executing the selection ──────────────────────── // The census row for qualify_rotation_route is classified by EXECUTING select_authorization_pattern From 8e5b038052c556684597f9de35597cb60d50e04e Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Sun, 4 Oct 2026 04:16:56 +0000 Subject: [PATCH 05/22] O1a side-chat review: modeled run cannot ground; response bound to subject; structural request identity; mtjade1 historical - RouteQualificationLiveResponse (sealed, no mint in this cut) is the only input qualify_rotation_route grounds from; the dry realization mints a distinct ModeledRouteQualificationResponse whose classifier verdict carries no standing. - Both responses carry the exact RouteQualificationSubject bound at the mint; a response for another subject refuses. - account_write_request_eq is structural (canonical DeclarationRef equality); the approval identity is an injective length-prefixed encoding of every field. - mtjade1's capture yields a HistoricalRotationRouteObservation at its factory address, not a standing; O1c-1 AccessDiscover mints the current one (mtjade1_current_route_standing_frontier). Co-Authored-By: Claude Opus 5.5 (1M context) --- .../machine_intake/bmc_rotation_route.dag | 278 ++++++++++++---- .../bmc_rotation_route_evidence.dag | 41 ++- ...tation_route_forged_probe_witness_test.dag | 10 +- ...intake_bmc_rotation_route_witness_test.dag | 300 ++++++++++-------- 4 files changed, 419 insertions(+), 210 deletions(-) diff --git a/dag/gunbc/machine_intake/bmc_rotation_route.dag b/dag/gunbc/machine_intake/bmc_rotation_route.dag index 86a885b8ad3..076ddff3ed7 100644 --- a/dag/gunbc/machine_intake/bmc_rotation_route.dag +++ b/dag/gunbc/machine_intake/bmc_rotation_route.dag @@ -1,12 +1,12 @@ module gunbc.machine_intake_bmc_rotation_route -import std.types { Bool, NonEmptyStr, String } +import std.types { Bool, Int, NonEmptyStr, String } import std.disposition { Disposition, Terminal } import std.dissolution { DissolutionCondition, unbound_dissolution } -import std.decl_ref { DeclarationRef, decl_ref, decl_field_ref } +import std.decl_ref { DeclarationRef, DeclField, WholeDeclaration, NamedField, TypeParameter, decl_ref, decl_field_ref, declaration_ref_eq } import std.content_hash { content_hash_of_value } import extdeps.external_authority { ExternalAuthority } -import extdeps.bmc.endpoint { BmcControllerEndpoint } +import extdeps.bmc.endpoint { AmiMegaRac, BmcControllerEndpoint, BmcFirmwareFamily, OpenBmc } import extdeps.bmc.capability { BmcFirmwareReleaseIdentity, bmc_firmware_release_identity_eq } import extdeps.bmc.access_profile { BmcAccessSurface } import extdeps.bmc.ipmi_channel { IpmiUserId } @@ -120,6 +120,7 @@ fn rotation_route_from_citation( ) -> BmcRotationRouteStanding admit_callers: [ decl_ref(module_path: "test.claim.machine_intake_bmc_rotation_route_witness_test", decl_name: "a_cited_route_admits_apply_and_is_bound_to_its_build"), + decl_ref(module_path: "test.claim.machine_intake_bmc_rotation_route_witness_test", decl_name: "a_rotation_approval_for_one_controller_does_not_admit_another"), ] { BmcRotationRouteStanding { @@ -129,6 +130,18 @@ fn rotation_route_from_citation( } } +// A ROUTE OBSERVATION FROM A PAST READ, AT THE ADDRESS IT WAS READ ON. It is not a standing and +// nothing here converts it into one: a controller's current route standing is minted inside +// AccessDiscover (cut O1c) from a CURRENT read at its current endpoint. A historical observation is +// what a past capture is entitled to say -- which surface answered, at which address, at which build, +// and which account-write request that makes worth qualifying -- and it authorizes nothing. +type HistoricalRotationRouteObservation { + observed_endpoint: BmcControllerEndpoint + firmware: BmcFirmwareReleaseIdentity + request: BmcAccountWriteRequest + evidence: RouteCandidateEvidence +} + fn rotation_route_is_grounded(standing: BmcRotationRouteStanding) -> Bool { match standing.grounding { RouteGroundedByExecutedRequest { request: _, request_receipt: _, response_receipt: _ } => true @@ -146,11 +159,85 @@ fn account_write_request_text(request: BmcAccountWriteRequest) -> NonEmptyStr { } } +// ── IDENTITY AND EQUALITY: structural, never display text ────────────────────────────────────── +// +// A display rendering drops fields (the Redfish arm's text named neither the declaration field nor +// the action shape), so two different operations would share one authorization key. Equality is +// therefore structural over the whole coproduct, with canonical DeclarationRef equality for both +// refs; and the identity an approval names is an INJECTIVE canonical encoding of every field -- each +// component length-prefixed and tagged -- so distinct subjects never share an identity. +fn account_write_request_eq(a: BmcAccountWriteRequest, b: BmcAccountWriteRequest) -> Bool { + match a { + IpmiSetUserPassword { user: ua } => + match b { + IpmiSetUserPassword { user: ub } => (ua as Int) == (ub as Int) + RedfishAccountPasswordWrite { transport_operation: _, action_shape: _ } => false + } + RedfishAccountPasswordWrite { transport_operation: oa, action_shape: sa } => + match b { + IpmiSetUserPassword { user: _ } => false + RedfishAccountPasswordWrite { transport_operation: ob, action_shape: sb } => + declaration_ref_eq(a: oa, b: ob) && declaration_ref_eq(a: sa, b: sb) + } + } +} + +fn canonical_component(text: String) -> String { + join([to_string(length(text)), ":", text], "") +} + +fn canonical_decl_field(field: DeclField) -> String { + match field { + WholeDeclaration => "W;" + NamedField { field_name: n } => join(["N", canonical_component(text: n as String)], "") + TypeParameter { name: n } => join(["T", canonical_component(text: n as String)], "") + } +} + +fn canonical_decl_ref(r: DeclarationRef) -> String { + join([canonical_component(text: r.module_path as String), canonical_component(text: r.decl_name as String), canonical_decl_field(field: r.field)], "") +} + +fn canonical_account_write_request(request: BmcAccountWriteRequest) -> String { + match request { + IpmiSetUserPassword { user: u } => join(["ipmi-set-user-password;", canonical_component(text: to_string(u as Int))], "") + RedfishAccountPasswordWrite { transport_operation: op, action_shape: act } => + join(["redfish-account-password-write;", canonical_decl_ref(r: op), canonical_decl_ref(r: act)], "") + } +} + +fn canonical_firmware_family(family: BmcFirmwareFamily) -> String { + match family { + OpenBmc => "openbmc" + AmiMegaRac => "ami-megarac" + } +} + +// THE QUALIFICATION AND ROTATION SUBJECT: one controller, one build, one request. A response, an +// approval and a grounding are each about exactly one subject, and are compared on it. +type RouteQualificationSubject { + endpoint: BmcControllerEndpoint + firmware: BmcFirmwareReleaseIdentity + request: BmcAccountWriteRequest +} + +fn route_qualification_subject_eq(a: RouteQualificationSubject, b: RouteQualificationSubject) -> Bool { + (a.endpoint.host as String) == (b.endpoint.host as String) + && bmc_firmware_release_identity_eq(a: a.firmware, b: b.firmware) + && account_write_request_eq(a: a.request, b: b.request) +} + // THE IDENTITY an approval for this controller, build and request must name. An approval for another // controller, another build or another request is a different decision and is refused. fn rotation_route_request_identity(standing: BmcRotationRouteStanding, request: BmcAccountWriteRequest) -> NonEmptyStr { join( - [standing.endpoint.host as String, "|", standing.firmware.raw_version as String, "|", account_write_request_text(request: request) as String], + [ + "gunbc.bmc.rotation-route/v1;", + canonical_component(text: standing.endpoint.host as String), + canonical_component(text: canonical_firmware_family(family: standing.firmware.family)), + canonical_component(text: standing.firmware.raw_version as String), + canonical_account_write_request(request: request), + ], "", ) as NonEmptyStr } @@ -160,23 +247,38 @@ fn rotation_route_request_identity(standing: BmcRotationRouteStanding, request: // GROUNDING A ROUTE IS ITS OWN EFFECT, NOT THE APPLY. The rotation Apply consumes a grounded route, // so it cannot produce the premise that admits it. Qualification is a separately authorized // privileged effect: it is classified by executing gunbc.auth.authorization_pattern_selection -// select_authorization_pattern in gunbc.auth.privileged_effect_census (its row names this function), -// and the pattern that classification selects is an operator-approved capability per controller. So -// the effect takes a Redemption from gunbc.auth.approval_broker and refuses unless it is an admitted -// APPROVE whose authority is route qualification and whose request revision names this exact -// controller, build and request. An approval of the ROTATION is a different authority and does not -// qualify a route. +// select_authorization_pattern in gunbc.auth.privileged_effect_census (its row names +// qualify_rotation_route), and the pattern that classification selects is an operator-approved +// capability per controller. So the effect takes a Redemption from gunbc.auth.approval_broker and +// refuses unless it is an admitted APPROVE whose authority is route qualification and whose request +// revision names this exact controller, build and request. An approval of the ROTATION is a different +// authority and does not qualify a route. data route_qualification_authority: NonEmptyStr = "gunbc.bmc.rotation-route-qualification" as NonEmptyStr data rotation_apply_authority: NonEmptyStr = "gunbc.bmc.credential-rotation" as NonEmptyStr -// WHAT THE REQUEST ANSWERED, minted only by a realization of the request. Sealed, so a caller cannot -// author a response the controller never gave and present it to qualify_rotation_route. The one -// realization in this cut is the dry one over gunbc.bmc_model BmcWorld; there is no live call and no -// workflow entry. The live realization is a second mint here, beside this one, and lands with the -// first per-controller operator go-ahead (route_qualification_live_frontier). -type RouteQualificationResponse sole_constructor { - request: BmcAccountWriteRequest +// TWO RESPONSE CARRIERS, AND ONLY ONE OF THEM CAN GROUND A ROUTE. A response says what a request +// answered, bound AT ITS MINT to the exact subject it was made against. +// +// RouteQualificationLiveResponse is what a live transport call against the controller answered, with +// its transport receipts; it is the only input from which qualify_rotation_route constructs +// RouteGroundedByExecutedRequest. It is sealed and HAS NO MINT IN THIS CUT: no live effect exists, so +// none is faked (route_qualification_live_frontier). +// +// ModeledRouteQualificationResponse is what the dry realization over gunbc.bmc_model BmcWorld +// answered. It exercises the same classifier, and the type wall is that no function taking it +// returns a BmcRotationRouteStanding: classify_modeled_route_qualification can only say whether the +// modeled run WOULD qualify. A label beginning "dry" is not the wall; the type is. +type RouteQualificationLiveResponse sole_constructor { + subject: RouteQualificationSubject + request_receipt: EvidenceRef + response_receipt: EvidenceRef + completed: Bool + readback_accepted: Bool +} + +type ModeledRouteQualificationResponse sole_constructor { + subject: RouteQualificationSubject request_receipt: EvidenceRef response_receipt: EvidenceRef completed: Bool @@ -185,22 +287,22 @@ type RouteQualificationResponse sole_constructor { type DryRouteQualificationStep { world: BmcWorld - response: RouteQualificationResponse? + response: ModeledRouteQualificationResponse? } // THE DRY REALIZATION. The request is the IPMI Set User Password transition of gunbc.bmc_model; the // readback is that model's authentication of the same user with the same password, independent of // the write's completion. The receipts digest the rendered request and response; the password is // never rendered into either. A request the model does not carry (the Redfish account write: the -// model holds no Redfish account surface) yields no response, so the qualification refuses rather -// than reading a success from nothing. -fn dry_route_qualification_request(world: BmcWorld, request: BmcAccountWriteRequest, password: String) -> DryRouteQualificationStep { - match request { +// model holds no Redfish account surface) yields no response, so the classifier refuses rather than +// reading a success from nothing. +fn dry_route_qualification_request(world: BmcWorld, subject: RouteQualificationSubject, password: String) -> DryRouteQualificationStep { + match subject.request { RedfishAccountPasswordWrite { transport_operation: _, action_shape: _ } => DryRouteQualificationStep { world: world, response: none } IpmiSetUserPassword { user: u } => { let step = bmc_ipmi_set_user_password(world: world, user: u, password: password) let accepted = bmc_ipmi_user_accepts(world: step.world, user: u, password: password) - let request_text = join(["dry ", account_write_request_text(request: request) as String, ", password length ", to_string(length(password))], "") as NonEmptyStr + let request_text = join(["modeled ", account_write_request_text(request: subject.request) as String, " at ", subject.endpoint.host as String, " firmware ", subject.firmware.raw_version as String, ", password length ", to_string(length(password))], "") as NonEmptyStr let response_text = join( [request_text as String, " -> completed=", if step.completed { "true" } else { "false" }, " readback=", if accepted { "accepted" } else { "refused" }], "", @@ -208,8 +310,8 @@ fn dry_route_qualification_request(world: BmcWorld, request: BmcAccountWriteRequ DryRouteQualificationStep { world: step.world, response: Present { - value: RouteQualificationResponse { - request: request, + value: ModeledRouteQualificationResponse { + subject: subject, request_receipt: EvidenceRef { label: request_text, digest: content_hash_of_value(value: request_text) }, response_receipt: EvidenceRef { label: response_text, digest: content_hash_of_value(value: response_text) }, completed: step.completed, @@ -227,19 +329,11 @@ type RouteQualificationRefusal | QualificationApprovalDenied | QualificationApprovalForAnotherAuthority { authority: NonEmptyStr } | QualificationApprovalForAnotherRequest { approved: NonEmptyStr, requested: NonEmptyStr } - | QualificationResponseForAnotherRequest + | QualificationResponseForAnotherSubject { answered: RouteQualificationSubject, candidate: RouteQualificationSubject } | QualificationRequestUnrealized | QualificationRequestNotCompleted { response_receipt: EvidenceRef } | QualificationReadbackRefused { response_receipt: EvidenceRef } -type RouteQualificationOutcome - = RouteQualified { standing: BmcRotationRouteStanding } - | RouteQualificationRefused { standing: BmcRotationRouteStanding, cause: RouteQualificationRefusal } - -fn account_write_request_eq(a: BmcAccountWriteRequest, b: BmcAccountWriteRequest) -> Bool { - (account_write_request_text(request: a) as String) == (account_write_request_text(request: b) as String) -} - fn qualification_approval_refusal(standing: BmcRotationRouteStanding, request: BmcAccountWriteRequest, approval: Redemption) -> RouteQualificationRefusal? { match approval { RedemptionRefused { cause: c } => Present { value: QualificationApprovalRefused { cause: c } } @@ -258,50 +352,104 @@ fn qualification_approval_refusal(standing: BmcRotationRouteStanding, request: B } } -// THE EFFECT'S DECISION over what the realization answered. Refuses, keeping the candidate, unless -// the subject is a candidate, the approval discharges this exact request, the response answers that -// request, the request completed, and the independent readback accepted. Only then does the standing -// become grounded by an executed request carrying the request and response receipts. -fn qualify_rotation_route( +// THE CLASSIFIER BOTH CARRIERS SHARE, over the response's fields. none means every condition holds: +// the standing is a candidate, the approval discharges this exact subject, the response answers this +// exact subject (controller, build and request, bound at its mint), it completed, and the independent +// readback accepted. +fn route_qualification_refusal( standing: BmcRotationRouteStanding, approval: Redemption, - response: RouteQualificationResponse?, -) -> RouteQualificationOutcome { + answered: RouteQualificationSubject, + response_receipt: EvidenceRef, + completed: Bool, + readback_accepted: Bool, +) -> RouteQualificationRefusal? { + match standing.grounding { + RouteGroundedByExecutedRequest { request: _, request_receipt: _, response_receipt: _ } => Present { value: QualificationSubjectNotACandidate } + RouteGroundedByCitedSource { request: _, citation: _ } => Present { value: QualificationSubjectNotACandidate } + RouteUngrounded => Present { value: QualificationSubjectNotACandidate } + RouteQualificationCandidate { request: req, evidence: _ } => + match qualification_approval_refusal(standing: standing, request: req, approval: approval) { + Present { value: refusal } => Present { value: refusal } + Absent => { + let candidate = RouteQualificationSubject { endpoint: standing.endpoint, firmware: standing.firmware, request: req } + if !route_qualification_subject_eq(a: answered, b: candidate) { + Present { value: QualificationResponseForAnotherSubject { answered: answered, candidate: candidate } } + } else if !completed { + Present { value: QualificationRequestNotCompleted { response_receipt: response_receipt } } + } else if !readback_accepted { + Present { value: QualificationReadbackRefused { response_receipt: response_receipt } } + } else { + none + } + } + } + } +} + +fn candidate_refusal_without_response(standing: BmcRotationRouteStanding, approval: Redemption) -> RouteQualificationRefusal { match standing.grounding { - RouteGroundedByExecutedRequest { request: _, request_receipt: _, response_receipt: _ } => - RouteQualificationRefused { standing: standing, cause: QualificationSubjectNotACandidate } - RouteGroundedByCitedSource { request: _, citation: _ } => - RouteQualificationRefused { standing: standing, cause: QualificationSubjectNotACandidate } - RouteUngrounded => RouteQualificationRefused { standing: standing, cause: QualificationSubjectNotACandidate } RouteQualificationCandidate { request: req, evidence: _ } => match qualification_approval_refusal(standing: standing, request: req, approval: approval) { + Present { value: refusal } => refusal + Absent => QualificationRequestUnrealized + } + RouteGroundedByExecutedRequest { request: _, request_receipt: _, response_receipt: _ } => QualificationSubjectNotACandidate + RouteGroundedByCitedSource { request: _, citation: _ } => QualificationSubjectNotACandidate + RouteUngrounded => QualificationSubjectNotACandidate + } +} + +type RouteQualificationOutcome + = RouteQualified { standing: BmcRotationRouteStanding } + | RouteQualificationRefused { standing: BmcRotationRouteStanding, cause: RouteQualificationRefusal } + +// THE EFFECT: from a LIVE response only. The one construction of RouteGroundedByExecutedRequest from +// a candidate. Its census row is gunbc.auth.privileged_effect_census route_qualification_effect. +fn qualify_rotation_route( + standing: BmcRotationRouteStanding, + approval: Redemption, + response: RouteQualificationLiveResponse?, +) -> RouteQualificationOutcome { + match response { + Absent => RouteQualificationRefused { standing: standing, cause: candidate_refusal_without_response(standing: standing, approval: approval) } + Present { value: r } => + match route_qualification_refusal(standing: standing, approval: approval, answered: r.subject, response_receipt: r.response_receipt, completed: r.completed, readback_accepted: r.readback_accepted) { Present { value: refusal } => RouteQualificationRefused { standing: standing, cause: refusal } Absent => - match response { - Absent => RouteQualificationRefused { standing: standing, cause: QualificationRequestUnrealized } - Present { value: r } => - if !account_write_request_eq(a: r.request, b: req) { - RouteQualificationRefused { standing: standing, cause: QualificationResponseForAnotherRequest } - } else if !r.completed { - RouteQualificationRefused { standing: standing, cause: QualificationRequestNotCompleted { response_receipt: r.response_receipt } } - } else if !r.readback_accepted { - RouteQualificationRefused { standing: standing, cause: QualificationReadbackRefused { response_receipt: r.response_receipt } } - } else { - RouteQualified { - standing: BmcRotationRouteStanding { - endpoint: standing.endpoint, - firmware: standing.firmware, - grounding: RouteGroundedByExecutedRequest { request: req, request_receipt: r.request_receipt, response_receipt: r.response_receipt }, - }, - } - } + RouteQualified { + standing: BmcRotationRouteStanding { + endpoint: standing.endpoint, + firmware: standing.firmware, + grounding: RouteGroundedByExecutedRequest { request: r.subject.request, request_receipt: r.request_receipt, response_receipt: r.response_receipt }, + }, } } } } +// THE MODELED VERDICT: what the same classifier says of a modeled run. No arm carries a standing. +type ModeledRouteQualificationVerdict + = ModeledQualificationWouldQualify { subject: RouteQualificationSubject, request_receipt: EvidenceRef, response_receipt: EvidenceRef } + | ModeledQualificationRefused { cause: RouteQualificationRefusal } + +fn classify_modeled_route_qualification( + standing: BmcRotationRouteStanding, + approval: Redemption, + response: ModeledRouteQualificationResponse?, +) -> ModeledRouteQualificationVerdict { + match response { + Absent => ModeledQualificationRefused { cause: candidate_refusal_without_response(standing: standing, approval: approval) } + Present { value: r } => + match route_qualification_refusal(standing: standing, approval: approval, answered: r.subject, response_receipt: r.response_receipt, completed: r.completed, readback_accepted: r.readback_accepted) { + Present { value: refusal } => ModeledQualificationRefused { cause: refusal } + Absent => ModeledQualificationWouldQualify { subject: r.subject, request_receipt: r.request_receipt, response_receipt: r.response_receipt } + } + } +} + data route_qualification_live_frontier: DissolutionCondition = unbound_dissolution( - description: "dissolves when a live realization of the route-qualification request mints RouteQualificationResponse beside dry_route_qualification_request from a transport call against the controller, under that controller's own operator go-ahead redeemed through gunbc.auth.approval_broker, with request and response bytes committed as content-addressed evidence; NOT satisfied by the dry realization over gunbc.bmc_model BmcWorld, by a workflow entry that has not executed, or by a receipt that names no controller and build" as NonEmptyStr, + description: "dissolves when a live realization of the route-qualification request mints RouteQualificationLiveResponse in this module from a transport call against the controller, bound to the exact RouteQualificationSubject it was made against, under that controller's own operator go-ahead redeemed through gunbc.auth.approval_broker, with request and response bytes committed as content-addressed evidence, and qualify_rotation_route is called with it; until then RouteQualificationLiveResponse has no mint and no candidate can be grounded by qualification. NOT satisfied by the dry realization over gunbc.bmc_model BmcWorld (its ModeledRouteQualificationResponse cannot construct a standing), by a workflow entry that has not executed, or by a receipt that names no controller and build" as NonEmptyStr, ) // ── THE ORDINARY ROTATION APPLY CONSUMES ONLY A GROUNDED ROUTE ────────────────────────────────── diff --git a/dag/gunbc/machine_intake/bmc_rotation_route_evidence.dag b/dag/gunbc/machine_intake/bmc_rotation_route_evidence.dag index af12bfd8bfa..c792ce52e3b 100644 --- a/dag/gunbc/machine_intake/bmc_rotation_route_evidence.dag +++ b/dag/gunbc/machine_intake/bmc_rotation_route_evidence.dag @@ -1,6 +1,7 @@ module gunbc.machine_intake_bmc_rotation_route_evidence import std.types { NonEmptyStr, String } +import std.dissolution { DissolutionCondition, unbound_dissolution } import std.content_hash { Sha256Hash } import std.content_hash { sha256_hex_digest } import extdeps.bmc.endpoint { BmcControllerEndpoint } @@ -20,8 +21,8 @@ import gunbc.machine_intake_mtjade1_access_observation { import gunbc.machine_intake_mtcollins1_access_observation { mtcollins1_endpoint, mtcollins1_firmware } import gunbc.machine_intake_mtcollins1_bmc_secure_observation { mtcollins1_user3_route_evidence } import gunbc.machine_intake_bmc_rotation_route { - BmcRotationRouteStanding, IpmiSetUserPassword, ObservedSurfaceRead, - rotation_route_candidate, rotation_route_from_committed_execution, redfish_account_password_write, + BmcRotationRouteStanding, HistoricalRotationRouteObservation, IpmiSetUserPassword, ObservedSurfaceRead, + rotation_route_from_committed_execution, redfish_account_password_write, } // THE ROTATION ROUTE STANDING OF EACH CONTROLLER THIS FLEET HAS EVIDENCE FOR, derived from that @@ -45,14 +46,18 @@ fn mtcollins1_rotation_route_standing() -> BmcRotationRouteStanding { ) } -// MTJADE1: AT MOST A CANDIDATE, AND ONLY WHEN ITS MANAGER READ BINDS. The committed Redfish -// GET /redfish/v1/Managers/Self proves the controller serves a Redfish Manager surface at the address -// it was read on and reports the firmware build it reports. It proves no AccountService write and no -// IPMI user-management request on this controller, so the standing is a qualification candidate for -// the Redfish account-password write naming that observed surface -- never grounded. The build is -// read from the capture (its FirmwareVersion) and the family from the same capture's discrimination, -// so a capture that does not decode, does not bind to this unit's observed link, or does not -// discriminate a family yields no standing rather than a stand-in. +// MTJADE1: A HISTORICAL OBSERVATION, NOT A STANDING. The committed Redfish GET +// /redfish/v1/Managers/Self was read on 2026-10-03 at the controller's FACTORY address 10.0.7.2; the +// controller has since been moved to DHCP, so that address is not its current endpoint and a standing +// keyed on it would describe a controller nobody can reach there. The read proves a Redfish Manager +// surface at the build it reports, and proves no AccountService write and no IPMI user-management +// request. So this module states only what the capture is entitled to: a historical route +// observation naming the observed surface, the address and build it was read at, and the Redfish +// account write that makes it worth qualifying. NO CURRENT mtjade1 STANDING IS MINTED IN THIS CUT: +// AccessDiscover (cut O1c-1) mints it from a current read at the current endpoint +// (mtjade1_current_route_standing_frontier). A capture that does not decode, does not bind to this +// unit's observed link, or does not discriminate a family yields no observation rather than a +// stand-in. fn mtjade1_observed_endpoint(network: ObservedBmcNetwork) -> BmcControllerEndpoint? { match network { BmcNetworkObservedStatic { address: a, prefix: _, gateway: _, link: _, basis: _ } => Present { value: BmcControllerEndpoint { host: render_ipv4_address(addr: a) } } @@ -68,7 +73,7 @@ fn manager_read_receipt(read: RecordedManagerIdentityObservation) -> EvidenceRef } } -fn rotation_route_standing_from_manager_read(read: RecordedManagerIdentityObservation) -> BmcRotationRouteStanding? { +fn historical_route_observation_from_manager_read(read: RecordedManagerIdentityObservation) -> HistoricalRotationRouteObservation? { match read.decoded { RecordedManagerRefused { gap: _ } => none RecordedManagerDecoded { observation: o } => @@ -85,12 +90,12 @@ fn rotation_route_standing_from_manager_read(read: RecordedManagerIdentityObserv Absent => none Present { value: receipt } => Present { - value: rotation_route_candidate( - endpoint: endpoint, + value: HistoricalRotationRouteObservation { + observed_endpoint: endpoint, firmware: bmc_firmware_release_identity_of_wire(family: f, wire: o.firmware_version as NonEmptyStr), request: redfish_account_password_write(), evidence: ObservedSurfaceRead { surface: SurfaceManagerIdentity, receipt: receipt }, - ), + }, } } } @@ -99,6 +104,10 @@ fn rotation_route_standing_from_manager_read(read: RecordedManagerIdentityObserv } } -fn mtjade1_rotation_route_standing() -> BmcRotationRouteStanding? uses fs: std.resources.Filesystem { - rotation_route_standing_from_manager_read(read: read_mtjade1_recorded_manager_identity()) +fn mtjade1_historical_rotation_route_observation() -> HistoricalRotationRouteObservation? uses fs: std.resources.Filesystem { + historical_route_observation_from_manager_read(read: read_mtjade1_recorded_manager_identity()) } + +data mtjade1_current_route_standing_frontier: DissolutionCondition = unbound_dissolution( + description: "dissolves when cut O1c-1's AccessDiscover phase mints mtjade1's current BmcRotationRouteStanding from a current read at the controller's current endpoint, joined to this unit by its observed BMC link; NOT satisfied by re-keying mtjade1_historical_rotation_route_observation onto a new address, or by any standing whose endpoint was not read in the same run" as NonEmptyStr, +) diff --git a/dag/test/claim/machine_intake/machine_intake_bmc_rotation_route_forged_probe_witness_test.dag b/dag/test/claim/machine_intake/machine_intake_bmc_rotation_route_forged_probe_witness_test.dag index a3a65886a93..259cfa6ce0e 100644 --- a/dag/test/claim/machine_intake/machine_intake_bmc_rotation_route_forged_probe_witness_test.dag +++ b/dag/test/claim/machine_intake/machine_intake_bmc_rotation_route_forged_probe_witness_test.dag @@ -10,12 +10,12 @@ import gunbc.compile_diagnostic_census { data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly // THE ROTATION ROUTE SEALS, ENROLLED AS EXECUTED REDS (cut O1a). The probe source below authors a -// grounded BmcRotationRouteStanding and a RouteQualificationResponse outside their module, and calls +// grounded BmcRotationRouteStanding, a RouteQualificationLiveResponse and a ModeledRouteQualificationResponse outside their module, and calls // the committed-execution and citation mints from a caller neither admits. This witness hands that // source to the compiler through the diagnostic-census harness and requires the refusal CLASS at each // SUBJECT by name, so a probe refusing for any other reason measures another wall; the class-scoped // control shows a clean source reading the same module through its real producer emits neither class. -data forged_probe_source: String = "module probe_rotation_route_forged\n\nimport std.types { Bool, NonEmptyStr }\nimport std.content_hash { content_hash_of_value }\nimport extdeps.uri { uri_https }\nimport extdeps.external_authority { ExternalAuthority }\nimport gunbc.machine_intake_receipt { EvidenceRef }\nimport gunbc.machine_intake_mtcollins1_access_observation { mtcollins1_endpoint, mtcollins1_firmware }\nimport gunbc.machine_intake_mtcollins1_bmc_secure_observation { mtcollins1_user3_route_evidence }\nimport gunbc.machine_intake_bmc_rotation_route {\n BmcRotationRouteStanding, RouteQualificationResponse, IpmiSetUserPassword, RouteGroundedByExecutedRequest,\n rotation_route_from_committed_execution, rotation_route_from_citation,\n}\n\nfn forged_grounded_standing() -> BmcRotationRouteStanding {\n BmcRotationRouteStanding {\n endpoint: mtcollins1_endpoint,\n firmware: mtcollins1_firmware,\n grounding: RouteGroundedByExecutedRequest { request: IpmiSetUserPassword { user: 3 }, request_receipt: mtcollins1_user3_route_evidence, response_receipt: mtcollins1_user3_route_evidence },\n }\n}\n\nfn forged_response() -> RouteQualificationResponse {\n RouteQualificationResponse {\n request: IpmiSetUserPassword { user: 3 },\n request_receipt: mtcollins1_user3_route_evidence,\n response_receipt: mtcollins1_user3_route_evidence,\n completed: true,\n readback_accepted: true,\n }\n}\n\nfn forged_committed_execution() -> BmcRotationRouteStanding {\n rotation_route_from_committed_execution(\n endpoint: mtcollins1_endpoint,\n firmware: mtcollins1_firmware,\n request: IpmiSetUserPassword { user: 3 },\n request_receipt: mtcollins1_user3_route_evidence,\n response_receipt: mtcollins1_user3_route_evidence,\n )\n}\n\nfn forged_citation() -> BmcRotationRouteStanding {\n rotation_route_from_citation(\n endpoint: mtcollins1_endpoint,\n firmware: mtcollins1_firmware,\n request: IpmiSetUserPassword { user: 3 },\n citation: ExternalAuthority { uri: uri_https(locator: \"example.invalid/forged\") },\n )\n}\n" +data forged_probe_source: String = "module probe_rotation_route_forged\n\nimport std.types { Bool, NonEmptyStr }\nimport std.content_hash { content_hash_of_value }\nimport extdeps.uri { uri_https }\nimport extdeps.external_authority { ExternalAuthority }\nimport gunbc.machine_intake_receipt { EvidenceRef }\nimport gunbc.machine_intake_mtcollins1_access_observation { mtcollins1_endpoint, mtcollins1_firmware }\nimport gunbc.machine_intake_mtcollins1_bmc_secure_observation { mtcollins1_user3_route_evidence }\nimport gunbc.machine_intake_bmc_rotation_route {\n BmcRotationRouteStanding, RouteQualificationLiveResponse, ModeledRouteQualificationResponse, RouteQualificationSubject, IpmiSetUserPassword, RouteGroundedByExecutedRequest,\n rotation_route_from_committed_execution, rotation_route_from_citation,\n}\n\nfn forged_grounded_standing() -> BmcRotationRouteStanding {\n BmcRotationRouteStanding {\n endpoint: mtcollins1_endpoint,\n firmware: mtcollins1_firmware,\n grounding: RouteGroundedByExecutedRequest { request: IpmiSetUserPassword { user: 3 }, request_receipt: mtcollins1_user3_route_evidence, response_receipt: mtcollins1_user3_route_evidence },\n }\n}\n\nfn forged_subject() -> RouteQualificationSubject {\n RouteQualificationSubject { endpoint: mtcollins1_endpoint, firmware: mtcollins1_firmware, request: IpmiSetUserPassword { user: 3 } }\n}\n\nfn forged_modeled_response() -> ModeledRouteQualificationResponse {\n ModeledRouteQualificationResponse {\n subject: forged_subject(),\n request_receipt: mtcollins1_user3_route_evidence,\n response_receipt: mtcollins1_user3_route_evidence,\n completed: true,\n readback_accepted: true,\n }\n}\n\nfn forged_response() -> RouteQualificationLiveResponse {\n RouteQualificationLiveResponse {\n subject: forged_subject(),\n request_receipt: mtcollins1_user3_route_evidence,\n response_receipt: mtcollins1_user3_route_evidence,\n completed: true,\n readback_accepted: true,\n }\n}\n\nfn forged_committed_execution() -> BmcRotationRouteStanding {\n rotation_route_from_committed_execution(\n endpoint: mtcollins1_endpoint,\n firmware: mtcollins1_firmware,\n request: IpmiSetUserPassword { user: 3 },\n request_receipt: mtcollins1_user3_route_evidence,\n response_receipt: mtcollins1_user3_route_evidence,\n )\n}\n\nfn forged_citation() -> BmcRotationRouteStanding {\n rotation_route_from_citation(\n endpoint: mtcollins1_endpoint,\n firmware: mtcollins1_firmware,\n request: IpmiSetUserPassword { user: 3 },\n citation: ExternalAuthority { uri: uri_https(locator: \"example.invalid/forged\") },\n )\n}\n" data harness_control_source: String = "module probe_rotation_route_harness_control\nimport gunbc.machine_intake_bmc_rotation_route { BmcRotationRouteStanding }\nimport gunbc.machine_intake_bmc_rotation_route_evidence { mtcollins1_rotation_route_standing }\nfn standing() -> BmcRotationRouteStanding { mtcollins1_rotation_route_standing() }\n" @@ -47,11 +47,13 @@ test fn the_harness_runs_and_a_clean_source_emits_neither_wall_class() -> Bool { && blocking_count_for_class(c: c, wanted: "ConstructorCallAdmissionRefused") == 0 } -// A grounded standing and a qualification response cannot be authored outside their module. +// A grounded standing, a live qualification response (which has no mint in this cut) and a modeled +// response cannot be authored outside their module. test fn a_forged_route_standing_and_response_are_refused_at_their_literals() -> Bool { let c = probe() blocking_count_for_class_and_subject(c: c, wanted: "SoleConstructorViolation", subject: "BmcRotationRouteStanding") >= 1 - && blocking_count_for_class_and_subject(c: c, wanted: "SoleConstructorViolation", subject: "RouteQualificationResponse") >= 1 + && blocking_count_for_class_and_subject(c: c, wanted: "SoleConstructorViolation", subject: "RouteQualificationLiveResponse") >= 1 + && blocking_count_for_class_and_subject(c: c, wanted: "SoleConstructorViolation", subject: "ModeledRouteQualificationResponse") >= 1 } // The committed-execution and citation mints refuse a caller outside their admitted roots. diff --git a/dag/test/claim/machine_intake/machine_intake_bmc_rotation_route_witness_test.dag b/dag/test/claim/machine_intake/machine_intake_bmc_rotation_route_witness_test.dag index 0ef56252272..985b177b43c 100644 --- a/dag/test/claim/machine_intake/machine_intake_bmc_rotation_route_witness_test.dag +++ b/dag/test/claim/machine_intake/machine_intake_bmc_rotation_route_witness_test.dag @@ -1,6 +1,7 @@ module test.claim.machine_intake_bmc_rotation_route_witness_test import std.types { Bool, NonEmptyStr, String, Timestamp } +import std.decl_ref { decl_field_ref } import std.scoped_authorization { AttemptIdentity } import std.content_hash { content_hash_of_value } import v2.std.live_tree { LiveTreeDisposition, ReadsLiveTree } @@ -24,10 +25,11 @@ import gunbc.machine_intake_bmc_rotation_route { BmcRotationRouteStanding, BmcAccountWriteRequest, IpmiSetUserPassword, RedfishAccountPasswordWrite, ObservedSurfaceRead, PublicStandardOperation, RouteGroundedByExecutedRequest, RouteGroundedByCitedSource, RouteQualificationCandidate, RouteUngrounded, - RouteQualified, RouteQualificationRefused, + RouteQualified, RouteQualificationRefused, RouteQualificationSubject, HistoricalRotationRouteObservation, + ModeledQualificationWouldQualify, ModeledQualificationRefused, RouteQualificationRefusal, QualificationSubjectNotACandidate, QualificationApprovalRefused, QualificationApprovalDenied, QualificationApprovalForAnotherAuthority, QualificationApprovalForAnotherRequest, - QualificationResponseForAnotherRequest, QualificationRequestUnrealized, + QualificationResponseForAnotherSubject, QualificationRequestUnrealized, QualificationRequestNotCompleted, QualificationReadbackRefused, RotationApplyAdmitted, RotationApplyRouteNotGrounded, RotationApplyRouteForAnotherController, RotationApplyRouteForAnotherBuild, RotationApplyApprovalRefused, RotationApplyApprovalDenied, @@ -35,11 +37,11 @@ import gunbc.machine_intake_bmc_rotation_route { route_qualification_authority, rotation_apply_authority, rotation_route_ungrounded, rotation_route_candidate, rotation_route_from_citation, rotation_route_request_identity, rotation_route_is_grounded, - dry_route_qualification_request, qualify_rotation_route, admit_rotation_apply, - redfish_account_password_write, + dry_route_qualification_request, qualify_rotation_route, classify_modeled_route_qualification, admit_rotation_apply, + account_write_request_eq, redfish_account_password_write, } import gunbc.machine_intake_bmc_rotation_route_evidence { - mtcollins1_rotation_route_standing, mtjade1_rotation_route_standing, rotation_route_standing_from_manager_read, + mtcollins1_rotation_route_standing, mtjade1_historical_rotation_route_observation, historical_route_observation_from_manager_read, } data live_tree_disposition: LiveTreeDisposition = ReadsLiveTree @@ -81,10 +83,12 @@ fn rotation_approval_for(s: BmcRotationRouteStanding) -> Redemption { approval(authority: rotation_apply_authority, revision: rotation_route_request_identity(standing: s, request: standing_request(s: s))) } -// A synthetic MegaRAC controller and build for the qualification bootstrap; no unit row is made from -// it, so the dry run grounds nothing any production consumer reads. +// A synthetic MegaRAC controller pair and build for the qualification bootstrap. No unit row is made +// from either, and no modeled run grounds anything: the modeled verdict carries no standing. data lab_endpoint: BmcControllerEndpoint = BmcControllerEndpoint { host: "198.51.100.7" } +data lab_endpoint_b: BmcControllerEndpoint = BmcControllerEndpoint { host: "198.51.100.8" } + fn lab_firmware() -> BmcFirmwareReleaseIdentity { bmc_firmware_release_identity_of_wire(family: AmiMegaRac, wire: "0.32" as NonEmptyStr) } @@ -94,15 +98,23 @@ data lab_surface_receipt: EvidenceRef = EvidenceRef { digest: content_hash_of_value(value: "lab IPMI user list read" as NonEmptyStr), } -fn lab_candidate(request: BmcAccountWriteRequest) -> BmcRotationRouteStanding { +fn candidate_at(endpoint: BmcControllerEndpoint, request: BmcAccountWriteRequest) -> BmcRotationRouteStanding { rotation_route_candidate( - endpoint: lab_endpoint, + endpoint: endpoint, firmware: lab_firmware(), request: request, evidence: ObservedSurfaceRead { surface: SurfaceAccountManagement, receipt: lab_surface_receipt }, ) } +fn lab_candidate(request: BmcAccountWriteRequest) -> BmcRotationRouteStanding { + candidate_at(endpoint: lab_endpoint, request: request) +} + +fn subject_at(endpoint: BmcControllerEndpoint, request: BmcAccountWriteRequest) -> RouteQualificationSubject { + RouteQualificationSubject { endpoint: endpoint, firmware: lab_firmware(), request: request } +} + fn lab_world_with_user3() -> BmcWorld { bmc_with_ipmi_users(world: bmc_world(power: BmcPowerOn), users: [BmcIpmiUser { id: 3, password: "factory" }]) } @@ -111,33 +123,32 @@ fn qualification_approval_for(standing: BmcRotationRouteStanding, request: BmcAc approval(authority: route_qualification_authority, revision: rotation_route_request_identity(standing: standing, request: request)) } -fn qualify_lab(world: BmcWorld, request: BmcAccountWriteRequest, approval_value: Redemption) -> BmcRotationRouteStanding? { - let candidate = lab_candidate(request: request) - match qualify_rotation_route(standing: candidate, approval: approval_value, response: dry_route_qualification_request(world: world, request: request, password: "new-Secret!1").response) { - RouteQualified { standing: s } => Present { value: s } - RouteQualificationRefused { standing: _, cause: _ } => none +fn refusal_name(c: RouteQualificationRefusal) -> String { + match c { + QualificationSubjectNotACandidate => "not-a-candidate" + QualificationApprovalRefused { cause: _ } => "approval-refused" + QualificationApprovalDenied => "approval-denied" + QualificationApprovalForAnotherAuthority { authority: _ } => "another-authority" + QualificationApprovalForAnotherRequest { approved: _, requested: _ } => "another-request" + QualificationResponseForAnotherSubject { answered: _, candidate: _ } => "response-for-another-subject" + QualificationRequestUnrealized => "unrealized" + QualificationRequestNotCompleted { response_receipt: _ } => "not-completed" + QualificationReadbackRefused { response_receipt: _ } => "readback-refused" } } -fn refusal_of(world: BmcWorld, request: BmcAccountWriteRequest, approval_value: Redemption) -> String { - let candidate = lab_candidate(request: request) - match qualify_rotation_route(standing: candidate, approval: approval_value, response: dry_route_qualification_request(world: world, request: request, password: "new-Secret!1").response) { - RouteQualified { standing: _ } => "qualified" - RouteQualificationRefused { standing: _, cause: c } => - match c { - QualificationSubjectNotACandidate => "not-a-candidate" - QualificationApprovalRefused { cause: _ } => "approval-refused" - QualificationApprovalDenied => "approval-denied" - QualificationApprovalForAnotherAuthority { authority: _ } => "another-authority" - QualificationApprovalForAnotherRequest { approved: _, requested: _ } => "another-request" - QualificationResponseForAnotherRequest => "response-for-another-request" - QualificationRequestUnrealized => "unrealized" - QualificationRequestNotCompleted { response_receipt: _ } => "not-completed" - QualificationReadbackRefused { response_receipt: _ } => "readback-refused" - } +// The modeled verdict for a candidate, an approval and a modeled run against `answered`. +fn modeled_verdict(candidate: BmcRotationRouteStanding, approval_value: Redemption, world: BmcWorld, answered: RouteQualificationSubject) -> String { + match classify_modeled_route_qualification(standing: candidate, approval: approval_value, response: dry_route_qualification_request(world: world, subject: answered, password: "new-Secret!1").response) { + ModeledQualificationWouldQualify { subject: _, request_receipt: _, response_receipt: _ } => "would-qualify" + ModeledQualificationRefused { cause: c } => refusal_name(c: c) } } +fn refusal_of(world: BmcWorld, request: BmcAccountWriteRequest, approval_value: Redemption) -> String { + modeled_verdict(candidate: lab_candidate(request: request), approval_value: approval_value, world: world, answered: subject_at(endpoint: lab_endpoint, request: request)) +} + fn apply_verdict(standing: BmcRotationRouteStanding, target: BmcControllerEndpoint, firmware: BmcFirmwareReleaseIdentity, approval_value: Redemption) -> String { match admit_rotation_apply(standing: standing, target_endpoint: target, target_firmware: firmware, approval: approval_value) { RotationApplyAdmitted { standing: _, request: _, decided_by: _ } => "admitted" @@ -160,6 +171,12 @@ fn grounding_kind(standing: BmcRotationRouteStanding) -> String { } } +// The candidate a past read would justify, at the address it was read on. Supplied by the witness +// only: no production code mints a standing from a historical observation. +fn candidate_from_history(h: HistoricalRotationRouteObservation) -> BmcRotationRouteStanding { + rotation_route_candidate(endpoint: h.observed_endpoint, firmware: h.firmware, request: h.request, evidence: h.evidence) +} + // ── rows from evidence ────────────────────────────────────────────────────────────────────────── // mtcollins1 is grounded by its executed IPMI Set User Password on user 3, bound to its own @@ -182,126 +199,157 @@ test fn mtcollins1_is_grounded_by_its_executed_ipmi_request() -> Bool { } } -// mtjade1 is at most a candidate: the committed Manager read (the real path: read, hashed, decoded, -// bound to the unit's link, discriminated) yields a candidate naming the observed Manager surface and -// the build the capture reports, and never a grounded route. -test fn mtjade1_is_a_candidate_naming_its_observed_redfish_manager_surface() -> Bool { - match mtjade1_rotation_route_standing() { +// mtjade1 has a HISTORICAL observation only (the real path: read, hashed, decoded, bound to the +// unit's link, discriminated), at the factory address the capture was read on and the build it +// reports, naming the observed Manager surface and the Redfish account write. Its type is not a +// standing; the current standing is AccessDiscover's (O1c-1). +test fn mtjade1_has_only_a_historical_observation_at_its_factory_address() -> Bool { + match mtjade1_historical_rotation_route_observation() { Absent => false - Present { value: s } => - (s.endpoint.host as String) == "10.0.7.2" - && (s.firmware.raw_version as String) == "2.11.104000" - && !rotation_route_is_grounded(standing: s) - && match s.grounding { - RouteQualificationCandidate { request: r, evidence: e } => - match r { - RedfishAccountPasswordWrite { transport_operation: _, action_shape: _ } => true - IpmiSetUserPassword { user: _ } => false - } - && match e { - ObservedSurfaceRead { surface: sf, receipt: _ } => match sf { SurfaceManagerIdentity => true _ => false } - PublicStandardOperation { authority: _ } => false - } - RouteGroundedByExecutedRequest { request: _, request_receipt: _, response_receipt: _ } => false - RouteGroundedByCitedSource { request: _, citation: _ } => false - RouteUngrounded => false + Present { value: h } => + (h.observed_endpoint.host as String) == "10.0.7.2" + && (h.firmware.raw_version as String) == "2.11.104000" + && account_write_request_eq(a: h.request, b: redfish_account_password_write()) + && match h.evidence { + ObservedSurfaceRead { surface: sf, receipt: _ } => match sf { SurfaceManagerIdentity => true _ => false } + PublicStandardOperation { authority: _ } => false } } } // CONTROL: two AmiMegaRac controllers with different observed and executed surfaces produce -// different route standings. Same family, different grounding: a family-keyed answer cannot pass. +// different route standings. Same family: mtcollins1's executed request grounds its route; the most +// mtjade1's Manager read can justify is a candidate. A family-keyed answer cannot pass. test fn two_megarac_controllers_with_different_surfaces_have_different_standings() -> Bool { - match mtjade1_rotation_route_standing() { + match mtjade1_historical_rotation_route_observation() { Absent => false - Present { value: jade } => + Present { value: h } => { + let jade = candidate_from_history(h: h) let collins = mtcollins1_rotation_route_standing() collins.firmware.family == AmiMegaRac && jade.firmware.family == AmiMegaRac && grounding_kind(standing: collins) == "executed" && grounding_kind(standing: jade) == "candidate" + } } } -// CONTROL: a Manager GET alone cannot construct an account-write route. The only standing the -// Manager read can produce is a candidate; the rotation Apply refuses it even beside an operator -// approval of the rotation. +// CONTROL: a Manager GET alone cannot construct an account-write route. The most the read justifies +// is a candidate; the rotation Apply refuses it beside an exact approval of the rotation, and the +// qualification classifier refuses it with an exact qualification approval because no live (or even +// modeled) account write answered. test fn a_manager_get_alone_cannot_construct_an_account_write_route() -> Bool { - match rotation_route_standing_from_manager_read(read: read_mtjade1_recorded_manager_identity()) { + match historical_route_observation_from_manager_read(read: read_mtjade1_recorded_manager_identity()) { Absent => false - Present { value: s } => + Present { value: h } => { + let s = candidate_from_history(h: h) !rotation_route_is_grounded(standing: s) && apply_verdict(standing: s, target: s.endpoint, firmware: s.firmware, approval_value: rotation_approval_for(s: s)) == "route-not-grounded" + && match qualify_rotation_route(standing: s, approval: qualification_approval_for(standing: s, request: h.request), response: none) { + RouteQualificationRefused { standing: _, cause: c } => refusal_name(c: c) == "unrealized" + RouteQualified { standing: _ } => false + } + } } } // CONTROL: RouteUngrounded + operator approval of the rotation + an ordinary Apply -> refused, and -// refused for the ROUTE. Positive control on the same fold: mtcollins1's grounded route with the same -// approval, aimed at its own controller and build, is admitted. +// refused for the ROUTE. Positive control on the same fold, with the one real live-execution +// carrier: mtcollins1's committed executed route with its exact approval is admitted. test fn an_ungrounded_route_with_rotation_approval_is_refused_and_a_grounded_one_is_admitted() -> Bool { let ungrounded = rotation_route_ungrounded(endpoint: mtcollins1_endpoint, firmware: mtcollins1_firmware) apply_verdict(standing: ungrounded, target: mtcollins1_endpoint, firmware: mtcollins1_firmware, approval_value: rotation_approval_for(s: ungrounded)) == "route-not-grounded" && apply_verdict(standing: mtcollins1_rotation_route_standing(), target: mtcollins1_endpoint, firmware: mtcollins1_firmware, approval_value: rotation_approval_for(s: mtcollins1_rotation_route_standing())) == "admitted" } -// An IPMI route grounded on mtcollins1 does not authorize mtjade1, nor mtcollins1 at another build, -// nor a write approved under the route-qualification authority instead of the rotation's. +// An IPMI route grounded on mtcollins1 does not authorize mtjade1 (at the address its capture names), +// nor mtcollins1 at another build, nor a write approved under the route-qualification authority. test fn mtcollins1s_grounded_route_does_not_authorize_another_controller_build_or_authority() -> Bool { - match mtjade1_rotation_route_standing() { + match mtjade1_historical_rotation_route_observation() { Absent => false - Present { value: jade } => + Present { value: h } => { let collins = mtcollins1_rotation_route_standing() - apply_verdict(standing: collins, target: jade.endpoint, firmware: jade.firmware, approval_value: rotation_approval_for(s: collins)) == "another-controller" + apply_verdict(standing: collins, target: h.observed_endpoint, firmware: h.firmware, approval_value: rotation_approval_for(s: collins)) == "another-controller" && apply_verdict(standing: collins, target: mtcollins1_endpoint, firmware: bmc_firmware_release_identity_of_wire(family: AmiMegaRac, wire: "0.33" as NonEmptyStr), approval_value: rotation_approval_for(s: collins)) == "another-build" - && apply_verdict(standing: collins, target: mtcollins1_endpoint, firmware: mtcollins1_firmware, approval_value: approval(authority: route_qualification_authority, revision: "rotate" as NonEmptyStr)) == "another-authority" + && apply_verdict(standing: collins, target: mtcollins1_endpoint, firmware: mtcollins1_firmware, approval_value: approval(authority: route_qualification_authority, revision: rotation_route_request_identity(standing: collins, request: IpmiSetUserPassword { user: 3 }))) == "another-authority" + } } } // ── the qualification bootstrap, over the dry realization ─────────────────────────────────────── -// Candidate -> grounded by executed request, crossed by the qualification effect alone: the approval -// names route qualification and this exact controller, build and request; the dry Set User Password -// completes and the independent readback accepts the new password. The grounded standing carries the -// dry request and response receipts, and is then admitted for an ordinary rotation Apply. -test fn the_qualification_effect_grounds_a_candidate_from_its_request_and_response() -> Bool { +// THE MODELED RUN CANNOT GROUND A PRODUCTION ROUTE (side-chat review of afcc512e9c, item 1). With a +// candidate, the exact qualification approval and a completed, read-back modeled Set User Password, +// the classifier says the run WOULD qualify -- and that verdict carries no standing. The candidate +// stays a candidate, the ordinary rotation Apply still refuses it, and qualify_rotation_route, the +// only construction of an executed grounding, has no live response to read and refuses. +test fn a_modeled_run_would_qualify_but_grounds_nothing() -> Bool { let request = IpmiSetUserPassword { user: 3 } - let step = dry_route_qualification_request(world: lab_world_with_user3(), request: request, password: "new-Secret!1") + let candidate = lab_candidate(request: request) + let exact = qualification_approval_for(standing: candidate, request: request) + let step = dry_route_qualification_request(world: lab_world_with_user3(), subject: subject_at(endpoint: lab_endpoint, request: request), password: "new-Secret!1") bmc_ipmi_user_accepts(world: step.world, user: 3, password: "new-Secret!1") && !bmc_ipmi_user_accepts(world: step.world, user: 3, password: "factory") - && match qualify_lab(world: lab_world_with_user3(), request: request, approval_value: qualification_approval_for(standing: lab_candidate(request: request), request: request)) { - Absent => false - Present { value: s } => - grounding_kind(standing: s) == "executed" - && (s.endpoint.host as String) == (lab_endpoint.host as String) - && apply_verdict(standing: s, target: lab_endpoint, firmware: lab_firmware(), approval_value: rotation_approval_for(s: s)) == "admitted" + && modeled_verdict(candidate: candidate, approval_value: exact, world: lab_world_with_user3(), answered: subject_at(endpoint: lab_endpoint, request: request)) == "would-qualify" + && grounding_kind(standing: candidate) == "candidate" + && apply_verdict(standing: candidate, target: lab_endpoint, firmware: lab_firmware(), approval_value: rotation_approval_for(s: candidate)) == "route-not-grounded" + && match qualify_rotation_route(standing: candidate, approval: exact, response: none) { + RouteQualificationRefused { standing: s, cause: c } => refusal_name(c: c) == "unrealized" && grounding_kind(standing: s) == "candidate" + RouteQualified { standing: _ } => false } } -// Every way across that is not the qualification effect over a completed, read-back request -// approved for exactly this request, refuses and keeps the candidate. -test fn the_qualification_effect_refuses_every_other_crossing() -> Bool { +// THE RESPONSE IS BOUND TO ITS SUBJECT (item 2). A response made against controller A answers A: for +// candidate B with the same request and B's exact approval it refuses; for candidate A it would +// qualify. +test fn a_response_for_another_controller_is_refused() -> Bool { + let request = IpmiSetUserPassword { user: 3 } + let b = candidate_at(endpoint: lab_endpoint_b, request: request) + let a = candidate_at(endpoint: lab_endpoint, request: request) + modeled_verdict(candidate: b, approval_value: qualification_approval_for(standing: b, request: request), world: lab_world_with_user3(), answered: subject_at(endpoint: lab_endpoint, request: request)) == "response-for-another-subject" + && modeled_verdict(candidate: a, approval_value: qualification_approval_for(standing: a, request: request), world: lab_world_with_user3(), answered: subject_at(endpoint: lab_endpoint, request: request)) == "would-qualify" +} + +// REQUEST IDENTITY IS STRUCTURAL (item 3). Two Redfish account writes differing ONLY in the transport +// operation's declaration field, or ONLY in the action shape, are different requests: unequal, with +// different approval identities, and an approval for one refuses the other. +fn redfish_write(op_field: NonEmptyStr, action_field: NonEmptyStr) -> BmcAccountWriteRequest { + RedfishAccountPasswordWrite { + transport_operation: decl_field_ref(module_path: "extdeps.bmc.http", decl_name: "redfish.Http", field_name: op_field), + action_shape: decl_field_ref(module_path: "extdeps.bmc.types", decl_name: "RedfishSystemAction", field_name: action_field), + } +} + +test fn requests_differing_only_in_transport_or_action_shape_are_different_requests() -> Bool { + let base = redfish_write(op_field: "SetAccountPassword" as NonEmptyStr, action_field: "SetAccountPassword" as NonEmptyStr) + let other_transport = redfish_write(op_field: "SetAccountPasswordV2" as NonEmptyStr, action_field: "SetAccountPassword" as NonEmptyStr) + let other_action = redfish_write(op_field: "SetAccountPassword" as NonEmptyStr, action_field: "ResetAccountPassword" as NonEmptyStr) + let c_transport = lab_candidate(request: other_transport) + let c_action = lab_candidate(request: other_action) + account_write_request_eq(a: base, b: base) + && !account_write_request_eq(a: base, b: other_transport) + && !account_write_request_eq(a: base, b: other_action) + && classify_names(candidate: c_transport, approval_value: qualification_approval_for(standing: c_transport, request: base)) == "another-request" + && classify_names(candidate: c_action, approval_value: qualification_approval_for(standing: c_action, request: base)) == "another-request" +} + +fn classify_names(candidate: BmcRotationRouteStanding, approval_value: Redemption) -> String { + match classify_modeled_route_qualification(standing: candidate, approval: approval_value, response: none) { + ModeledQualificationWouldQualify { subject: _, request_receipt: _, response_receipt: _ } => "would-qualify" + ModeledQualificationRefused { cause: c } => refusal_name(c: c) + } +} + +// Every other way across refuses and keeps the candidate. +test fn the_qualification_classifier_refuses_every_other_crossing() -> Bool { let ipmi = IpmiSetUserPassword { user: 3 } let right = qualification_approval_for(standing: lab_candidate(request: ipmi), request: ipmi) refusal_of(world: lab_world_with_user3(), request: ipmi, approval_value: rotation_approval_for(s: lab_candidate(request: ipmi))) == "another-authority" && refusal_of(world: lab_world_with_user3(), request: ipmi, approval_value: approval(authority: route_qualification_authority, revision: "another controller" as NonEmptyStr)) == "another-request" && refusal_of(world: bmc_world(power: BmcPowerOn), request: ipmi, approval_value: right) == "not-completed" && refusal_of(world: lab_world_with_user3(), request: redfish_account_password_write(), approval_value: qualification_approval_for(standing: lab_candidate(request: redfish_account_password_write()), request: redfish_account_password_write())) == "unrealized" - && match qualify_rotation_route( - standing: rotation_route_ungrounded(endpoint: lab_endpoint, firmware: lab_firmware()), - approval: right, - response: dry_route_qualification_request(world: lab_world_with_user3(), request: ipmi, password: "x").response, - ) { - RouteQualificationRefused { standing: _, cause: c } => match c { QualificationSubjectNotACandidate => true _ => false } - RouteQualified { standing: _ } => false - } - && match qualify_rotation_route( - standing: lab_candidate(request: ipmi), - approval: right, - response: dry_route_qualification_request(world: lab_world_with_user3(), request: IpmiSetUserPassword { user: 4 }, password: "x").response, - ) { - RouteQualificationRefused { standing: _, cause: c } => match c { QualificationResponseForAnotherRequest => true _ => false } - RouteQualified { standing: _ } => false - } + && modeled_verdict(candidate: rotation_route_ungrounded(endpoint: lab_endpoint, firmware: lab_firmware()), approval_value: right, world: lab_world_with_user3(), answered: subject_at(endpoint: lab_endpoint, request: ipmi)) == "not-a-candidate" + && modeled_verdict(candidate: lab_candidate(request: ipmi), approval_value: right, world: lab_world_with_user3(), answered: subject_at(endpoint: lab_endpoint, request: IpmiSetUserPassword { user: 4 })) == "response-for-another-subject" } // THE CITED ARM: a route grounded by a source cited for this build admits an Apply on that build and @@ -334,33 +382,35 @@ test fn the_qualification_effect_is_classified_operator_approved_and_conforms() && match site_verdict(row: r).conformance { Conforms => true _ => false }) } -// AN APPROVAL IS BOUND TO ITS CONTROLLER, BUILD AND REQUEST (review 75181). An admitted approval of -// mtcollins1's rotation, reused for another controller whose route is grounded under the same -// authority, is a different decision and refuses; the same approval re-minted for the other -// controller's own identity is admitted; and a denial is its own typed arm. +// AN APPROVAL IS BOUND TO ITS CONTROLLER, BUILD AND REQUEST (review 75181). mtcollins1's rotation +// approval, reused for another controller's grounded route under the same authority, is a different +// decision and refuses; the approval minted for that route's own identity is admitted; and a denial +// is its own typed arm. Shown on a cited route, the grounded arm a witness may construct. test fn a_rotation_approval_for_one_controller_does_not_admit_another() -> Bool { let request = IpmiSetUserPassword { user: 3 } - match qualify_lab(world: lab_world_with_user3(), request: request, approval_value: qualification_approval_for(standing: lab_candidate(request: request), request: request)) { - Absent => false - Present { value: lab } => - let denied = RedemptionAdmitted { - claims: ApprovalCapabilityClaims { - protocol: approval_capability_protocol, - issuer: "gunbc-approval-broker" as NonEmptyStr, - audience: "srv1" as NonEmptyStr, - authority: rotation_apply_authority, - escalation_id: "route-witness-2" as NonEmptyStr, - request_revision: rotation_route_request_identity(standing: lab, request: request), - decision: ProposeDeny, - attempt: "attempt-2" as AttemptIdentity, - issued_at: "2026-10-03T00:00:00Z", - expires_at: "2026-10-03T00:15:00Z", - key_id: "broker-2026-10" as MacKeyId, - }, - decided_by: "operator" as NonEmptyStr, - } - apply_verdict(standing: lab, target: lab_endpoint, firmware: lab_firmware(), approval_value: rotation_approval_for(s: mtcollins1_rotation_route_standing())) == "another-request" - && apply_verdict(standing: lab, target: lab_endpoint, firmware: lab_firmware(), approval_value: rotation_approval_for(s: lab)) == "admitted" - && apply_verdict(standing: lab, target: lab_endpoint, firmware: lab_firmware(), approval_value: denied) == "approval-denied" + let lab = rotation_route_from_citation( + endpoint: lab_endpoint, + firmware: lab_firmware(), + request: request, + citation: ExternalAuthority { uri: uri_https(locator: "example.invalid/route-witness-citation" as NonEmptyStr) }, + ) + let denied = RedemptionAdmitted { + claims: ApprovalCapabilityClaims { + protocol: approval_capability_protocol, + issuer: "gunbc-approval-broker" as NonEmptyStr, + audience: "srv1" as NonEmptyStr, + authority: rotation_apply_authority, + escalation_id: "route-witness-2" as NonEmptyStr, + request_revision: rotation_route_request_identity(standing: lab, request: request), + decision: ProposeDeny, + attempt: "attempt-2" as AttemptIdentity, + issued_at: "2026-10-03T00:00:00Z", + expires_at: "2026-10-03T00:15:00Z", + key_id: "broker-2026-10" as MacKeyId, + }, + decided_by: "operator" as NonEmptyStr, } + apply_verdict(standing: lab, target: lab_endpoint, firmware: lab_firmware(), approval_value: rotation_approval_for(s: mtcollins1_rotation_route_standing())) == "another-request" + && apply_verdict(standing: lab, target: lab_endpoint, firmware: lab_firmware(), approval_value: rotation_approval_for(s: lab)) == "admitted" + && apply_verdict(standing: lab, target: lab_endpoint, firmware: lab_firmware(), approval_value: denied) == "approval-denied" } From 0f35b65e341005b62a5204131fd014d0396735b5 Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Sun, 4 Oct 2026 08:03:37 +0000 Subject: [PATCH 06/22] Managed-host cut O1a-2: IPMI Set User Access as a second route request shape Co-Authored-By: Claude Opus 5.5 (1M context) --- dag/gunbc/auth/privileged_effect_census.dag | 26 ++++ dag/gunbc/bmc_model.dag | 60 +++++++-- .../machine_intake/bmc_rotation_route.dag | 115 ++++++++++++++++-- .../bmc_rotation_route_evidence.dag | 55 ++++++++- ...intake_bmc_rotation_route_witness_test.dag | 105 +++++++++++++++- 5 files changed, 331 insertions(+), 30 deletions(-) diff --git a/dag/gunbc/auth/privileged_effect_census.dag b/dag/gunbc/auth/privileged_effect_census.dag index 2c01dc277ec..1b3e9118c39 100644 --- a/dag/gunbc/auth/privileged_effect_census.dag +++ b/dag/gunbc/auth/privileged_effect_census.dag @@ -310,6 +310,26 @@ fn route_qualification_effect() -> PrivilegedEffect { } } +// ROTATION ROUTE QUALIFICATION, CHANNEL-ACCESS SHAPE (cut O1a-2). The same qualification effect +// executed for an IPMI Set User Access request: one per controller and build. Its characteristics +// are stated as they are rather than copied from the password row. IRREVERSIBLE, AND SAID SO: a +// privilege write to the wrong user or channel can remove the last administrator's access over the +// LAN, and getting it back needs hands on the unit (a host-side interface or a reflash), which no +// reapply over the network can do. It applies NO credential: it changes a privilege limit, not a +// password. No dispatched run carries it; in this cut it is modeled with a dry realization only. +fn route_qualification_channel_access_effect() -> PrivilegedEffect { + PrivilegedEffect { + subject: "qualify a BMC channel-access route: execute one IPMI Set User Access request on one controller at one firmware build and read it back with Get User Access" as NonEmptyStr, + frequency: DeviceOnce, + reversibility: IrreversibleEffect { what_is_lost: "a privilege write to the wrong user or channel can remove the last administrator's LAN access; recovering it needs hands on the unit, not a reapply" as NonEmptyStr }, + surface: ApiSurface, + workload_identity: WorkloadIdentityUnbindable { cause: "no dispatched run carries route qualification; in cut O1a-2 it is modeled with a dry realization only" as NonEmptyStr }, + minted_reach: MintsNoCredential, + billing: NoBillingConsequence, + witness_discharge: NoWitnessDischarge, + } +} + // ── INTERLOCKS: the state an effect's parameters are honest only under ───────────────────────── // A row's reversibility can depend on a fact about the world rather than about the call: the boot // above is reversible by reapply only while nobody is working on the unit. That condition is not a @@ -611,6 +631,12 @@ data privileged_effect_census: List = [ realized: RealizedApprovalCapability, divergence_reason: none, }, + PrivilegedEffectSite { + site: site(module_path: "gunbc.machine_intake_bmc_rotation_route", decl_name: "qualify_rotation_route"), + effect: route_qualification_channel_access_effect(), + realized: RealizedApprovalCapability, + divergence_reason: none, + }, PrivilegedEffectSite { site: site(module_path: "gunbc.machine_intake_mtcollins1_boot_run", decl_name: "mtcollins1_boot_wet"), effect: mtcollins1_boot_effect(), diff --git a/dag/gunbc/bmc_model.dag b/dag/gunbc/bmc_model.dag index 2bbb9af7cea..b72f0337087 100644 --- a/dag/gunbc/bmc_model.dag +++ b/dag/gunbc/bmc_model.dag @@ -4,7 +4,7 @@ import std.types { Bool, Int, List } import std.measure { Second, second, second_count } import v2.std.optional { Present, Absent } import v2.std.algebra { any, filter } -import extdeps.bmc.ipmi_channel { IpmiUserId } +import extdeps.bmc.ipmi_channel { IpmiUserId, IpmiUserChannelAccess, IpmiChannelPrivilegeLimit } import extdeps.bmc.ipmi_chassis_control { IpmiChassisControlAction, IpmiChassisPowerDown, IpmiChassisPowerUp, IpmiChassisPowerCycle, IpmiChassisHardReset, } @@ -74,13 +74,14 @@ type BmcWorld { sol_drop_after_boot: Second? web: BmcWebWorld ipmi_users: List + ipmi_user_access: List } fn bmc_world(power: BmcPower) -> BmcWorld { BmcWorld { power: power, pending: [], fired: [], boot_override: BootOverrideNone, sel: [], sol_session_open: false, cycle_off_interval: second(count: 5), host_booted_at: none, booted_via_override: false, sol_drop_after_boot: none, - web: bmc_web_world_untouched, ipmi_users: [], + web: bmc_web_world_untouched, ipmi_users: [], ipmi_user_access: [], } } @@ -148,7 +149,7 @@ fn bmc_with_power(world: BmcWorld, power: BmcPower) -> BmcWorld { power: power, pending: world.pending, fired: world.fired, boot_override: world.boot_override, sel: world.sel, sol_session_open: world.sol_session_open, cycle_off_interval: world.cycle_off_interval, host_booted_at: world.host_booted_at, booted_via_override: world.booted_via_override, sol_drop_after_boot: world.sol_drop_after_boot, - web: world.web, ipmi_users: world.ipmi_users, + web: world.web, ipmi_users: world.ipmi_users, ipmi_user_access: world.ipmi_user_access, } } @@ -157,7 +158,7 @@ fn bmc_with_web(world: BmcWorld, web: BmcWebWorld) -> BmcWorld { power: world.power, pending: world.pending, fired: world.fired, boot_override: world.boot_override, sel: world.sel, sol_session_open: world.sol_session_open, cycle_off_interval: world.cycle_off_interval, host_booted_at: world.host_booted_at, booted_via_override: world.booted_via_override, sol_drop_after_boot: world.sol_drop_after_boot, - web: web, ipmi_users: world.ipmi_users, + web: web, ipmi_users: world.ipmi_users, ipmi_user_access: world.ipmi_user_access, } } @@ -266,7 +267,7 @@ fn bmc_with_override(world: BmcWorld, over: BmcBootOverride) -> BmcWorld { power: world.power, pending: world.pending, fired: world.fired, boot_override: over, sel: world.sel, sol_session_open: world.sol_session_open, cycle_off_interval: world.cycle_off_interval, host_booted_at: world.host_booted_at, booted_via_override: world.booted_via_override, sol_drop_after_boot: world.sol_drop_after_boot, - web: world.web, ipmi_users: world.ipmi_users, + web: world.web, ipmi_users: world.ipmi_users, ipmi_user_access: world.ipmi_user_access, } } @@ -275,7 +276,7 @@ fn bmc_with_sol_session(world: BmcWorld, open: Bool) -> BmcWorld { power: world.power, pending: world.pending, fired: world.fired, boot_override: world.boot_override, sel: world.sel, sol_session_open: open, cycle_off_interval: world.cycle_off_interval, host_booted_at: world.host_booted_at, booted_via_override: world.booted_via_override, sol_drop_after_boot: world.sol_drop_after_boot, - web: world.web, ipmi_users: world.ipmi_users, + web: world.web, ipmi_users: world.ipmi_users, ipmi_user_access: world.ipmi_user_access, } } @@ -284,7 +285,7 @@ fn bmc_with_pending(world: BmcWorld, pending: List, fired: Li power: world.power, pending: pending, fired: fired, boot_override: world.boot_override, sel: world.sel, sol_session_open: world.sol_session_open, cycle_off_interval: world.cycle_off_interval, host_booted_at: world.host_booted_at, booted_via_override: world.booted_via_override, sol_drop_after_boot: world.sol_drop_after_boot, - web: world.web, ipmi_users: world.ipmi_users, + web: world.web, ipmi_users: world.ipmi_users, ipmi_user_access: world.ipmi_user_access, } } @@ -300,7 +301,7 @@ fn bmc_host_boots(world: BmcWorld, now: Second) -> BmcWorld { power: BmcPowerOn, pending: pending, fired: world.fired, boot_override: BootOverrideNone, sel: world.sel, sol_session_open: world.sol_session_open, cycle_off_interval: world.cycle_off_interval, host_booted_at: Present { value: now }, booted_via_override: via, sol_drop_after_boot: world.sol_drop_after_boot, - web: world.web, ipmi_users: world.ipmi_users, + web: world.web, ipmi_users: world.ipmi_users, ipmi_user_access: world.ipmi_user_access, } } @@ -401,7 +402,7 @@ fn bmc_with_sol_drop_after_boot(world: BmcWorld, after: Second) -> BmcWorld { power: world.power, pending: world.pending, fired: world.fired, boot_override: world.boot_override, sel: world.sel, sol_session_open: world.sol_session_open, cycle_off_interval: world.cycle_off_interval, host_booted_at: world.host_booted_at, booted_via_override: world.booted_via_override, sol_drop_after_boot: Present { value: after }, - web: world.web, ipmi_users: world.ipmi_users, + web: world.web, ipmi_users: world.ipmi_users, ipmi_user_access: world.ipmi_user_access, } } @@ -432,7 +433,7 @@ fn bmc_with_ipmi_users(world: BmcWorld, users: List) -> BmcWorld { power: world.power, pending: world.pending, fired: world.fired, boot_override: world.boot_override, sel: world.sel, sol_session_open: world.sol_session_open, cycle_off_interval: world.cycle_off_interval, host_booted_at: world.host_booted_at, booted_via_override: world.booted_via_override, sol_drop_after_boot: world.sol_drop_after_boot, - web: world.web, ipmi_users: users, + web: world.web, ipmi_users: users, ipmi_user_access: world.ipmi_user_access, } } @@ -455,3 +456,42 @@ fn bmc_ipmi_set_user_password(world: BmcWorld, user: IpmiUserId, password: Strin fn bmc_ipmi_user_accepts(world: BmcWorld, user: IpmiUserId, password: String) -> Bool { any(world.ipmi_users, u => (u.id as Int) == (user as Int) && u.password == password) } + +// ── IPMI USER ACCESS ───────────────────────────────────────────────────────────────────────────── +// +// THE CONTROLLER'S PER-CHANNEL USER ACCESS TABLE: one (channel, user, privilege limit) row per pair +// the controller holds, the shape Get User Access returns (extdeps.bmc.ipmi_channel). The transition +// is the Set User Access command of the public IPMI v2.0 specification (App NetFn, command 43h): it +// sets one user's privilege limit on one channel and changes nothing else -- not the password, not +// the row of any other channel or user. A write for a user the IPMI user table does not hold changes +// nothing and is not completed. +type BmcIpmiSetUserAccessStep { + world: BmcWorld + completed: Bool +} + +fn bmc_with_ipmi_user_access(world: BmcWorld, rows: List) -> BmcWorld { + BmcWorld { + power: world.power, pending: world.pending, fired: world.fired, boot_override: world.boot_override, sel: world.sel, + sol_session_open: world.sol_session_open, cycle_off_interval: world.cycle_off_interval, + host_booted_at: world.host_booted_at, booted_via_override: world.booted_via_override, sol_drop_after_boot: world.sol_drop_after_boot, + web: world.web, ipmi_users: world.ipmi_users, ipmi_user_access: rows, + } +} + +fn bmc_ipmi_set_user_access(world: BmcWorld, access: IpmiUserChannelAccess) -> BmcIpmiSetUserAccessStep { + if any(world.ipmi_users, u => (u.id as Int) == (access.user as Int)) { + let others = filter(world.ipmi_user_access, r => !((r.user as Int) == (access.user as Int) && (r.channel as Int) == (access.channel as Int))) + BmcIpmiSetUserAccessStep { world: bmc_with_ipmi_user_access(world: world, rows: list_append(others, access)), completed: true } + } else { + BmcIpmiSetUserAccessStep { world: world, completed: false } + } +} + +// Get User Access for one (channel, user): the readback a channel-access write is judged by, +// independent of the write's completion. Absent when the controller holds no row for the pair. +fn bmc_ipmi_get_user_access(world: BmcWorld, user: IpmiUserId, channel: Int) -> IpmiChannelPrivilegeLimit? { + let wanted: IpmiChannelPrivilegeLimit? = none + filter(world.ipmi_user_access, r => (r.user as Int) == (user as Int) && (r.channel as Int) == channel) + |> fold(init: wanted, f: (acc, r) => match acc { Absent => Present { value: r.privilege } Present { value: _ } => acc }) +} diff --git a/dag/gunbc/machine_intake/bmc_rotation_route.dag b/dag/gunbc/machine_intake/bmc_rotation_route.dag index 076ddff3ed7..9872df6777b 100644 --- a/dag/gunbc/machine_intake/bmc_rotation_route.dag +++ b/dag/gunbc/machine_intake/bmc_rotation_route.dag @@ -9,11 +9,14 @@ import extdeps.external_authority { ExternalAuthority } import extdeps.bmc.endpoint { AmiMegaRac, BmcControllerEndpoint, BmcFirmwareFamily, OpenBmc } import extdeps.bmc.capability { BmcFirmwareReleaseIdentity, bmc_firmware_release_identity_eq } import extdeps.bmc.access_profile { BmcAccessSurface } -import extdeps.bmc.ipmi_channel { IpmiUserId } +import extdeps.bmc.ipmi_channel { + IpmiUserId, IpmiUserChannelAccess, IpmiChannelPrivilegeLimit, + IpmiPrivilegeCallback, IpmiPrivilegeUser, IpmiPrivilegeOperator, IpmiPrivilegeAdministrator, IpmiPrivilegeOem, IpmiPrivilegeNoAccess, +} import gunbc.machine_intake_receipt { EvidenceRef } import gunbc.auth.approval_capability { ProposeApprove, ProposeDeny } import gunbc.auth.approval_broker { Redemption, RedemptionAdmitted, RedemptionRefused, RedemptionRefusal } -import gunbc.bmc_model { BmcWorld, bmc_ipmi_set_user_password, bmc_ipmi_user_accepts } +import gunbc.bmc_model { BmcWorld, bmc_ipmi_set_user_password, bmc_ipmi_user_accepts, bmc_ipmi_set_user_access, bmc_ipmi_get_user_access } data bmc_rotation_route_disposition: Disposition = Terminal { reason: "The rotation route standing is the terminal form of the AccessDiscover route answer (docs/plans/managed-host-untangle.md, cut O1a): one sealed standing per controller and firmware build, bound to the evidence that grounds it, and the separate qualification effect that is the only crossing from a candidate to an executed-request grounding. It replaces the family-keyed rotation answer that gunbc.bmc_implementation_dispatch used to give; nothing here is staged pending a different construction." as NonEmptyStr, @@ -35,9 +38,15 @@ data bmc_rotation_route_disposition: Disposition = Terminal { // over the controller's IPMI LAN route; it is what mtcollins1 executed. RedfishAccountPasswordWrite // names the modeled Redfish account-password operation and action shape by reference; on MegaRAC it // is only ever a candidate today, because no AccountService write has been executed on any MegaRAC -// controller this repository has receipts for. +// controller this repository has receipts for. IpmiSetUserAccess is the public IPMI v2.0 Set User +// Access command (App NetFn, command 43h): it sets one user's privilege limit on one channel, carried +// as the same (channel, user, privilege) row Get User Access returns (extdeps.bmc.ipmi_channel +// IpmiUserChannelAccess). It is the write that closes a published account on a channel -- a password +// write cannot set a channel privilege to NO ACCESS -- and no execution of it is committed for any +// controller, so it is only ever a candidate today. type BmcAccountWriteRequest = IpmiSetUserPassword { user: IpmiUserId } + | IpmiSetUserAccess { access: IpmiUserChannelAccess } | RedfishAccountPasswordWrite { transport_operation: DeclarationRef, action_shape: DeclarationRef } // WHY A CANDIDATE IS WORTH TRYING. Either a surface was observed on THIS controller (the read surface @@ -154,6 +163,8 @@ fn rotation_route_is_grounded(standing: BmcRotationRouteStanding) -> Bool { fn account_write_request_text(request: BmcAccountWriteRequest) -> NonEmptyStr { match request { IpmiSetUserPassword { user: u } => join(["IPMI Set User Password (App 47h) user ", to_string(u as Int)], "") as NonEmptyStr + IpmiSetUserAccess { access: a } => + join(["IPMI Set User Access (App 43h) user ", to_string(a.user as Int), " channel ", to_string(a.channel as Int), " privilege ", canonical_ipmi_privilege(privilege: a.privilege)], "") as NonEmptyStr RedfishAccountPasswordWrite { transport_operation: op, action_shape: _ } => join(["Redfish account password write via ", op.module_path as String, " ", op.decl_name as String], "") as NonEmptyStr } @@ -171,17 +182,72 @@ fn account_write_request_eq(a: BmcAccountWriteRequest, b: BmcAccountWriteRequest IpmiSetUserPassword { user: ua } => match b { IpmiSetUserPassword { user: ub } => (ua as Int) == (ub as Int) + IpmiSetUserAccess { access: _ } => false + RedfishAccountPasswordWrite { transport_operation: _, action_shape: _ } => false + } + IpmiSetUserAccess { access: xa } => + match b { + IpmiSetUserPassword { user: _ } => false + IpmiSetUserAccess { access: xb } => + (xa.user as Int) == (xb.user as Int) + && (xa.channel as Int) == (xb.channel as Int) + && ipmi_privilege_eq(a: xa.privilege, b: xb.privilege) RedfishAccountPasswordWrite { transport_operation: _, action_shape: _ } => false } RedfishAccountPasswordWrite { transport_operation: oa, action_shape: sa } => match b { IpmiSetUserPassword { user: _ } => false + IpmiSetUserAccess { access: _ } => false RedfishAccountPasswordWrite { transport_operation: ob, action_shape: sb } => declaration_ref_eq(a: oa, b: ob) && declaration_ref_eq(a: sa, b: sb) } } } +// THE OPERATION a request performs, without its arguments: which command (or which modeled Redfish +// operation and action shape). A route grounds an OPERATION on a controller and build -- an executed +// Set User Password on user 3 shows that controller performs Set User Password -- while the exact +// arguments are what an approval names. So the Apply admission compares shapes, and the approval +// identity compares every field. +fn account_write_request_same_operation(a: BmcAccountWriteRequest, b: BmcAccountWriteRequest) -> Bool { + match a { + IpmiSetUserPassword { user: _ } => + match b { + IpmiSetUserPassword { user: _ } => true + IpmiSetUserAccess { access: _ } => false + RedfishAccountPasswordWrite { transport_operation: _, action_shape: _ } => false + } + IpmiSetUserAccess { access: _ } => + match b { + IpmiSetUserPassword { user: _ } => false + IpmiSetUserAccess { access: _ } => true + RedfishAccountPasswordWrite { transport_operation: _, action_shape: _ } => false + } + RedfishAccountPasswordWrite { transport_operation: oa, action_shape: sa } => + match b { + IpmiSetUserPassword { user: _ } => false + IpmiSetUserAccess { access: _ } => false + RedfishAccountPasswordWrite { transport_operation: ob, action_shape: sb } => + declaration_ref_eq(a: oa, b: ob) && declaration_ref_eq(a: sa, b: sb) + } + } +} + +fn canonical_ipmi_privilege(privilege: IpmiChannelPrivilegeLimit) -> String { + match privilege { + IpmiPrivilegeCallback => "callback" + IpmiPrivilegeUser => "user" + IpmiPrivilegeOperator => "operator" + IpmiPrivilegeAdministrator => "administrator" + IpmiPrivilegeOem => "oem" + IpmiPrivilegeNoAccess => "no-access" + } +} + +fn ipmi_privilege_eq(a: IpmiChannelPrivilegeLimit, b: IpmiChannelPrivilegeLimit) -> Bool { + canonical_ipmi_privilege(privilege: a) == canonical_ipmi_privilege(privilege: b) +} + fn canonical_component(text: String) -> String { join([to_string(length(text)), ":", text], "") } @@ -201,6 +267,8 @@ fn canonical_decl_ref(r: DeclarationRef) -> String { fn canonical_account_write_request(request: BmcAccountWriteRequest) -> String { match request { IpmiSetUserPassword { user: u } => join(["ipmi-set-user-password;", canonical_component(text: to_string(u as Int))], "") + IpmiSetUserAccess { access: a } => + join(["ipmi-set-user-access;", canonical_component(text: to_string(a.user as Int)), canonical_component(text: to_string(a.channel as Int)), canonical_component(text: canonical_ipmi_privilege(privilege: a.privilege))], "") RedfishAccountPasswordWrite { transport_operation: op, action_shape: act } => join(["redfish-account-password-write;", canonical_decl_ref(r: op), canonical_decl_ref(r: act)], "") } @@ -290,15 +358,40 @@ type DryRouteQualificationStep { response: ModeledRouteQualificationResponse? } -// THE DRY REALIZATION. The request is the IPMI Set User Password transition of gunbc.bmc_model; the -// readback is that model's authentication of the same user with the same password, independent of -// the write's completion. The receipts digest the rendered request and response; the password is +// THE DRY REALIZATION. A Set User Password request is gunbc.bmc_model's password transition, read +// back by that model's authentication of the same user with the same password; a Set User Access +// request is its channel-access transition, read back by Get User Access for the same (channel, +// user). Each readback is independent of the write's completion. The receipts digest the rendered request and response; the password is // never rendered into either. A request the model does not carry (the Redfish account write: the // model holds no Redfish account surface) yields no response, so the classifier refuses rather than // reading a success from nothing. fn dry_route_qualification_request(world: BmcWorld, subject: RouteQualificationSubject, password: String) -> DryRouteQualificationStep { match subject.request { RedfishAccountPasswordWrite { transport_operation: _, action_shape: _ } => DryRouteQualificationStep { world: world, response: none } + IpmiSetUserAccess { access: x } => { + let step = bmc_ipmi_set_user_access(world: world, access: x) + let accepted = match bmc_ipmi_get_user_access(world: step.world, user: x.user, channel: x.channel as Int) { + Present { value: p } => ipmi_privilege_eq(a: p, b: x.privilege) + Absent => false + } + let request_text = join(["modeled ", account_write_request_text(request: subject.request) as String, " at ", subject.endpoint.host as String, " firmware ", subject.firmware.raw_version as String], "") as NonEmptyStr + let response_text = join( + [request_text as String, " -> completed=", if step.completed { "true" } else { "false" }, " get-user-access=", if accepted { "matches" } else { "differs" }], + "", + ) as NonEmptyStr + DryRouteQualificationStep { + world: step.world, + response: Present { + value: ModeledRouteQualificationResponse { + subject: subject, + request_receipt: EvidenceRef { label: request_text, digest: content_hash_of_value(value: request_text) }, + response_receipt: EvidenceRef { label: response_text, digest: content_hash_of_value(value: response_text) }, + completed: step.completed, + readback_accepted: accepted, + }, + }, + } + } IpmiSetUserPassword { user: u } => { let step = bmc_ipmi_set_user_password(world: world, user: u, password: password) let accepted = bmc_ipmi_user_accepts(world: step.world, user: u, password: password) @@ -460,12 +553,15 @@ data route_qualification_live_frontier: DissolutionCondition = unbound_dissoluti // controller or build refuses a write to another, so mtcollins1's executed IPMI route can never // authorize mtjade1. The approval must name the rotation authority AND this exact controller, build // and request (rotation_route_request_identity): an approval given for one controller is a different -// decision on every other, refused as RotationApplyApprovalForAnotherRequest. +// decision on every other, refused as RotationApplyApprovalForAnotherRequest. The Apply names the +// request it will make, and a route grounds one OPERATION: a grounded Set User Password route does not +// admit a Set User Access write, refused as RotationApplyRouteForAnotherOperation. type RotationApplyAdmission = RotationApplyAdmitted { standing: BmcRotationRouteStanding, request: BmcAccountWriteRequest, decided_by: NonEmptyStr } | RotationApplyRouteNotGrounded { standing: BmcRotationRouteStanding } | RotationApplyRouteForAnotherController { route_endpoint: BmcControllerEndpoint, target_endpoint: BmcControllerEndpoint } | RotationApplyRouteForAnotherBuild { route_firmware: BmcFirmwareReleaseIdentity, target_firmware: BmcFirmwareReleaseIdentity } + | RotationApplyRouteForAnotherOperation { grounded: BmcAccountWriteRequest, requested: BmcAccountWriteRequest } | RotationApplyApprovalRefused { cause: RedemptionRefusal } | RotationApplyApprovalDenied | RotationApplyApprovalForAnotherAuthority { authority: NonEmptyStr } @@ -484,15 +580,18 @@ fn admit_rotation_apply( standing: BmcRotationRouteStanding, target_endpoint: BmcControllerEndpoint, target_firmware: BmcFirmwareReleaseIdentity, + request: BmcAccountWriteRequest, approval: Redemption, ) -> RotationApplyAdmission { match grounded_request(standing: standing) { Absent => RotationApplyRouteNotGrounded { standing: standing } - Present { value: request } => + Present { value: grounded } => if (standing.endpoint.host as String) != (target_endpoint.host as String) { RotationApplyRouteForAnotherController { route_endpoint: standing.endpoint, target_endpoint: target_endpoint } } else if !bmc_firmware_release_identity_eq(a: standing.firmware, b: target_firmware) { RotationApplyRouteForAnotherBuild { route_firmware: standing.firmware, target_firmware: target_firmware } + } else if !account_write_request_same_operation(a: grounded, b: request) { + RotationApplyRouteForAnotherOperation { grounded: grounded, requested: request } } else { match approval { RedemptionRefused { cause: c } => RotationApplyApprovalRefused { cause: c } diff --git a/dag/gunbc/machine_intake/bmc_rotation_route_evidence.dag b/dag/gunbc/machine_intake/bmc_rotation_route_evidence.dag index c792ce52e3b..c58ad9deb0a 100644 --- a/dag/gunbc/machine_intake/bmc_rotation_route_evidence.dag +++ b/dag/gunbc/machine_intake/bmc_rotation_route_evidence.dag @@ -1,11 +1,11 @@ module gunbc.machine_intake_bmc_rotation_route_evidence -import std.types { NonEmptyStr, String } +import std.types { Int, NonEmptyStr, String } import std.dissolution { DissolutionCondition, unbound_dissolution } import std.content_hash { Sha256Hash } import std.content_hash { sha256_hex_digest } -import extdeps.bmc.endpoint { BmcControllerEndpoint } -import extdeps.bmc.capability { bmc_firmware_release_identity_of_wire } +import extdeps.bmc.endpoint { AmiMegaRac, BmcControllerEndpoint } +import extdeps.bmc.capability { BmcFirmwareReleaseIdentity, bmc_firmware_release_identity_of_wire } import extdeps.bmc.access_profile { SurfaceManagerIdentity } import extdeps.network.ipv4 { render_ipv4_address } import gunbc.machine_intake_receipt { EvidenceRef } @@ -19,10 +19,12 @@ import gunbc.machine_intake_mtjade1_access_observation { read_mtjade1_recorded_manager_identity, } import gunbc.machine_intake_mtcollins1_access_observation { mtcollins1_endpoint, mtcollins1_firmware } -import gunbc.machine_intake_mtcollins1_bmc_secure_observation { mtcollins1_user3_route_evidence } +import gunbc.machine_intake_mtcollins1_bmc_secure_observation { mtcollins1_user3_route_evidence, mtcollins1_published_user } +import extdeps.bmc.ipmi_channel { IpmiPrivilegeNoAccess, ipmi_user_channel_access, extdeps_external_authority_anchor } +import extdeps.ampere.mt_collins_firmware_release { mt_collins_bmc_0_45_3_hpm } import gunbc.machine_intake_bmc_rotation_route { - BmcRotationRouteStanding, HistoricalRotationRouteObservation, IpmiSetUserPassword, ObservedSurfaceRead, - rotation_route_from_committed_execution, redfish_account_password_write, + BmcRotationRouteStanding, HistoricalRotationRouteObservation, IpmiSetUserPassword, IpmiSetUserAccess, ObservedSurfaceRead, + PublicStandardOperation, rotation_route_candidate, rotation_route_from_committed_execution, redfish_account_password_write, } // THE ROTATION ROUTE STANDING OF EACH CONTROLLER THIS FLEET HAS EVIDENCE FOR, derived from that @@ -46,6 +48,47 @@ fn mtcollins1_rotation_route_standing() -> BmcRotationRouteStanding { ) } +// MTCOLLINS1'S CHANNEL-ACCESS ROUTE (cut O1a-2): A CANDIDATE, NOT GROUNDED. The BmcSecure conjunction +// needs the published account refused on every LAN census member, and a password write cannot set a +// channel privilege limit to NO ACCESS; Set User Access can. No execution of it on this controller is +// committed, so the standing is a qualification candidate and nothing more. +// +// THE CONTROLLER AND BUILD ARE THE CURRENT ONES. The endpoint is the unit's controller address. The +// build is BMC 0.45.3, the release extdeps.ampere.mt_collins_firmware_release mt_collins_bmc_0_45_3_hpm +// installed on 2026-10-02 (gunbc.fleet.mtcollins_firmware_converge credential_effect_of records that +// reflash), so it is NOT mtcollins1_firmware (0.32), and the executed password route on 0.32 does not +// carry over to it (admit_rotation_apply refuses another build). The raw string is the release's own +// version; no post-reflash version readback is committed (see the evidence note below). +// +// THE REQUEST is the one the operator-gated qualification would execute: the published account +// (mtcollins1_published_user) to NO ACCESS on LAN channel 2, the first of the channels the operator +// reports the factory administrator still holds after the reflash (eager-gull-22, 2026-10-04). Those +// channel numbers are an operator report, not a committed observation. +// +// EVIDENCE IS THE PUBLIC STANDARD ONLY. The IPMI v2.0 specification defines Set User Access +// (extdeps.bmc.ipmi_channel's cited authority). NO post-reflash channel-access observation is +// committed, so none is cited. The read-only observations missing, each to be committed as a +// content-addressed receipt from the controller at its current address: Get Channel Info for every +// channel 0h-Fh (the post-reflash channel census), Get User Access for the published user on every +// channel that census returns, and a version readback (Get Device ID / mc info) naming the installed +// BMC build. +fn mtcollins1_current_bmc_firmware() -> BmcFirmwareReleaseIdentity { + let v = mt_collins_bmc_0_45_3_hpm.version + bmc_firmware_release_identity_of_wire( + family: AmiMegaRac, + wire: join([to_string(v.major as Int), ".", to_string(v.minor as Int), ".", to_string(v.patch as Int)], "") as NonEmptyStr, + ) +} + +fn mtcollins1_channel_access_route_standing() -> BmcRotationRouteStanding { + rotation_route_candidate( + endpoint: mtcollins1_endpoint, + firmware: mtcollins1_current_bmc_firmware(), + request: IpmiSetUserAccess { access: ipmi_user_channel_access(channel: 2, user: mtcollins1_published_user, privilege: IpmiPrivilegeNoAccess) }, + evidence: PublicStandardOperation { authority: extdeps_external_authority_anchor }, + ) +} + // MTJADE1: A HISTORICAL OBSERVATION, NOT A STANDING. The committed Redfish GET // /redfish/v1/Managers/Self was read on 2026-10-03 at the controller's FACTORY address 10.0.7.2; the // controller has since been moved to DHCP, so that address is not its current endpoint and a standing diff --git a/dag/test/claim/machine_intake/machine_intake_bmc_rotation_route_witness_test.dag b/dag/test/claim/machine_intake/machine_intake_bmc_rotation_route_witness_test.dag index 985b177b43c..8bd3899bbf3 100644 --- a/dag/test/claim/machine_intake/machine_intake_bmc_rotation_route_witness_test.dag +++ b/dag/test/claim/machine_intake/machine_intake_bmc_rotation_route_witness_test.dag @@ -17,12 +17,13 @@ import gunbc.auth.approval_capability { ApprovalCapabilityClaims, ProposeApprove import gunbc.auth.approval_broker { Redemption, RedemptionAdmitted } import gunbc.auth.authorization_pattern_selection { OperatorApprovedCapability, PatternSelected, select_authorization_pattern } import gunbc.auth.privileged_effect_census { Conforms, privileged_effect_census, site_verdict } -import gunbc.bmc_model { BmcWorld, BmcIpmiUser, BmcPowerOn, bmc_world, bmc_with_ipmi_users, bmc_ipmi_user_accepts } +import gunbc.bmc_model { BmcWorld, BmcIpmiUser, BmcPowerOn, bmc_world, bmc_with_ipmi_users, bmc_ipmi_user_accepts, bmc_ipmi_get_user_access } +import extdeps.bmc.ipmi_channel { IpmiChannelPrivilegeLimit, IpmiPrivilegeNoAccess, IpmiPrivilegeAdministrator, IpmiPrivilegeUser, ipmi_user_channel_access } import gunbc.machine_intake_mtcollins1_access_observation { mtcollins1_endpoint, mtcollins1_firmware } import gunbc.machine_intake_mtcollins1_bmc_secure_observation { mtcollins1_user3_route_digest } import gunbc.machine_intake_mtjade1_access_observation { read_mtjade1_recorded_manager_identity } import gunbc.machine_intake_bmc_rotation_route { - BmcRotationRouteStanding, BmcAccountWriteRequest, IpmiSetUserPassword, RedfishAccountPasswordWrite, + BmcRotationRouteStanding, BmcAccountWriteRequest, IpmiSetUserPassword, IpmiSetUserAccess, RedfishAccountPasswordWrite, ObservedSurfaceRead, PublicStandardOperation, RouteGroundedByExecutedRequest, RouteGroundedByCitedSource, RouteQualificationCandidate, RouteUngrounded, RouteQualified, RouteQualificationRefused, RouteQualificationSubject, HistoricalRotationRouteObservation, @@ -32,7 +33,7 @@ import gunbc.machine_intake_bmc_rotation_route { QualificationResponseForAnotherSubject, QualificationRequestUnrealized, QualificationRequestNotCompleted, QualificationReadbackRefused, RotationApplyAdmitted, RotationApplyRouteNotGrounded, RotationApplyRouteForAnotherController, - RotationApplyRouteForAnotherBuild, RotationApplyApprovalRefused, RotationApplyApprovalDenied, + RotationApplyRouteForAnotherBuild, RotationApplyRouteForAnotherOperation, RotationApplyApprovalRefused, RotationApplyApprovalDenied, RotationApplyApprovalForAnotherAuthority, RotationApplyApprovalForAnotherRequest, route_qualification_authority, rotation_apply_authority, rotation_route_ungrounded, rotation_route_candidate, rotation_route_from_citation, @@ -41,7 +42,7 @@ import gunbc.machine_intake_bmc_rotation_route { account_write_request_eq, redfish_account_password_write, } import gunbc.machine_intake_bmc_rotation_route_evidence { - mtcollins1_rotation_route_standing, mtjade1_historical_rotation_route_observation, historical_route_observation_from_manager_read, + mtcollins1_rotation_route_standing, mtcollins1_channel_access_route_standing, mtjade1_historical_rotation_route_observation, historical_route_observation_from_manager_read, } data live_tree_disposition: LiveTreeDisposition = ReadsLiveTree @@ -150,11 +151,16 @@ fn refusal_of(world: BmcWorld, request: BmcAccountWriteRequest, approval_value: } fn apply_verdict(standing: BmcRotationRouteStanding, target: BmcControllerEndpoint, firmware: BmcFirmwareReleaseIdentity, approval_value: Redemption) -> String { - match admit_rotation_apply(standing: standing, target_endpoint: target, target_firmware: firmware, approval: approval_value) { + apply_verdict_for(standing: standing, target: target, firmware: firmware, request: standing_request(s: standing), approval_value: approval_value) +} + +fn apply_verdict_for(standing: BmcRotationRouteStanding, target: BmcControllerEndpoint, firmware: BmcFirmwareReleaseIdentity, request: BmcAccountWriteRequest, approval_value: Redemption) -> String { + match admit_rotation_apply(standing: standing, target_endpoint: target, target_firmware: firmware, request: request, approval: approval_value) { RotationApplyAdmitted { standing: _, request: _, decided_by: _ } => "admitted" RotationApplyRouteNotGrounded { standing: _ } => "route-not-grounded" RotationApplyRouteForAnotherController { route_endpoint: _, target_endpoint: _ } => "another-controller" RotationApplyRouteForAnotherBuild { route_firmware: _, target_firmware: _ } => "another-build" + RotationApplyRouteForAnotherOperation { grounded: _, requested: _ } => "another-operation" RotationApplyApprovalRefused { cause: _ } => "approval-refused" RotationApplyApprovalDenied => "approval-denied" RotationApplyApprovalForAnotherAuthority { authority: _ } => "another-authority" @@ -189,6 +195,7 @@ test fn mtcollins1_is_grounded_by_its_executed_ipmi_request() -> Bool { RouteGroundedByExecutedRequest { request: r, request_receipt: q, response_receipt: p } => match r { IpmiSetUserPassword { user: u } => (u as Int) == 3 + IpmiSetUserAccess { access: _ } => false RedfishAccountPasswordWrite { transport_operation: _, action_shape: _ } => false } && q.digest == mtcollins1_user3_route_digest @@ -372,7 +379,7 @@ test fn a_cited_route_admits_apply_and_is_bound_to_its_build() -> Bool { // over its stated characteristics: the selection returns the operator-approved capability, and the // row's realization (an admitted Redemption) conforms to it. test fn the_qualification_effect_is_classified_operator_approved_and_conforms() -> Bool { - let rows = filter(privileged_effect_census, r => (r.site.module_path as String) == "gunbc.machine_intake_bmc_rotation_route" && (r.site.decl_name as String) == "qualify_rotation_route") + let rows = filter(privileged_effect_census, r => (r.site.module_path as String) == "gunbc.machine_intake_bmc_rotation_route" && (r.site.decl_name as String) == "qualify_rotation_route" && string_contains(s: r.effect.subject as String, pattern: "account-write route")) length(rows) == 1 && all(rows, r => match select_authorization_pattern(e: r.effect) { @@ -414,3 +421,89 @@ test fn a_rotation_approval_for_one_controller_does_not_admit_another() -> Bool && apply_verdict(standing: lab, target: lab_endpoint, firmware: lab_firmware(), approval_value: rotation_approval_for(s: lab)) == "admitted" && apply_verdict(standing: lab, target: lab_endpoint, firmware: lab_firmware(), approval_value: denied) == "approval-denied" } + +// ── cut O1a-2: the channel-access request shape ───────────────────────────────────────────────── + +fn access_write(user: Int, channel: Int, privilege: IpmiChannelPrivilegeLimit) -> BmcAccountWriteRequest { + IpmiSetUserAccess { access: ipmi_user_channel_access(channel: channel, user: user, privilege: privilege) } +} + +// EVERY FIELD IS IN THE IDENTITY. Set User Access requests differing ONLY in the channel, ONLY in the +// privilege limit, or ONLY in the user are different requests: unequal, and an approval for the base +// request refuses each as another request. +test fn channel_access_requests_differing_in_any_one_field_are_different_requests() -> Bool { + let base = access_write(user: 2, channel: 2, privilege: IpmiPrivilegeNoAccess) + let other_channel = access_write(user: 2, channel: 3, privilege: IpmiPrivilegeNoAccess) + let other_privilege = access_write(user: 2, channel: 2, privilege: IpmiPrivilegeUser) + let other_user = access_write(user: 4, channel: 2, privilege: IpmiPrivilegeNoAccess) + let c_channel = lab_candidate(request: other_channel) + let c_privilege = lab_candidate(request: other_privilege) + let c_user = lab_candidate(request: other_user) + account_write_request_eq(a: base, b: base) + && !account_write_request_eq(a: base, b: other_channel) + && !account_write_request_eq(a: base, b: other_privilege) + && !account_write_request_eq(a: base, b: other_user) + && classify_names(candidate: c_channel, approval_value: qualification_approval_for(standing: c_channel, request: base)) == "another-request" + && classify_names(candidate: c_privilege, approval_value: qualification_approval_for(standing: c_privilege, request: base)) == "another-request" + && classify_names(candidate: c_user, approval_value: qualification_approval_for(standing: c_user, request: base)) == "another-request" +} + +// mtcollins1's channel-access route is a candidate on its CURRENT controller and build (0.45.3, not +// the 0.32 its password route was executed on), naming the published account to NO ACCESS on channel +// 2, with the public standard as its only evidence. It is not grounded, and an Apply refuses it. +test fn mtcollins1_channel_access_route_is_an_ungrounded_candidate_on_its_current_build() -> Bool { + let s = mtcollins1_channel_access_route_standing() + (s.endpoint.host as String) == "192.168.1.228" + && (s.firmware.raw_version as String) == "0.45.3" + && !rotation_route_is_grounded(standing: s) + && match s.grounding { + RouteQualificationCandidate { request: r, evidence: e } => + account_write_request_eq(a: r, b: access_write(user: 2, channel: 2, privilege: IpmiPrivilegeNoAccess)) + && match e { PublicStandardOperation { authority: _ } => true ObservedSurfaceRead { surface: _, receipt: _ } => false } + RouteGroundedByExecutedRequest { request: _, request_receipt: _, response_receipt: _ } => false + RouteGroundedByCitedSource { request: _, citation: _ } => false + RouteUngrounded => false + } + && apply_verdict(standing: s, target: s.endpoint, firmware: s.firmware, approval_value: rotation_approval_for(s: s)) == "route-not-grounded" +} + +// THE MODELED CHANNEL-ACCESS RUN: the Set User Access transition sets exactly that (channel, user) +// row, Get User Access reads it back, and the classifier says it would qualify -- with no standing. +// A user the IPMI table does not hold is not completed. +test fn a_modeled_channel_access_run_would_qualify_but_grounds_nothing() -> Bool { + let request = access_write(user: 3, channel: 2, privilege: IpmiPrivilegeNoAccess) + let candidate = lab_candidate(request: request) + let step = dry_route_qualification_request(world: lab_world_with_user3(), subject: subject_at(endpoint: lab_endpoint, request: request), password: "unused") + match bmc_ipmi_get_user_access(world: step.world, user: 3, channel: 2) { + Present { value: p } => match p { IpmiPrivilegeNoAccess => true _ => false } + Absent => false + } + && match bmc_ipmi_get_user_access(world: step.world, user: 3, channel: 3) { Absent => true Present { value: _ } => false } + && modeled_verdict(candidate: candidate, approval_value: qualification_approval_for(standing: candidate, request: request), world: lab_world_with_user3(), answered: subject_at(endpoint: lab_endpoint, request: request)) == "would-qualify" + && grounding_kind(standing: candidate) == "candidate" + && refusal_of(world: lab_world_with_user3(), request: access_write(user: 9, channel: 2, privilege: IpmiPrivilegeNoAccess), approval_value: qualification_approval_for(standing: lab_candidate(request: access_write(user: 9, channel: 2, privilege: IpmiPrivilegeNoAccess)), request: access_write(user: 9, channel: 2, privilege: IpmiPrivilegeNoAccess))) == "not-completed" +} + +// A GROUNDED ROUTE FOR ONE OPERATION DOES NOT ADMIT ANOTHER. mtcollins1's grounded Set User Password +// route, on its own controller and build, with an exact approval of a Set User Access write, refuses +// as another operation; the same route with an exact approval of a password write is admitted. +test fn a_grounded_password_route_does_not_admit_a_channel_access_apply() -> Bool { + let collins = mtcollins1_rotation_route_standing() + let access = access_write(user: 2, channel: 2, privilege: IpmiPrivilegeNoAccess) + apply_verdict_for(standing: collins, target: mtcollins1_endpoint, firmware: mtcollins1_firmware, request: access, approval_value: approval(authority: rotation_apply_authority, revision: rotation_route_request_identity(standing: collins, request: access))) == "another-operation" + && apply_verdict_for(standing: collins, target: mtcollins1_endpoint, firmware: mtcollins1_firmware, request: IpmiSetUserPassword { user: 3 }, approval_value: approval(authority: rotation_apply_authority, revision: rotation_route_request_identity(standing: collins, request: IpmiSetUserPassword { user: 3 }))) == "admitted" +} + +// The census row for qualifying the channel-access shape, classified by EXECUTING the selection over +// its own characteristics (not the password row's): the selection returns the operator-approved +// capability and the row's realization conforms. +test fn the_channel_access_qualification_effect_is_classified_by_executing_the_selection() -> Bool { + let rows = filter(privileged_effect_census, r => (r.site.decl_name as String) == "qualify_rotation_route" && string_contains(s: r.effect.subject as String, pattern: "channel-access route")) + length(rows) == 1 + && all(rows, r => + match select_authorization_pattern(e: r.effect) { + PatternSelected { pattern: p, receipt: _ } => match p { OperatorApprovedCapability => true _ => false } + _ => false + } + && match site_verdict(row: r).conformance { Conforms => true _ => false }) +} From 6ee95d05b4b34b5e04b2c30f0a6122f2a717ad4b Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Sun, 4 Oct 2026 08:52:31 +0000 Subject: [PATCH 07/22] =?UTF-8?q?O1a-2:=20the=20lockout=20hazard=20is=20a?= =?UTF-8?q?=20refusal=20=E2=80=94=20a=20privilege-lowering=20channel-acces?= =?UTF-8?q?s=20write=20needs=20the=20managed=20account=20read=20back=20at?= =?UTF-8?q?=20administrator=20on=20that=20channel=20in=20the=20same=20run?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 (1M context) --- .../machine_intake/bmc_rotation_route.dag | 72 ++++++++++++++++++- ...intake_bmc_rotation_route_witness_test.dag | 52 +++++++++++++- 2 files changed, 121 insertions(+), 3 deletions(-) diff --git a/dag/gunbc/machine_intake/bmc_rotation_route.dag b/dag/gunbc/machine_intake/bmc_rotation_route.dag index 9872df6777b..2d3c18651cb 100644 --- a/dag/gunbc/machine_intake/bmc_rotation_route.dag +++ b/dag/gunbc/machine_intake/bmc_rotation_route.dag @@ -1,6 +1,8 @@ module gunbc.machine_intake_bmc_rotation_route import std.types { Bool, Int, NonEmptyStr, String } +import std.scoped_authorization { AttemptIdentity } +import v2.std.algebra { any } import std.disposition { Disposition, Terminal } import std.dissolution { DissolutionCondition, unbound_dissolution } import std.decl_ref { DeclarationRef, DeclField, WholeDeclaration, NamedField, TypeParameter, decl_ref, decl_field_ref, declaration_ref_eq } @@ -130,6 +132,7 @@ fn rotation_route_from_citation( admit_callers: [ decl_ref(module_path: "test.claim.machine_intake_bmc_rotation_route_witness_test", decl_name: "a_cited_route_admits_apply_and_is_bound_to_its_build"), decl_ref(module_path: "test.claim.machine_intake_bmc_rotation_route_witness_test", decl_name: "a_rotation_approval_for_one_controller_does_not_admit_another"), + decl_ref(module_path: "test.claim.machine_intake_bmc_rotation_route_witness_test", decl_name: "a_channel_access_write_that_could_lock_out_every_administrator_is_unplannable"), ] { BmcRotationRouteStanding { @@ -566,6 +569,69 @@ type RotationApplyAdmission | RotationApplyApprovalDenied | RotationApplyApprovalForAnotherAuthority { authority: NonEmptyStr } | RotationApplyApprovalForAnotherRequest { approved: NonEmptyStr, requested: NonEmptyStr } + | RotationApplyWouldLeaveNoAdministrator { channel: Int, cause: AdministratorRetentionRefusal } + +// THE LOCKOUT HAZARD IS A REFUSAL, NOT A NOTE. A Set User Access write that lowers a user's privilege +// on a channel (anything other than ADMINISTRATOR) could remove the last administrator-capable account +// from that channel. It is admissible only beside a typed precondition: the MANAGED account -- a +// different user from the one being closed -- read back at ADMINISTRATOR on that same channel with +// Get User Access, IN THE SAME RUN, which is the attempt the approval names. The readback's producer is +// the BmcSecure observation (cut O1b); here it is an admission input, and its absence refuses. +type ManagedAdministratorReadback { + attempt: AttemptIdentity + managed_user: IpmiUserId + access: List +} + +type AdministratorRetentionRefusal + = ManagedReadbackAbsent + | ManagedReadbackFromAnotherRun { readback: AttemptIdentity, approved: AttemptIdentity } + | ManagedAccountIsTheClosedAccount { user: IpmiUserId } + | ManagedAccountNotAdministratorOnChannel { managed_user: IpmiUserId } + +fn lowers_privilege(privilege: IpmiChannelPrivilegeLimit) -> Bool { + match privilege { + IpmiPrivilegeAdministrator => false + IpmiPrivilegeCallback => true + IpmiPrivilegeUser => true + IpmiPrivilegeOperator => true + IpmiPrivilegeOem => true + IpmiPrivilegeNoAccess => true + } +} + +fn administrator_retention_refusal(request: BmcAccountWriteRequest, readback: ManagedAdministratorReadback?, approved_attempt: AttemptIdentity) -> AdministratorRetentionRefusal? { + match request { + IpmiSetUserPassword { user: _ } => none + RedfishAccountPasswordWrite { transport_operation: _, action_shape: _ } => none + IpmiSetUserAccess { access: x } => + if !lowers_privilege(privilege: x.privilege) { + none + } else { + match readback { + Absent => Present { value: ManagedReadbackAbsent } + Present { value: r } => + if (r.attempt as String) != (approved_attempt as String) { + Present { value: ManagedReadbackFromAnotherRun { readback: r.attempt, approved: approved_attempt } } + } else if (r.managed_user as Int) == (x.user as Int) { + Present { value: ManagedAccountIsTheClosedAccount { user: x.user } } + } else if any(r.access, a => (a.user as Int) == (r.managed_user as Int) && (a.channel as Int) == (x.channel as Int) && !lowers_privilege(privilege: a.privilege)) { + none + } else { + Present { value: ManagedAccountNotAdministratorOnChannel { managed_user: r.managed_user } } + } + } + } + } +} + +fn request_channel(request: BmcAccountWriteRequest) -> Int { + match request { + IpmiSetUserAccess { access: x } => x.channel as Int + IpmiSetUserPassword { user: _ } => 0 + RedfishAccountPasswordWrite { transport_operation: _, action_shape: _ } => 0 + } +} fn grounded_request(standing: BmcRotationRouteStanding) -> BmcAccountWriteRequest? { match standing.grounding { @@ -581,6 +647,7 @@ fn admit_rotation_apply( target_endpoint: BmcControllerEndpoint, target_firmware: BmcFirmwareReleaseIdentity, request: BmcAccountWriteRequest, + managed_readback: ManagedAdministratorReadback?, approval: Redemption, ) -> RotationApplyAdmission { match grounded_request(standing: standing) { @@ -604,7 +671,10 @@ fn admit_rotation_apply( } else if cl.request_revision != rotation_route_request_identity(standing: standing, request: request) { RotationApplyApprovalForAnotherRequest { approved: cl.request_revision, requested: rotation_route_request_identity(standing: standing, request: request) } } else { - RotationApplyAdmitted { standing: standing, request: request, decided_by: by } + match administrator_retention_refusal(request: request, readback: managed_readback, approved_attempt: cl.attempt) { + Present { value: c } => RotationApplyWouldLeaveNoAdministrator { channel: request_channel(request: request), cause: c } + Absent => RotationApplyAdmitted { standing: standing, request: request, decided_by: by } + } } } } diff --git a/dag/test/claim/machine_intake/machine_intake_bmc_rotation_route_witness_test.dag b/dag/test/claim/machine_intake/machine_intake_bmc_rotation_route_witness_test.dag index 8bd3899bbf3..8172b6acbb2 100644 --- a/dag/test/claim/machine_intake/machine_intake_bmc_rotation_route_witness_test.dag +++ b/dag/test/claim/machine_intake/machine_intake_bmc_rotation_route_witness_test.dag @@ -34,7 +34,8 @@ import gunbc.machine_intake_bmc_rotation_route { QualificationRequestNotCompleted, QualificationReadbackRefused, RotationApplyAdmitted, RotationApplyRouteNotGrounded, RotationApplyRouteForAnotherController, RotationApplyRouteForAnotherBuild, RotationApplyRouteForAnotherOperation, RotationApplyApprovalRefused, RotationApplyApprovalDenied, - RotationApplyApprovalForAnotherAuthority, RotationApplyApprovalForAnotherRequest, + RotationApplyApprovalForAnotherAuthority, RotationApplyApprovalForAnotherRequest, RotationApplyWouldLeaveNoAdministrator, + ManagedAdministratorReadback, ManagedReadbackAbsent, ManagedReadbackFromAnotherRun, ManagedAccountIsTheClosedAccount, ManagedAccountNotAdministratorOnChannel, route_qualification_authority, rotation_apply_authority, rotation_route_ungrounded, rotation_route_candidate, rotation_route_from_citation, rotation_route_request_identity, rotation_route_is_grounded, @@ -155,7 +156,7 @@ fn apply_verdict(standing: BmcRotationRouteStanding, target: BmcControllerEndpoi } fn apply_verdict_for(standing: BmcRotationRouteStanding, target: BmcControllerEndpoint, firmware: BmcFirmwareReleaseIdentity, request: BmcAccountWriteRequest, approval_value: Redemption) -> String { - match admit_rotation_apply(standing: standing, target_endpoint: target, target_firmware: firmware, request: request, approval: approval_value) { + match admit_rotation_apply(standing: standing, target_endpoint: target, target_firmware: firmware, request: request, managed_readback: none, approval: approval_value) { RotationApplyAdmitted { standing: _, request: _, decided_by: _ } => "admitted" RotationApplyRouteNotGrounded { standing: _ } => "route-not-grounded" RotationApplyRouteForAnotherController { route_endpoint: _, target_endpoint: _ } => "another-controller" @@ -165,6 +166,7 @@ fn apply_verdict_for(standing: BmcRotationRouteStanding, target: BmcControllerEn RotationApplyApprovalDenied => "approval-denied" RotationApplyApprovalForAnotherAuthority { authority: _ } => "another-authority" RotationApplyApprovalForAnotherRequest { approved: _, requested: _ } => "another-request" + RotationApplyWouldLeaveNoAdministrator { channel: _, cause: _ } => "would-leave-no-administrator" } } @@ -507,3 +509,49 @@ test fn the_channel_access_qualification_effect_is_classified_by_executing_the_s } && match site_verdict(row: r).conformance { Conforms => true _ => false }) } + +// THE LOCKOUT HAZARD IS UNPLANNABLE. On a grounded channel-access route (a cited one, the grounded +// arm a witness may construct), closing user 2 on channel 2 with an exact approval of that write: +// with no managed readback -> refused; with the managed account (user 3) read back at ADMINISTRATOR on +// channel 2 in the approval's own attempt -> admitted; the same readback from another run, a readback +// whose managed account IS the closed one, and a managed account at ADMINISTRATOR only on another +// channel -> each refused with its own typed cause. +fn lockout_verdict(readback: ManagedAdministratorReadback?) -> String { + let request = access_write(user: 2, channel: 2, privilege: IpmiPrivilegeNoAccess) + let route = rotation_route_from_citation( + endpoint: lab_endpoint, + firmware: lab_firmware(), + request: access_write(user: 2, channel: 3, privilege: IpmiPrivilegeNoAccess), + citation: ExternalAuthority { uri: uri_https(locator: "example.invalid/route-witness-citation" as NonEmptyStr) }, + ) + match admit_rotation_apply( + standing: route, + target_endpoint: lab_endpoint, + target_firmware: lab_firmware(), + request: request, + managed_readback: readback, + approval: approval(authority: rotation_apply_authority, revision: rotation_route_request_identity(standing: route, request: request)), + ) { + RotationApplyAdmitted { standing: _, request: _, decided_by: _ } => "admitted" + RotationApplyWouldLeaveNoAdministrator { channel: ch, cause: c } => + if ch != 2 { "wrong-channel" } else { + match c { + ManagedReadbackAbsent => "readback-absent" + ManagedReadbackFromAnotherRun { readback: _, approved: _ } => "another-run" + ManagedAccountIsTheClosedAccount { user: _ } => "managed-is-closed" + ManagedAccountNotAdministratorOnChannel { managed_user: _ } => "not-administrator-on-channel" + } + } + _ => "other-refusal" + } +} + +test fn a_channel_access_write_that_could_lock_out_every_administrator_is_unplannable() -> Bool { + let admin_on_2 = [ipmi_user_channel_access(channel: 2, user: 3, privilege: IpmiPrivilegeAdministrator)] + let admin_on_1 = [ipmi_user_channel_access(channel: 1, user: 3, privilege: IpmiPrivilegeAdministrator)] + lockout_verdict(readback: none) == "readback-absent" + && lockout_verdict(readback: Present { value: ManagedAdministratorReadback { attempt: "attempt-1" as AttemptIdentity, managed_user: 3, access: admin_on_2 } }) == "admitted" + && lockout_verdict(readback: Present { value: ManagedAdministratorReadback { attempt: "attempt-0" as AttemptIdentity, managed_user: 3, access: admin_on_2 } }) == "another-run" + && lockout_verdict(readback: Present { value: ManagedAdministratorReadback { attempt: "attempt-1" as AttemptIdentity, managed_user: 2, access: [ipmi_user_channel_access(channel: 2, user: 2, privilege: IpmiPrivilegeAdministrator)] } }) == "managed-is-closed" + && lockout_verdict(readback: Present { value: ManagedAdministratorReadback { attempt: "attempt-1" as AttemptIdentity, managed_user: 3, access: admin_on_1 } }) == "not-administrator-on-channel" +} From 7887d74ed29fd8127fa141e274df9a9162ff1737 Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Sun, 4 Oct 2026 09:04:51 +0000 Subject: [PATCH 08/22] O1a-2: admit the lockout helper (the citation mint's actual caller) Co-Authored-By: Claude Opus 5.5 (1M context) --- dag/gunbc/machine_intake/bmc_rotation_route.dag | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dag/gunbc/machine_intake/bmc_rotation_route.dag b/dag/gunbc/machine_intake/bmc_rotation_route.dag index 2d3c18651cb..bc8691fa464 100644 --- a/dag/gunbc/machine_intake/bmc_rotation_route.dag +++ b/dag/gunbc/machine_intake/bmc_rotation_route.dag @@ -132,7 +132,7 @@ fn rotation_route_from_citation( admit_callers: [ decl_ref(module_path: "test.claim.machine_intake_bmc_rotation_route_witness_test", decl_name: "a_cited_route_admits_apply_and_is_bound_to_its_build"), decl_ref(module_path: "test.claim.machine_intake_bmc_rotation_route_witness_test", decl_name: "a_rotation_approval_for_one_controller_does_not_admit_another"), - decl_ref(module_path: "test.claim.machine_intake_bmc_rotation_route_witness_test", decl_name: "a_channel_access_write_that_could_lock_out_every_administrator_is_unplannable"), + decl_ref(module_path: "test.claim.machine_intake_bmc_rotation_route_witness_test", decl_name: "lockout_verdict"), ] { BmcRotationRouteStanding { From b66626e28c27f10d365944b14fa0e3b6181e000d Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Sun, 4 Oct 2026 09:18:17 +0000 Subject: [PATCH 09/22] O1a-2: ManagedAdministratorReadback is sealed and bound to the route's endpoint and build Co-Authored-By: Claude Opus 5.5 (1M context) --- .../machine_intake/bmc_rotation_route.dag | 44 ++++++++++++++++--- ...tation_route_forged_probe_witness_test.dag | 4 +- ...intake_bmc_rotation_route_witness_test.dag | 29 +++++++++--- 3 files changed, 64 insertions(+), 13 deletions(-) diff --git a/dag/gunbc/machine_intake/bmc_rotation_route.dag b/dag/gunbc/machine_intake/bmc_rotation_route.dag index bc8691fa464..184b45b93ed 100644 --- a/dag/gunbc/machine_intake/bmc_rotation_route.dag +++ b/dag/gunbc/machine_intake/bmc_rotation_route.dag @@ -575,16 +575,44 @@ type RotationApplyAdmission // on a channel (anything other than ADMINISTRATOR) could remove the last administrator-capable account // from that channel. It is admissible only beside a typed precondition: the MANAGED account -- a // different user from the one being closed -- read back at ADMINISTRATOR on that same channel with -// Get User Access, IN THE SAME RUN, which is the attempt the approval names. The readback's producer is -// the BmcSecure observation (cut O1b); here it is an admission input, and its absence refuses. -type ManagedAdministratorReadback { +// Get User Access, IN THE SAME RUN, which is the attempt the approval names, ON THE SAME CONTROLLER AND +// BUILD as the route. +// +// THE READBACK IS SEALED, so the precondition is not a caller-supplied Boolean in a record. Its only +// production mint is the Get User Access read performed in the run against the controller, which does +// not exist in this cut (managed_administrator_readback_live_frontier): until it lands, no production +// caller can satisfy the precondition, and every privilege-lowering write refuses. The one other mint +// is admitted only to this module's witness, which needs readbacks to exercise every refusal arm. +type ManagedAdministratorReadback sole_constructor { + endpoint: BmcControllerEndpoint + firmware: BmcFirmwareReleaseIdentity attempt: AttemptIdentity managed_user: IpmiUserId access: List } +fn managed_administrator_readback_fixture( + endpoint: BmcControllerEndpoint, + firmware: BmcFirmwareReleaseIdentity, + attempt: AttemptIdentity, + managed_user: IpmiUserId, + access: List, +) -> ManagedAdministratorReadback + admit_callers: [ + decl_ref(module_path: "test.claim.machine_intake_bmc_rotation_route_witness_test", decl_name: "readback_at"), + ] +{ + ManagedAdministratorReadback { endpoint: endpoint, firmware: firmware, attempt: attempt, managed_user: managed_user, access: access } +} + +data managed_administrator_readback_live_frontier: DissolutionCondition = unbound_dissolution( + description: "dissolves when a live Get User Access read of the managed account, performed in the same run against the controller, mints ManagedAdministratorReadback in this module bound to that controller's endpoint, its observed firmware build and the run's attempt, with the response bytes committed as content-addressed evidence; until then no production caller can satisfy the administrator-retention precondition and every privilege-lowering channel-access write refuses. NOT satisfied by the witness fixture mint, by a readback read in another run, or by a readback of another controller or build" as NonEmptyStr, +) + type AdministratorRetentionRefusal = ManagedReadbackAbsent + | ManagedReadbackFromAnotherController { readback: BmcControllerEndpoint, route: BmcControllerEndpoint } + | ManagedReadbackFromAnotherBuild { readback: BmcFirmwareReleaseIdentity, route: BmcFirmwareReleaseIdentity } | ManagedReadbackFromAnotherRun { readback: AttemptIdentity, approved: AttemptIdentity } | ManagedAccountIsTheClosedAccount { user: IpmiUserId } | ManagedAccountNotAdministratorOnChannel { managed_user: IpmiUserId } @@ -600,7 +628,7 @@ fn lowers_privilege(privilege: IpmiChannelPrivilegeLimit) -> Bool { } } -fn administrator_retention_refusal(request: BmcAccountWriteRequest, readback: ManagedAdministratorReadback?, approved_attempt: AttemptIdentity) -> AdministratorRetentionRefusal? { +fn administrator_retention_refusal(standing: BmcRotationRouteStanding, request: BmcAccountWriteRequest, readback: ManagedAdministratorReadback?, approved_attempt: AttemptIdentity) -> AdministratorRetentionRefusal? { match request { IpmiSetUserPassword { user: _ } => none RedfishAccountPasswordWrite { transport_operation: _, action_shape: _ } => none @@ -611,7 +639,11 @@ fn administrator_retention_refusal(request: BmcAccountWriteRequest, readback: Ma match readback { Absent => Present { value: ManagedReadbackAbsent } Present { value: r } => - if (r.attempt as String) != (approved_attempt as String) { + if (r.endpoint.host as String) != (standing.endpoint.host as String) { + Present { value: ManagedReadbackFromAnotherController { readback: r.endpoint, route: standing.endpoint } } + } else if !bmc_firmware_release_identity_eq(a: r.firmware, b: standing.firmware) { + Present { value: ManagedReadbackFromAnotherBuild { readback: r.firmware, route: standing.firmware } } + } else if (r.attempt as String) != (approved_attempt as String) { Present { value: ManagedReadbackFromAnotherRun { readback: r.attempt, approved: approved_attempt } } } else if (r.managed_user as Int) == (x.user as Int) { Present { value: ManagedAccountIsTheClosedAccount { user: x.user } } @@ -671,7 +703,7 @@ fn admit_rotation_apply( } else if cl.request_revision != rotation_route_request_identity(standing: standing, request: request) { RotationApplyApprovalForAnotherRequest { approved: cl.request_revision, requested: rotation_route_request_identity(standing: standing, request: request) } } else { - match administrator_retention_refusal(request: request, readback: managed_readback, approved_attempt: cl.attempt) { + match administrator_retention_refusal(standing: standing, request: request, readback: managed_readback, approved_attempt: cl.attempt) { Present { value: c } => RotationApplyWouldLeaveNoAdministrator { channel: request_channel(request: request), cause: c } Absent => RotationApplyAdmitted { standing: standing, request: request, decided_by: by } } diff --git a/dag/test/claim/machine_intake/machine_intake_bmc_rotation_route_forged_probe_witness_test.dag b/dag/test/claim/machine_intake/machine_intake_bmc_rotation_route_forged_probe_witness_test.dag index 259cfa6ce0e..6c6b71fe1f9 100644 --- a/dag/test/claim/machine_intake/machine_intake_bmc_rotation_route_forged_probe_witness_test.dag +++ b/dag/test/claim/machine_intake/machine_intake_bmc_rotation_route_forged_probe_witness_test.dag @@ -15,7 +15,7 @@ data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly // source to the compiler through the diagnostic-census harness and requires the refusal CLASS at each // SUBJECT by name, so a probe refusing for any other reason measures another wall; the class-scoped // control shows a clean source reading the same module through its real producer emits neither class. -data forged_probe_source: String = "module probe_rotation_route_forged\n\nimport std.types { Bool, NonEmptyStr }\nimport std.content_hash { content_hash_of_value }\nimport extdeps.uri { uri_https }\nimport extdeps.external_authority { ExternalAuthority }\nimport gunbc.machine_intake_receipt { EvidenceRef }\nimport gunbc.machine_intake_mtcollins1_access_observation { mtcollins1_endpoint, mtcollins1_firmware }\nimport gunbc.machine_intake_mtcollins1_bmc_secure_observation { mtcollins1_user3_route_evidence }\nimport gunbc.machine_intake_bmc_rotation_route {\n BmcRotationRouteStanding, RouteQualificationLiveResponse, ModeledRouteQualificationResponse, RouteQualificationSubject, IpmiSetUserPassword, RouteGroundedByExecutedRequest,\n rotation_route_from_committed_execution, rotation_route_from_citation,\n}\n\nfn forged_grounded_standing() -> BmcRotationRouteStanding {\n BmcRotationRouteStanding {\n endpoint: mtcollins1_endpoint,\n firmware: mtcollins1_firmware,\n grounding: RouteGroundedByExecutedRequest { request: IpmiSetUserPassword { user: 3 }, request_receipt: mtcollins1_user3_route_evidence, response_receipt: mtcollins1_user3_route_evidence },\n }\n}\n\nfn forged_subject() -> RouteQualificationSubject {\n RouteQualificationSubject { endpoint: mtcollins1_endpoint, firmware: mtcollins1_firmware, request: IpmiSetUserPassword { user: 3 } }\n}\n\nfn forged_modeled_response() -> ModeledRouteQualificationResponse {\n ModeledRouteQualificationResponse {\n subject: forged_subject(),\n request_receipt: mtcollins1_user3_route_evidence,\n response_receipt: mtcollins1_user3_route_evidence,\n completed: true,\n readback_accepted: true,\n }\n}\n\nfn forged_response() -> RouteQualificationLiveResponse {\n RouteQualificationLiveResponse {\n subject: forged_subject(),\n request_receipt: mtcollins1_user3_route_evidence,\n response_receipt: mtcollins1_user3_route_evidence,\n completed: true,\n readback_accepted: true,\n }\n}\n\nfn forged_committed_execution() -> BmcRotationRouteStanding {\n rotation_route_from_committed_execution(\n endpoint: mtcollins1_endpoint,\n firmware: mtcollins1_firmware,\n request: IpmiSetUserPassword { user: 3 },\n request_receipt: mtcollins1_user3_route_evidence,\n response_receipt: mtcollins1_user3_route_evidence,\n )\n}\n\nfn forged_citation() -> BmcRotationRouteStanding {\n rotation_route_from_citation(\n endpoint: mtcollins1_endpoint,\n firmware: mtcollins1_firmware,\n request: IpmiSetUserPassword { user: 3 },\n citation: ExternalAuthority { uri: uri_https(locator: \"example.invalid/forged\") },\n )\n}\n" +data forged_probe_source: String = "module probe_rotation_route_forged\n\nimport std.types { Bool, NonEmptyStr }\nimport std.content_hash { content_hash_of_value }\nimport extdeps.uri { uri_https }\nimport extdeps.external_authority { ExternalAuthority }\nimport gunbc.machine_intake_receipt { EvidenceRef }\nimport gunbc.machine_intake_mtcollins1_access_observation { mtcollins1_endpoint, mtcollins1_firmware }\nimport gunbc.machine_intake_mtcollins1_bmc_secure_observation { mtcollins1_user3_route_evidence }\nimport gunbc.machine_intake_bmc_rotation_route {\n BmcRotationRouteStanding, RouteQualificationLiveResponse, ModeledRouteQualificationResponse, RouteQualificationSubject, IpmiSetUserPassword, RouteGroundedByExecutedRequest,\n rotation_route_from_committed_execution, rotation_route_from_citation,\n ManagedAdministratorReadback, managed_administrator_readback_fixture,\n}\nimport std.scoped_authorization { AttemptIdentity }\n\nfn forged_grounded_standing() -> BmcRotationRouteStanding {\n BmcRotationRouteStanding {\n endpoint: mtcollins1_endpoint,\n firmware: mtcollins1_firmware,\n grounding: RouteGroundedByExecutedRequest { request: IpmiSetUserPassword { user: 3 }, request_receipt: mtcollins1_user3_route_evidence, response_receipt: mtcollins1_user3_route_evidence },\n }\n}\n\nfn forged_subject() -> RouteQualificationSubject {\n RouteQualificationSubject { endpoint: mtcollins1_endpoint, firmware: mtcollins1_firmware, request: IpmiSetUserPassword { user: 3 } }\n}\n\nfn forged_modeled_response() -> ModeledRouteQualificationResponse {\n ModeledRouteQualificationResponse {\n subject: forged_subject(),\n request_receipt: mtcollins1_user3_route_evidence,\n response_receipt: mtcollins1_user3_route_evidence,\n completed: true,\n readback_accepted: true,\n }\n}\n\nfn forged_response() -> RouteQualificationLiveResponse {\n RouteQualificationLiveResponse {\n subject: forged_subject(),\n request_receipt: mtcollins1_user3_route_evidence,\n response_receipt: mtcollins1_user3_route_evidence,\n completed: true,\n readback_accepted: true,\n }\n}\n\nfn forged_committed_execution() -> BmcRotationRouteStanding {\n rotation_route_from_committed_execution(\n endpoint: mtcollins1_endpoint,\n firmware: mtcollins1_firmware,\n request: IpmiSetUserPassword { user: 3 },\n request_receipt: mtcollins1_user3_route_evidence,\n response_receipt: mtcollins1_user3_route_evidence,\n )\n}\n\nfn forged_citation() -> BmcRotationRouteStanding {\n rotation_route_from_citation(\n endpoint: mtcollins1_endpoint,\n firmware: mtcollins1_firmware,\n request: IpmiSetUserPassword { user: 3 },\n citation: ExternalAuthority { uri: uri_https(locator: \"example.invalid/forged\") },\n )\n}\n\nfn forged_readback() -> ManagedAdministratorReadback {\n ManagedAdministratorReadback { endpoint: mtcollins1_endpoint, firmware: mtcollins1_firmware, attempt: \"attempt-1\" as AttemptIdentity, managed_user: 3, access: [] }\n}\n\nfn forged_readback_through_the_fixture() -> ManagedAdministratorReadback {\n managed_administrator_readback_fixture(endpoint: mtcollins1_endpoint, firmware: mtcollins1_firmware, attempt: \"attempt-1\" as AttemptIdentity, managed_user: 3, access: [])\n}\n" data harness_control_source: String = "module probe_rotation_route_harness_control\nimport gunbc.machine_intake_bmc_rotation_route { BmcRotationRouteStanding }\nimport gunbc.machine_intake_bmc_rotation_route_evidence { mtcollins1_rotation_route_standing }\nfn standing() -> BmcRotationRouteStanding { mtcollins1_rotation_route_standing() }\n" @@ -54,6 +54,7 @@ test fn a_forged_route_standing_and_response_are_refused_at_their_literals() -> blocking_count_for_class_and_subject(c: c, wanted: "SoleConstructorViolation", subject: "BmcRotationRouteStanding") >= 1 && blocking_count_for_class_and_subject(c: c, wanted: "SoleConstructorViolation", subject: "RouteQualificationLiveResponse") >= 1 && blocking_count_for_class_and_subject(c: c, wanted: "SoleConstructorViolation", subject: "ModeledRouteQualificationResponse") >= 1 + && blocking_count_for_class_and_subject(c: c, wanted: "SoleConstructorViolation", subject: "ManagedAdministratorReadback") >= 1 } // The committed-execution and citation mints refuse a caller outside their admitted roots. @@ -61,4 +62,5 @@ test fn the_grounding_mints_refuse_an_outside_caller() -> Bool { let c = probe() blocking_count_for_class_and_subject(c: c, wanted: "ConstructorCallAdmissionRefused", subject: "rotation_route_from_committed_execution") >= 1 && blocking_count_for_class_and_subject(c: c, wanted: "ConstructorCallAdmissionRefused", subject: "rotation_route_from_citation") >= 1 + && blocking_count_for_class_and_subject(c: c, wanted: "ConstructorCallAdmissionRefused", subject: "managed_administrator_readback_fixture") >= 1 } diff --git a/dag/test/claim/machine_intake/machine_intake_bmc_rotation_route_witness_test.dag b/dag/test/claim/machine_intake/machine_intake_bmc_rotation_route_witness_test.dag index 8172b6acbb2..35ed8b94082 100644 --- a/dag/test/claim/machine_intake/machine_intake_bmc_rotation_route_witness_test.dag +++ b/dag/test/claim/machine_intake/machine_intake_bmc_rotation_route_witness_test.dag @@ -1,6 +1,6 @@ module test.claim.machine_intake_bmc_rotation_route_witness_test -import std.types { Bool, NonEmptyStr, String, Timestamp } +import std.types { Bool, Int, List, NonEmptyStr, String, Timestamp } import std.decl_ref { decl_field_ref } import std.scoped_authorization { AttemptIdentity } import std.content_hash { content_hash_of_value } @@ -35,7 +35,7 @@ import gunbc.machine_intake_bmc_rotation_route { RotationApplyAdmitted, RotationApplyRouteNotGrounded, RotationApplyRouteForAnotherController, RotationApplyRouteForAnotherBuild, RotationApplyRouteForAnotherOperation, RotationApplyApprovalRefused, RotationApplyApprovalDenied, RotationApplyApprovalForAnotherAuthority, RotationApplyApprovalForAnotherRequest, RotationApplyWouldLeaveNoAdministrator, - ManagedAdministratorReadback, ManagedReadbackAbsent, ManagedReadbackFromAnotherRun, ManagedAccountIsTheClosedAccount, ManagedAccountNotAdministratorOnChannel, + ManagedAdministratorReadback, managed_administrator_readback_fixture, ManagedReadbackAbsent, ManagedReadbackFromAnotherController, ManagedReadbackFromAnotherBuild, ManagedReadbackFromAnotherRun, ManagedAccountIsTheClosedAccount, ManagedAccountNotAdministratorOnChannel, route_qualification_authority, rotation_apply_authority, rotation_route_ungrounded, rotation_route_candidate, rotation_route_from_citation, rotation_route_request_identity, rotation_route_is_grounded, @@ -537,6 +537,8 @@ fn lockout_verdict(readback: ManagedAdministratorReadback?) -> String { if ch != 2 { "wrong-channel" } else { match c { ManagedReadbackAbsent => "readback-absent" + ManagedReadbackFromAnotherController { readback: _, route: _ } => "another-controller" + ManagedReadbackFromAnotherBuild { readback: _, route: _ } => "another-build" ManagedReadbackFromAnotherRun { readback: _, approved: _ } => "another-run" ManagedAccountIsTheClosedAccount { user: _ } => "managed-is-closed" ManagedAccountNotAdministratorOnChannel { managed_user: _ } => "not-administrator-on-channel" @@ -546,12 +548,27 @@ fn lockout_verdict(readback: ManagedAdministratorReadback?) -> String { } } +// The one way this witness obtains a readback: the fixture mint, admitted to this function only. +fn readback_at(endpoint: BmcControllerEndpoint, firmware: BmcFirmwareReleaseIdentity, attempt: NonEmptyStr, managed_user: Int, access: List) -> ManagedAdministratorReadback? { + Present { value: managed_administrator_readback_fixture(endpoint: endpoint, firmware: firmware, attempt: attempt as AttemptIdentity, managed_user: managed_user, access: access) } +} + test fn a_channel_access_write_that_could_lock_out_every_administrator_is_unplannable() -> Bool { let admin_on_2 = [ipmi_user_channel_access(channel: 2, user: 3, privilege: IpmiPrivilegeAdministrator)] let admin_on_1 = [ipmi_user_channel_access(channel: 1, user: 3, privilege: IpmiPrivilegeAdministrator)] lockout_verdict(readback: none) == "readback-absent" - && lockout_verdict(readback: Present { value: ManagedAdministratorReadback { attempt: "attempt-1" as AttemptIdentity, managed_user: 3, access: admin_on_2 } }) == "admitted" - && lockout_verdict(readback: Present { value: ManagedAdministratorReadback { attempt: "attempt-0" as AttemptIdentity, managed_user: 3, access: admin_on_2 } }) == "another-run" - && lockout_verdict(readback: Present { value: ManagedAdministratorReadback { attempt: "attempt-1" as AttemptIdentity, managed_user: 2, access: [ipmi_user_channel_access(channel: 2, user: 2, privilege: IpmiPrivilegeAdministrator)] } }) == "managed-is-closed" - && lockout_verdict(readback: Present { value: ManagedAdministratorReadback { attempt: "attempt-1" as AttemptIdentity, managed_user: 3, access: admin_on_1 } }) == "not-administrator-on-channel" + && lockout_verdict(readback: readback_at(endpoint: lab_endpoint, firmware: lab_firmware(), attempt: "attempt-1" as NonEmptyStr, managed_user: 3, access: admin_on_2)) == "admitted" + && lockout_verdict(readback: readback_at(endpoint: lab_endpoint, firmware: lab_firmware(), attempt: "attempt-0" as NonEmptyStr, managed_user: 3, access: admin_on_2)) == "another-run" + && lockout_verdict(readback: readback_at(endpoint: lab_endpoint, firmware: lab_firmware(), attempt: "attempt-1" as NonEmptyStr, managed_user: 2, access: [ipmi_user_channel_access(channel: 2, user: 2, privilege: IpmiPrivilegeAdministrator)])) == "managed-is-closed" + && lockout_verdict(readback: readback_at(endpoint: lab_endpoint, firmware: lab_firmware(), attempt: "attempt-1" as NonEmptyStr, managed_user: 3, access: admin_on_1)) == "not-administrator-on-channel" +} + +// A READBACK FROM CONTROLLER A CANNOT UNLOCK A CLOSE ON CONTROLLER B, nor one from another build of the +// same controller: the same readback that admits the close on its own controller and build refuses on +// the route's controller B and on build 0.33. +test fn a_readback_from_another_controller_or_build_does_not_unlock_a_close() -> Bool { + let admin_on_2 = [ipmi_user_channel_access(channel: 2, user: 3, privilege: IpmiPrivilegeAdministrator)] + lockout_verdict(readback: readback_at(endpoint: lab_endpoint_b, firmware: lab_firmware(), attempt: "attempt-1" as NonEmptyStr, managed_user: 3, access: admin_on_2)) == "another-controller" + && lockout_verdict(readback: readback_at(endpoint: lab_endpoint, firmware: bmc_firmware_release_identity_of_wire(family: AmiMegaRac, wire: "0.33" as NonEmptyStr), attempt: "attempt-1" as NonEmptyStr, managed_user: 3, access: admin_on_2)) == "another-build" + && lockout_verdict(readback: readback_at(endpoint: lab_endpoint, firmware: lab_firmware(), attempt: "attempt-1" as NonEmptyStr, managed_user: 3, access: admin_on_2)) == "admitted" } From 44f35f6eb173e5e932aa60d95c920a3bd01ac333 Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Sun, 4 Oct 2026 10:30:27 +0000 Subject: [PATCH 10/22] O1a-2 side-chat items 1, 3, precision: pre-write qualification admission, per-shape entrypoints, privilege-limit-only operation - AdmittedRouteQualificationRequest (sealed) is the only input a live transport may use; minted by admit_password_route_qualification / admit_privilege_limit_route_qualification, the latter requiring the same-run managed-administrator receipt before any write. - mtcollins1's qualifying request is non-destructive (managed user 3 re-asserted ADMINISTRATOR on ch1). - Census rows keyed by the two entrypoint sites, no prose second key. - IpmiSetUserAccess renamed IpmiSetUserPrivilegeLimit: the privilege-limit-only form (byte 1 bit 7 clear). - Duplicate (channel, user) readback rows refuse. Co-Authored-By: Claude Opus 5.5 (1M context) --- dag/gunbc/auth/privileged_effect_census.dag | 6 +- .../machine_intake/bmc_rotation_route.dag | 170 ++++++++++++++---- .../bmc_rotation_route_evidence.dag | 22 ++- ...tation_route_forged_probe_witness_test.dag | 3 +- ...intake_bmc_rotation_route_witness_test.dag | 76 +++++++- 5 files changed, 226 insertions(+), 51 deletions(-) diff --git a/dag/gunbc/auth/privileged_effect_census.dag b/dag/gunbc/auth/privileged_effect_census.dag index 6781516da9d..c0b418c4e72 100644 --- a/dag/gunbc/auth/privileged_effect_census.dag +++ b/dag/gunbc/auth/privileged_effect_census.dag @@ -319,7 +319,7 @@ fn route_qualification_effect() -> PrivilegedEffect { // password. No dispatched run carries it; in this cut it is modeled with a dry realization only. fn route_qualification_channel_access_effect() -> PrivilegedEffect { PrivilegedEffect { - subject: "qualify a BMC channel-access route: execute one IPMI Set User Access request on one controller at one firmware build and read it back with Get User Access" as NonEmptyStr, + subject: "qualify a BMC channel-access route: execute one IPMI Set User Access request in its privilege-limit-only form on one controller at one firmware build and read it back with Get User Access" as NonEmptyStr, frequency: DeviceOnce, reversibility: IrreversibleEffect { what_is_lost: "a privilege write to the wrong user or channel can remove the last administrator's LAN access; recovering it needs hands on the unit, not a reapply" as NonEmptyStr }, surface: ApiSurface, @@ -626,13 +626,13 @@ data privileged_effect_census: List = [ divergence_reason: none, }, PrivilegedEffectSite { - site: site(module_path: "gunbc.machine_intake_bmc_rotation_route", decl_name: "qualify_rotation_route"), + site: site(module_path: "gunbc.machine_intake_bmc_rotation_route", decl_name: "admit_password_route_qualification"), effect: route_qualification_effect(), realized: RealizedApprovalCapability, divergence_reason: none, }, PrivilegedEffectSite { - site: site(module_path: "gunbc.machine_intake_bmc_rotation_route", decl_name: "qualify_rotation_route"), + site: site(module_path: "gunbc.machine_intake_bmc_rotation_route", decl_name: "admit_privilege_limit_route_qualification"), effect: route_qualification_channel_access_effect(), realized: RealizedApprovalCapability, divergence_reason: none, diff --git a/dag/gunbc/machine_intake/bmc_rotation_route.dag b/dag/gunbc/machine_intake/bmc_rotation_route.dag index 184b45b93ed..7ddd944fac6 100644 --- a/dag/gunbc/machine_intake/bmc_rotation_route.dag +++ b/dag/gunbc/machine_intake/bmc_rotation_route.dag @@ -2,7 +2,7 @@ module gunbc.machine_intake_bmc_rotation_route import std.types { Bool, Int, NonEmptyStr, String } import std.scoped_authorization { AttemptIdentity } -import v2.std.algebra { any } +import v2.std.algebra { any, filter, length } import std.disposition { Disposition, Terminal } import std.dissolution { DissolutionCondition, unbound_dissolution } import std.decl_ref { DeclarationRef, DeclField, WholeDeclaration, NamedField, TypeParameter, decl_ref, decl_field_ref, declaration_ref_eq } @@ -40,15 +40,19 @@ data bmc_rotation_route_disposition: Disposition = Terminal { // over the controller's IPMI LAN route; it is what mtcollins1 executed. RedfishAccountPasswordWrite // names the modeled Redfish account-password operation and action shape by reference; on MegaRAC it // is only ever a candidate today, because no AccountService write has been executed on any MegaRAC -// controller this repository has receipts for. IpmiSetUserAccess is the public IPMI v2.0 Set User -// Access command (App NetFn, command 43h): it sets one user's privilege limit on one channel, carried -// as the same (channel, user, privilege) row Get User Access returns (extdeps.bmc.ipmi_channel -// IpmiUserChannelAccess). It is the write that closes a published account on a channel -- a password +// controller this repository has receipts for. IpmiSetUserPrivilegeLimit is ONLY the privilege-limit +// form of the public IPMI v2.0 Set User Access command (App NetFn, command 43h): request byte 1 bit 7 +// clear, so the callback, link-authentication and IPMI-messaging bits are NOT changed, and only the +// user's privilege limit on one channel is set; no session limit is written. It is carried as the same +// (channel, user, privilege) row Get User Access returns (extdeps.bmc.ipmi_channel IpmiUserChannelAccess), +// which is a projection of that command's result, not the full command. A future live transport must +// issue exactly this mode, and a route grounded by it grounds this restricted operation only: it is not +// evidence for any other use of Set User Access. It is the write that closes a published account on a channel -- a password // write cannot set a channel privilege to NO ACCESS -- and no execution of it is committed for any // controller, so it is only ever a candidate today. type BmcAccountWriteRequest = IpmiSetUserPassword { user: IpmiUserId } - | IpmiSetUserAccess { access: IpmiUserChannelAccess } + | IpmiSetUserPrivilegeLimit { access: IpmiUserChannelAccess } | RedfishAccountPasswordWrite { transport_operation: DeclarationRef, action_shape: DeclarationRef } // WHY A CANDIDATE IS WORTH TRYING. Either a surface was observed on THIS controller (the read surface @@ -166,8 +170,8 @@ fn rotation_route_is_grounded(standing: BmcRotationRouteStanding) -> Bool { fn account_write_request_text(request: BmcAccountWriteRequest) -> NonEmptyStr { match request { IpmiSetUserPassword { user: u } => join(["IPMI Set User Password (App 47h) user ", to_string(u as Int)], "") as NonEmptyStr - IpmiSetUserAccess { access: a } => - join(["IPMI Set User Access (App 43h) user ", to_string(a.user as Int), " channel ", to_string(a.channel as Int), " privilege ", canonical_ipmi_privilege(privilege: a.privilege)], "") as NonEmptyStr + IpmiSetUserPrivilegeLimit { access: a } => + join(["IPMI Set User Access, privilege limit only (App 43h, byte 1 bit 7 clear) user ", to_string(a.user as Int), " channel ", to_string(a.channel as Int), " privilege ", canonical_ipmi_privilege(privilege: a.privilege)], "") as NonEmptyStr RedfishAccountPasswordWrite { transport_operation: op, action_shape: _ } => join(["Redfish account password write via ", op.module_path as String, " ", op.decl_name as String], "") as NonEmptyStr } @@ -185,13 +189,13 @@ fn account_write_request_eq(a: BmcAccountWriteRequest, b: BmcAccountWriteRequest IpmiSetUserPassword { user: ua } => match b { IpmiSetUserPassword { user: ub } => (ua as Int) == (ub as Int) - IpmiSetUserAccess { access: _ } => false + IpmiSetUserPrivilegeLimit { access: _ } => false RedfishAccountPasswordWrite { transport_operation: _, action_shape: _ } => false } - IpmiSetUserAccess { access: xa } => + IpmiSetUserPrivilegeLimit { access: xa } => match b { IpmiSetUserPassword { user: _ } => false - IpmiSetUserAccess { access: xb } => + IpmiSetUserPrivilegeLimit { access: xb } => (xa.user as Int) == (xb.user as Int) && (xa.channel as Int) == (xb.channel as Int) && ipmi_privilege_eq(a: xa.privilege, b: xb.privilege) @@ -200,7 +204,7 @@ fn account_write_request_eq(a: BmcAccountWriteRequest, b: BmcAccountWriteRequest RedfishAccountPasswordWrite { transport_operation: oa, action_shape: sa } => match b { IpmiSetUserPassword { user: _ } => false - IpmiSetUserAccess { access: _ } => false + IpmiSetUserPrivilegeLimit { access: _ } => false RedfishAccountPasswordWrite { transport_operation: ob, action_shape: sb } => declaration_ref_eq(a: oa, b: ob) && declaration_ref_eq(a: sa, b: sb) } @@ -217,19 +221,19 @@ fn account_write_request_same_operation(a: BmcAccountWriteRequest, b: BmcAccount IpmiSetUserPassword { user: _ } => match b { IpmiSetUserPassword { user: _ } => true - IpmiSetUserAccess { access: _ } => false + IpmiSetUserPrivilegeLimit { access: _ } => false RedfishAccountPasswordWrite { transport_operation: _, action_shape: _ } => false } - IpmiSetUserAccess { access: _ } => + IpmiSetUserPrivilegeLimit { access: _ } => match b { IpmiSetUserPassword { user: _ } => false - IpmiSetUserAccess { access: _ } => true + IpmiSetUserPrivilegeLimit { access: _ } => true RedfishAccountPasswordWrite { transport_operation: _, action_shape: _ } => false } RedfishAccountPasswordWrite { transport_operation: oa, action_shape: sa } => match b { IpmiSetUserPassword { user: _ } => false - IpmiSetUserAccess { access: _ } => false + IpmiSetUserPrivilegeLimit { access: _ } => false RedfishAccountPasswordWrite { transport_operation: ob, action_shape: sb } => declaration_ref_eq(a: oa, b: ob) && declaration_ref_eq(a: sa, b: sb) } @@ -270,8 +274,8 @@ fn canonical_decl_ref(r: DeclarationRef) -> String { fn canonical_account_write_request(request: BmcAccountWriteRequest) -> String { match request { IpmiSetUserPassword { user: u } => join(["ipmi-set-user-password;", canonical_component(text: to_string(u as Int))], "") - IpmiSetUserAccess { access: a } => - join(["ipmi-set-user-access;", canonical_component(text: to_string(a.user as Int)), canonical_component(text: to_string(a.channel as Int)), canonical_component(text: canonical_ipmi_privilege(privilege: a.privilege))], "") + IpmiSetUserPrivilegeLimit { access: a } => + join(["ipmi-set-user-privilege-limit;", canonical_component(text: to_string(a.user as Int)), canonical_component(text: to_string(a.channel as Int)), canonical_component(text: canonical_ipmi_privilege(privilege: a.privilege))], "") RedfishAccountPasswordWrite { transport_operation: op, action_shape: act } => join(["redfish-account-password-write;", canonical_decl_ref(r: op), canonical_decl_ref(r: act)], "") } @@ -371,7 +375,7 @@ type DryRouteQualificationStep { fn dry_route_qualification_request(world: BmcWorld, subject: RouteQualificationSubject, password: String) -> DryRouteQualificationStep { match subject.request { RedfishAccountPasswordWrite { transport_operation: _, action_shape: _ } => DryRouteQualificationStep { world: world, response: none } - IpmiSetUserAccess { access: x } => { + IpmiSetUserPrivilegeLimit { access: x } => { let step = bmc_ipmi_set_user_access(world: world, access: x) let accepted = match bmc_ipmi_get_user_access(world: step.world, user: x.user, channel: x.channel as Int) { Present { value: p } => ipmi_privilege_eq(a: p, b: x.privilege) @@ -544,8 +548,112 @@ fn classify_modeled_route_qualification( } } +// ── THE PRE-WRITE QUALIFICATION ADMISSION: the only value a transport call may be made from ────── +// +// THE FIRST DANGEROUS WRITE IS THE QUALIFICATION, NOT THE APPLY. Qualifying a route executes a real +// account write, so every guard the Apply has must hold BEFORE that write too. Each request shape has +// its own qualification entrypoint -- the effect boundary its census row names -- and each produces +// AdmittedRouteQualificationRequest, sealed, minted only here, and the ONLY input from which the live +// realization may make its transport call (route_qualification_live_frontier). A privilege-limit write +// is admitted only beside a same-run ManagedAdministratorReadback for the same controller and build: +// the managed account read back, uniquely, at ADMINISTRATOR on that channel, and not the account being +// lowered. No receipt, no transport call. +type AdmittedRouteQualificationRequest sole_constructor { + subject: RouteQualificationSubject + attempt: AttemptIdentity + decided_by: NonEmptyStr +} + +type RouteQualificationRequestRefusal + = QualificationRequestForAnotherOperation { candidate: BmcAccountWriteRequest } + | QualificationRequestRefusedByClassifier { cause: RouteQualificationRefusal } + | QualificationRequestWouldLeaveNoAdministrator { cause: AdministratorRetentionRefusal } + +type RouteQualificationRequestAdmission + = RouteQualificationRequestAdmitted { request: AdmittedRouteQualificationRequest } + | RouteQualificationRequestRefused { cause: RouteQualificationRequestRefusal } + +fn admit_route_qualification_request( + standing: BmcRotationRouteStanding, + approval: Redemption, + readback: ManagedAdministratorReadback?, +) -> RouteQualificationRequestAdmission { + match standing.grounding { + RouteQualificationCandidate { request: req, evidence: _ } => + match qualification_approval_refusal(standing: standing, request: req, approval: approval) { + Present { value: refusal } => RouteQualificationRequestRefused { cause: QualificationRequestRefusedByClassifier { cause: refusal } } + Absent => + match approval { + RedemptionRefused { cause: c } => RouteQualificationRequestRefused { cause: QualificationRequestRefusedByClassifier { cause: QualificationApprovalRefused { cause: c } } } + RedemptionAdmitted { claims: cl, decided_by: by } => + match administrator_retention_refusal(standing: standing, request: req, readback: readback, approved_attempt: cl.attempt) { + Present { value: c } => RouteQualificationRequestRefused { cause: QualificationRequestWouldLeaveNoAdministrator { cause: c } } + Absent => + RouteQualificationRequestAdmitted { + request: AdmittedRouteQualificationRequest { + subject: RouteQualificationSubject { endpoint: standing.endpoint, firmware: standing.firmware, request: req }, + attempt: cl.attempt, + decided_by: by, + }, + } + } + } + } + RouteGroundedByExecutedRequest { request: _, request_receipt: _, response_receipt: _ } => RouteQualificationRequestRefused { cause: QualificationRequestRefusedByClassifier { cause: QualificationSubjectNotACandidate } } + RouteGroundedByCitedSource { request: _, citation: _ } => RouteQualificationRequestRefused { cause: QualificationRequestRefusedByClassifier { cause: QualificationSubjectNotACandidate } } + RouteUngrounded => RouteQualificationRequestRefused { cause: QualificationRequestRefusedByClassifier { cause: QualificationSubjectNotACandidate } } + } +} + +fn candidate_request(standing: BmcRotationRouteStanding) -> BmcAccountWriteRequest? { + match standing.grounding { + RouteQualificationCandidate { request: r, evidence: _ } => Present { value: r } + RouteGroundedByExecutedRequest { request: _, request_receipt: _, response_receipt: _ } => none + RouteGroundedByCitedSource { request: _, citation: _ } => none + RouteUngrounded => none + } +} + +fn is_password_request(request: BmcAccountWriteRequest) -> Bool { + match request { + IpmiSetUserPassword { user: _ } => true + RedfishAccountPasswordWrite { transport_operation: _, action_shape: _ } => true + IpmiSetUserPrivilegeLimit { access: _ } => false + } +} + +// THE PASSWORD QUALIFICATION EFFECT. Census: route_qualification_effect. +fn admit_password_route_qualification(standing: BmcRotationRouteStanding, approval: Redemption) -> RouteQualificationRequestAdmission { + match candidate_request(standing: standing) { + Present { value: r } => + if is_password_request(request: r) { + admit_route_qualification_request(standing: standing, approval: approval, readback: none) + } else { + RouteQualificationRequestRefused { cause: QualificationRequestForAnotherOperation { candidate: r } } + } + Absent => admit_route_qualification_request(standing: standing, approval: approval, readback: none) + } +} + +// THE PRIVILEGE-LIMIT QUALIFICATION EFFECT. Census: route_qualification_channel_access_effect. +fn admit_privilege_limit_route_qualification( + standing: BmcRotationRouteStanding, + approval: Redemption, + readback: ManagedAdministratorReadback?, +) -> RouteQualificationRequestAdmission { + match candidate_request(standing: standing) { + Present { value: r } => + if is_password_request(request: r) { + RouteQualificationRequestRefused { cause: QualificationRequestForAnotherOperation { candidate: r } } + } else { + admit_route_qualification_request(standing: standing, approval: approval, readback: readback) + } + Absent => admit_route_qualification_request(standing: standing, approval: approval, readback: readback) + } +} + data route_qualification_live_frontier: DissolutionCondition = unbound_dissolution( - description: "dissolves when a live realization of the route-qualification request mints RouteQualificationLiveResponse in this module from a transport call against the controller, bound to the exact RouteQualificationSubject it was made against, under that controller's own operator go-ahead redeemed through gunbc.auth.approval_broker, with request and response bytes committed as content-addressed evidence, and qualify_rotation_route is called with it; until then RouteQualificationLiveResponse has no mint and no candidate can be grounded by qualification. NOT satisfied by the dry realization over gunbc.bmc_model BmcWorld (its ModeledRouteQualificationResponse cannot construct a standing), by a workflow entry that has not executed, or by a receipt that names no controller and build" as NonEmptyStr, + description: "dissolves when a live realization of the route-qualification request mints RouteQualificationLiveResponse in this module from a transport call against the controller made ONLY from an AdmittedRouteQualificationRequest (admit_password_route_qualification or admit_privilege_limit_route_qualification, so every pre-write guard including the same-run administrator-retention receipt has held) and, for a privilege-limit request, issued in the privilege-limit-only mode of Set User Access, bound to the exact RouteQualificationSubject it was made against, under that controller's own operator go-ahead redeemed through gunbc.auth.approval_broker, with request and response bytes committed as content-addressed evidence, and qualify_rotation_route is called with it; until then RouteQualificationLiveResponse has no mint and no candidate can be grounded by qualification. NOT satisfied by the dry realization over gunbc.bmc_model BmcWorld (its ModeledRouteQualificationResponse cannot construct a standing), by a workflow entry that has not executed, or by a receipt that names no controller and build" as NonEmptyStr, ) // ── THE ORDINARY ROTATION APPLY CONSUMES ONLY A GROUNDED ROUTE ────────────────────────────────── @@ -616,6 +724,7 @@ type AdministratorRetentionRefusal | ManagedReadbackFromAnotherRun { readback: AttemptIdentity, approved: AttemptIdentity } | ManagedAccountIsTheClosedAccount { user: IpmiUserId } | ManagedAccountNotAdministratorOnChannel { managed_user: IpmiUserId } + | ManagedReadbackDuplicateRow { managed_user: IpmiUserId, count: Int } fn lowers_privilege(privilege: IpmiChannelPrivilegeLimit) -> Bool { match privilege { @@ -632,10 +741,7 @@ fn administrator_retention_refusal(standing: BmcRotationRouteStanding, request: match request { IpmiSetUserPassword { user: _ } => none RedfishAccountPasswordWrite { transport_operation: _, action_shape: _ } => none - IpmiSetUserAccess { access: x } => - if !lowers_privilege(privilege: x.privilege) { - none - } else { + IpmiSetUserPrivilegeLimit { access: x } => match readback { Absent => Present { value: ManagedReadbackAbsent } Present { value: r } => @@ -645,21 +751,25 @@ fn administrator_retention_refusal(standing: BmcRotationRouteStanding, request: Present { value: ManagedReadbackFromAnotherBuild { readback: r.firmware, route: standing.firmware } } } else if (r.attempt as String) != (approved_attempt as String) { Present { value: ManagedReadbackFromAnotherRun { readback: r.attempt, approved: approved_attempt } } - } else if (r.managed_user as Int) == (x.user as Int) { + } else if lowers_privilege(privilege: x.privilege) && (r.managed_user as Int) == (x.user as Int) { Present { value: ManagedAccountIsTheClosedAccount { user: x.user } } - } else if any(r.access, a => (a.user as Int) == (r.managed_user as Int) && (a.channel as Int) == (x.channel as Int) && !lowers_privilege(privilege: a.privilege)) { - none } else { - Present { value: ManagedAccountNotAdministratorOnChannel { managed_user: r.managed_user } } + let rows = filter(r.access, a => (a.user as Int) == (r.managed_user as Int) && (a.channel as Int) == (x.channel as Int)) + if length(rows) > 1 { + Present { value: ManagedReadbackDuplicateRow { managed_user: r.managed_user, count: length(rows) } } + } else if any(rows, a => !lowers_privilege(privilege: a.privilege)) { + none + } else { + Present { value: ManagedAccountNotAdministratorOnChannel { managed_user: r.managed_user } } + } } } - } } } fn request_channel(request: BmcAccountWriteRequest) -> Int { match request { - IpmiSetUserAccess { access: x } => x.channel as Int + IpmiSetUserPrivilegeLimit { access: x } => x.channel as Int IpmiSetUserPassword { user: _ } => 0 RedfishAccountPasswordWrite { transport_operation: _, action_shape: _ } => 0 } diff --git a/dag/gunbc/machine_intake/bmc_rotation_route_evidence.dag b/dag/gunbc/machine_intake/bmc_rotation_route_evidence.dag index c58ad9deb0a..6776b10a1b0 100644 --- a/dag/gunbc/machine_intake/bmc_rotation_route_evidence.dag +++ b/dag/gunbc/machine_intake/bmc_rotation_route_evidence.dag @@ -19,11 +19,11 @@ import gunbc.machine_intake_mtjade1_access_observation { read_mtjade1_recorded_manager_identity, } import gunbc.machine_intake_mtcollins1_access_observation { mtcollins1_endpoint, mtcollins1_firmware } -import gunbc.machine_intake_mtcollins1_bmc_secure_observation { mtcollins1_user3_route_evidence, mtcollins1_published_user } -import extdeps.bmc.ipmi_channel { IpmiPrivilegeNoAccess, ipmi_user_channel_access, extdeps_external_authority_anchor } +import gunbc.machine_intake_mtcollins1_bmc_secure_observation { mtcollins1_user3_route_evidence } +import extdeps.bmc.ipmi_channel { IpmiPrivilegeAdministrator, ipmi_user_channel_access, extdeps_external_authority_anchor } import extdeps.ampere.mt_collins_firmware_release { mt_collins_bmc_0_45_3_hpm } import gunbc.machine_intake_bmc_rotation_route { - BmcRotationRouteStanding, HistoricalRotationRouteObservation, IpmiSetUserPassword, IpmiSetUserAccess, ObservedSurfaceRead, + BmcRotationRouteStanding, HistoricalRotationRouteObservation, IpmiSetUserPassword, IpmiSetUserPrivilegeLimit, ObservedSurfaceRead, PublicStandardOperation, rotation_route_candidate, rotation_route_from_committed_execution, redfish_account_password_write, } @@ -60,10 +60,16 @@ fn mtcollins1_rotation_route_standing() -> BmcRotationRouteStanding { // carry over to it (admit_rotation_apply refuses another build). The raw string is the release's own // version; no post-reflash version readback is committed (see the evidence note below). // -// THE REQUEST is the one the operator-gated qualification would execute: the published account -// (mtcollins1_published_user) to NO ACCESS on LAN channel 2, the first of the channels the operator -// reports the factory administrator still holds after the reflash (eager-gull-22, 2026-10-04). Those -// channel numbers are an operator report, not a committed observation. +// THE QUALIFYING REQUEST IS CHOSEN TO BE NON-DESTRUCTIVE. It re-asserts the MANAGED account's own +// ADMINISTRATOR limit on LAN channel 1 -- user 3, the gunbc account's IPMI id before the reflash -- rather +// than closing the factory administrator. It is safe because the pre-write admission +// (admit_privilege_limit_route_qualification) requires a same-run Get User Access readback, on this +// controller and build, showing that user ALREADY at ADMINISTRATOR on channel 1 as the unique row for +// the pair: so the write sets exactly the value just read, changes no access, and still exercises the +// command and its readback. If the post-reflash managed id or channel differs, that readback refuses +// and nothing is written. Closing the factory administrator (user 2, the channels the operator reports +// it still holds, eager-gull-22 2026-10-04) is an ordinary Apply AFTER this route is grounded, and it +// passes the same administrator-retention precondition. // // EVIDENCE IS THE PUBLIC STANDARD ONLY. The IPMI v2.0 specification defines Set User Access // (extdeps.bmc.ipmi_channel's cited authority). NO post-reflash channel-access observation is @@ -84,7 +90,7 @@ fn mtcollins1_channel_access_route_standing() -> BmcRotationRouteStanding { rotation_route_candidate( endpoint: mtcollins1_endpoint, firmware: mtcollins1_current_bmc_firmware(), - request: IpmiSetUserAccess { access: ipmi_user_channel_access(channel: 2, user: mtcollins1_published_user, privilege: IpmiPrivilegeNoAccess) }, + request: IpmiSetUserPrivilegeLimit { access: ipmi_user_channel_access(channel: 1, user: 3, privilege: IpmiPrivilegeAdministrator) }, evidence: PublicStandardOperation { authority: extdeps_external_authority_anchor }, ) } diff --git a/dag/test/claim/machine_intake/machine_intake_bmc_rotation_route_forged_probe_witness_test.dag b/dag/test/claim/machine_intake/machine_intake_bmc_rotation_route_forged_probe_witness_test.dag index 6c6b71fe1f9..d4e8a6e53c5 100644 --- a/dag/test/claim/machine_intake/machine_intake_bmc_rotation_route_forged_probe_witness_test.dag +++ b/dag/test/claim/machine_intake/machine_intake_bmc_rotation_route_forged_probe_witness_test.dag @@ -15,7 +15,7 @@ data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly // source to the compiler through the diagnostic-census harness and requires the refusal CLASS at each // SUBJECT by name, so a probe refusing for any other reason measures another wall; the class-scoped // control shows a clean source reading the same module through its real producer emits neither class. -data forged_probe_source: String = "module probe_rotation_route_forged\n\nimport std.types { Bool, NonEmptyStr }\nimport std.content_hash { content_hash_of_value }\nimport extdeps.uri { uri_https }\nimport extdeps.external_authority { ExternalAuthority }\nimport gunbc.machine_intake_receipt { EvidenceRef }\nimport gunbc.machine_intake_mtcollins1_access_observation { mtcollins1_endpoint, mtcollins1_firmware }\nimport gunbc.machine_intake_mtcollins1_bmc_secure_observation { mtcollins1_user3_route_evidence }\nimport gunbc.machine_intake_bmc_rotation_route {\n BmcRotationRouteStanding, RouteQualificationLiveResponse, ModeledRouteQualificationResponse, RouteQualificationSubject, IpmiSetUserPassword, RouteGroundedByExecutedRequest,\n rotation_route_from_committed_execution, rotation_route_from_citation,\n ManagedAdministratorReadback, managed_administrator_readback_fixture,\n}\nimport std.scoped_authorization { AttemptIdentity }\n\nfn forged_grounded_standing() -> BmcRotationRouteStanding {\n BmcRotationRouteStanding {\n endpoint: mtcollins1_endpoint,\n firmware: mtcollins1_firmware,\n grounding: RouteGroundedByExecutedRequest { request: IpmiSetUserPassword { user: 3 }, request_receipt: mtcollins1_user3_route_evidence, response_receipt: mtcollins1_user3_route_evidence },\n }\n}\n\nfn forged_subject() -> RouteQualificationSubject {\n RouteQualificationSubject { endpoint: mtcollins1_endpoint, firmware: mtcollins1_firmware, request: IpmiSetUserPassword { user: 3 } }\n}\n\nfn forged_modeled_response() -> ModeledRouteQualificationResponse {\n ModeledRouteQualificationResponse {\n subject: forged_subject(),\n request_receipt: mtcollins1_user3_route_evidence,\n response_receipt: mtcollins1_user3_route_evidence,\n completed: true,\n readback_accepted: true,\n }\n}\n\nfn forged_response() -> RouteQualificationLiveResponse {\n RouteQualificationLiveResponse {\n subject: forged_subject(),\n request_receipt: mtcollins1_user3_route_evidence,\n response_receipt: mtcollins1_user3_route_evidence,\n completed: true,\n readback_accepted: true,\n }\n}\n\nfn forged_committed_execution() -> BmcRotationRouteStanding {\n rotation_route_from_committed_execution(\n endpoint: mtcollins1_endpoint,\n firmware: mtcollins1_firmware,\n request: IpmiSetUserPassword { user: 3 },\n request_receipt: mtcollins1_user3_route_evidence,\n response_receipt: mtcollins1_user3_route_evidence,\n )\n}\n\nfn forged_citation() -> BmcRotationRouteStanding {\n rotation_route_from_citation(\n endpoint: mtcollins1_endpoint,\n firmware: mtcollins1_firmware,\n request: IpmiSetUserPassword { user: 3 },\n citation: ExternalAuthority { uri: uri_https(locator: \"example.invalid/forged\") },\n )\n}\n\nfn forged_readback() -> ManagedAdministratorReadback {\n ManagedAdministratorReadback { endpoint: mtcollins1_endpoint, firmware: mtcollins1_firmware, attempt: \"attempt-1\" as AttemptIdentity, managed_user: 3, access: [] }\n}\n\nfn forged_readback_through_the_fixture() -> ManagedAdministratorReadback {\n managed_administrator_readback_fixture(endpoint: mtcollins1_endpoint, firmware: mtcollins1_firmware, attempt: \"attempt-1\" as AttemptIdentity, managed_user: 3, access: [])\n}\n" +data forged_probe_source: String = "module probe_rotation_route_forged\n\nimport std.types { Bool, NonEmptyStr }\nimport std.content_hash { content_hash_of_value }\nimport extdeps.uri { uri_https }\nimport extdeps.external_authority { ExternalAuthority }\nimport gunbc.machine_intake_receipt { EvidenceRef }\nimport gunbc.machine_intake_mtcollins1_access_observation { mtcollins1_endpoint, mtcollins1_firmware }\nimport gunbc.machine_intake_mtcollins1_bmc_secure_observation { mtcollins1_user3_route_evidence }\nimport gunbc.machine_intake_bmc_rotation_route {\n BmcRotationRouteStanding, RouteQualificationLiveResponse, ModeledRouteQualificationResponse, RouteQualificationSubject, IpmiSetUserPassword, RouteGroundedByExecutedRequest,\n rotation_route_from_committed_execution, rotation_route_from_citation,\n ManagedAdministratorReadback, managed_administrator_readback_fixture, AdmittedRouteQualificationRequest,\n}\nimport std.scoped_authorization { AttemptIdentity }\n\nfn forged_grounded_standing() -> BmcRotationRouteStanding {\n BmcRotationRouteStanding {\n endpoint: mtcollins1_endpoint,\n firmware: mtcollins1_firmware,\n grounding: RouteGroundedByExecutedRequest { request: IpmiSetUserPassword { user: 3 }, request_receipt: mtcollins1_user3_route_evidence, response_receipt: mtcollins1_user3_route_evidence },\n }\n}\n\nfn forged_subject() -> RouteQualificationSubject {\n RouteQualificationSubject { endpoint: mtcollins1_endpoint, firmware: mtcollins1_firmware, request: IpmiSetUserPassword { user: 3 } }\n}\n\nfn forged_modeled_response() -> ModeledRouteQualificationResponse {\n ModeledRouteQualificationResponse {\n subject: forged_subject(),\n request_receipt: mtcollins1_user3_route_evidence,\n response_receipt: mtcollins1_user3_route_evidence,\n completed: true,\n readback_accepted: true,\n }\n}\n\nfn forged_response() -> RouteQualificationLiveResponse {\n RouteQualificationLiveResponse {\n subject: forged_subject(),\n request_receipt: mtcollins1_user3_route_evidence,\n response_receipt: mtcollins1_user3_route_evidence,\n completed: true,\n readback_accepted: true,\n }\n}\n\nfn forged_committed_execution() -> BmcRotationRouteStanding {\n rotation_route_from_committed_execution(\n endpoint: mtcollins1_endpoint,\n firmware: mtcollins1_firmware,\n request: IpmiSetUserPassword { user: 3 },\n request_receipt: mtcollins1_user3_route_evidence,\n response_receipt: mtcollins1_user3_route_evidence,\n )\n}\n\nfn forged_citation() -> BmcRotationRouteStanding {\n rotation_route_from_citation(\n endpoint: mtcollins1_endpoint,\n firmware: mtcollins1_firmware,\n request: IpmiSetUserPassword { user: 3 },\n citation: ExternalAuthority { uri: uri_https(locator: \"example.invalid/forged\") },\n )\n}\n\nfn forged_admitted_request() -> AdmittedRouteQualificationRequest {\n AdmittedRouteQualificationRequest { subject: forged_subject(), attempt: \"attempt-1\" as AttemptIdentity, decided_by: \"forger\" }\n}\n\nfn forged_readback() -> ManagedAdministratorReadback {\n ManagedAdministratorReadback { endpoint: mtcollins1_endpoint, firmware: mtcollins1_firmware, attempt: \"attempt-1\" as AttemptIdentity, managed_user: 3, access: [] }\n}\n\nfn forged_readback_through_the_fixture() -> ManagedAdministratorReadback {\n managed_administrator_readback_fixture(endpoint: mtcollins1_endpoint, firmware: mtcollins1_firmware, attempt: \"attempt-1\" as AttemptIdentity, managed_user: 3, access: [])\n}\n" data harness_control_source: String = "module probe_rotation_route_harness_control\nimport gunbc.machine_intake_bmc_rotation_route { BmcRotationRouteStanding }\nimport gunbc.machine_intake_bmc_rotation_route_evidence { mtcollins1_rotation_route_standing }\nfn standing() -> BmcRotationRouteStanding { mtcollins1_rotation_route_standing() }\n" @@ -55,6 +55,7 @@ test fn a_forged_route_standing_and_response_are_refused_at_their_literals() -> && blocking_count_for_class_and_subject(c: c, wanted: "SoleConstructorViolation", subject: "RouteQualificationLiveResponse") >= 1 && blocking_count_for_class_and_subject(c: c, wanted: "SoleConstructorViolation", subject: "ModeledRouteQualificationResponse") >= 1 && blocking_count_for_class_and_subject(c: c, wanted: "SoleConstructorViolation", subject: "ManagedAdministratorReadback") >= 1 + && blocking_count_for_class_and_subject(c: c, wanted: "SoleConstructorViolation", subject: "AdmittedRouteQualificationRequest") >= 1 } // The committed-execution and citation mints refuse a caller outside their admitted roots. diff --git a/dag/test/claim/machine_intake/machine_intake_bmc_rotation_route_witness_test.dag b/dag/test/claim/machine_intake/machine_intake_bmc_rotation_route_witness_test.dag index 35ed8b94082..f5516c70594 100644 --- a/dag/test/claim/machine_intake/machine_intake_bmc_rotation_route_witness_test.dag +++ b/dag/test/claim/machine_intake/machine_intake_bmc_rotation_route_witness_test.dag @@ -23,7 +23,8 @@ import gunbc.machine_intake_mtcollins1_access_observation { mtcollins1_endpoint, import gunbc.machine_intake_mtcollins1_bmc_secure_observation { mtcollins1_user3_route_digest } import gunbc.machine_intake_mtjade1_access_observation { read_mtjade1_recorded_manager_identity } import gunbc.machine_intake_bmc_rotation_route { - BmcRotationRouteStanding, BmcAccountWriteRequest, IpmiSetUserPassword, IpmiSetUserAccess, RedfishAccountPasswordWrite, + RouteQualificationRequestAdmission, + BmcRotationRouteStanding, BmcAccountWriteRequest, IpmiSetUserPassword, IpmiSetUserPrivilegeLimit, RedfishAccountPasswordWrite, ObservedSurfaceRead, PublicStandardOperation, RouteGroundedByExecutedRequest, RouteGroundedByCitedSource, RouteQualificationCandidate, RouteUngrounded, RouteQualified, RouteQualificationRefused, RouteQualificationSubject, HistoricalRotationRouteObservation, @@ -35,7 +36,10 @@ import gunbc.machine_intake_bmc_rotation_route { RotationApplyAdmitted, RotationApplyRouteNotGrounded, RotationApplyRouteForAnotherController, RotationApplyRouteForAnotherBuild, RotationApplyRouteForAnotherOperation, RotationApplyApprovalRefused, RotationApplyApprovalDenied, RotationApplyApprovalForAnotherAuthority, RotationApplyApprovalForAnotherRequest, RotationApplyWouldLeaveNoAdministrator, - ManagedAdministratorReadback, managed_administrator_readback_fixture, ManagedReadbackAbsent, ManagedReadbackFromAnotherController, ManagedReadbackFromAnotherBuild, ManagedReadbackFromAnotherRun, ManagedAccountIsTheClosedAccount, ManagedAccountNotAdministratorOnChannel, + ManagedAdministratorReadback, managed_administrator_readback_fixture, ManagedReadbackAbsent, ManagedReadbackFromAnotherController, ManagedReadbackFromAnotherBuild, ManagedReadbackFromAnotherRun, ManagedAccountIsTheClosedAccount, ManagedAccountNotAdministratorOnChannel, ManagedReadbackDuplicateRow, + RouteQualificationRequestAdmitted, RouteQualificationRequestRefused, QualificationRequestForAnotherOperation, + QualificationRequestRefusedByClassifier, QualificationRequestWouldLeaveNoAdministrator, + admit_password_route_qualification, admit_privilege_limit_route_qualification, route_qualification_authority, rotation_apply_authority, rotation_route_ungrounded, rotation_route_candidate, rotation_route_from_citation, rotation_route_request_identity, rotation_route_is_grounded, @@ -197,7 +201,7 @@ test fn mtcollins1_is_grounded_by_its_executed_ipmi_request() -> Bool { RouteGroundedByExecutedRequest { request: r, request_receipt: q, response_receipt: p } => match r { IpmiSetUserPassword { user: u } => (u as Int) == 3 - IpmiSetUserAccess { access: _ } => false + IpmiSetUserPrivilegeLimit { access: _ } => false RedfishAccountPasswordWrite { transport_operation: _, action_shape: _ } => false } && q.digest == mtcollins1_user3_route_digest @@ -381,7 +385,7 @@ test fn a_cited_route_admits_apply_and_is_bound_to_its_build() -> Bool { // over its stated characteristics: the selection returns the operator-approved capability, and the // row's realization (an admitted Redemption) conforms to it. test fn the_qualification_effect_is_classified_operator_approved_and_conforms() -> Bool { - let rows = filter(privileged_effect_census, r => (r.site.module_path as String) == "gunbc.machine_intake_bmc_rotation_route" && (r.site.decl_name as String) == "qualify_rotation_route" && string_contains(s: r.effect.subject as String, pattern: "account-write route")) + let rows = filter(privileged_effect_census, r => (r.site.module_path as String) == "gunbc.machine_intake_bmc_rotation_route" && (r.site.decl_name as String) == "admit_password_route_qualification") length(rows) == 1 && all(rows, r => match select_authorization_pattern(e: r.effect) { @@ -427,7 +431,7 @@ test fn a_rotation_approval_for_one_controller_does_not_admit_another() -> Bool // ── cut O1a-2: the channel-access request shape ───────────────────────────────────────────────── fn access_write(user: Int, channel: Int, privilege: IpmiChannelPrivilegeLimit) -> BmcAccountWriteRequest { - IpmiSetUserAccess { access: ipmi_user_channel_access(channel: channel, user: user, privilege: privilege) } + IpmiSetUserPrivilegeLimit { access: ipmi_user_channel_access(channel: channel, user: user, privilege: privilege) } } // EVERY FIELD IS IN THE IDENTITY. Set User Access requests differing ONLY in the channel, ONLY in the @@ -451,8 +455,9 @@ test fn channel_access_requests_differing_in_any_one_field_are_different_request } // mtcollins1's channel-access route is a candidate on its CURRENT controller and build (0.45.3, not -// the 0.32 its password route was executed on), naming the published account to NO ACCESS on channel -// 2, with the public standard as its only evidence. It is not grounded, and an Apply refuses it. +// the 0.32 its password route was executed on), naming the NON-DESTRUCTIVE qualifying request (the +// managed account, user 3, re-asserted at ADMINISTRATOR on channel 1), with the public standard as its +// only evidence. It is not grounded, and an Apply refuses it. test fn mtcollins1_channel_access_route_is_an_ungrounded_candidate_on_its_current_build() -> Bool { let s = mtcollins1_channel_access_route_standing() (s.endpoint.host as String) == "192.168.1.228" @@ -460,7 +465,7 @@ test fn mtcollins1_channel_access_route_is_an_ungrounded_candidate_on_its_curren && !rotation_route_is_grounded(standing: s) && match s.grounding { RouteQualificationCandidate { request: r, evidence: e } => - account_write_request_eq(a: r, b: access_write(user: 2, channel: 2, privilege: IpmiPrivilegeNoAccess)) + account_write_request_eq(a: r, b: access_write(user: 3, channel: 1, privilege: IpmiPrivilegeAdministrator)) && match e { PublicStandardOperation { authority: _ } => true ObservedSurfaceRead { surface: _, receipt: _ } => false } RouteGroundedByExecutedRequest { request: _, request_receipt: _, response_receipt: _ } => false RouteGroundedByCitedSource { request: _, citation: _ } => false @@ -500,7 +505,7 @@ test fn a_grounded_password_route_does_not_admit_a_channel_access_apply() -> Boo // its own characteristics (not the password row's): the selection returns the operator-approved // capability and the row's realization conforms. test fn the_channel_access_qualification_effect_is_classified_by_executing_the_selection() -> Bool { - let rows = filter(privileged_effect_census, r => (r.site.decl_name as String) == "qualify_rotation_route" && string_contains(s: r.effect.subject as String, pattern: "channel-access route")) + let rows = filter(privileged_effect_census, r => (r.site.module_path as String) == "gunbc.machine_intake_bmc_rotation_route" && (r.site.decl_name as String) == "admit_privilege_limit_route_qualification") length(rows) == 1 && all(rows, r => match select_authorization_pattern(e: r.effect) { @@ -542,6 +547,7 @@ fn lockout_verdict(readback: ManagedAdministratorReadback?) -> String { ManagedReadbackFromAnotherRun { readback: _, approved: _ } => "another-run" ManagedAccountIsTheClosedAccount { user: _ } => "managed-is-closed" ManagedAccountNotAdministratorOnChannel { managed_user: _ } => "not-administrator-on-channel" + ManagedReadbackDuplicateRow { managed_user: _, count: _ } => "duplicate-row" } } _ => "other-refusal" @@ -572,3 +578,55 @@ test fn a_readback_from_another_controller_or_build_does_not_unlock_a_close() -> && lockout_verdict(readback: readback_at(endpoint: lab_endpoint, firmware: bmc_firmware_release_identity_of_wire(family: AmiMegaRac, wire: "0.33" as NonEmptyStr), attempt: "attempt-1" as NonEmptyStr, managed_user: 3, access: admin_on_2)) == "another-build" && lockout_verdict(readback: readback_at(endpoint: lab_endpoint, firmware: lab_firmware(), attempt: "attempt-1" as NonEmptyStr, managed_user: 3, access: admin_on_2)) == "admitted" } + +// A DUPLICATE (channel, user) RESULT REFUSES: an ADMINISTRATOR row beside a contradictory NO ACCESS row +// for the same managed user and channel is not a unique reading. +test fn a_duplicated_managed_readback_row_refuses() -> Bool { + lockout_verdict(readback: readback_at(endpoint: lab_endpoint, firmware: lab_firmware(), attempt: "attempt-1" as NonEmptyStr, managed_user: 3, access: [ + ipmi_user_channel_access(channel: 2, user: 3, privilege: IpmiPrivilegeAdministrator), + ipmi_user_channel_access(channel: 2, user: 3, privilege: IpmiPrivilegeNoAccess), + ])) == "duplicate-row" +} + +// ── THE PRE-WRITE QUALIFICATION ADMISSION (side-chat review of 7887d74ed2, item 1) ────────────────── + +fn prewrite_verdict(a: RouteQualificationRequestAdmission) -> String { + match a { + RouteQualificationRequestAdmitted { request: _ } => "admitted" + RouteQualificationRequestRefused { cause: c } => + match c { + QualificationRequestForAnotherOperation { candidate: _ } => "another-operation" + QualificationRequestRefusedByClassifier { cause: k } => refusal_name(c: k) + QualificationRequestWouldLeaveNoAdministrator { cause: k } => + match k { + ManagedReadbackAbsent => "readback-absent" + _ => "retention-refused" + } + } + } +} + +// THE MTCOLLINS1 CANDIDATE CANNOT REACH A TRANSPORT CALL WITHOUT A CURRENT RECEIPT. With its exact +// qualification approval and no managed-administrator readback, the privilege-limit entrypoint refuses +// before any write: no AdmittedRouteQualificationRequest exists, and that sealed value is the only input +// the live transport is permitted. The password entrypoint refuses the candidate as another operation. +test fn the_mtcollins1_channel_access_candidate_cannot_issue_a_request_without_a_current_receipt() -> Bool { + let s = mtcollins1_channel_access_route_standing() + let exact = qualification_approval_for(standing: s, request: standing_request(s: s)) + prewrite_verdict(a: admit_privilege_limit_route_qualification(standing: s, approval: exact, readback: none)) == "readback-absent" + && prewrite_verdict(a: admit_password_route_qualification(standing: s, approval: exact)) == "another-operation" +} + +// THE POSITIVE, ON A LAB CANDIDATE WITH THE NON-DESTRUCTIVE SHAPE: re-asserting the managed account's +// ADMINISTRATOR limit on channel 1, with the exact approval and a same-run readback showing it already +// ADMINISTRATOR there, is admitted; the same with a readback from another controller refuses; and a +// rotation approval refuses at the classifier. +test fn the_prewrite_admission_admits_only_with_the_same_run_receipt() -> Bool { + let request = access_write(user: 3, channel: 1, privilege: IpmiPrivilegeAdministrator) + let c = lab_candidate(request: request) + let exact = qualification_approval_for(standing: c, request: request) + let admin_on_1 = [ipmi_user_channel_access(channel: 1, user: 3, privilege: IpmiPrivilegeAdministrator)] + prewrite_verdict(a: admit_privilege_limit_route_qualification(standing: c, approval: exact, readback: readback_at(endpoint: lab_endpoint, firmware: lab_firmware(), attempt: "attempt-1" as NonEmptyStr, managed_user: 3, access: admin_on_1))) == "admitted" + && prewrite_verdict(a: admit_privilege_limit_route_qualification(standing: c, approval: exact, readback: readback_at(endpoint: lab_endpoint_b, firmware: lab_firmware(), attempt: "attempt-1" as NonEmptyStr, managed_user: 3, access: admin_on_1))) == "retention-refused" + && prewrite_verdict(a: admit_privilege_limit_route_qualification(standing: c, approval: rotation_approval_for(s: c), readback: readback_at(endpoint: lab_endpoint, firmware: lab_firmware(), attempt: "attempt-1" as NonEmptyStr, managed_user: 3, access: admin_on_1))) == "another-authority" +} From 6d277411fdb4d5f5d280dbe8edc70137812ab243 Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Sun, 4 Oct 2026 10:45:51 +0000 Subject: [PATCH 11/22] O1a-2: an executed grounding states whether its effect was observed; a privilege-lowering Apply requires EffectObserved Co-Authored-By: Claude Opus 5.5 (1M context) --- .../machine_intake/bmc_rotation_route.dag | 91 ++++++++++++++++--- .../bmc_rotation_route_evidence.dag | 7 +- ...tation_route_forged_probe_witness_test.dag | 3 +- ...intake_bmc_rotation_route_witness_test.dag | 71 +++++++++++++-- 4 files changed, 150 insertions(+), 22 deletions(-) diff --git a/dag/gunbc/machine_intake/bmc_rotation_route.dag b/dag/gunbc/machine_intake/bmc_rotation_route.dag index 7ddd944fac6..309a4f3f06c 100644 --- a/dag/gunbc/machine_intake/bmc_rotation_route.dag +++ b/dag/gunbc/machine_intake/bmc_rotation_route.dag @@ -66,11 +66,22 @@ type RouteCandidateEvidence // RouteGroundedByExecutedRequest, plus a route grounded by a source cited for this build. Only the // two Grounded arms admit an ordinary rotation Apply (admit_rotation_apply). type BmcRotationRouteGrounding - = RouteGroundedByExecutedRequest { request: BmcAccountWriteRequest, request_receipt: EvidenceRef, response_receipt: EvidenceRef } + = RouteGroundedByExecutedRequest { request: BmcAccountWriteRequest, request_receipt: EvidenceRef, response_receipt: EvidenceRef, effect: RouteEffectStanding } | RouteGroundedByCitedSource { request: BmcAccountWriteRequest, citation: ExternalAuthority } | RouteQualificationCandidate { request: BmcAccountWriteRequest, evidence: RouteCandidateEvidence } | RouteUngrounded +// WHAT AN EXECUTED REQUEST GROUNDS: that the controller ACCEPTED the operation, and -- only when the +// run could tell -- that it TOOK EFFECT. A write whose requested value equals the value already present +// reads back identically whether the controller applied it or silently ignored it, so it grounds +// acceptance only. The effect is observed exactly when the reading taken BEFORE the write differed from +// the requested value and the readback AFTER it matches; that comparison is made by whoever mints the +// response, never declared by a caller. A privilege-lowering Apply relies on the effect and requires +// EffectObserved (admit_rotation_apply). +type RouteEffectStanding + = EffectObserved + | AcceptedEffectUnobserved + // SEALED: the endpoint and build are joined to their grounding only by the mints in this module, so // no other module can pair one controller's executed request with another controller or build. The // grounding coproduct itself is not sealed (sole_constructor is discarded on a coproduct right-hand @@ -112,6 +123,7 @@ fn rotation_route_from_committed_execution( request: BmcAccountWriteRequest, request_receipt: EvidenceRef, response_receipt: EvidenceRef, + effect: RouteEffectStanding, ) -> BmcRotationRouteStanding admit_callers: [ decl_ref(module_path: "gunbc.machine_intake_bmc_rotation_route_evidence", decl_name: "mtcollins1_rotation_route_standing"), @@ -120,7 +132,7 @@ fn rotation_route_from_committed_execution( BmcRotationRouteStanding { endpoint: endpoint, firmware: firmware, - grounding: RouteGroundedByExecutedRequest { request: request, request_receipt: request_receipt, response_receipt: response_receipt }, + grounding: RouteGroundedByExecutedRequest { request: request, request_receipt: request_receipt, response_receipt: response_receipt, effect: effect }, } } @@ -160,7 +172,7 @@ type HistoricalRotationRouteObservation { fn rotation_route_is_grounded(standing: BmcRotationRouteStanding) -> Bool { match standing.grounding { - RouteGroundedByExecutedRequest { request: _, request_receipt: _, response_receipt: _ } => true + RouteGroundedByExecutedRequest { request: _, request_receipt: _, response_receipt: _, effect: _ } => true RouteGroundedByCitedSource { request: _, citation: _ } => true RouteQualificationCandidate { request: _, evidence: _ } => false RouteUngrounded => false @@ -350,6 +362,7 @@ type RouteQualificationLiveResponse sole_constructor { response_receipt: EvidenceRef completed: Bool readback_accepted: Bool + effect: RouteEffectStanding } type ModeledRouteQualificationResponse sole_constructor { @@ -358,6 +371,11 @@ type ModeledRouteQualificationResponse sole_constructor { response_receipt: EvidenceRef completed: Bool readback_accepted: Bool + effect: RouteEffectStanding +} + +fn effect_of(before_matched: Bool, after_matched: Bool) -> RouteEffectStanding { + if !before_matched && after_matched { EffectObserved } else { AcceptedEffectUnobserved } } type DryRouteQualificationStep { @@ -376,6 +394,10 @@ fn dry_route_qualification_request(world: BmcWorld, subject: RouteQualificationS match subject.request { RedfishAccountPasswordWrite { transport_operation: _, action_shape: _ } => DryRouteQualificationStep { world: world, response: none } IpmiSetUserPrivilegeLimit { access: x } => { + let before = match bmc_ipmi_get_user_access(world: world, user: x.user, channel: x.channel as Int) { + Present { value: p } => ipmi_privilege_eq(a: p, b: x.privilege) + Absent => false + } let step = bmc_ipmi_set_user_access(world: world, access: x) let accepted = match bmc_ipmi_get_user_access(world: step.world, user: x.user, channel: x.channel as Int) { Present { value: p } => ipmi_privilege_eq(a: p, b: x.privilege) @@ -395,11 +417,13 @@ fn dry_route_qualification_request(world: BmcWorld, subject: RouteQualificationS response_receipt: EvidenceRef { label: response_text, digest: content_hash_of_value(value: response_text) }, completed: step.completed, readback_accepted: accepted, + effect: effect_of(before_matched: before, after_matched: accepted), }, }, } } IpmiSetUserPassword { user: u } => { + let before = bmc_ipmi_user_accepts(world: world, user: u, password: password) let step = bmc_ipmi_set_user_password(world: world, user: u, password: password) let accepted = bmc_ipmi_user_accepts(world: step.world, user: u, password: password) let request_text = join(["modeled ", account_write_request_text(request: subject.request) as String, " at ", subject.endpoint.host as String, " firmware ", subject.firmware.raw_version as String, ", password length ", to_string(length(password))], "") as NonEmptyStr @@ -416,6 +440,7 @@ fn dry_route_qualification_request(world: BmcWorld, subject: RouteQualificationS response_receipt: EvidenceRef { label: response_text, digest: content_hash_of_value(value: response_text) }, completed: step.completed, readback_accepted: accepted, + effect: effect_of(before_matched: before, after_matched: accepted), }, }, } @@ -465,7 +490,7 @@ fn route_qualification_refusal( readback_accepted: Bool, ) -> RouteQualificationRefusal? { match standing.grounding { - RouteGroundedByExecutedRequest { request: _, request_receipt: _, response_receipt: _ } => Present { value: QualificationSubjectNotACandidate } + RouteGroundedByExecutedRequest { request: _, request_receipt: _, response_receipt: _, effect: _ } => Present { value: QualificationSubjectNotACandidate } RouteGroundedByCitedSource { request: _, citation: _ } => Present { value: QualificationSubjectNotACandidate } RouteUngrounded => Present { value: QualificationSubjectNotACandidate } RouteQualificationCandidate { request: req, evidence: _ } => @@ -494,7 +519,7 @@ fn candidate_refusal_without_response(standing: BmcRotationRouteStanding, approv Present { value: refusal } => refusal Absent => QualificationRequestUnrealized } - RouteGroundedByExecutedRequest { request: _, request_receipt: _, response_receipt: _ } => QualificationSubjectNotACandidate + RouteGroundedByExecutedRequest { request: _, request_receipt: _, response_receipt: _, effect: _ } => QualificationSubjectNotACandidate RouteGroundedByCitedSource { request: _, citation: _ } => QualificationSubjectNotACandidate RouteUngrounded => QualificationSubjectNotACandidate } @@ -521,7 +546,7 @@ fn qualify_rotation_route( standing: BmcRotationRouteStanding { endpoint: standing.endpoint, firmware: standing.firmware, - grounding: RouteGroundedByExecutedRequest { request: r.subject.request, request_receipt: r.request_receipt, response_receipt: r.response_receipt }, + grounding: RouteGroundedByExecutedRequest { request: r.subject.request, request_receipt: r.request_receipt, response_receipt: r.response_receipt, effect: r.effect }, }, } } @@ -530,7 +555,7 @@ fn qualify_rotation_route( // THE MODELED VERDICT: what the same classifier says of a modeled run. No arm carries a standing. type ModeledRouteQualificationVerdict - = ModeledQualificationWouldQualify { subject: RouteQualificationSubject, request_receipt: EvidenceRef, response_receipt: EvidenceRef } + = ModeledQualificationWouldQualify { subject: RouteQualificationSubject, request_receipt: EvidenceRef, response_receipt: EvidenceRef, effect: RouteEffectStanding } | ModeledQualificationRefused { cause: RouteQualificationRefusal } fn classify_modeled_route_qualification( @@ -543,7 +568,7 @@ fn classify_modeled_route_qualification( Present { value: r } => match route_qualification_refusal(standing: standing, approval: approval, answered: r.subject, response_receipt: r.response_receipt, completed: r.completed, readback_accepted: r.readback_accepted) { Present { value: refusal } => ModeledQualificationRefused { cause: refusal } - Absent => ModeledQualificationWouldQualify { subject: r.subject, request_receipt: r.request_receipt, response_receipt: r.response_receipt } + Absent => ModeledQualificationWouldQualify { subject: r.subject, request_receipt: r.request_receipt, response_receipt: r.response_receipt, effect: r.effect } } } } @@ -599,7 +624,7 @@ fn admit_route_qualification_request( } } } - RouteGroundedByExecutedRequest { request: _, request_receipt: _, response_receipt: _ } => RouteQualificationRequestRefused { cause: QualificationRequestRefusedByClassifier { cause: QualificationSubjectNotACandidate } } + RouteGroundedByExecutedRequest { request: _, request_receipt: _, response_receipt: _, effect: _ } => RouteQualificationRequestRefused { cause: QualificationRequestRefusedByClassifier { cause: QualificationSubjectNotACandidate } } RouteGroundedByCitedSource { request: _, citation: _ } => RouteQualificationRequestRefused { cause: QualificationRequestRefusedByClassifier { cause: QualificationSubjectNotACandidate } } RouteUngrounded => RouteQualificationRequestRefused { cause: QualificationRequestRefusedByClassifier { cause: QualificationSubjectNotACandidate } } } @@ -608,7 +633,7 @@ fn admit_route_qualification_request( fn candidate_request(standing: BmcRotationRouteStanding) -> BmcAccountWriteRequest? { match standing.grounding { RouteQualificationCandidate { request: r, evidence: _ } => Present { value: r } - RouteGroundedByExecutedRequest { request: _, request_receipt: _, response_receipt: _ } => none + RouteGroundedByExecutedRequest { request: _, request_receipt: _, response_receipt: _, effect: _ } => none RouteGroundedByCitedSource { request: _, citation: _ } => none RouteUngrounded => none } @@ -673,6 +698,7 @@ type RotationApplyAdmission | RotationApplyRouteForAnotherController { route_endpoint: BmcControllerEndpoint, target_endpoint: BmcControllerEndpoint } | RotationApplyRouteForAnotherBuild { route_firmware: BmcFirmwareReleaseIdentity, target_firmware: BmcFirmwareReleaseIdentity } | RotationApplyRouteForAnotherOperation { grounded: BmcAccountWriteRequest, requested: BmcAccountWriteRequest } + | RotationApplyRouteEffectUnobserved { standing: BmcRotationRouteStanding } | RotationApplyApprovalRefused { cause: RedemptionRefusal } | RotationApplyApprovalDenied | RotationApplyApprovalForAnotherAuthority { authority: NonEmptyStr } @@ -775,9 +801,50 @@ fn request_channel(request: BmcAccountWriteRequest) -> Int { } } +fn lowering_request(request: BmcAccountWriteRequest) -> Bool { + match request { + IpmiSetUserPrivilegeLimit { access: x } => lowers_privilege(privilege: x.privilege) + IpmiSetUserPassword { user: _ } => false + RedfishAccountPasswordWrite { transport_operation: _, action_shape: _ } => false + } +} + +// A route whose grounding observed the operation take effect: an executed request with EffectObserved, +// or a source cited for this build (the citation states the operation's effect). An accept-only +// execution does not qualify. +fn route_effect_observed(standing: BmcRotationRouteStanding) -> Bool { + match standing.grounding { + RouteGroundedByExecutedRequest { request: _, request_receipt: _, response_receipt: _, effect: e } => + match e { EffectObserved => true AcceptedEffectUnobserved => false } + RouteGroundedByCitedSource { request: _, citation: _ } => true + RouteQualificationCandidate { request: _, evidence: _ } => false + RouteUngrounded => false + } +} + +// THE WITNESS'S EXECUTED-ROUTE FIXTURE: the only way to hold an executed grounding with a chosen effect +// standing while no live response mint exists. Admitted to the witness helper only. +fn rotation_route_executed_fixture( + endpoint: BmcControllerEndpoint, + firmware: BmcFirmwareReleaseIdentity, + request: BmcAccountWriteRequest, + receipt: EvidenceRef, + effect: RouteEffectStanding, +) -> BmcRotationRouteStanding + admit_callers: [ + decl_ref(module_path: "test.claim.machine_intake_bmc_rotation_route_witness_test", decl_name: "executed_route_at"), + ] +{ + BmcRotationRouteStanding { + endpoint: endpoint, + firmware: firmware, + grounding: RouteGroundedByExecutedRequest { request: request, request_receipt: receipt, response_receipt: receipt, effect: effect }, + } +} + fn grounded_request(standing: BmcRotationRouteStanding) -> BmcAccountWriteRequest? { match standing.grounding { - RouteGroundedByExecutedRequest { request: r, request_receipt: _, response_receipt: _ } => Present { value: r } + RouteGroundedByExecutedRequest { request: r, request_receipt: _, response_receipt: _, effect: _ } => Present { value: r } RouteGroundedByCitedSource { request: r, citation: _ } => Present { value: r } RouteQualificationCandidate { request: _, evidence: _ } => none RouteUngrounded => none @@ -801,6 +868,8 @@ fn admit_rotation_apply( RotationApplyRouteForAnotherBuild { route_firmware: standing.firmware, target_firmware: target_firmware } } else if !account_write_request_same_operation(a: grounded, b: request) { RotationApplyRouteForAnotherOperation { grounded: grounded, requested: request } + } else if lowering_request(request: request) && !route_effect_observed(standing: standing) { + RotationApplyRouteEffectUnobserved { standing: standing } } else { match approval { RedemptionRefused { cause: c } => RotationApplyApprovalRefused { cause: c } diff --git a/dag/gunbc/machine_intake/bmc_rotation_route_evidence.dag b/dag/gunbc/machine_intake/bmc_rotation_route_evidence.dag index 6776b10a1b0..f33f3d1e6e7 100644 --- a/dag/gunbc/machine_intake/bmc_rotation_route_evidence.dag +++ b/dag/gunbc/machine_intake/bmc_rotation_route_evidence.dag @@ -24,7 +24,7 @@ import extdeps.bmc.ipmi_channel { IpmiPrivilegeAdministrator, ipmi_user_channel_ import extdeps.ampere.mt_collins_firmware_release { mt_collins_bmc_0_45_3_hpm } import gunbc.machine_intake_bmc_rotation_route { BmcRotationRouteStanding, HistoricalRotationRouteObservation, IpmiSetUserPassword, IpmiSetUserPrivilegeLimit, ObservedSurfaceRead, - PublicStandardOperation, rotation_route_candidate, rotation_route_from_committed_execution, redfish_account_password_write, + PublicStandardOperation, EffectObserved, rotation_route_candidate, rotation_route_from_committed_execution, redfish_account_password_write, } // THE ROTATION ROUTE STANDING OF EACH CONTROLLER THIS FLEET HAS EVIDENCE FOR, derived from that @@ -36,7 +36,9 @@ import gunbc.machine_intake_bmc_rotation_route { // store round-trip, and the controller answered "Set User Password command successful"; step (d) // then authenticated as that user over IPMI and the web API at the same address. The request and // its response are both recorded in that one transcript, so both receipts name it: the transcript -// is the request receipt and the response receipt, at its committed digest. It is consumed for the +// is the request receipt and the response receipt, at its committed digest. THE EFFECT WAS OBSERVED: +// the value set was a newly minted secret the account did not hold before (steps b and c), and step (d) +// then authenticated with it over IPMI and the web API, so the before and after readings differ. It is consumed for the // same rotation by gunbc.machine_intake_mtcollins1_bmc_secure_observation as RotationApplied. fn mtcollins1_rotation_route_standing() -> BmcRotationRouteStanding { rotation_route_from_committed_execution( @@ -45,6 +47,7 @@ fn mtcollins1_rotation_route_standing() -> BmcRotationRouteStanding { request: IpmiSetUserPassword { user: 3 }, request_receipt: mtcollins1_user3_route_evidence, response_receipt: mtcollins1_user3_route_evidence, + effect: EffectObserved, ) } diff --git a/dag/test/claim/machine_intake/machine_intake_bmc_rotation_route_forged_probe_witness_test.dag b/dag/test/claim/machine_intake/machine_intake_bmc_rotation_route_forged_probe_witness_test.dag index d4e8a6e53c5..757a64a1adc 100644 --- a/dag/test/claim/machine_intake/machine_intake_bmc_rotation_route_forged_probe_witness_test.dag +++ b/dag/test/claim/machine_intake/machine_intake_bmc_rotation_route_forged_probe_witness_test.dag @@ -15,7 +15,7 @@ data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly // source to the compiler through the diagnostic-census harness and requires the refusal CLASS at each // SUBJECT by name, so a probe refusing for any other reason measures another wall; the class-scoped // control shows a clean source reading the same module through its real producer emits neither class. -data forged_probe_source: String = "module probe_rotation_route_forged\n\nimport std.types { Bool, NonEmptyStr }\nimport std.content_hash { content_hash_of_value }\nimport extdeps.uri { uri_https }\nimport extdeps.external_authority { ExternalAuthority }\nimport gunbc.machine_intake_receipt { EvidenceRef }\nimport gunbc.machine_intake_mtcollins1_access_observation { mtcollins1_endpoint, mtcollins1_firmware }\nimport gunbc.machine_intake_mtcollins1_bmc_secure_observation { mtcollins1_user3_route_evidence }\nimport gunbc.machine_intake_bmc_rotation_route {\n BmcRotationRouteStanding, RouteQualificationLiveResponse, ModeledRouteQualificationResponse, RouteQualificationSubject, IpmiSetUserPassword, RouteGroundedByExecutedRequest,\n rotation_route_from_committed_execution, rotation_route_from_citation,\n ManagedAdministratorReadback, managed_administrator_readback_fixture, AdmittedRouteQualificationRequest,\n}\nimport std.scoped_authorization { AttemptIdentity }\n\nfn forged_grounded_standing() -> BmcRotationRouteStanding {\n BmcRotationRouteStanding {\n endpoint: mtcollins1_endpoint,\n firmware: mtcollins1_firmware,\n grounding: RouteGroundedByExecutedRequest { request: IpmiSetUserPassword { user: 3 }, request_receipt: mtcollins1_user3_route_evidence, response_receipt: mtcollins1_user3_route_evidence },\n }\n}\n\nfn forged_subject() -> RouteQualificationSubject {\n RouteQualificationSubject { endpoint: mtcollins1_endpoint, firmware: mtcollins1_firmware, request: IpmiSetUserPassword { user: 3 } }\n}\n\nfn forged_modeled_response() -> ModeledRouteQualificationResponse {\n ModeledRouteQualificationResponse {\n subject: forged_subject(),\n request_receipt: mtcollins1_user3_route_evidence,\n response_receipt: mtcollins1_user3_route_evidence,\n completed: true,\n readback_accepted: true,\n }\n}\n\nfn forged_response() -> RouteQualificationLiveResponse {\n RouteQualificationLiveResponse {\n subject: forged_subject(),\n request_receipt: mtcollins1_user3_route_evidence,\n response_receipt: mtcollins1_user3_route_evidence,\n completed: true,\n readback_accepted: true,\n }\n}\n\nfn forged_committed_execution() -> BmcRotationRouteStanding {\n rotation_route_from_committed_execution(\n endpoint: mtcollins1_endpoint,\n firmware: mtcollins1_firmware,\n request: IpmiSetUserPassword { user: 3 },\n request_receipt: mtcollins1_user3_route_evidence,\n response_receipt: mtcollins1_user3_route_evidence,\n )\n}\n\nfn forged_citation() -> BmcRotationRouteStanding {\n rotation_route_from_citation(\n endpoint: mtcollins1_endpoint,\n firmware: mtcollins1_firmware,\n request: IpmiSetUserPassword { user: 3 },\n citation: ExternalAuthority { uri: uri_https(locator: \"example.invalid/forged\") },\n )\n}\n\nfn forged_admitted_request() -> AdmittedRouteQualificationRequest {\n AdmittedRouteQualificationRequest { subject: forged_subject(), attempt: \"attempt-1\" as AttemptIdentity, decided_by: \"forger\" }\n}\n\nfn forged_readback() -> ManagedAdministratorReadback {\n ManagedAdministratorReadback { endpoint: mtcollins1_endpoint, firmware: mtcollins1_firmware, attempt: \"attempt-1\" as AttemptIdentity, managed_user: 3, access: [] }\n}\n\nfn forged_readback_through_the_fixture() -> ManagedAdministratorReadback {\n managed_administrator_readback_fixture(endpoint: mtcollins1_endpoint, firmware: mtcollins1_firmware, attempt: \"attempt-1\" as AttemptIdentity, managed_user: 3, access: [])\n}\n" +data forged_probe_source: String = "module probe_rotation_route_forged\n\nimport std.types { Bool, NonEmptyStr }\nimport std.content_hash { content_hash_of_value }\nimport extdeps.uri { uri_https }\nimport extdeps.external_authority { ExternalAuthority }\nimport gunbc.machine_intake_receipt { EvidenceRef }\nimport gunbc.machine_intake_mtcollins1_access_observation { mtcollins1_endpoint, mtcollins1_firmware }\nimport gunbc.machine_intake_mtcollins1_bmc_secure_observation { mtcollins1_user3_route_evidence }\nimport gunbc.machine_intake_bmc_rotation_route {\n BmcRotationRouteStanding, RouteQualificationLiveResponse, ModeledRouteQualificationResponse, RouteQualificationSubject, IpmiSetUserPassword, RouteGroundedByExecutedRequest, EffectObserved,\n rotation_route_from_committed_execution, rotation_route_from_citation, rotation_route_executed_fixture,\n ManagedAdministratorReadback, managed_administrator_readback_fixture, AdmittedRouteQualificationRequest,\n}\nimport std.scoped_authorization { AttemptIdentity }\n\nfn forged_grounded_standing() -> BmcRotationRouteStanding {\n BmcRotationRouteStanding {\n endpoint: mtcollins1_endpoint,\n firmware: mtcollins1_firmware,\n grounding: RouteGroundedByExecutedRequest { request: IpmiSetUserPassword { user: 3 }, request_receipt: mtcollins1_user3_route_evidence, response_receipt: mtcollins1_user3_route_evidence, effect: EffectObserved },\n }\n}\n\nfn forged_subject() -> RouteQualificationSubject {\n RouteQualificationSubject { endpoint: mtcollins1_endpoint, firmware: mtcollins1_firmware, request: IpmiSetUserPassword { user: 3 } }\n}\n\nfn forged_modeled_response() -> ModeledRouteQualificationResponse {\n ModeledRouteQualificationResponse {\n subject: forged_subject(),\n request_receipt: mtcollins1_user3_route_evidence,\n response_receipt: mtcollins1_user3_route_evidence,\n completed: true,\n readback_accepted: true,\n effect: EffectObserved,\n }\n}\n\nfn forged_response() -> RouteQualificationLiveResponse {\n RouteQualificationLiveResponse {\n subject: forged_subject(),\n request_receipt: mtcollins1_user3_route_evidence,\n response_receipt: mtcollins1_user3_route_evidence,\n completed: true,\n readback_accepted: true,\n effect: EffectObserved,\n }\n}\n\nfn forged_committed_execution() -> BmcRotationRouteStanding {\n rotation_route_from_committed_execution(\n endpoint: mtcollins1_endpoint,\n firmware: mtcollins1_firmware,\n request: IpmiSetUserPassword { user: 3 },\n request_receipt: mtcollins1_user3_route_evidence,\n response_receipt: mtcollins1_user3_route_evidence,\n effect: EffectObserved,\n )\n}\n\nfn forged_citation() -> BmcRotationRouteStanding {\n rotation_route_from_citation(\n endpoint: mtcollins1_endpoint,\n firmware: mtcollins1_firmware,\n request: IpmiSetUserPassword { user: 3 },\n citation: ExternalAuthority { uri: uri_https(locator: \"example.invalid/forged\") },\n )\n}\n\nfn forged_executed_fixture() -> BmcRotationRouteStanding {\n rotation_route_executed_fixture(endpoint: mtcollins1_endpoint, firmware: mtcollins1_firmware, request: IpmiSetUserPassword { user: 3 }, receipt: mtcollins1_user3_route_evidence, effect: EffectObserved)\n}\n\nfn forged_admitted_request() -> AdmittedRouteQualificationRequest {\n AdmittedRouteQualificationRequest { subject: forged_subject(), attempt: \"attempt-1\" as AttemptIdentity, decided_by: \"forger\" }\n}\n\nfn forged_readback() -> ManagedAdministratorReadback {\n ManagedAdministratorReadback { endpoint: mtcollins1_endpoint, firmware: mtcollins1_firmware, attempt: \"attempt-1\" as AttemptIdentity, managed_user: 3, access: [] }\n}\n\nfn forged_readback_through_the_fixture() -> ManagedAdministratorReadback {\n managed_administrator_readback_fixture(endpoint: mtcollins1_endpoint, firmware: mtcollins1_firmware, attempt: \"attempt-1\" as AttemptIdentity, managed_user: 3, access: [])\n}\n" data harness_control_source: String = "module probe_rotation_route_harness_control\nimport gunbc.machine_intake_bmc_rotation_route { BmcRotationRouteStanding }\nimport gunbc.machine_intake_bmc_rotation_route_evidence { mtcollins1_rotation_route_standing }\nfn standing() -> BmcRotationRouteStanding { mtcollins1_rotation_route_standing() }\n" @@ -64,4 +64,5 @@ test fn the_grounding_mints_refuse_an_outside_caller() -> Bool { blocking_count_for_class_and_subject(c: c, wanted: "ConstructorCallAdmissionRefused", subject: "rotation_route_from_committed_execution") >= 1 && blocking_count_for_class_and_subject(c: c, wanted: "ConstructorCallAdmissionRefused", subject: "rotation_route_from_citation") >= 1 && blocking_count_for_class_and_subject(c: c, wanted: "ConstructorCallAdmissionRefused", subject: "managed_administrator_readback_fixture") >= 1 + && blocking_count_for_class_and_subject(c: c, wanted: "ConstructorCallAdmissionRefused", subject: "rotation_route_executed_fixture") >= 1 } diff --git a/dag/test/claim/machine_intake/machine_intake_bmc_rotation_route_witness_test.dag b/dag/test/claim/machine_intake/machine_intake_bmc_rotation_route_witness_test.dag index f5516c70594..3d1dd0920da 100644 --- a/dag/test/claim/machine_intake/machine_intake_bmc_rotation_route_witness_test.dag +++ b/dag/test/claim/machine_intake/machine_intake_bmc_rotation_route_witness_test.dag @@ -17,7 +17,7 @@ import gunbc.auth.approval_capability { ApprovalCapabilityClaims, ProposeApprove import gunbc.auth.approval_broker { Redemption, RedemptionAdmitted } import gunbc.auth.authorization_pattern_selection { OperatorApprovedCapability, PatternSelected, select_authorization_pattern } import gunbc.auth.privileged_effect_census { Conforms, privileged_effect_census, site_verdict } -import gunbc.bmc_model { BmcWorld, BmcIpmiUser, BmcPowerOn, bmc_world, bmc_with_ipmi_users, bmc_ipmi_user_accepts, bmc_ipmi_get_user_access } +import gunbc.bmc_model { BmcWorld, BmcIpmiUser, BmcPowerOn, bmc_world, bmc_with_ipmi_users, bmc_ipmi_user_accepts, bmc_ipmi_get_user_access, bmc_ipmi_set_user_access } import extdeps.bmc.ipmi_channel { IpmiChannelPrivilegeLimit, IpmiPrivilegeNoAccess, IpmiPrivilegeAdministrator, IpmiPrivilegeUser, ipmi_user_channel_access } import gunbc.machine_intake_mtcollins1_access_observation { mtcollins1_endpoint, mtcollins1_firmware } import gunbc.machine_intake_mtcollins1_bmc_secure_observation { mtcollins1_user3_route_digest } @@ -34,7 +34,8 @@ import gunbc.machine_intake_bmc_rotation_route { QualificationResponseForAnotherSubject, QualificationRequestUnrealized, QualificationRequestNotCompleted, QualificationReadbackRefused, RotationApplyAdmitted, RotationApplyRouteNotGrounded, RotationApplyRouteForAnotherController, - RotationApplyRouteForAnotherBuild, RotationApplyRouteForAnotherOperation, RotationApplyApprovalRefused, RotationApplyApprovalDenied, + RotationApplyRouteForAnotherBuild, RotationApplyRouteForAnotherOperation, RotationApplyRouteEffectUnobserved, RotationApplyApprovalRefused, + EffectObserved, AcceptedEffectUnobserved, RouteEffectStanding, rotation_route_executed_fixture, RotationApplyApprovalDenied, RotationApplyApprovalForAnotherAuthority, RotationApplyApprovalForAnotherRequest, RotationApplyWouldLeaveNoAdministrator, ManagedAdministratorReadback, managed_administrator_readback_fixture, ManagedReadbackAbsent, ManagedReadbackFromAnotherController, ManagedReadbackFromAnotherBuild, ManagedReadbackFromAnotherRun, ManagedAccountIsTheClosedAccount, ManagedAccountNotAdministratorOnChannel, ManagedReadbackDuplicateRow, RouteQualificationRequestAdmitted, RouteQualificationRequestRefused, QualificationRequestForAnotherOperation, @@ -77,7 +78,7 @@ fn approval(authority: NonEmptyStr, revision: NonEmptyStr) -> Redemption { fn standing_request(s: BmcRotationRouteStanding) -> BmcAccountWriteRequest { match s.grounding { - RouteGroundedByExecutedRequest { request: r, request_receipt: _, response_receipt: _ } => r + RouteGroundedByExecutedRequest { request: r, request_receipt: _, response_receipt: _, effect: _ } => r RouteGroundedByCitedSource { request: r, citation: _ } => r RouteQualificationCandidate { request: r, evidence: _ } => r RouteUngrounded => IpmiSetUserPassword { user: 3 } @@ -146,7 +147,7 @@ fn refusal_name(c: RouteQualificationRefusal) -> String { // The modeled verdict for a candidate, an approval and a modeled run against `answered`. fn modeled_verdict(candidate: BmcRotationRouteStanding, approval_value: Redemption, world: BmcWorld, answered: RouteQualificationSubject) -> String { match classify_modeled_route_qualification(standing: candidate, approval: approval_value, response: dry_route_qualification_request(world: world, subject: answered, password: "new-Secret!1").response) { - ModeledQualificationWouldQualify { subject: _, request_receipt: _, response_receipt: _ } => "would-qualify" + ModeledQualificationWouldQualify { subject: _, request_receipt: _, response_receipt: _, effect: _ } => "would-qualify" ModeledQualificationRefused { cause: c } => refusal_name(c: c) } } @@ -166,6 +167,7 @@ fn apply_verdict_for(standing: BmcRotationRouteStanding, target: BmcControllerEn RotationApplyRouteForAnotherController { route_endpoint: _, target_endpoint: _ } => "another-controller" RotationApplyRouteForAnotherBuild { route_firmware: _, target_firmware: _ } => "another-build" RotationApplyRouteForAnotherOperation { grounded: _, requested: _ } => "another-operation" + RotationApplyRouteEffectUnobserved { standing: _ } => "effect-unobserved" RotationApplyApprovalRefused { cause: _ } => "approval-refused" RotationApplyApprovalDenied => "approval-denied" RotationApplyApprovalForAnotherAuthority { authority: _ } => "another-authority" @@ -176,7 +178,7 @@ fn apply_verdict_for(standing: BmcRotationRouteStanding, target: BmcControllerEn fn grounding_kind(standing: BmcRotationRouteStanding) -> String { match standing.grounding { - RouteGroundedByExecutedRequest { request: _, request_receipt: _, response_receipt: _ } => "executed" + RouteGroundedByExecutedRequest { request: _, request_receipt: _, response_receipt: _, effect: _ } => "executed" RouteGroundedByCitedSource { request: _, citation: _ } => "cited" RouteQualificationCandidate { request: _, evidence: _ } => "candidate" RouteUngrounded => "ungrounded" @@ -198,7 +200,7 @@ test fn mtcollins1_is_grounded_by_its_executed_ipmi_request() -> Bool { (s.endpoint.host as String) == "192.168.1.228" && (s.firmware.raw_version as String) == "0.32" && match s.grounding { - RouteGroundedByExecutedRequest { request: r, request_receipt: q, response_receipt: p } => + RouteGroundedByExecutedRequest { request: r, request_receipt: q, response_receipt: p, effect: _ } => match r { IpmiSetUserPassword { user: u } => (u as Int) == 3 IpmiSetUserPrivilegeLimit { access: _ } => false @@ -348,7 +350,7 @@ test fn requests_differing_only_in_transport_or_action_shape_are_different_reque fn classify_names(candidate: BmcRotationRouteStanding, approval_value: Redemption) -> String { match classify_modeled_route_qualification(standing: candidate, approval: approval_value, response: none) { - ModeledQualificationWouldQualify { subject: _, request_receipt: _, response_receipt: _ } => "would-qualify" + ModeledQualificationWouldQualify { subject: _, request_receipt: _, response_receipt: _, effect: _ } => "would-qualify" ModeledQualificationRefused { cause: c } => refusal_name(c: c) } } @@ -467,7 +469,7 @@ test fn mtcollins1_channel_access_route_is_an_ungrounded_candidate_on_its_curren RouteQualificationCandidate { request: r, evidence: e } => account_write_request_eq(a: r, b: access_write(user: 3, channel: 1, privilege: IpmiPrivilegeAdministrator)) && match e { PublicStandardOperation { authority: _ } => true ObservedSurfaceRead { surface: _, receipt: _ } => false } - RouteGroundedByExecutedRequest { request: _, request_receipt: _, response_receipt: _ } => false + RouteGroundedByExecutedRequest { request: _, request_receipt: _, response_receipt: _, effect: _ } => false RouteGroundedByCitedSource { request: _, citation: _ } => false RouteUngrounded => false } @@ -630,3 +632,56 @@ test fn the_prewrite_admission_admits_only_with_the_same_run_receipt() -> Bool { && prewrite_verdict(a: admit_privilege_limit_route_qualification(standing: c, approval: exact, readback: readback_at(endpoint: lab_endpoint_b, firmware: lab_firmware(), attempt: "attempt-1" as NonEmptyStr, managed_user: 3, access: admin_on_1))) == "retention-refused" && prewrite_verdict(a: admit_privilege_limit_route_qualification(standing: c, approval: rotation_approval_for(s: c), readback: readback_at(endpoint: lab_endpoint, firmware: lab_firmware(), attempt: "attempt-1" as NonEmptyStr, managed_user: 3, access: admin_on_1))) == "another-authority" } + +// ── WHAT A QUALIFICATION GROUNDS: acceptance, and effect only when the run could tell ─────────────── + +// The witness's one way to hold an executed grounding with a chosen effect standing. +fn executed_route_at(request: BmcAccountWriteRequest, effect: RouteEffectStanding) -> BmcRotationRouteStanding { + rotation_route_executed_fixture(endpoint: lab_endpoint, firmware: lab_firmware(), request: request, receipt: lab_surface_receipt, effect: effect) +} + +fn modeled_effect(candidate: BmcRotationRouteStanding, world: BmcWorld, request: BmcAccountWriteRequest) -> String { + match classify_modeled_route_qualification(standing: candidate, approval: qualification_approval_for(standing: candidate, request: request), response: dry_route_qualification_request(world: world, subject: subject_at(endpoint: lab_endpoint, request: request), password: "unused").response) { + ModeledQualificationWouldQualify { subject: _, request_receipt: _, response_receipt: _, effect: e } => match e { EffectObserved => "observed" AcceptedEffectUnobserved => "accepted-only" } + ModeledQualificationRefused { cause: _ } => "refused" + } +} + +fn world_with_user3_admin_on_1() -> BmcWorld { + bmc_ipmi_set_user_access(world: lab_world_with_user3(), access: ipmi_user_channel_access(channel: 1, user: 3, privilege: IpmiPrivilegeAdministrator)).world +} + +// THE IDEMPOTENT QUALIFYING REQUEST GROUNDS ACCEPTANCE ONLY. Re-asserting a value already present reads +// back identically whether applied or ignored: the modeled run reports accepted-only. The same request +// against a world where the value differed beforehand reports the effect observed. +test fn an_idempotent_qualifying_write_grounds_acceptance_only() -> Bool { + let request = access_write(user: 3, channel: 1, privilege: IpmiPrivilegeAdministrator) + let c = lab_candidate(request: request) + modeled_effect(candidate: c, world: world_with_user3_admin_on_1(), request: request) == "accepted-only" + && modeled_effect(candidate: c, world: lab_world_with_user3(), request: request) == "observed" +} + +// AN ACCEPT-ONLY GROUNDING DOES NOT ADMIT THE CLOSING WRITE. A grounded privilege-limit route whose +// effect was unobserved, with an exact approval of closing user 2 on channel 2 and a valid same-run +// managed-administrator readback, refuses as effect-unobserved; the same with EffectObserved is admitted. +fn closing_verdict(effect: RouteEffectStanding) -> String { + let route = executed_route_at(request: access_write(user: 3, channel: 1, privilege: IpmiPrivilegeAdministrator), effect: effect) + let close = access_write(user: 2, channel: 2, privilege: IpmiPrivilegeNoAccess) + match admit_rotation_apply( + standing: route, + target_endpoint: lab_endpoint, + target_firmware: lab_firmware(), + request: close, + managed_readback: readback_at(endpoint: lab_endpoint, firmware: lab_firmware(), attempt: "attempt-1" as NonEmptyStr, managed_user: 3, access: [ipmi_user_channel_access(channel: 2, user: 3, privilege: IpmiPrivilegeAdministrator)]), + approval: approval(authority: rotation_apply_authority, revision: rotation_route_request_identity(standing: route, request: close)), + ) { + RotationApplyAdmitted { standing: _, request: _, decided_by: _ } => "admitted" + RotationApplyRouteEffectUnobserved { standing: _ } => "effect-unobserved" + _ => "other-refusal" + } +} + +test fn an_accept_only_grounding_does_not_admit_the_closing_write() -> Bool { + closing_verdict(effect: AcceptedEffectUnobserved) == "effect-unobserved" + && closing_verdict(effect: EffectObserved) == "admitted" +} From 4fe9f69e46e859d3257d07296445271f9524c129 Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Mon, 5 Oct 2026 00:10:49 +0000 Subject: [PATCH 12/22] O1a-2 side-chat review of 6d277411fd: no carrier-returning facades; idempotent qualification must re-assert the managed account's own current value; full live frontiers Co-Authored-By: Claude Opus 5.5 (1M context) --- .../machine_intake/bmc_rotation_route.dag | 56 ++++++++++++++-- ...intake_bmc_rotation_route_witness_test.dag | 66 +++++++++++-------- 2 files changed, 86 insertions(+), 36 deletions(-) diff --git a/dag/gunbc/machine_intake/bmc_rotation_route.dag b/dag/gunbc/machine_intake/bmc_rotation_route.dag index 309a4f3f06c..2698b3c2647 100644 --- a/dag/gunbc/machine_intake/bmc_rotation_route.dag +++ b/dag/gunbc/machine_intake/bmc_rotation_route.dag @@ -611,7 +611,7 @@ fn admit_route_qualification_request( match approval { RedemptionRefused { cause: c } => RouteQualificationRequestRefused { cause: QualificationRequestRefusedByClassifier { cause: QualificationApprovalRefused { cause: c } } } RedemptionAdmitted { claims: cl, decided_by: by } => - match administrator_retention_refusal(standing: standing, request: req, readback: readback, approved_attempt: cl.attempt) { + match qualification_retention_refusal(standing: standing, request: req, readback: readback, approved_attempt: cl.attempt) { Present { value: c } => RouteQualificationRequestRefused { cause: QualificationRequestWouldLeaveNoAdministrator { cause: c } } Absent => RouteQualificationRequestAdmitted { @@ -630,6 +630,39 @@ fn admit_route_qualification_request( } } +// AT THE QUALIFICATION BOUNDARY a privilege-limit request that does not lower anything is admitted +// only as an IDEMPOTENT RE-ASSERTION OF THE MANAGED ACCOUNT'S OWN CURRENT VALUE: the request's target user +// IS the readback's managed account, and that account's unique row for the target channel already holds +// exactly the requested limit. So a managed id that changed after the reflash, or a target that does not +// already hold the value, issues no request at all, rather than granting a privilege. A lowering request +// at qualification is an effectful act and passes the ordinary retention precondition. +fn qualification_retention_refusal(standing: BmcRotationRouteStanding, request: BmcAccountWriteRequest, readback: ManagedAdministratorReadback?, approved_attempt: AttemptIdentity) -> AdministratorRetentionRefusal? { + match administrator_retention_refusal(standing: standing, request: request, readback: readback, approved_attempt: approved_attempt) { + Present { value: c } => Present { value: c } + Absent => + match request { + IpmiSetUserPrivilegeLimit { access: x } => + if lowers_privilege(privilege: x.privilege) { + none + } else { + match readback { + Absent => Present { value: ManagedReadbackAbsent } + Present { value: r } => + if (r.managed_user as Int) != (x.user as Int) { + Present { value: QualificationTargetIsNotTheManagedAccount { target: x.user, managed_user: r.managed_user } } + } else if any(r.access, a => (a.user as Int) == (x.user as Int) && (a.channel as Int) == (x.channel as Int) && ipmi_privilege_eq(a: a.privilege, b: x.privilege)) { + none + } else { + Present { value: QualificationTargetDoesNotAlreadyHoldTheLimit { target: x.user } } + } + } + } + IpmiSetUserPassword { user: _ } => none + RedfishAccountPasswordWrite { transport_operation: _, action_shape: _ } => none + } + } +} + fn candidate_request(standing: BmcRotationRouteStanding) -> BmcAccountWriteRequest? { match standing.grounding { RouteQualificationCandidate { request: r, evidence: _ } => Present { value: r } @@ -678,7 +711,7 @@ fn admit_privilege_limit_route_qualification( } data route_qualification_live_frontier: DissolutionCondition = unbound_dissolution( - description: "dissolves when a live realization of the route-qualification request mints RouteQualificationLiveResponse in this module from a transport call against the controller made ONLY from an AdmittedRouteQualificationRequest (admit_password_route_qualification or admit_privilege_limit_route_qualification, so every pre-write guard including the same-run administrator-retention receipt has held) and, for a privilege-limit request, issued in the privilege-limit-only mode of Set User Access, bound to the exact RouteQualificationSubject it was made against, under that controller's own operator go-ahead redeemed through gunbc.auth.approval_broker, with request and response bytes committed as content-addressed evidence, and qualify_rotation_route is called with it; until then RouteQualificationLiveResponse has no mint and no candidate can be grounded by qualification. NOT satisfied by the dry realization over gunbc.bmc_model BmcWorld (its ModeledRouteQualificationResponse cannot construct a standing), by a workflow entry that has not executed, or by a receipt that names no controller and build" as NonEmptyStr, + description: "dissolves when a live realization of the route-qualification request mints RouteQualificationLiveResponse in this module from a transport call against the controller made ONLY from an AdmittedRouteQualificationRequest whose pre-write receipt satisfied managed_administrator_readback_live_frontier in full (goal-bound account authentication and subject binding, unique channel/user evidence, pre-write ordering) (admit_password_route_qualification or admit_privilege_limit_route_qualification, so every pre-write guard including the same-run administrator-retention receipt has held) and, for a privilege-limit request, issued in the privilege-limit-only mode of Set User Access, bound to the exact RouteQualificationSubject it was made against, with its effect standing computed from an ESTABLISHED pre-write reading of the target that DIFFERS from the requested value and a post-write readback that MATCHES it (EffectObserved), and AcceptedEffectUnobserved otherwise -- a missing or unread pre-state is never evidence of a difference, under that controller's own operator go-ahead redeemed through gunbc.auth.approval_broker, with request and response bytes committed as content-addressed evidence, and qualify_rotation_route is called with it; until then RouteQualificationLiveResponse has no mint and no candidate can be grounded by qualification. NOT satisfied by the dry realization over gunbc.bmc_model BmcWorld (its ModeledRouteQualificationResponse cannot construct a standing), by a workflow entry that has not executed, or by a receipt that names no controller and build" as NonEmptyStr, ) // ── THE ORDINARY ROTATION APPLY CONSUMES ONLY A GROUNDED ROUTE ────────────────────────────────── @@ -716,7 +749,8 @@ type RotationApplyAdmission // production mint is the Get User Access read performed in the run against the controller, which does // not exist in this cut (managed_administrator_readback_live_frontier): until it lands, no production // caller can satisfy the precondition, and every privilege-lowering write refuses. The one other mint -// is admitted only to this module's witness, which needs readbacks to exercise every refusal arm. +// is admitted only to the exact witness claims that consume the readback they mint and return a Bool, +// so no admitted caller hands a readback to anyone else. type ManagedAdministratorReadback sole_constructor { endpoint: BmcControllerEndpoint firmware: BmcFirmwareReleaseIdentity @@ -733,14 +767,19 @@ fn managed_administrator_readback_fixture( access: List, ) -> ManagedAdministratorReadback admit_callers: [ - decl_ref(module_path: "test.claim.machine_intake_bmc_rotation_route_witness_test", decl_name: "readback_at"), + decl_ref(module_path: "test.claim.machine_intake_bmc_rotation_route_witness_test", decl_name: "a_channel_access_write_that_could_lock_out_every_administrator_is_unplannable"), + decl_ref(module_path: "test.claim.machine_intake_bmc_rotation_route_witness_test", decl_name: "a_readback_from_another_controller_or_build_does_not_unlock_a_close"), + decl_ref(module_path: "test.claim.machine_intake_bmc_rotation_route_witness_test", decl_name: "a_duplicated_managed_readback_row_refuses"), + decl_ref(module_path: "test.claim.machine_intake_bmc_rotation_route_witness_test", decl_name: "the_prewrite_admission_admits_only_with_the_same_run_receipt"), + decl_ref(module_path: "test.claim.machine_intake_bmc_rotation_route_witness_test", decl_name: "an_accept_only_grounding_does_not_admit_the_closing_write"), + decl_ref(module_path: "test.claim.machine_intake_bmc_rotation_route_witness_test", decl_name: "the_idempotent_qualification_requires_the_target_pair_to_already_hold_the_value"), ] { ManagedAdministratorReadback { endpoint: endpoint, firmware: firmware, attempt: attempt, managed_user: managed_user, access: access } } data managed_administrator_readback_live_frontier: DissolutionCondition = unbound_dissolution( - description: "dissolves when a live Get User Access read of the managed account, performed in the same run against the controller, mints ManagedAdministratorReadback in this module bound to that controller's endpoint, its observed firmware build and the run's attempt, with the response bytes committed as content-addressed evidence; until then no production caller can satisfy the administrator-retention precondition and every privilege-lowering channel-access write refuses. NOT satisfied by the witness fixture mint, by a readback read in another run, or by a readback of another controller or build" as NonEmptyStr, + description: "dissolves when ManagedAdministratorReadback is minted in this module ONLY from a live read in the same run, against the controller, that establishes ALL of: (1) successful authentication of the GOAL-BOUND managed account (the account the BmcSecure goal names, bound to the machine/intake subject), so the reading is that account's and not a cached or supplied row; (2) the endpoint and the firmware build observed in that run, and the run's attempt; (3) a Get User Access result for every (channel, user) pair it carries, unique per pair, with the response bytes committed as content-addressed evidence; (4) an observer-clock time ordered BEFORE the write the readback admits. Missing, unreadable, duplicated or conflicting, stale, other-controller, other-build or other-account readings refuse. Until then no production caller can satisfy the administrator-retention precondition and every privilege-limit write refuses. NOT satisfied by the witness fixture, by a reading from another run, by a cached access row, or by a reading timed after the write" as NonEmptyStr, ) type AdministratorRetentionRefusal @@ -751,6 +790,8 @@ type AdministratorRetentionRefusal | ManagedAccountIsTheClosedAccount { user: IpmiUserId } | ManagedAccountNotAdministratorOnChannel { managed_user: IpmiUserId } | ManagedReadbackDuplicateRow { managed_user: IpmiUserId, count: Int } + | QualificationTargetIsNotTheManagedAccount { target: IpmiUserId, managed_user: IpmiUserId } + | QualificationTargetDoesNotAlreadyHoldTheLimit { target: IpmiUserId } fn lowers_privilege(privilege: IpmiChannelPrivilegeLimit) -> Bool { match privilege { @@ -823,7 +864,8 @@ fn route_effect_observed(standing: BmcRotationRouteStanding) -> Bool { } // THE WITNESS'S EXECUTED-ROUTE FIXTURE: the only way to hold an executed grounding with a chosen effect -// standing while no live response mint exists. Admitted to the witness helper only. +// standing while no live response mint exists. Admitted only to the one claim that consumes it and +// returns a Bool. fn rotation_route_executed_fixture( endpoint: BmcControllerEndpoint, firmware: BmcFirmwareReleaseIdentity, @@ -832,7 +874,7 @@ fn rotation_route_executed_fixture( effect: RouteEffectStanding, ) -> BmcRotationRouteStanding admit_callers: [ - decl_ref(module_path: "test.claim.machine_intake_bmc_rotation_route_witness_test", decl_name: "executed_route_at"), + decl_ref(module_path: "test.claim.machine_intake_bmc_rotation_route_witness_test", decl_name: "an_accept_only_grounding_does_not_admit_the_closing_write"), ] { BmcRotationRouteStanding { diff --git a/dag/test/claim/machine_intake/machine_intake_bmc_rotation_route_witness_test.dag b/dag/test/claim/machine_intake/machine_intake_bmc_rotation_route_witness_test.dag index 3d1dd0920da..ae1b7fdb258 100644 --- a/dag/test/claim/machine_intake/machine_intake_bmc_rotation_route_witness_test.dag +++ b/dag/test/claim/machine_intake/machine_intake_bmc_rotation_route_witness_test.dag @@ -18,7 +18,7 @@ import gunbc.auth.approval_broker { Redemption, RedemptionAdmitted } import gunbc.auth.authorization_pattern_selection { OperatorApprovedCapability, PatternSelected, select_authorization_pattern } import gunbc.auth.privileged_effect_census { Conforms, privileged_effect_census, site_verdict } import gunbc.bmc_model { BmcWorld, BmcIpmiUser, BmcPowerOn, bmc_world, bmc_with_ipmi_users, bmc_ipmi_user_accepts, bmc_ipmi_get_user_access, bmc_ipmi_set_user_access } -import extdeps.bmc.ipmi_channel { IpmiChannelPrivilegeLimit, IpmiPrivilegeNoAccess, IpmiPrivilegeAdministrator, IpmiPrivilegeUser, ipmi_user_channel_access } +import extdeps.bmc.ipmi_channel { IpmiChannelPrivilegeLimit, IpmiPrivilegeNoAccess, IpmiPrivilegeAdministrator, IpmiPrivilegeOperator, IpmiPrivilegeUser, IpmiUserChannelAccess, ipmi_user_channel_access } import gunbc.machine_intake_mtcollins1_access_observation { mtcollins1_endpoint, mtcollins1_firmware } import gunbc.machine_intake_mtcollins1_bmc_secure_observation { mtcollins1_user3_route_digest } import gunbc.machine_intake_mtjade1_access_observation { read_mtjade1_recorded_manager_identity } @@ -37,7 +37,7 @@ import gunbc.machine_intake_bmc_rotation_route { RotationApplyRouteForAnotherBuild, RotationApplyRouteForAnotherOperation, RotationApplyRouteEffectUnobserved, RotationApplyApprovalRefused, EffectObserved, AcceptedEffectUnobserved, RouteEffectStanding, rotation_route_executed_fixture, RotationApplyApprovalDenied, RotationApplyApprovalForAnotherAuthority, RotationApplyApprovalForAnotherRequest, RotationApplyWouldLeaveNoAdministrator, - ManagedAdministratorReadback, managed_administrator_readback_fixture, ManagedReadbackAbsent, ManagedReadbackFromAnotherController, ManagedReadbackFromAnotherBuild, ManagedReadbackFromAnotherRun, ManagedAccountIsTheClosedAccount, ManagedAccountNotAdministratorOnChannel, ManagedReadbackDuplicateRow, + ManagedAdministratorReadback, managed_administrator_readback_fixture, ManagedReadbackAbsent, ManagedReadbackFromAnotherController, ManagedReadbackFromAnotherBuild, ManagedReadbackFromAnotherRun, ManagedAccountIsTheClosedAccount, ManagedAccountNotAdministratorOnChannel, ManagedReadbackDuplicateRow, QualificationTargetIsNotTheManagedAccount, QualificationTargetDoesNotAlreadyHoldTheLimit, RouteQualificationRequestAdmitted, RouteQualificationRequestRefused, QualificationRequestForAnotherOperation, QualificationRequestRefusedByClassifier, QualificationRequestWouldLeaveNoAdministrator, admit_password_route_qualification, admit_privilege_limit_route_qualification, @@ -550,25 +550,24 @@ fn lockout_verdict(readback: ManagedAdministratorReadback?) -> String { ManagedAccountIsTheClosedAccount { user: _ } => "managed-is-closed" ManagedAccountNotAdministratorOnChannel { managed_user: _ } => "not-administrator-on-channel" ManagedReadbackDuplicateRow { managed_user: _, count: _ } => "duplicate-row" + QualificationTargetIsNotTheManagedAccount { target: _, managed_user: _ } => "target-not-managed" + QualificationTargetDoesNotAlreadyHoldTheLimit { target: _ } => "target-not-holding" } } _ => "other-refusal" } } -// The one way this witness obtains a readback: the fixture mint, admitted to this function only. -fn readback_at(endpoint: BmcControllerEndpoint, firmware: BmcFirmwareReleaseIdentity, attempt: NonEmptyStr, managed_user: Int, access: List) -> ManagedAdministratorReadback? { - Present { value: managed_administrator_readback_fixture(endpoint: endpoint, firmware: firmware, attempt: attempt as AttemptIdentity, managed_user: managed_user, access: access) } -} - +// Every readback below is minted by managed_administrator_readback_fixture IN THE CLAIM THAT CONSUMES IT: +// the fixture admits exactly those claims, and no function here returns a readback or a standing. test fn a_channel_access_write_that_could_lock_out_every_administrator_is_unplannable() -> Bool { let admin_on_2 = [ipmi_user_channel_access(channel: 2, user: 3, privilege: IpmiPrivilegeAdministrator)] let admin_on_1 = [ipmi_user_channel_access(channel: 1, user: 3, privilege: IpmiPrivilegeAdministrator)] lockout_verdict(readback: none) == "readback-absent" - && lockout_verdict(readback: readback_at(endpoint: lab_endpoint, firmware: lab_firmware(), attempt: "attempt-1" as NonEmptyStr, managed_user: 3, access: admin_on_2)) == "admitted" - && lockout_verdict(readback: readback_at(endpoint: lab_endpoint, firmware: lab_firmware(), attempt: "attempt-0" as NonEmptyStr, managed_user: 3, access: admin_on_2)) == "another-run" - && lockout_verdict(readback: readback_at(endpoint: lab_endpoint, firmware: lab_firmware(), attempt: "attempt-1" as NonEmptyStr, managed_user: 2, access: [ipmi_user_channel_access(channel: 2, user: 2, privilege: IpmiPrivilegeAdministrator)])) == "managed-is-closed" - && lockout_verdict(readback: readback_at(endpoint: lab_endpoint, firmware: lab_firmware(), attempt: "attempt-1" as NonEmptyStr, managed_user: 3, access: admin_on_1)) == "not-administrator-on-channel" + && lockout_verdict(readback: Present { value: managed_administrator_readback_fixture(endpoint: lab_endpoint, firmware: lab_firmware(), attempt: "attempt-1" as AttemptIdentity, managed_user: 3, access: admin_on_2) }) == "admitted" + && lockout_verdict(readback: Present { value: managed_administrator_readback_fixture(endpoint: lab_endpoint, firmware: lab_firmware(), attempt: "attempt-0" as AttemptIdentity, managed_user: 3, access: admin_on_2) }) == "another-run" + && lockout_verdict(readback: Present { value: managed_administrator_readback_fixture(endpoint: lab_endpoint, firmware: lab_firmware(), attempt: "attempt-1" as AttemptIdentity, managed_user: 2, access: [ipmi_user_channel_access(channel: 2, user: 2, privilege: IpmiPrivilegeAdministrator)]) }) == "managed-is-closed" + && lockout_verdict(readback: Present { value: managed_administrator_readback_fixture(endpoint: lab_endpoint, firmware: lab_firmware(), attempt: "attempt-1" as AttemptIdentity, managed_user: 3, access: admin_on_1) }) == "not-administrator-on-channel" } // A READBACK FROM CONTROLLER A CANNOT UNLOCK A CLOSE ON CONTROLLER B, nor one from another build of the @@ -576,18 +575,18 @@ test fn a_channel_access_write_that_could_lock_out_every_administrator_is_unplan // the route's controller B and on build 0.33. test fn a_readback_from_another_controller_or_build_does_not_unlock_a_close() -> Bool { let admin_on_2 = [ipmi_user_channel_access(channel: 2, user: 3, privilege: IpmiPrivilegeAdministrator)] - lockout_verdict(readback: readback_at(endpoint: lab_endpoint_b, firmware: lab_firmware(), attempt: "attempt-1" as NonEmptyStr, managed_user: 3, access: admin_on_2)) == "another-controller" - && lockout_verdict(readback: readback_at(endpoint: lab_endpoint, firmware: bmc_firmware_release_identity_of_wire(family: AmiMegaRac, wire: "0.33" as NonEmptyStr), attempt: "attempt-1" as NonEmptyStr, managed_user: 3, access: admin_on_2)) == "another-build" - && lockout_verdict(readback: readback_at(endpoint: lab_endpoint, firmware: lab_firmware(), attempt: "attempt-1" as NonEmptyStr, managed_user: 3, access: admin_on_2)) == "admitted" + lockout_verdict(readback: Present { value: managed_administrator_readback_fixture(endpoint: lab_endpoint_b, firmware: lab_firmware(), attempt: "attempt-1" as AttemptIdentity, managed_user: 3, access: admin_on_2) }) == "another-controller" + && lockout_verdict(readback: Present { value: managed_administrator_readback_fixture(endpoint: lab_endpoint, firmware: bmc_firmware_release_identity_of_wire(family: AmiMegaRac, wire: "0.33" as NonEmptyStr), attempt: "attempt-1" as AttemptIdentity, managed_user: 3, access: admin_on_2) }) == "another-build" + && lockout_verdict(readback: Present { value: managed_administrator_readback_fixture(endpoint: lab_endpoint, firmware: lab_firmware(), attempt: "attempt-1" as AttemptIdentity, managed_user: 3, access: admin_on_2) }) == "admitted" } // A DUPLICATE (channel, user) RESULT REFUSES: an ADMINISTRATOR row beside a contradictory NO ACCESS row // for the same managed user and channel is not a unique reading. test fn a_duplicated_managed_readback_row_refuses() -> Bool { - lockout_verdict(readback: readback_at(endpoint: lab_endpoint, firmware: lab_firmware(), attempt: "attempt-1" as NonEmptyStr, managed_user: 3, access: [ + lockout_verdict(readback: Present { value: managed_administrator_readback_fixture(endpoint: lab_endpoint, firmware: lab_firmware(), attempt: "attempt-1" as AttemptIdentity, managed_user: 3, access: [ ipmi_user_channel_access(channel: 2, user: 3, privilege: IpmiPrivilegeAdministrator), ipmi_user_channel_access(channel: 2, user: 3, privilege: IpmiPrivilegeNoAccess), - ])) == "duplicate-row" + ]) }) == "duplicate-row" } // ── THE PRE-WRITE QUALIFICATION ADMISSION (side-chat review of 7887d74ed2, item 1) ────────────────── @@ -628,18 +627,13 @@ test fn the_prewrite_admission_admits_only_with_the_same_run_receipt() -> Bool { let c = lab_candidate(request: request) let exact = qualification_approval_for(standing: c, request: request) let admin_on_1 = [ipmi_user_channel_access(channel: 1, user: 3, privilege: IpmiPrivilegeAdministrator)] - prewrite_verdict(a: admit_privilege_limit_route_qualification(standing: c, approval: exact, readback: readback_at(endpoint: lab_endpoint, firmware: lab_firmware(), attempt: "attempt-1" as NonEmptyStr, managed_user: 3, access: admin_on_1))) == "admitted" - && prewrite_verdict(a: admit_privilege_limit_route_qualification(standing: c, approval: exact, readback: readback_at(endpoint: lab_endpoint_b, firmware: lab_firmware(), attempt: "attempt-1" as NonEmptyStr, managed_user: 3, access: admin_on_1))) == "retention-refused" - && prewrite_verdict(a: admit_privilege_limit_route_qualification(standing: c, approval: rotation_approval_for(s: c), readback: readback_at(endpoint: lab_endpoint, firmware: lab_firmware(), attempt: "attempt-1" as NonEmptyStr, managed_user: 3, access: admin_on_1))) == "another-authority" + prewrite_verdict(a: admit_privilege_limit_route_qualification(standing: c, approval: exact, readback: Present { value: managed_administrator_readback_fixture(endpoint: lab_endpoint, firmware: lab_firmware(), attempt: "attempt-1" as AttemptIdentity, managed_user: 3, access: admin_on_1) })) == "admitted" + && prewrite_verdict(a: admit_privilege_limit_route_qualification(standing: c, approval: exact, readback: Present { value: managed_administrator_readback_fixture(endpoint: lab_endpoint_b, firmware: lab_firmware(), attempt: "attempt-1" as AttemptIdentity, managed_user: 3, access: admin_on_1) })) == "retention-refused" + && prewrite_verdict(a: admit_privilege_limit_route_qualification(standing: c, approval: rotation_approval_for(s: c), readback: Present { value: managed_administrator_readback_fixture(endpoint: lab_endpoint, firmware: lab_firmware(), attempt: "attempt-1" as AttemptIdentity, managed_user: 3, access: admin_on_1) })) == "another-authority" } // ── WHAT A QUALIFICATION GROUNDS: acceptance, and effect only when the run could tell ─────────────── -// The witness's one way to hold an executed grounding with a chosen effect standing. -fn executed_route_at(request: BmcAccountWriteRequest, effect: RouteEffectStanding) -> BmcRotationRouteStanding { - rotation_route_executed_fixture(endpoint: lab_endpoint, firmware: lab_firmware(), request: request, receipt: lab_surface_receipt, effect: effect) -} - fn modeled_effect(candidate: BmcRotationRouteStanding, world: BmcWorld, request: BmcAccountWriteRequest) -> String { match classify_modeled_route_qualification(standing: candidate, approval: qualification_approval_for(standing: candidate, request: request), response: dry_route_qualification_request(world: world, subject: subject_at(endpoint: lab_endpoint, request: request), password: "unused").response) { ModeledQualificationWouldQualify { subject: _, request_receipt: _, response_receipt: _, effect: e } => match e { EffectObserved => "observed" AcceptedEffectUnobserved => "accepted-only" } @@ -664,15 +658,14 @@ test fn an_idempotent_qualifying_write_grounds_acceptance_only() -> Bool { // AN ACCEPT-ONLY GROUNDING DOES NOT ADMIT THE CLOSING WRITE. A grounded privilege-limit route whose // effect was unobserved, with an exact approval of closing user 2 on channel 2 and a valid same-run // managed-administrator readback, refuses as effect-unobserved; the same with EffectObserved is admitted. -fn closing_verdict(effect: RouteEffectStanding) -> String { - let route = executed_route_at(request: access_write(user: 3, channel: 1, privilege: IpmiPrivilegeAdministrator), effect: effect) +fn closing_verdict(route: BmcRotationRouteStanding, readback: ManagedAdministratorReadback?) -> String { let close = access_write(user: 2, channel: 2, privilege: IpmiPrivilegeNoAccess) match admit_rotation_apply( standing: route, target_endpoint: lab_endpoint, target_firmware: lab_firmware(), request: close, - managed_readback: readback_at(endpoint: lab_endpoint, firmware: lab_firmware(), attempt: "attempt-1" as NonEmptyStr, managed_user: 3, access: [ipmi_user_channel_access(channel: 2, user: 3, privilege: IpmiPrivilegeAdministrator)]), + managed_readback: readback, approval: approval(authority: rotation_apply_authority, revision: rotation_route_request_identity(standing: route, request: close)), ) { RotationApplyAdmitted { standing: _, request: _, decided_by: _ } => "admitted" @@ -682,6 +675,21 @@ fn closing_verdict(effect: RouteEffectStanding) -> String { } test fn an_accept_only_grounding_does_not_admit_the_closing_write() -> Bool { - closing_verdict(effect: AcceptedEffectUnobserved) == "effect-unobserved" - && closing_verdict(effect: EffectObserved) == "admitted" + let qualifying = access_write(user: 3, channel: 1, privilege: IpmiPrivilegeAdministrator) + let readback = Present { value: managed_administrator_readback_fixture(endpoint: lab_endpoint, firmware: lab_firmware(), attempt: "attempt-1" as AttemptIdentity, managed_user: 3, access: [ipmi_user_channel_access(channel: 2, user: 3, privilege: IpmiPrivilegeAdministrator)]) } + closing_verdict(route: rotation_route_executed_fixture(endpoint: lab_endpoint, firmware: lab_firmware(), request: qualifying, receipt: lab_surface_receipt, effect: AcceptedEffectUnobserved), readback: readback) == "effect-unobserved" + && closing_verdict(route: rotation_route_executed_fixture(endpoint: lab_endpoint, firmware: lab_firmware(), request: qualifying, receipt: lab_surface_receipt, effect: EffectObserved), readback: readback) == "admitted" +} + +// THE NON-DESTRUCTIVE QUALIFICATION RE-ASSERTS THE MANAGED ACCOUNT'S OWN CURRENT VALUE (side-chat review +// of 6d277411fd, item 2). For the target (user 3, channel 1, ADMINISTRATOR): a receipt only for managed +// user 4, though ADMINISTRATOR on channel 1, issues no qualification request; a receipt for user 3 whose +// channel-1 row is OPERATOR issues none; the exact current ADMINISTRATOR reading for user 3 is admitted. +test fn the_idempotent_qualification_requires_the_target_pair_to_already_hold_the_value() -> Bool { + let request = access_write(user: 3, channel: 1, privilege: IpmiPrivilegeAdministrator) + let c = lab_candidate(request: request) + let exact = qualification_approval_for(standing: c, request: request) + prewrite_verdict(a: admit_privilege_limit_route_qualification(standing: c, approval: exact, readback: Present { value: managed_administrator_readback_fixture(endpoint: lab_endpoint, firmware: lab_firmware(), attempt: "attempt-1" as AttemptIdentity, managed_user: 4, access: [ipmi_user_channel_access(channel: 1, user: 4, privilege: IpmiPrivilegeAdministrator)]) })) == "retention-refused" + && prewrite_verdict(a: admit_privilege_limit_route_qualification(standing: c, approval: exact, readback: Present { value: managed_administrator_readback_fixture(endpoint: lab_endpoint, firmware: lab_firmware(), attempt: "attempt-1" as AttemptIdentity, managed_user: 3, access: [ipmi_user_channel_access(channel: 1, user: 3, privilege: IpmiPrivilegeOperator)]) })) == "retention-refused" + && prewrite_verdict(a: admit_privilege_limit_route_qualification(standing: c, approval: exact, readback: Present { value: managed_administrator_readback_fixture(endpoint: lab_endpoint, firmware: lab_firmware(), attempt: "attempt-1" as AttemptIdentity, managed_user: 3, access: [ipmi_user_channel_access(channel: 1, user: 3, privilege: IpmiPrivilegeAdministrator)]) })) == "admitted" } From e12070ae03d57004769b851dba056fc012b4890b Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Mon, 5 Oct 2026 00:48:23 +0000 Subject: [PATCH 13/22] O1a-2: discriminating target-pair controls; drop the implied (dead) holds-value check Co-Authored-By: Claude Opus 5.5 (1M context) --- .../machine_intake/bmc_rotation_route.dag | 12 ++++++------ ...intake_bmc_rotation_route_witness_test.dag | 19 +++++++++++-------- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/dag/gunbc/machine_intake/bmc_rotation_route.dag b/dag/gunbc/machine_intake/bmc_rotation_route.dag index 2698b3c2647..8a0999ef758 100644 --- a/dag/gunbc/machine_intake/bmc_rotation_route.dag +++ b/dag/gunbc/machine_intake/bmc_rotation_route.dag @@ -633,8 +633,11 @@ fn admit_route_qualification_request( // AT THE QUALIFICATION BOUNDARY a privilege-limit request that does not lower anything is admitted // only as an IDEMPOTENT RE-ASSERTION OF THE MANAGED ACCOUNT'S OWN CURRENT VALUE: the request's target user // IS the readback's managed account, and that account's unique row for the target channel already holds -// exactly the requested limit. So a managed id that changed after the reflash, or a target that does not -// already hold the value, issues no request at all, rather than granting a privilege. A lowering request +// exactly the requested limit. The second half is not a separate check: a non-lowering request IS +// ADMINISTRATOR, and administrator_retention_refusal (applied first) already requires the managed +// account's unique row on that channel to be ADMINISTRATOR. So a managed id that changed after the +// reflash, or a target that does not already hold the value, issues no request at all, rather than +// granting a privilege. A lowering request // at qualification is an effectful act and passes the ordinary retention precondition. fn qualification_retention_refusal(standing: BmcRotationRouteStanding, request: BmcAccountWriteRequest, readback: ManagedAdministratorReadback?, approved_attempt: AttemptIdentity) -> AdministratorRetentionRefusal? { match administrator_retention_refusal(standing: standing, request: request, readback: readback, approved_attempt: approved_attempt) { @@ -650,10 +653,8 @@ fn qualification_retention_refusal(standing: BmcRotationRouteStanding, request: Present { value: r } => if (r.managed_user as Int) != (x.user as Int) { Present { value: QualificationTargetIsNotTheManagedAccount { target: x.user, managed_user: r.managed_user } } - } else if any(r.access, a => (a.user as Int) == (x.user as Int) && (a.channel as Int) == (x.channel as Int) && ipmi_privilege_eq(a: a.privilege, b: x.privilege)) { - none } else { - Present { value: QualificationTargetDoesNotAlreadyHoldTheLimit { target: x.user } } + none } } } @@ -791,7 +792,6 @@ type AdministratorRetentionRefusal | ManagedAccountNotAdministratorOnChannel { managed_user: IpmiUserId } | ManagedReadbackDuplicateRow { managed_user: IpmiUserId, count: Int } | QualificationTargetIsNotTheManagedAccount { target: IpmiUserId, managed_user: IpmiUserId } - | QualificationTargetDoesNotAlreadyHoldTheLimit { target: IpmiUserId } fn lowers_privilege(privilege: IpmiChannelPrivilegeLimit) -> Bool { match privilege { diff --git a/dag/test/claim/machine_intake/machine_intake_bmc_rotation_route_witness_test.dag b/dag/test/claim/machine_intake/machine_intake_bmc_rotation_route_witness_test.dag index ae1b7fdb258..c109805df60 100644 --- a/dag/test/claim/machine_intake/machine_intake_bmc_rotation_route_witness_test.dag +++ b/dag/test/claim/machine_intake/machine_intake_bmc_rotation_route_witness_test.dag @@ -37,7 +37,7 @@ import gunbc.machine_intake_bmc_rotation_route { RotationApplyRouteForAnotherBuild, RotationApplyRouteForAnotherOperation, RotationApplyRouteEffectUnobserved, RotationApplyApprovalRefused, EffectObserved, AcceptedEffectUnobserved, RouteEffectStanding, rotation_route_executed_fixture, RotationApplyApprovalDenied, RotationApplyApprovalForAnotherAuthority, RotationApplyApprovalForAnotherRequest, RotationApplyWouldLeaveNoAdministrator, - ManagedAdministratorReadback, managed_administrator_readback_fixture, ManagedReadbackAbsent, ManagedReadbackFromAnotherController, ManagedReadbackFromAnotherBuild, ManagedReadbackFromAnotherRun, ManagedAccountIsTheClosedAccount, ManagedAccountNotAdministratorOnChannel, ManagedReadbackDuplicateRow, QualificationTargetIsNotTheManagedAccount, QualificationTargetDoesNotAlreadyHoldTheLimit, + ManagedAdministratorReadback, managed_administrator_readback_fixture, ManagedReadbackAbsent, ManagedReadbackFromAnotherController, ManagedReadbackFromAnotherBuild, ManagedReadbackFromAnotherRun, ManagedAccountIsTheClosedAccount, ManagedAccountNotAdministratorOnChannel, ManagedReadbackDuplicateRow, QualificationTargetIsNotTheManagedAccount, RouteQualificationRequestAdmitted, RouteQualificationRequestRefused, QualificationRequestForAnotherOperation, QualificationRequestRefusedByClassifier, QualificationRequestWouldLeaveNoAdministrator, admit_password_route_qualification, admit_privilege_limit_route_qualification, @@ -551,7 +551,6 @@ fn lockout_verdict(readback: ManagedAdministratorReadback?) -> String { ManagedAccountNotAdministratorOnChannel { managed_user: _ } => "not-administrator-on-channel" ManagedReadbackDuplicateRow { managed_user: _, count: _ } => "duplicate-row" QualificationTargetIsNotTheManagedAccount { target: _, managed_user: _ } => "target-not-managed" - QualificationTargetDoesNotAlreadyHoldTheLimit { target: _ } => "target-not-holding" } } _ => "other-refusal" @@ -601,6 +600,9 @@ fn prewrite_verdict(a: RouteQualificationRequestAdmission) -> String { QualificationRequestWouldLeaveNoAdministrator { cause: k } => match k { ManagedReadbackAbsent => "readback-absent" + ManagedReadbackFromAnotherController { readback: _, route: _ } => "another-controller" + QualificationTargetIsNotTheManagedAccount { target: _, managed_user: _ } => "target-not-managed" + ManagedAccountNotAdministratorOnChannel { managed_user: _ } => "not-administrator-on-channel" _ => "retention-refused" } } @@ -628,7 +630,7 @@ test fn the_prewrite_admission_admits_only_with_the_same_run_receipt() -> Bool { let exact = qualification_approval_for(standing: c, request: request) let admin_on_1 = [ipmi_user_channel_access(channel: 1, user: 3, privilege: IpmiPrivilegeAdministrator)] prewrite_verdict(a: admit_privilege_limit_route_qualification(standing: c, approval: exact, readback: Present { value: managed_administrator_readback_fixture(endpoint: lab_endpoint, firmware: lab_firmware(), attempt: "attempt-1" as AttemptIdentity, managed_user: 3, access: admin_on_1) })) == "admitted" - && prewrite_verdict(a: admit_privilege_limit_route_qualification(standing: c, approval: exact, readback: Present { value: managed_administrator_readback_fixture(endpoint: lab_endpoint_b, firmware: lab_firmware(), attempt: "attempt-1" as AttemptIdentity, managed_user: 3, access: admin_on_1) })) == "retention-refused" + && prewrite_verdict(a: admit_privilege_limit_route_qualification(standing: c, approval: exact, readback: Present { value: managed_administrator_readback_fixture(endpoint: lab_endpoint_b, firmware: lab_firmware(), attempt: "attempt-1" as AttemptIdentity, managed_user: 3, access: admin_on_1) })) == "another-controller" && prewrite_verdict(a: admit_privilege_limit_route_qualification(standing: c, approval: rotation_approval_for(s: c), readback: Present { value: managed_administrator_readback_fixture(endpoint: lab_endpoint, firmware: lab_firmware(), attempt: "attempt-1" as AttemptIdentity, managed_user: 3, access: admin_on_1) })) == "another-authority" } @@ -682,14 +684,15 @@ test fn an_accept_only_grounding_does_not_admit_the_closing_write() -> Bool { } // THE NON-DESTRUCTIVE QUALIFICATION RE-ASSERTS THE MANAGED ACCOUNT'S OWN CURRENT VALUE (side-chat review -// of 6d277411fd, item 2). For the target (user 3, channel 1, ADMINISTRATOR): a receipt only for managed -// user 4, though ADMINISTRATOR on channel 1, issues no qualification request; a receipt for user 3 whose -// channel-1 row is OPERATOR issues none; the exact current ADMINISTRATOR reading for user 3 is admitted. +// of 6d277411fd, item 2). For the target (user 3, channel 1, ADMINISTRATOR): a receipt for managed user 4 +// -- ADMINISTRATOR on channel 1, and even carrying an ADMINISTRATOR row for user 3 -- issues no request, +// refused only because the target is not the managed account; a receipt for user 3 whose channel-1 row +// is OPERATOR issues none; user 3's exact current ADMINISTRATOR reading is admitted. test fn the_idempotent_qualification_requires_the_target_pair_to_already_hold_the_value() -> Bool { let request = access_write(user: 3, channel: 1, privilege: IpmiPrivilegeAdministrator) let c = lab_candidate(request: request) let exact = qualification_approval_for(standing: c, request: request) - prewrite_verdict(a: admit_privilege_limit_route_qualification(standing: c, approval: exact, readback: Present { value: managed_administrator_readback_fixture(endpoint: lab_endpoint, firmware: lab_firmware(), attempt: "attempt-1" as AttemptIdentity, managed_user: 4, access: [ipmi_user_channel_access(channel: 1, user: 4, privilege: IpmiPrivilegeAdministrator)]) })) == "retention-refused" - && prewrite_verdict(a: admit_privilege_limit_route_qualification(standing: c, approval: exact, readback: Present { value: managed_administrator_readback_fixture(endpoint: lab_endpoint, firmware: lab_firmware(), attempt: "attempt-1" as AttemptIdentity, managed_user: 3, access: [ipmi_user_channel_access(channel: 1, user: 3, privilege: IpmiPrivilegeOperator)]) })) == "retention-refused" + prewrite_verdict(a: admit_privilege_limit_route_qualification(standing: c, approval: exact, readback: Present { value: managed_administrator_readback_fixture(endpoint: lab_endpoint, firmware: lab_firmware(), attempt: "attempt-1" as AttemptIdentity, managed_user: 4, access: [ipmi_user_channel_access(channel: 1, user: 4, privilege: IpmiPrivilegeAdministrator), ipmi_user_channel_access(channel: 1, user: 3, privilege: IpmiPrivilegeAdministrator)]) })) == "target-not-managed" + && prewrite_verdict(a: admit_privilege_limit_route_qualification(standing: c, approval: exact, readback: Present { value: managed_administrator_readback_fixture(endpoint: lab_endpoint, firmware: lab_firmware(), attempt: "attempt-1" as AttemptIdentity, managed_user: 3, access: [ipmi_user_channel_access(channel: 1, user: 3, privilege: IpmiPrivilegeOperator)]) })) == "not-administrator-on-channel" && prewrite_verdict(a: admit_privilege_limit_route_qualification(standing: c, approval: exact, readback: Present { value: managed_administrator_readback_fixture(endpoint: lab_endpoint, firmware: lab_firmware(), attempt: "attempt-1" as AttemptIdentity, managed_user: 3, access: [ipmi_user_channel_access(channel: 1, user: 3, privilege: IpmiPrivilegeAdministrator)]) })) == "admitted" } From a68bb7adf65af5703fc2c42d2bffb75ded32a045 Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Mon, 5 Oct 2026 03:54:25 +0000 Subject: [PATCH 14/22] O1a-2 integration: one-arm MissingAccountOperation spelled as a coproduct; arrival witness match covers the privilege-limit arm (floor findings at 8960bbe5) Co-Authored-By: Claude Opus 5.5 (1M context) --- dag/gunbc/machine_intake/bmc_secure.dag | 3 +-- .../machine_intake_arrival_converge_witness_test.dag | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/dag/gunbc/machine_intake/bmc_secure.dag b/dag/gunbc/machine_intake/bmc_secure.dag index 9e1e8185188..c8125af02ce 100644 --- a/dag/gunbc/machine_intake/bmc_secure.dag +++ b/dag/gunbc/machine_intake/bmc_secure.dag @@ -1380,8 +1380,7 @@ type BmcSecureStateRefusal // channel-access write" is now a typed plan refusal rather than an assessment refusal. Putting the // factory password back is still not an admitted action, so that deviation still refuses with the // missing operation named. -type MissingAccountOperation - = PublishedFactoryCredentialRestore +type MissingAccountOperation = | PublishedFactoryCredentialRestore type ConjunctionCauseClass = CauseRemediableByAccountAction diff --git a/dag/test/claim/machine_intake/machine_intake_arrival_converge_witness_test.dag b/dag/test/claim/machine_intake/machine_intake_arrival_converge_witness_test.dag index a7a024cadef..09d97a0dbcb 100644 --- a/dag/test/claim/machine_intake/machine_intake_arrival_converge_witness_test.dag +++ b/dag/test/claim/machine_intake/machine_intake_arrival_converge_witness_test.dag @@ -18,7 +18,7 @@ import gunbc.machine_intake_mtjade1_access_observation { } import gunbc.machine_intake_bmc_rotation_route { BmcRotationRouteStanding, BmcAccountWriteRequest, RouteQualificationCandidate, RouteGroundedByExecutedRequest, RouteGroundedByCitedSource, RouteUngrounded, - RedfishAccountPasswordWrite, IpmiSetUserPassword, ObservedSurfaceRead, PublicStandardOperation, + RedfishAccountPasswordWrite, IpmiSetUserPassword, IpmiSetUserPrivilegeLimit, ObservedSurfaceRead, PublicStandardOperation, RotationApplyAdmitted, RotationApplyRouteNotGrounded, rotation_apply_authority, rotation_route_request_identity, rotation_route_is_grounded, admit_rotation_apply, } @@ -75,7 +75,7 @@ fn instance_step_is(s: StepInstanceStanding Bool { match route.grounding { RouteQualificationCandidate { request: r, evidence: e } => - (match r { RedfishAccountPasswordWrite { transport_operation: _, action_shape: _ } => true IpmiSetUserPassword { user: _ } => false }) + (match r { RedfishAccountPasswordWrite { transport_operation: _, action_shape: _ } => true IpmiSetUserPassword { user: _ } => false IpmiSetUserPrivilegeLimit { access: _ } => false }) && (match e { ObservedSurfaceRead { surface: _, receipt: rc } => (rc.label as String) == "artifacts/bmc/mtjade1-redfish-manager-self-192.168.1.246-2026-10-04T043605Z.json" PublicStandardOperation { authority: _ } => false }) RouteGroundedByExecutedRequest { request: _, request_receipt: _, response_receipt: _, effect: _ } => false RouteGroundedByCitedSource { request: _, citation: _ } => false From 7264e4eb166637470ab3750003e522b4e96df265 Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Mon, 5 Oct 2026 04:14:18 +0000 Subject: [PATCH 15/22] O1a-2 integration, side-chat review of 8960bbe511: producer-bound readback inputs, confined projection, channel access read from the world - BmcAccountStateObservation records the authenticated managed IPMI user and the run's attempt at its producer; its mint is admitted to dry_read_bmc_account_state only. - project_managed_administrator_readback takes the observation alone and is admitted to admitted_channel_writes only; the plan refuses a claimed managed user other than the authenticated one and readings after the plan. - dry_read_bmc_account_state reads Get User Access rows from the world; a real channel-close plan is applied, read back and converges. Co-Authored-By: Claude Opus 5.5 (1M context) --- dag/gunbc/machine_intake/bmc_secure.dag | 67 +++++++--- ...secure_state_forged_probe_witness_test.dag | 11 +- ...e_intake_bmc_secure_state_witness_test.dag | 123 +++++++++++++++++- 3 files changed, 180 insertions(+), 21 deletions(-) diff --git a/dag/gunbc/machine_intake/bmc_secure.dag b/dag/gunbc/machine_intake/bmc_secure.dag index c8125af02ce..15a67e16616 100644 --- a/dag/gunbc/machine_intake/bmc_secure.dag +++ b/dag/gunbc/machine_intake/bmc_secure.dag @@ -2,6 +2,7 @@ module gunbc.machine_intake_bmc_secure import std.types { Bool, EpochMs, Int, List, Map, NonEmptyStr, String, list_length } import v2.std.algebra { filter } +import std.decl_ref { decl_ref } import std.content_hash { ContentHash, content_hash_of_value } import std.dissolution { DissolutionCondition, unbound_dissolution } import std.algebra { FreeSemigroup } @@ -68,6 +69,7 @@ import gunbc.machine_intake_bmc_rotation_route { import extdeps.bmc.endpoint { BmcControllerEndpoint } import extdeps.bmc.types { RedfishAccountRole } import extdeps.bmc.ipmi_channel { + ipmi_controller_channel_census, IpmiChannelCensusMember, IpmiChannelNumber, IpmiControllerChannelCensus, @@ -1242,6 +1244,8 @@ type BmcAccountStateObservation sole_constructor { endpoint: BmcControllerEndpoint firmware: BmcFirmwareReleaseIdentity managed: ManagedCredentialReference + managed_user: IpmiUserId + attempt: AttemptIdentity read_floor: ObserverClockInstant managed_probe: ObservedCredentialProbe channel_census: IpmiControllerChannelCensus @@ -1260,6 +1264,8 @@ fn observed_bmc_account_state( endpoint: BmcControllerEndpoint, firmware: BmcFirmwareReleaseIdentity, managed: ManagedCredentialReference, + managed_user: IpmiUserId, + attempt: AttemptIdentity, read_floor: ObserverClockInstant, managed_probe: ObservedCredentialProbe, channel_census: IpmiControllerChannelCensus, @@ -1271,12 +1277,18 @@ fn observed_bmc_account_state( break_glass: ManagedCredentialReference, break_glass_probe: ObservedCredentialProbe, controller_clock: ControllerClockReading?, -) -> BmcAccountStateObservation { +) -> BmcAccountStateObservation + admit_callers: [ + decl_ref(module_path: "gunbc.machine_intake_bmc_secure", decl_name: "dry_read_bmc_account_state"), + ] +{ BmcAccountStateObservation { subject: subject, endpoint: endpoint, firmware: firmware, managed: managed, + managed_user: managed_user, + attempt: attempt, read_floor: read_floor, managed_probe: managed_probe, channel_census: channel_census, @@ -1757,6 +1769,8 @@ type BmcAccountPlanRefusal | PublishedGenerationNotGoalBound { generation: ManagedCredentialReference, goal: ManagedCredentialReference } | GenerationFetchedAfterPlan { target: AccountWriteTarget, fetched_at: ObserverClockInstant, planned_at: ObserverClockInstant } | PlanPrecedesDivergedReading { read_floor: ObserverClockInstant, planned_at: ObserverClockInstant } + | PlanPrecedesReading { planned_at: ObserverClockInstant } + | ManagedUserNotTheAuthenticatedAccount { supplied: IpmiUserId, authenticated: IpmiUserId } | ChannelCloseRouteNotSupplied { channels: List } | ChannelCloseApprovalAbsent { channel: IpmiChannelNumber } | ChannelWriteNotAdmitted { channel: IpmiChannelNumber, admission: RotationApplyAdmission } @@ -1853,10 +1867,15 @@ fn published_channels_left_open(observed: BmcAccountStateObservation) -> List ManagedAdministratorReadback? { +// census's Get User Access rows for the AUTHENTICATED managed user the observation recorded, and the +// readback carries the observation's own endpoint, build and attempt -- all set by the observation's +// producer, none by a consumer. The admission then compares that attempt with the approval's, so an +// approval for another run refuses. Admitted only to admitted_channel_writes: no facade returns it. +fn project_managed_administrator_readback(observed: BmcAccountStateObservation) -> ManagedAdministratorReadback? + admit_callers: [ + decl_ref(module_path: "gunbc.machine_intake_bmc_secure", decl_name: "admitted_channel_writes"), + ] +{ match observed.managed_probe { ObservedCredentialAccepted { reading: r } => if observer_instant_precedes(earlier: r.observed_at, later: observed.read_floor) || observer_instant_precedes(earlier: observed.census_observed_at, later: observed.read_floor) { @@ -1866,9 +1885,9 @@ fn project_managed_administrator_readback(observed: BmcAccountStateObservation, value: managed_administrator_readback_projected( endpoint: observed.endpoint, firmware: observed.firmware, - attempt: attempt, - managed_user: managed_user, - access: filter(observed.channel_census.user_access, a => (a.user as Int) == (managed_user as Int)), + attempt: observed.attempt, + managed_user: observed.managed_user, + access: filter(observed.channel_census.user_access, a => (a.user as Int) == (observed.managed_user as Int)), ), } } @@ -1877,6 +1896,14 @@ fn project_managed_administrator_readback(observed: BmcAccountStateObservation, } } +fn managed_probe_instant(probe: ObservedCredentialProbe, fallback: ObserverClockInstant) -> ObserverClockInstant { + match probe { + ObservedCredentialAccepted { reading: r } => r.observed_at + ObservedCredentialRejected { reading: r } => r.observed_at + ObservedCredentialUnestablished { detail: _ } => fallback + } +} + fn approval_for_request(route: BmcRotationRouteStanding, request: BmcAccountWriteRequest, approvals: List) -> Redemption? { let wanted = rotation_route_request_identity(standing: route, request: request) let none_yet: Redemption? = none @@ -1895,7 +1922,7 @@ type ChannelWritesAdmission = ChannelWritesAdmitted { writes: List } | ChannelWritesRefused { cause: BmcAccountPlanRefusal } -fn admitted_channel_writes(observed: BmcAccountStateObservation, managed_user: IpmiUserId, input: ChannelCloseInput?) -> ChannelWritesAdmission { +fn admitted_channel_writes(observed: BmcAccountStateObservation, input: ChannelCloseInput?) -> ChannelWritesAdmission { let open = published_channels_left_open(observed: observed) if list_length(items: open) == 0 { ChannelWritesAdmitted { writes: [] } @@ -1911,10 +1938,7 @@ fn admitted_channel_writes(observed: BmcAccountStateObservation, managed_user: I match approval_for_request(route: inp.route, request: request, approvals: inp.approvals) { Absent => ChannelWritesRefused { cause: ChannelCloseApprovalAbsent { channel: ch } } Present { value: approval } => { - let readback = match approval { - RedemptionAdmitted { claims: cl, decided_by: _ } => project_managed_administrator_readback(observed: observed, managed_user: managed_user, attempt: cl.attempt) - RedemptionRefused { cause: _ } => none - } + let readback = project_managed_administrator_readback(observed: observed) let admission = admit_rotation_apply( standing: inp.route, target_endpoint: observed.endpoint, @@ -1965,6 +1989,10 @@ fn plan_bmc_account_action( Apply { plan: due } => if observer_instant_precedes(earlier: planned_at, later: o.read_floor) { BmcAccountPlanRefused { cause: PlanPrecedesDivergedReading { read_floor: o.read_floor, planned_at: planned_at } } + } else if observer_instant_precedes(earlier: planned_at, later: o.census_observed_at) || observer_instant_precedes(earlier: planned_at, later: managed_probe_instant(probe: o.managed_probe, fallback: o.read_floor)) { + BmcAccountPlanRefused { cause: PlanPrecedesReading { planned_at: planned_at } } + } else if (managed_user as Int) != (o.managed_user as Int) { + BmcAccountPlanRefused { cause: ManagedUserNotTheAuthenticatedAccount { supplied: managed_user, authenticated: o.managed_user } } } else { let next = fetched_generation_reference(fetched: managed_generation) let in_force = goal.managed @@ -1981,7 +2009,7 @@ fn plan_bmc_account_action( match admitted_account_write(target: PublishedAccountTarget, user: o.published_user, route: published_route, endpoint: o.endpoint, firmware: o.firmware, approval: published_approval, generation: published_generation, planned_at: planned_at) { PlannedAccountWriteRefused { cause: c } => BmcAccountPlanRefused { cause: c } PlannedAccountWriteAdmitted { write: pw } => - match admitted_channel_writes(observed: o, managed_user: managed_user, input: channel_close) { + match admitted_channel_writes(observed: o, input: channel_close) { ChannelWritesRefused { cause: c } => BmcAccountPlanRefused { cause: c } ChannelWritesAdmitted { writes: cw } => BmcAccountPlanned { @@ -2175,7 +2203,11 @@ fn dry_published_lan_probes( } // ONE READ OF THE WORLD'S ACCOUNT STATE. read_at_millis is the realization's observer schedule; every -// reading in the observation is taken at it. +// reading in the observation is taken at it. The census MEMBERS (which channels exist, their media and +// LAN addresses) are the supplied channel layout; every Get User Access row is read from the world, so a +// readback after a channel-access write reports what the write did. managed_user is the IPMI user the +// managed probe authenticated as, and attempt is the run this read belongs to: both are recorded here, +// by the producer, and never assigned later by a consumer. fn dry_read_bmc_account_state( world: BmcWorld, subject: MachineIntakeSubject, @@ -2190,6 +2222,7 @@ fn dry_read_bmc_account_state( published_account: PublishedAccountKind, break_glass: ManagedCredentialReference, break_glass_password: String, + attempt: AttemptIdentity, read_at_millis: EpochMs, ) -> BmcAccountStateObservation { let at = dry_bmc_account_instant(millis: read_at_millis) @@ -2198,9 +2231,11 @@ fn dry_read_bmc_account_state( endpoint: endpoint, firmware: firmware, managed: managed, + managed_user: managed_user, + attempt: attempt, read_floor: at, managed_probe: dry_probe(world: world, user: managed_user, password: managed_password, what: "managed", at: at), - channel_census: census, + channel_census: ipmi_controller_channel_census(members: census.members, user_access: world.ipmi_user_access), census_evidence: dry_evidence(text: join(["dry channel census of ", endpoint.host as String, " at ", to_string(read_at_millis as Int)], "")), census_observed_at: at, published_probes: dry_published_lan_probes(world: world, census: census, published_user: published_user, published_password: published_password, at: at), diff --git a/dag/test/claim/machine_intake/machine_intake_bmc_secure_state_forged_probe_witness_test.dag b/dag/test/claim/machine_intake/machine_intake_bmc_secure_state_forged_probe_witness_test.dag index fc9d11613a4..fd3fba1af20 100644 --- a/dag/test/claim/machine_intake/machine_intake_bmc_secure_state_forged_probe_witness_test.dag +++ b/dag/test/claim/machine_intake/machine_intake_bmc_secure_state_forged_probe_witness_test.dag @@ -17,7 +17,7 @@ data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly // diagnostic-census harness and requires each refusal CLASS at its SUBJECT by name, so a probe refusing // for another reason measures another wall; the class-scoped control shows a clean source reading the // same modules emits none of them. -data forged_probe_source: String = "module probe_bmc_secure_state_forged\n\nimport std.types { Bool, EpochMs, NonEmptyStr, String }\nimport std.content_hash { content_hash_of_value }\nimport gunbc.clock_read { ObserverClockInstant, ObserverClockModeled, observer_clock_modeled }\nimport gunbc.machine_intake_receipt { EvidenceRef }\nimport gunbc.machine_intake_bmc_rotation_route { BmcRotationRouteStanding }\nimport test.claim.machine_intake_bmc_secure_state_witness { cited_lab_route_managed_user }\nimport gunbc.machine_intake_subject { MachineIntakeSubject }\nimport extdeps.bmc.endpoint { BmcControllerEndpoint }\nimport extdeps.bmc.capability { BmcFirmwareReleaseIdentity }\nimport extdeps.bmc.ipmi_channel { IpmiControllerChannelCensus }\nimport gunbc.machine_intake_bmc_secure {\n ControllerClockReading, ObservedCredentialProbe, ObservedCredentialAccepted,\n ManagedCredentialGenerationStored, ManagedCredentialGenerationFetched, BmcAccountActionPlan,\n BmcAccountApplication, BmcSecurePhaseReceipt, BmcAccountStateObservation,\n ManagedCredentialReference, ObservedPublishedAccount, observed_bmc_account_state,\n ObservedReading, PublishedAccountKind,\n}\n\nfn evidence() -> EvidenceRef {\n EvidenceRef { label: \"forged\", digest: content_hash_of_value(value: \"forged\" as NonEmptyStr) }\n}\n\nfn forged_instant() -> ObserverClockInstant {\n ObserverClockInstant { millis: 946684800000, source: ObserverClockModeled { realization: \"forged\" } }\n}\n\nfn forged_modeled_instant() -> ObserverClockInstant {\n observer_clock_modeled(millis: 946684800000, realization: \"forged\" as NonEmptyStr)\n}\n\nfn controller_time_as_read_floor(\n subject: MachineIntakeSubject,\n endpoint: BmcControllerEndpoint,\n firmware: BmcFirmwareReleaseIdentity,\n managed: ManagedCredentialReference,\n reading: ControllerClockReading,\n probe: ObservedCredentialProbe,\n census: IpmiControllerChannelCensus,\n instant: ObserverClockInstant,\n account: ObservedPublishedAccount,\n) -> BmcAccountStateObservation {\n observed_bmc_account_state(\n subject: subject,\n endpoint: endpoint,\n firmware: firmware,\n managed: managed,\n read_floor: reading,\n managed_probe: probe,\n channel_census: census,\n census_evidence: evidence(),\n census_observed_at: instant,\n published_probes: [],\n published_user: 2,\n published_account: account,\n break_glass: managed,\n break_glass_probe: probe,\n controller_clock: none,\n )\n}\n\nfn forged_stored(s: ManagedCredentialGenerationStored) -> ManagedCredentialGenerationStored {\n ManagedCredentialGenerationStored { reference: s.reference, stored_version: s.stored_version, stored_at: s.stored_at }\n}\n\nfn forged_fetched(s: ManagedCredentialGenerationStored) -> ManagedCredentialGenerationFetched {\n ManagedCredentialGenerationFetched { stored: s, fetched_at: s.stored_at }\n}\n\nfn forged_application(p: BmcAccountActionPlan) -> BmcAccountApplication {\n BmcAccountApplication {\n plan: p,\n managed_write_completed: true,\n published_write_completed: true,\n request_receipt: evidence(),\n response_receipt: evidence(),\n applied_at: p.planned_at,\n }\n}\n\nfn forged_receipt(r: BmcSecurePhaseReceipt) -> BmcSecurePhaseReceipt {\n BmcSecurePhaseReceipt { subject: r.subject, phase: r.phase, goal: r.goal, decision: r.decision, held: r.held }\n}\n\nfn forged_plan(p: BmcAccountActionPlan) -> BmcAccountActionPlan {\n BmcAccountActionPlan {\n subject: p.subject,\n endpoint: p.endpoint,\n firmware: p.firmware,\n goal: p.goal,\n diverged: p.diverged,\n due: p.due,\n managed_write: p.managed_write,\n published_write: p.published_write,\n planned_at: p.planned_at,\n }\n}\n\nfn forged_observation(o: BmcAccountStateObservation) -> BmcAccountStateObservation {\n BmcAccountStateObservation {\n subject: o.subject,\n endpoint: o.endpoint,\n managed: o.managed,\n read_floor: o.read_floor,\n managed_probe: o.managed_probe,\n channel_census: o.channel_census,\n census_evidence: o.census_evidence,\n census_observed_at: o.census_observed_at,\n published_probes: o.published_probes,\n published_user: o.published_user,\n published_account: o.published_account,\n controller_clock: o.controller_clock,\n }\n}\n\nfn controller_time_in_a_reading_field(reading: ControllerClockReading) -> ObservedReading {\n ObservedReading { evidence: evidence(), observed_at: reading }\n}\n\nfn controller_time_in_an_account_field(kind: PublishedAccountKind, reading: ControllerClockReading) -> ObservedPublishedAccount {\n ObservedPublishedAccount { kind: kind, evidence: evidence(), observed_at: reading }\n}\n\nfn borrowed_fixture_route() -> BmcRotationRouteStanding {\n cited_lab_route_managed_user()\n}\n" +data forged_probe_source: String = "module probe_bmc_secure_state_forged\n\nimport std.types { Bool, EpochMs, NonEmptyStr, String }\nimport std.content_hash { content_hash_of_value }\nimport gunbc.clock_read { ObserverClockInstant, ObserverClockModeled, observer_clock_modeled }\nimport gunbc.machine_intake_receipt { EvidenceRef }\nimport gunbc.machine_intake_bmc_rotation_route { BmcRotationRouteStanding }\nimport test.claim.machine_intake_bmc_secure_state_witness { cited_lab_route_managed_user }\nimport gunbc.machine_intake_subject { MachineIntakeSubject }\nimport extdeps.bmc.endpoint { BmcControllerEndpoint }\nimport extdeps.bmc.capability { BmcFirmwareReleaseIdentity }\nimport extdeps.bmc.ipmi_channel { IpmiControllerChannelCensus }\nimport gunbc.machine_intake_bmc_secure {\n ControllerClockReading, ObservedCredentialProbe, ObservedCredentialAccepted,\n ManagedCredentialGenerationStored, ManagedCredentialGenerationFetched, BmcAccountActionPlan,\n BmcAccountApplication, BmcSecurePhaseReceipt, BmcAccountStateObservation,\n ManagedCredentialReference, ObservedPublishedAccount, observed_bmc_account_state,\n ObservedReading, PublishedAccountKind, project_managed_administrator_readback,\n}\nimport std.scoped_authorization { AttemptIdentity }\nimport gunbc.machine_intake_bmc_rotation_route { ManagedAdministratorReadback }\n\nfn evidence() -> EvidenceRef {\n EvidenceRef { label: \"forged\", digest: content_hash_of_value(value: \"forged\" as NonEmptyStr) }\n}\n\nfn forged_instant() -> ObserverClockInstant {\n ObserverClockInstant { millis: 946684800000, source: ObserverClockModeled { realization: \"forged\" } }\n}\n\nfn forged_modeled_instant() -> ObserverClockInstant {\n observer_clock_modeled(millis: 946684800000, realization: \"forged\" as NonEmptyStr)\n}\n\nfn controller_time_as_read_floor(\n subject: MachineIntakeSubject,\n endpoint: BmcControllerEndpoint,\n firmware: BmcFirmwareReleaseIdentity,\n managed: ManagedCredentialReference,\n reading: ControllerClockReading,\n probe: ObservedCredentialProbe,\n census: IpmiControllerChannelCensus,\n instant: ObserverClockInstant,\n account: ObservedPublishedAccount,\n) -> BmcAccountStateObservation {\n observed_bmc_account_state(\n subject: subject,\n endpoint: endpoint,\n firmware: firmware,\n managed: managed,\n managed_user: 3,\n attempt: \"forged\" as AttemptIdentity,\n read_floor: reading,\n managed_probe: probe,\n channel_census: census,\n census_evidence: evidence(),\n census_observed_at: instant,\n published_probes: [],\n published_user: 2,\n published_account: account,\n break_glass: managed,\n break_glass_probe: probe,\n controller_clock: none,\n )\n}\n\nfn readback_through_the_projection(o: BmcAccountStateObservation) -> ManagedAdministratorReadback? {\n project_managed_administrator_readback(observed: o)\n}\n\nfn forged_stored(s: ManagedCredentialGenerationStored) -> ManagedCredentialGenerationStored {\n ManagedCredentialGenerationStored { reference: s.reference, stored_version: s.stored_version, stored_at: s.stored_at }\n}\n\nfn forged_fetched(s: ManagedCredentialGenerationStored) -> ManagedCredentialGenerationFetched {\n ManagedCredentialGenerationFetched { stored: s, fetched_at: s.stored_at }\n}\n\nfn forged_application(p: BmcAccountActionPlan) -> BmcAccountApplication {\n BmcAccountApplication {\n plan: p,\n managed_write_completed: true,\n published_write_completed: true,\n request_receipt: evidence(),\n response_receipt: evidence(),\n applied_at: p.planned_at,\n }\n}\n\nfn forged_receipt(r: BmcSecurePhaseReceipt) -> BmcSecurePhaseReceipt {\n BmcSecurePhaseReceipt { subject: r.subject, phase: r.phase, goal: r.goal, decision: r.decision, held: r.held }\n}\n\nfn forged_plan(p: BmcAccountActionPlan) -> BmcAccountActionPlan {\n BmcAccountActionPlan {\n subject: p.subject,\n endpoint: p.endpoint,\n firmware: p.firmware,\n goal: p.goal,\n diverged: p.diverged,\n due: p.due,\n managed_write: p.managed_write,\n published_write: p.published_write,\n planned_at: p.planned_at,\n }\n}\n\nfn forged_observation(o: BmcAccountStateObservation) -> BmcAccountStateObservation {\n BmcAccountStateObservation {\n subject: o.subject,\n endpoint: o.endpoint,\n managed: o.managed,\n read_floor: o.read_floor,\n managed_probe: o.managed_probe,\n channel_census: o.channel_census,\n census_evidence: o.census_evidence,\n census_observed_at: o.census_observed_at,\n published_probes: o.published_probes,\n published_user: o.published_user,\n published_account: o.published_account,\n controller_clock: o.controller_clock,\n }\n}\n\nfn controller_time_in_a_reading_field(reading: ControllerClockReading) -> ObservedReading {\n ObservedReading { evidence: evidence(), observed_at: reading }\n}\n\nfn controller_time_in_an_account_field(kind: PublishedAccountKind, reading: ControllerClockReading) -> ObservedPublishedAccount {\n ObservedPublishedAccount { kind: kind, evidence: evidence(), observed_at: reading }\n}\n\nfn borrowed_fixture_route() -> BmcRotationRouteStanding {\n cited_lab_route_managed_user()\n}\n" data harness_control_source: String = "module probe_bmc_secure_state_harness_control\nimport gunbc.machine_intake_bmc_secure { BmcSecurePhaseReceipt, bmc_secure_phase_receipt_evidence }\nimport gunbc.machine_intake_receipt { EvidenceRef }\nimport std.types { List }\nfn evidence_of(r: BmcSecurePhaseReceipt) -> List { bmc_secure_phase_receipt_evidence(receipt: r) }\n" @@ -90,3 +90,12 @@ test fn a_controller_clock_reading_in_an_ordering_field_refuses_at_the_seal() -> test fn a_controller_clock_reading_cannot_be_the_read_floor() -> Bool { blocking_count_for_class_and_subject(c: probe(), wanted: "DeclaredTypeNotInhabited", subject: "direct call argument for parameter 'read_floor'") >= 1 } + +// THE PROJECTION IS NOT A CONSTRUCTOR PROXY (side-chat review of 8960bbe511). An outside call to +// project_managed_administrator_readback -- the function that returns the sealed readback -- refuses at +// its admission, as does an outside call to the observation's own mint. +test fn the_readback_projection_and_the_observation_mint_refuse_an_outside_caller() -> Bool { + let c = probe() + blocking_count_for_class_and_subject(c: c, wanted: "ConstructorCallAdmissionRefused", subject: "project_managed_administrator_readback") >= 1 + && blocking_count_for_class_and_subject(c: c, wanted: "ConstructorCallAdmissionRefused", subject: "observed_bmc_account_state") >= 1 +} diff --git a/dag/test/claim/machine_intake/machine_intake_bmc_secure_state_witness_test.dag b/dag/test/claim/machine_intake/machine_intake_bmc_secure_state_witness_test.dag index 35ecddcb2e4..e68bcc140e9 100644 --- a/dag/test/claim/machine_intake/machine_intake_bmc_secure_state_witness_test.dag +++ b/dag/test/claim/machine_intake/machine_intake_bmc_secure_state_witness_test.dag @@ -46,10 +46,12 @@ import extdeps.crypto.mac { MacKeyId } import gunbc.auth.approval_capability { ApprovalCapabilityClaims, ProposeApprove, approval_capability_protocol } import gunbc.auth.approval_broker { Redemption, RedemptionAdmitted } import gunbc.auth.secret_ref_credential { SecretCredentialFetch, SecretCredentialReady, SecretCredentialFetchRefused } -import gunbc.bmc_model { BmcWorld, BmcIpmiUser, BmcPowerOn, bmc_world, bmc_with_ipmi_users } +import gunbc.bmc_model { BmcWorld, BmcIpmiUser, BmcPowerOn, bmc_world, bmc_with_ipmi_users, bmc_with_ipmi_user_access, bmc_ipmi_get_user_access } +import v2.std.algebra { any, filter } import gunbc.machine_intake_bmc_rotation_route { IpmiSetUserPrivilegeLimit, RotationApplyRouteForAnotherOperation, RotationApplyRouteEffectUnobserved, RotationApplyWouldLeaveNoAdministrator, rotation_route_candidate, PublicStandardOperation, + ManagedReadbackFromAnotherRun, ManagedAccountNotAdministratorOnChannel, BmcRotationRouteStanding, BmcAccountWriteRequest, IpmiSetUserPassword, @@ -74,6 +76,7 @@ import gunbc.machine_intake_bmc_rotation_route { } import gunbc.machine_intake_bmc_secure { ChannelCloseInput, ChannelCloseRouteNotSupplied, ChannelCloseApprovalAbsent, ChannelWriteNotAdmitted, + PlanPrecedesReading, ManagedUserNotTheAuthenticatedAccount, BmcSecureGoal, BmcAccountActionDue, PublishedGenerationNotGoalBound, @@ -294,7 +297,22 @@ fn read(w: BmcWorld, subject: MachineIntakeSubject, managed: ManagedCredentialRe read_with(w: w, subject: subject, managed: managed, managed_password: managed_password, census_value: census(published_lan_privilege_closed: closed), account: PublishedAccountRetired, at: at) } +// THE WORLD HOLDS THE CHANNEL ACCESS, AND THE READ TAKES IT FROM THERE. seeded adds the supplied census's +// Get User Access rows to the world only for (channel, user) pairs the world does not already hold, so a +// row a channel-access write set is kept, and a read after the write reports the write -- never the +// census the scenario started from. +fn seeded(w: BmcWorld, census_value: IpmiControllerChannelCensus) -> BmcWorld { + bmc_with_ipmi_user_access( + world: w, + rows: concat(w.ipmi_user_access, filter(census_value.user_access, r => !any(w.ipmi_user_access, h => (h.user as Int) == (r.user as Int) && (h.channel as Int) == (r.channel as Int)))), + ) +} + fn read_with(w: BmcWorld, subject: MachineIntakeSubject, managed: ManagedCredentialReference, managed_password: String, census_value: IpmiControllerChannelCensus, account: PublishedAccountKind, at: EpochMs) -> BmcAccountStateObservation { + read_in(w: seeded(w: w, census_value: census_value), subject: subject, managed: managed, managed_password: managed_password, census_value: census_value, account: account, attempt: "attempt-1", at: at) +} + +fn read_in(w: BmcWorld, subject: MachineIntakeSubject, managed: ManagedCredentialReference, managed_password: String, census_value: IpmiControllerChannelCensus, account: PublishedAccountKind, attempt: String, at: EpochMs) -> BmcAccountStateObservation { dry_read_bmc_account_state( world: w, subject: subject, @@ -309,6 +327,7 @@ fn read_with(w: BmcWorld, subject: MachineIntakeSubject, managed: ManagedCredent published_account: account, break_glass: goal_break_glass_ref(), break_glass_password: break_glass_password, + attempt: attempt as AttemptIdentity, read_at_millis: at, ) } @@ -476,7 +495,11 @@ fn plan_with( } fn plan_closing(reading: BmcAccountStateObservation, channel_close: ChannelCloseInput?) -> BmcAccountPlanOutcome? { - plan_full_closing(reading: reading, goal: goal_v1(), managed_route: grounded_route(user: managed_user), managed_generation_value: managed_generation(version: "2", fetch_at: t_fetch), published_generation_value: break_glass_generation(), channel_close: channel_close, planned_at: t_plan) + plan_closing_as(reading: reading, claimed_managed_user: managed_user, channel_close: channel_close) +} + +fn plan_closing_as(reading: BmcAccountStateObservation, claimed_managed_user: IpmiUserId, channel_close: ChannelCloseInput?) -> BmcAccountPlanOutcome? { + plan_full_as(reading: reading, goal: goal_v1(), claimed_managed_user: claimed_managed_user, managed_route: grounded_route(user: managed_user), managed_generation_value: managed_generation(version: "2", fetch_at: t_fetch), published_generation_value: break_glass_generation(), channel_close: channel_close, planned_at: t_plan) } fn plan_full( @@ -498,6 +521,19 @@ fn plan_full_closing( published_generation_value: ManagedCredentialGenerationFetched?, channel_close: ChannelCloseInput?, planned_at: EpochMs, +) -> BmcAccountPlanOutcome? { + plan_full_as(reading: reading, goal: goal, claimed_managed_user: managed_user, managed_route: managed_route, managed_generation_value: managed_generation_value, published_generation_value: published_generation_value, channel_close: channel_close, planned_at: planned_at) +} + +fn plan_full_as( + reading: BmcAccountStateObservation, + goal: BmcSecureGoal, + claimed_managed_user: IpmiUserId, + managed_route: BmcRotationRouteStanding, + managed_generation_value: ManagedCredentialGenerationFetched?, + published_generation_value: ManagedCredentialGenerationFetched?, + channel_close: ChannelCloseInput?, + planned_at: EpochMs, ) -> BmcAccountPlanOutcome? { match managed_generation_value { Absent => none @@ -510,7 +546,7 @@ fn plan_full_closing( subject: lab_subject(), goal: goal, reading: reading, - managed_user: managed_user, + managed_user: claimed_managed_user, managed_route: managed_route, managed_approval: rotation_approval(s: managed_route, user: route_user(s: managed_route)), managed_generation: mg, @@ -541,7 +577,12 @@ fn admission_label(a: RotationApplyAdmission) -> String { RotationApplyApprovalForAnotherRequest { approved: _, requested: _ } => "another-request" RotationApplyRouteForAnotherOperation { grounded: _, requested: _ } => "another-operation" RotationApplyRouteEffectUnobserved { standing: _ } => "effect-unobserved" - RotationApplyWouldLeaveNoAdministrator { channel: _, cause: _ } => "would-leave-no-administrator" + RotationApplyWouldLeaveNoAdministrator { channel: _, cause: c } => + match c { + ManagedReadbackFromAnotherRun { readback: _, approved: _ } => "would-leave-no-administrator:another-run" + ManagedAccountNotAdministratorOnChannel { managed_user: _ } => "would-leave-no-administrator:not-administrator-on-channel" + _ => "would-leave-no-administrator" + } } } @@ -579,6 +620,8 @@ fn plan_label(o: BmcAccountPlanOutcome?) -> String { PublishedGenerationNotGoalBound { generation: _, goal: _ } => "published-generation-not-goal-bound" GenerationFetchedAfterPlan { target: _, fetched_at: _, planned_at: _ } => "fetched-after-plan" PlanPrecedesDivergedReading { read_floor: _, planned_at: _ } => "plan-precedes-reading" + PlanPrecedesReading { planned_at: _ } => "plan-precedes-reading" + ManagedUserNotTheAuthenticatedAccount { supplied: _, authenticated: _ } => "managed-user-not-authenticated-account" ChannelCloseRouteNotSupplied { channels: _ } => "channel-close-route-not-supplied" ChannelCloseApprovalAbsent { channel: _ } => "channel-close-approval-absent" ChannelWriteNotAdmitted { channel: _, admission: a } => join(["channel-write-not-admitted:", admission_label(a: a)], "") @@ -907,3 +950,75 @@ test fn an_apply_whose_post_read_fails_the_goal_generation_mints_no_receipt() -> readback_at: t_readback, ) == join(["refused:post-read-not-held:", apply_on_finding(finding: BreakGlassGenerationRejected)], "") } + +// ── the projection's inputs come from the observation producer (side-chat review of 8960bbe511) ─── + +fn close_ch2() -> BmcAccountWriteRequest { + IpmiSetUserPrivilegeLimit { access: ipmi_user_channel_access(channel: 2, user: published_user, privilege: IpmiPrivilegeNoAccess) } +} + +fn close_approval_in(route: BmcRotationRouteStanding, attempt: String) -> Redemption { + RedemptionAdmitted { + claims: ApprovalCapabilityClaims { + protocol: approval_capability_protocol, + issuer: "gunbc-approval-broker" as NonEmptyStr, + audience: "srv1" as NonEmptyStr, + authority: rotation_apply_authority, + escalation_id: "o1a2-close" as NonEmptyStr, + request_revision: rotation_route_request_identity(standing: route, request: close_ch2()), + decision: ProposeApprove, + attempt: attempt as AttemptIdentity, + issued_at: "2026-10-05T00:00:00Z", + expires_at: "2026-10-05T00:15:00Z", + key_id: "broker-2026-10" as MacKeyId, + }, + decided_by: "operator" as NonEmptyStr, + } +} + +// On the REAL plan path, with the published account open on channel 2: read A (attempt-1) with an +// approval for run B refuses as another run; A with A plans the one write; a reading in which another +// user (4), not the authenticated managed user, holds ADMINISTRATOR on channel 2 refuses; and a plan +// claiming a managed user other than the one the read authenticated refuses. A read later than the plan +// refuses at PlanPrecedesDivergedReading (the dry read takes every reading at one instant). +test fn the_channel_close_readback_is_bound_to_the_observed_run_and_account() -> Bool { + let route = rotation_route_from_citation(endpoint: lab_endpoint, firmware: lab_firmware(), request: close_ch2(), citation: lab_route_fixture_citation) + let base = census_with(serial_privilege_open: true, unaddressed_lan_open: false) + let other_admin = ipmi_controller_channel_census(members: base.members, user_access: concat(base.user_access, [ipmi_user_channel_access(channel: 2, user: 4, privilege: IpmiPrivilegeAdministrator)])) + let a = secured_read(census_value: census_with_managed_row(managed_on_2: true), account: PublishedAccountRetired) + let later = read_with(w: world_secured(), subject: lab_subject(), managed: managed_ref(version: "1", epoch: 1), managed_password: managed_password_v1, census_value: census_with_managed_row(managed_on_2: true), account: PublishedAccountRetired, at: t_plan + 1) + channel_plan_label(o: plan_closing(reading: a, channel_close: Present { value: ChannelCloseInput { route: route, approvals: [close_approval_in(route: route, attempt: "attempt-2")] } })) == "channel-write-not-admitted:would-leave-no-administrator:another-run" + && channel_plan_label(o: plan_closing(reading: a, channel_close: Present { value: ChannelCloseInput { route: route, approvals: [close_approval_in(route: route, attempt: "attempt-1")] } })) == "planned:1" + && channel_plan_label(o: plan_closing(reading: secured_read(census_value: other_admin, account: PublishedAccountRetired), channel_close: Present { value: ChannelCloseInput { route: route, approvals: [close_approval_in(route: route, attempt: "attempt-1")] } })) == "channel-write-not-admitted:would-leave-no-administrator:not-administrator-on-channel" + && channel_plan_label(o: plan_closing_as(reading: a, claimed_managed_user: 4, channel_close: Present { value: ChannelCloseInput { route: route, approvals: [close_approval_in(route: route, attempt: "attempt-1")] } })) == "managed-user-not-authenticated-account" + && channel_plan_label(o: plan_closing(reading: later, channel_close: Present { value: ChannelCloseInput { route: route, approvals: [close_approval_in(route: route, attempt: "attempt-1")] } })) == "plan-precedes-reading" +} + +// ── one nonempty real plan through the dry application, the post-read and the phase (item 3) ───── + +// The published account open on serial channel 2, the managed account ADMINISTRATOR there. The plan's +// one channel write runs through dry_apply_bmc_account_plan; the post-read takes channel access from +// the RESULTING world (not from the census the scenario started with), and the phase converges. +// The world then holds the published user at NO ACCESS on channel 2 and the managed user still at +// ADMINISTRATOR there. +test fn a_planned_channel_close_is_applied_read_back_and_converges() -> Bool { + let route = rotation_route_from_citation(endpoint: lab_endpoint, firmware: lab_firmware(), request: close_ch2(), citation: lab_route_fixture_citation) + let layout = census_with_managed_row(managed_on_2: true) + let initial = seeded(w: world_secured(), census_value: layout) + let before = read_in(w: initial, subject: lab_subject(), managed: managed_ref(version: "1", epoch: 1), managed_password: managed_password_v1, census_value: layout, account: PublishedAccountRetired, attempt: "attempt-1", at: t_read) + match plan_closing(reading: before, channel_close: Present { value: ChannelCloseInput { route: route, approvals: [close_approval_in(route: route, attempt: "attempt-1")] } }) { + Absent => false + Present { value: o } => + match o { + BmcAccountPlanRefused { cause: _ } => false + BmcAccountPlanned { plan: p } => { + let step = dry_apply_bmc_account_plan(world: initial, plan: p, managed_fetch: managed_v2_fetch(), published_fetch: ready(secret: "bmc-lab-o1b-admin", version: "4", bytes: break_glass_password), applied_at_millis: t_apply) + let after = read_in(w: step.world, subject: lab_subject(), managed: p.goal.managed, managed_password: managed_password_v2, census_value: layout, account: PublishedAccountRetired, attempt: "attempt-1", at: t_readback) + list_length(items: p.channel_writes) == 1 + && phase_label(o: bmc_secure_phase_applied(application: step.application, post_read: after)) == "converged:applied" + && match bmc_ipmi_get_user_access(world: step.world, user: published_user, channel: 2) { Present { value: v } => v == IpmiPrivilegeNoAccess Absent => false } + && match bmc_ipmi_get_user_access(world: step.world, user: managed_user, channel: 2) { Present { value: v } => v == IpmiPrivilegeAdministrator Absent => false } + } + } + } +} From 8a240662e415c0fc74add7f6fe28d414a7209214 Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Mon, 5 Oct 2026 04:43:37 +0000 Subject: [PATCH 16/22] O1a-2: admit the two new channel-close claims to the citation mint (floor finding at 7264e4e) Co-Authored-By: Claude Opus 5.5 (1M context) --- dag/gunbc/machine_intake/bmc_rotation_route.dag | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dag/gunbc/machine_intake/bmc_rotation_route.dag b/dag/gunbc/machine_intake/bmc_rotation_route.dag index 47121d3f5d1..c876a4b93b9 100644 --- a/dag/gunbc/machine_intake/bmc_rotation_route.dag +++ b/dag/gunbc/machine_intake/bmc_rotation_route.dag @@ -153,6 +153,8 @@ fn rotation_route_from_citation( decl_ref(module_path: "test.claim.machine_intake_bmc_secure_state_witness", decl_name: "cited_lab_route_published_user"), decl_ref(module_path: "test.claim.machine_intake_bmc_secure_state_witness", decl_name: "cited_lab_route_managed_user_previous_build"), decl_ref(module_path: "test.claim.machine_intake_bmc_secure_state_witness", decl_name: "an_open_channel_is_closed_only_over_a_grounded_channel_access_route"), + decl_ref(module_path: "test.claim.machine_intake_bmc_secure_state_witness", decl_name: "the_channel_close_readback_is_bound_to_the_observed_run_and_account"), + decl_ref(module_path: "test.claim.machine_intake_bmc_secure_state_witness", decl_name: "a_planned_channel_close_is_applied_read_back_and_converges"), ] { BmcRotationRouteStanding { From 111316ffcacfac12f04e4617420d9130241ffcc4 Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Mon, 5 Oct 2026 05:10:02 +0000 Subject: [PATCH 17/22] O1a-2: exhaustive arms over RotationApplyAdmission in admitted_channel_writes (non-fold residue finding at 8a24066) Co-Authored-By: Claude Opus 5.5 (1M context) --- dag/gunbc/machine_intake/bmc_secure.dag | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/dag/gunbc/machine_intake/bmc_secure.dag b/dag/gunbc/machine_intake/bmc_secure.dag index 15a67e16616..3649c34b308 100644 --- a/dag/gunbc/machine_intake/bmc_secure.dag +++ b/dag/gunbc/machine_intake/bmc_secure.dag @@ -1950,7 +1950,16 @@ fn admitted_channel_writes(observed: BmcAccountStateObservation, input: ChannelC match admission { RotationApplyAdmitted { standing: st, request: req, decided_by: by } => ChannelWritesAdmitted { writes: concat(done, [PlannedChannelAccessWrite { channel: ch, route: st, request: req, decided_by: by }]) } - _ => ChannelWritesRefused { cause: ChannelWriteNotAdmitted { channel: ch, admission: admission } } + RotationApplyRouteNotGrounded { standing: _ } => ChannelWritesRefused { cause: ChannelWriteNotAdmitted { channel: ch, admission: admission } } + RotationApplyRouteForAnotherController { route_endpoint: _, target_endpoint: _ } => ChannelWritesRefused { cause: ChannelWriteNotAdmitted { channel: ch, admission: admission } } + RotationApplyRouteForAnotherBuild { route_firmware: _, target_firmware: _ } => ChannelWritesRefused { cause: ChannelWriteNotAdmitted { channel: ch, admission: admission } } + RotationApplyRouteForAnotherOperation { grounded: _, requested: _ } => ChannelWritesRefused { cause: ChannelWriteNotAdmitted { channel: ch, admission: admission } } + RotationApplyRouteEffectUnobserved { standing: _ } => ChannelWritesRefused { cause: ChannelWriteNotAdmitted { channel: ch, admission: admission } } + RotationApplyApprovalRefused { cause: _ } => ChannelWritesRefused { cause: ChannelWriteNotAdmitted { channel: ch, admission: admission } } + RotationApplyApprovalDenied => ChannelWritesRefused { cause: ChannelWriteNotAdmitted { channel: ch, admission: admission } } + RotationApplyApprovalForAnotherAuthority { authority: _ } => ChannelWritesRefused { cause: ChannelWriteNotAdmitted { channel: ch, admission: admission } } + RotationApplyApprovalForAnotherRequest { approved: _, requested: _ } => ChannelWritesRefused { cause: ChannelWriteNotAdmitted { channel: ch, admission: admission } } + RotationApplyWouldLeaveNoAdministrator { channel: _, cause: _ } => ChannelWritesRefused { cause: ChannelWriteNotAdmitted { channel: ch, admission: admission } } } } } From d5affb19633d18f75ade48e378fd92d8e94a9c87 Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Mon, 5 Oct 2026 05:52:24 +0000 Subject: [PATCH 18/22] O1a-2: O1b witness expectations follow the labels the code produces (route-for-user-2 approval refuses as another request; Apply decision label carries its finding; retention cause suffix) Co-Authored-By: Claude Opus 5.5 (1M context) --- .../machine_intake_bmc_secure_state_witness_test.dag | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dag/test/claim/machine_intake/machine_intake_bmc_secure_state_witness_test.dag b/dag/test/claim/machine_intake/machine_intake_bmc_secure_state_witness_test.dag index e68bcc140e9..9c779ce3751 100644 --- a/dag/test/claim/machine_intake/machine_intake_bmc_secure_state_witness_test.dag +++ b/dag/test/claim/machine_intake/machine_intake_bmc_secure_state_witness_test.dag @@ -798,7 +798,7 @@ test fn the_plan_refuses_a_stale_or_foreign_generation_and_a_foreign_reading() - plan_label(o: plan_with(reading: reading, goal: goal_v1(), managed_route: grounded_route(user: managed_user), managed_generation_value: break_glass_generation(), planned_at: t_plan)) == "generation-another-account" && plan_label(o: plan_with(reading: read(w: world_factory_open(), subject: lab_subject(), managed: managed_ref(version: "2", epoch: 2), managed_password: managed_password_v1, closed: true, at: t_read), goal: stale_goal, managed_route: grounded_route(user: managed_user), managed_generation_value: managed_generation(version: "2", fetch_at: t_fetch), planned_at: t_plan)) == "generation-not-advanced" && plan_label(o: plan_default(reading: foreign)) == "unobserved" - && plan_label(o: plan_with(reading: reading, goal: goal_v1(), managed_route: grounded_route(user: published_user), managed_generation_value: managed_generation(version: "2", fetch_at: t_fetch), planned_at: t_plan)) == "another-user" + && plan_label(o: plan_with(reading: reading, goal: goal_v1(), managed_route: grounded_route(user: published_user), managed_generation_value: managed_generation(version: "2", fetch_at: t_fetch), planned_at: t_plan)) == "not-admitted:another-request" } // ── blocker controls (side-chat review of 07423d29de) ─────────────────────────────────────────── @@ -873,8 +873,8 @@ test fn the_published_replacement_must_be_the_goal_bound_break_glass_generation( // plan refuses unless a channel-access route is supplied -- the missing operation is now a typed plan // refusal, not an assessment refusal. test fn an_open_channel_is_a_deviation_and_the_plan_refuses_without_a_channel_access_route() -> Bool { - assessment_on(reading: secured_read(census_value: census_with(serial_privilege_open: true, unaddressed_lan_open: false), account: PublishedAccountRetired)) == "diverged/apply" - && assessment_on(reading: secured_read(census_value: census_with(serial_privilege_open: false, unaddressed_lan_open: true), account: PublishedAccountRetired)) == "diverged/apply" + string_contains(s: assessment_on(reading: secured_read(census_value: census_with(serial_privilege_open: true, unaddressed_lan_open: false), account: PublishedAccountRetired)), pattern: "diverged/apply:") + && string_contains(s: assessment_on(reading: secured_read(census_value: census_with(serial_privilege_open: false, unaddressed_lan_open: true), account: PublishedAccountRetired)), pattern: "diverged/apply:") && plan_label(o: plan_default(reading: secured_read(census_value: census_with(serial_privilege_open: true, unaddressed_lan_open: false), account: PublishedAccountRetired))) == "channel-close-route-not-supplied" && assessment_on(reading: secured_read(census_value: census_with(serial_privilege_open: false, unaddressed_lan_open: false), account: PublishedAccountRetired)) == "satisfied/noop" } @@ -914,7 +914,7 @@ test fn an_open_channel_is_closed_only_over_a_grounded_channel_access_route() -> channel_plan_label(o: plan_closing(reading: with_admin, channel_close: none)) == "channel-close-route-not-supplied" && channel_plan_label(o: plan_closing(reading: with_admin, channel_close: Present { value: ChannelCloseInput { route: candidate, approvals: exact } })) == "channel-write-not-admitted:route-not-grounded" && channel_plan_label(o: plan_closing(reading: with_admin, channel_close: Present { value: ChannelCloseInput { route: route, approvals: [] } })) == "channel-close-approval-absent" - && channel_plan_label(o: plan_closing(reading: without_admin, channel_close: Present { value: ChannelCloseInput { route: route, approvals: exact } })) == "channel-write-not-admitted:would-leave-no-administrator" + && channel_plan_label(o: plan_closing(reading: without_admin, channel_close: Present { value: ChannelCloseInput { route: route, approvals: exact } })) == "channel-write-not-admitted:would-leave-no-administrator:not-administrator-on-channel" && channel_plan_label(o: plan_closing(reading: with_admin, channel_close: Present { value: ChannelCloseInput { route: route, approvals: exact } })) == "planned:1" } From e2e82594972b8f3f85bd1b4908d5174b291ea894 Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Mon, 5 Oct 2026 06:04:21 +0000 Subject: [PATCH 19/22] O1a-2: one equality for IpmiChannelPrivilegeLimit (direct ==); readback channel typed IpmiChannelNumber; no placeholder channel (reviews 76265, 76211) Co-Authored-By: Claude Opus 5.5 (1M context) --- dag/gunbc/bmc_model.dag | 6 ++-- .../machine_intake/bmc_rotation_route.dag | 35 ++++++++----------- ...intake_bmc_rotation_route_witness_test.dag | 2 +- 3 files changed, 19 insertions(+), 24 deletions(-) diff --git a/dag/gunbc/bmc_model.dag b/dag/gunbc/bmc_model.dag index b72f0337087..0c46980e40b 100644 --- a/dag/gunbc/bmc_model.dag +++ b/dag/gunbc/bmc_model.dag @@ -4,7 +4,7 @@ import std.types { Bool, Int, List } import std.measure { Second, second, second_count } import v2.std.optional { Present, Absent } import v2.std.algebra { any, filter } -import extdeps.bmc.ipmi_channel { IpmiUserId, IpmiUserChannelAccess, IpmiChannelPrivilegeLimit } +import extdeps.bmc.ipmi_channel { IpmiChannelNumber, IpmiUserId, IpmiUserChannelAccess, IpmiChannelPrivilegeLimit } import extdeps.bmc.ipmi_chassis_control { IpmiChassisControlAction, IpmiChassisPowerDown, IpmiChassisPowerUp, IpmiChassisPowerCycle, IpmiChassisHardReset, } @@ -490,8 +490,8 @@ fn bmc_ipmi_set_user_access(world: BmcWorld, access: IpmiUserChannelAccess) -> B // Get User Access for one (channel, user): the readback a channel-access write is judged by, // independent of the write's completion. Absent when the controller holds no row for the pair. -fn bmc_ipmi_get_user_access(world: BmcWorld, user: IpmiUserId, channel: Int) -> IpmiChannelPrivilegeLimit? { +fn bmc_ipmi_get_user_access(world: BmcWorld, user: IpmiUserId, channel: IpmiChannelNumber) -> IpmiChannelPrivilegeLimit? { let wanted: IpmiChannelPrivilegeLimit? = none - filter(world.ipmi_user_access, r => (r.user as Int) == (user as Int) && (r.channel as Int) == channel) + filter(world.ipmi_user_access, r => (r.user as Int) == (user as Int) && (r.channel as Int) == (channel as Int)) |> fold(init: wanted, f: (acc, r) => match acc { Absent => Present { value: r.privilege } Present { value: _ } => acc }) } diff --git a/dag/gunbc/machine_intake/bmc_rotation_route.dag b/dag/gunbc/machine_intake/bmc_rotation_route.dag index c876a4b93b9..b997639aa7c 100644 --- a/dag/gunbc/machine_intake/bmc_rotation_route.dag +++ b/dag/gunbc/machine_intake/bmc_rotation_route.dag @@ -12,7 +12,7 @@ import extdeps.bmc.endpoint { AmiMegaRac, BmcControllerEndpoint, BmcFirmwareFami import extdeps.bmc.capability { BmcFirmwareReleaseIdentity, bmc_firmware_release_identity_eq } import extdeps.bmc.access_profile { BmcAccessSurface } import extdeps.bmc.ipmi_channel { - IpmiUserId, IpmiUserChannelAccess, IpmiChannelPrivilegeLimit, + IpmiUserId, IpmiUserChannelAccess, IpmiChannelPrivilegeLimit, IpmiChannelNumber, IpmiPrivilegeCallback, IpmiPrivilegeUser, IpmiPrivilegeOperator, IpmiPrivilegeAdministrator, IpmiPrivilegeOem, IpmiPrivilegeNoAccess, } import gunbc.machine_intake_receipt { EvidenceRef } @@ -216,7 +216,7 @@ fn account_write_request_eq(a: BmcAccountWriteRequest, b: BmcAccountWriteRequest IpmiSetUserPrivilegeLimit { access: xb } => (xa.user as Int) == (xb.user as Int) && (xa.channel as Int) == (xb.channel as Int) - && ipmi_privilege_eq(a: xa.privilege, b: xb.privilege) + && xa.privilege == xb.privilege RedfishAccountPasswordWrite { transport_operation: _, action_shape: _ } => false } RedfishAccountPasswordWrite { transport_operation: oa, action_shape: sa } => @@ -269,9 +269,6 @@ fn canonical_ipmi_privilege(privilege: IpmiChannelPrivilegeLimit) -> String { } } -fn ipmi_privilege_eq(a: IpmiChannelPrivilegeLimit, b: IpmiChannelPrivilegeLimit) -> Bool { - canonical_ipmi_privilege(privilege: a) == canonical_ipmi_privilege(privilege: b) -} fn canonical_component(text: String) -> String { join([to_string(length(text)), ":", text], "") @@ -400,13 +397,13 @@ fn dry_route_qualification_request(world: BmcWorld, subject: RouteQualificationS match subject.request { RedfishAccountPasswordWrite { transport_operation: _, action_shape: _ } => DryRouteQualificationStep { world: world, response: none } IpmiSetUserPrivilegeLimit { access: x } => { - let before = match bmc_ipmi_get_user_access(world: world, user: x.user, channel: x.channel as Int) { - Present { value: p } => ipmi_privilege_eq(a: p, b: x.privilege) + let before = match bmc_ipmi_get_user_access(world: world, user: x.user, channel: x.channel) { + Present { value: p } => p == x.privilege Absent => false } let step = bmc_ipmi_set_user_access(world: world, access: x) - let accepted = match bmc_ipmi_get_user_access(world: step.world, user: x.user, channel: x.channel as Int) { - Present { value: p } => ipmi_privilege_eq(a: p, b: x.privilege) + let accepted = match bmc_ipmi_get_user_access(world: step.world, user: x.user, channel: x.channel) { + Present { value: p } => p == x.privilege Absent => false } let request_text = join(["modeled ", account_write_request_text(request: subject.request) as String, " at ", subject.endpoint.host as String, " firmware ", subject.firmware.raw_version as String], "") as NonEmptyStr @@ -743,7 +740,7 @@ type RotationApplyAdmission | RotationApplyApprovalDenied | RotationApplyApprovalForAnotherAuthority { authority: NonEmptyStr } | RotationApplyApprovalForAnotherRequest { approved: NonEmptyStr, requested: NonEmptyStr } - | RotationApplyWouldLeaveNoAdministrator { channel: Int, cause: AdministratorRetentionRefusal } + | RotationApplyWouldLeaveNoAdministrator { channel: IpmiChannelNumber, cause: AdministratorRetentionRefusal } // THE LOCKOUT HAZARD IS A REFUSAL, NOT A NOTE. A Set User Access write that lowers a user's privilege // on a channel (anything other than ADMINISTRATOR) could remove the last administrator-capable account @@ -862,13 +859,6 @@ fn administrator_retention_refusal(standing: BmcRotationRouteStanding, request: } } -fn request_channel(request: BmcAccountWriteRequest) -> Int { - match request { - IpmiSetUserPrivilegeLimit { access: x } => x.channel as Int - IpmiSetUserPassword { user: _ } => 0 - RedfishAccountPasswordWrite { transport_operation: _, action_shape: _ } => 0 - } -} fn lowering_request(request: BmcAccountWriteRequest) -> Bool { match request { @@ -952,9 +942,14 @@ fn admit_rotation_apply( } else if cl.request_revision != rotation_route_request_identity(standing: standing, request: request) { RotationApplyApprovalForAnotherRequest { approved: cl.request_revision, requested: rotation_route_request_identity(standing: standing, request: request) } } else { - match administrator_retention_refusal(standing: standing, request: request, readback: managed_readback, approved_attempt: cl.attempt) { - Present { value: c } => RotationApplyWouldLeaveNoAdministrator { channel: request_channel(request: request), cause: c } - Absent => RotationApplyAdmitted { standing: standing, request: request, decided_by: by } + match request { + IpmiSetUserPrivilegeLimit { access: x } => + match administrator_retention_refusal(standing: standing, request: request, readback: managed_readback, approved_attempt: cl.attempt) { + Present { value: c } => RotationApplyWouldLeaveNoAdministrator { channel: x.channel, cause: c } + Absent => RotationApplyAdmitted { standing: standing, request: request, decided_by: by } + } + IpmiSetUserPassword { user: _ } => RotationApplyAdmitted { standing: standing, request: request, decided_by: by } + RedfishAccountPasswordWrite { transport_operation: _, action_shape: _ } => RotationApplyAdmitted { standing: standing, request: request, decided_by: by } } } } diff --git a/dag/test/claim/machine_intake/machine_intake_bmc_rotation_route_witness_test.dag b/dag/test/claim/machine_intake/machine_intake_bmc_rotation_route_witness_test.dag index c109805df60..bafb24fd09d 100644 --- a/dag/test/claim/machine_intake/machine_intake_bmc_rotation_route_witness_test.dag +++ b/dag/test/claim/machine_intake/machine_intake_bmc_rotation_route_witness_test.dag @@ -541,7 +541,7 @@ fn lockout_verdict(readback: ManagedAdministratorReadback?) -> String { ) { RotationApplyAdmitted { standing: _, request: _, decided_by: _ } => "admitted" RotationApplyWouldLeaveNoAdministrator { channel: ch, cause: c } => - if ch != 2 { "wrong-channel" } else { + if (ch as Int) != 2 { "wrong-channel" } else { match c { ManagedReadbackAbsent => "readback-absent" ManagedReadbackFromAnotherController { readback: _, route: _ } => "another-controller" From ca9ca59f47716930b4cf3b149e24ec6be4592e45 Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Mon, 5 Oct 2026 07:00:24 +0000 Subject: [PATCH 20/22] O1a-2: the controller-clock read-floor wall re-pointed at the dry read's schedule argument (the mint now admits only the dry read) Co-Authored-By: Claude Opus 5.5 (1M context) --- ...ake_bmc_secure_state_forged_probe_witness_test.dag | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/dag/test/claim/machine_intake/machine_intake_bmc_secure_state_forged_probe_witness_test.dag b/dag/test/claim/machine_intake/machine_intake_bmc_secure_state_forged_probe_witness_test.dag index fd3fba1af20..7ebb1dd7a8b 100644 --- a/dag/test/claim/machine_intake/machine_intake_bmc_secure_state_forged_probe_witness_test.dag +++ b/dag/test/claim/machine_intake/machine_intake_bmc_secure_state_forged_probe_witness_test.dag @@ -17,7 +17,7 @@ data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly // diagnostic-census harness and requires each refusal CLASS at its SUBJECT by name, so a probe refusing // for another reason measures another wall; the class-scoped control shows a clean source reading the // same modules emits none of them. -data forged_probe_source: String = "module probe_bmc_secure_state_forged\n\nimport std.types { Bool, EpochMs, NonEmptyStr, String }\nimport std.content_hash { content_hash_of_value }\nimport gunbc.clock_read { ObserverClockInstant, ObserverClockModeled, observer_clock_modeled }\nimport gunbc.machine_intake_receipt { EvidenceRef }\nimport gunbc.machine_intake_bmc_rotation_route { BmcRotationRouteStanding }\nimport test.claim.machine_intake_bmc_secure_state_witness { cited_lab_route_managed_user }\nimport gunbc.machine_intake_subject { MachineIntakeSubject }\nimport extdeps.bmc.endpoint { BmcControllerEndpoint }\nimport extdeps.bmc.capability { BmcFirmwareReleaseIdentity }\nimport extdeps.bmc.ipmi_channel { IpmiControllerChannelCensus }\nimport gunbc.machine_intake_bmc_secure {\n ControllerClockReading, ObservedCredentialProbe, ObservedCredentialAccepted,\n ManagedCredentialGenerationStored, ManagedCredentialGenerationFetched, BmcAccountActionPlan,\n BmcAccountApplication, BmcSecurePhaseReceipt, BmcAccountStateObservation,\n ManagedCredentialReference, ObservedPublishedAccount, observed_bmc_account_state,\n ObservedReading, PublishedAccountKind, project_managed_administrator_readback,\n}\nimport std.scoped_authorization { AttemptIdentity }\nimport gunbc.machine_intake_bmc_rotation_route { ManagedAdministratorReadback }\n\nfn evidence() -> EvidenceRef {\n EvidenceRef { label: \"forged\", digest: content_hash_of_value(value: \"forged\" as NonEmptyStr) }\n}\n\nfn forged_instant() -> ObserverClockInstant {\n ObserverClockInstant { millis: 946684800000, source: ObserverClockModeled { realization: \"forged\" } }\n}\n\nfn forged_modeled_instant() -> ObserverClockInstant {\n observer_clock_modeled(millis: 946684800000, realization: \"forged\" as NonEmptyStr)\n}\n\nfn controller_time_as_read_floor(\n subject: MachineIntakeSubject,\n endpoint: BmcControllerEndpoint,\n firmware: BmcFirmwareReleaseIdentity,\n managed: ManagedCredentialReference,\n reading: ControllerClockReading,\n probe: ObservedCredentialProbe,\n census: IpmiControllerChannelCensus,\n instant: ObserverClockInstant,\n account: ObservedPublishedAccount,\n) -> BmcAccountStateObservation {\n observed_bmc_account_state(\n subject: subject,\n endpoint: endpoint,\n firmware: firmware,\n managed: managed,\n managed_user: 3,\n attempt: \"forged\" as AttemptIdentity,\n read_floor: reading,\n managed_probe: probe,\n channel_census: census,\n census_evidence: evidence(),\n census_observed_at: instant,\n published_probes: [],\n published_user: 2,\n published_account: account,\n break_glass: managed,\n break_glass_probe: probe,\n controller_clock: none,\n )\n}\n\nfn readback_through_the_projection(o: BmcAccountStateObservation) -> ManagedAdministratorReadback? {\n project_managed_administrator_readback(observed: o)\n}\n\nfn forged_stored(s: ManagedCredentialGenerationStored) -> ManagedCredentialGenerationStored {\n ManagedCredentialGenerationStored { reference: s.reference, stored_version: s.stored_version, stored_at: s.stored_at }\n}\n\nfn forged_fetched(s: ManagedCredentialGenerationStored) -> ManagedCredentialGenerationFetched {\n ManagedCredentialGenerationFetched { stored: s, fetched_at: s.stored_at }\n}\n\nfn forged_application(p: BmcAccountActionPlan) -> BmcAccountApplication {\n BmcAccountApplication {\n plan: p,\n managed_write_completed: true,\n published_write_completed: true,\n request_receipt: evidence(),\n response_receipt: evidence(),\n applied_at: p.planned_at,\n }\n}\n\nfn forged_receipt(r: BmcSecurePhaseReceipt) -> BmcSecurePhaseReceipt {\n BmcSecurePhaseReceipt { subject: r.subject, phase: r.phase, goal: r.goal, decision: r.decision, held: r.held }\n}\n\nfn forged_plan(p: BmcAccountActionPlan) -> BmcAccountActionPlan {\n BmcAccountActionPlan {\n subject: p.subject,\n endpoint: p.endpoint,\n firmware: p.firmware,\n goal: p.goal,\n diverged: p.diverged,\n due: p.due,\n managed_write: p.managed_write,\n published_write: p.published_write,\n planned_at: p.planned_at,\n }\n}\n\nfn forged_observation(o: BmcAccountStateObservation) -> BmcAccountStateObservation {\n BmcAccountStateObservation {\n subject: o.subject,\n endpoint: o.endpoint,\n managed: o.managed,\n read_floor: o.read_floor,\n managed_probe: o.managed_probe,\n channel_census: o.channel_census,\n census_evidence: o.census_evidence,\n census_observed_at: o.census_observed_at,\n published_probes: o.published_probes,\n published_user: o.published_user,\n published_account: o.published_account,\n controller_clock: o.controller_clock,\n }\n}\n\nfn controller_time_in_a_reading_field(reading: ControllerClockReading) -> ObservedReading {\n ObservedReading { evidence: evidence(), observed_at: reading }\n}\n\nfn controller_time_in_an_account_field(kind: PublishedAccountKind, reading: ControllerClockReading) -> ObservedPublishedAccount {\n ObservedPublishedAccount { kind: kind, evidence: evidence(), observed_at: reading }\n}\n\nfn borrowed_fixture_route() -> BmcRotationRouteStanding {\n cited_lab_route_managed_user()\n}\n" +data forged_probe_source: String = "module probe_bmc_secure_state_forged\n\nimport std.types { Bool, EpochMs, NonEmptyStr, String }\nimport std.content_hash { content_hash_of_value }\nimport gunbc.clock_read { ObserverClockInstant, ObserverClockModeled, observer_clock_modeled }\nimport gunbc.machine_intake_receipt { EvidenceRef }\nimport gunbc.machine_intake_bmc_rotation_route { BmcRotationRouteStanding }\nimport test.claim.machine_intake_bmc_secure_state_witness { cited_lab_route_managed_user }\nimport gunbc.machine_intake_subject { MachineIntakeSubject }\nimport extdeps.bmc.endpoint { BmcControllerEndpoint }\nimport extdeps.bmc.capability { BmcFirmwareReleaseIdentity }\nimport extdeps.bmc.ipmi_channel { IpmiControllerChannelCensus }\nimport gunbc.machine_intake_bmc_secure {\n ControllerClockReading, ObservedCredentialProbe, ObservedCredentialAccepted,\n ManagedCredentialGenerationStored, ManagedCredentialGenerationFetched, BmcAccountActionPlan,\n BmcAccountApplication, BmcSecurePhaseReceipt, BmcAccountStateObservation,\n ManagedCredentialReference, ObservedPublishedAccount, observed_bmc_account_state,\n ObservedReading, PublishedAccountKind, project_managed_administrator_readback, dry_read_bmc_account_state,\n}\nimport gunbc.bmc_model { BmcWorld }\nimport std.scoped_authorization { AttemptIdentity }\nimport gunbc.machine_intake_bmc_rotation_route { ManagedAdministratorReadback }\n\nfn evidence() -> EvidenceRef {\n EvidenceRef { label: \"forged\", digest: content_hash_of_value(value: \"forged\" as NonEmptyStr) }\n}\n\nfn forged_instant() -> ObserverClockInstant {\n ObserverClockInstant { millis: 946684800000, source: ObserverClockModeled { realization: \"forged\" } }\n}\n\nfn forged_modeled_instant() -> ObserverClockInstant {\n observer_clock_modeled(millis: 946684800000, realization: \"forged\" as NonEmptyStr)\n}\n\nfn controller_time_as_read_floor(\n subject: MachineIntakeSubject,\n endpoint: BmcControllerEndpoint,\n firmware: BmcFirmwareReleaseIdentity,\n managed: ManagedCredentialReference,\n reading: ControllerClockReading,\n probe: ObservedCredentialProbe,\n census: IpmiControllerChannelCensus,\n instant: ObserverClockInstant,\n account: ObservedPublishedAccount,\n) -> BmcAccountStateObservation {\n observed_bmc_account_state(\n subject: subject,\n endpoint: endpoint,\n firmware: firmware,\n managed: managed,\n managed_user: 3,\n attempt: \"forged\" as AttemptIdentity,\n read_floor: reading,\n managed_probe: probe,\n channel_census: census,\n census_evidence: evidence(),\n census_observed_at: instant,\n published_probes: [],\n published_user: 2,\n published_account: account,\n break_glass: managed,\n break_glass_probe: probe,\n controller_clock: none,\n )\n}\n\nfn readback_through_the_projection(o: BmcAccountStateObservation) -> ManagedAdministratorReadback? {\n project_managed_administrator_readback(observed: o)\n}\n\nfn controller_time_as_read_schedule(\n w: BmcWorld,\n subject: MachineIntakeSubject,\n endpoint: BmcControllerEndpoint,\n firmware: BmcFirmwareReleaseIdentity,\n managed: ManagedCredentialReference,\n census: IpmiControllerChannelCensus,\n account: PublishedAccountKind,\n reading: ControllerClockReading,\n) -> BmcAccountStateObservation {\n dry_read_bmc_account_state(\n world: w,\n subject: subject,\n endpoint: endpoint,\n firmware: firmware,\n managed: managed,\n managed_user: 3,\n managed_password: \"x\",\n census: census,\n published_user: 2,\n published_password: \"x\",\n published_account: account,\n break_glass: managed,\n break_glass_password: \"x\",\n attempt: \"forged\" as AttemptIdentity,\n read_at_millis: reading,\n )\n}\n\nfn forged_stored(s: ManagedCredentialGenerationStored) -> ManagedCredentialGenerationStored {\n ManagedCredentialGenerationStored { reference: s.reference, stored_version: s.stored_version, stored_at: s.stored_at }\n}\n\nfn forged_fetched(s: ManagedCredentialGenerationStored) -> ManagedCredentialGenerationFetched {\n ManagedCredentialGenerationFetched { stored: s, fetched_at: s.stored_at }\n}\n\nfn forged_application(p: BmcAccountActionPlan) -> BmcAccountApplication {\n BmcAccountApplication {\n plan: p,\n managed_write_completed: true,\n published_write_completed: true,\n request_receipt: evidence(),\n response_receipt: evidence(),\n applied_at: p.planned_at,\n }\n}\n\nfn forged_receipt(r: BmcSecurePhaseReceipt) -> BmcSecurePhaseReceipt {\n BmcSecurePhaseReceipt { subject: r.subject, phase: r.phase, goal: r.goal, decision: r.decision, held: r.held }\n}\n\nfn forged_plan(p: BmcAccountActionPlan) -> BmcAccountActionPlan {\n BmcAccountActionPlan {\n subject: p.subject,\n endpoint: p.endpoint,\n firmware: p.firmware,\n goal: p.goal,\n diverged: p.diverged,\n due: p.due,\n managed_write: p.managed_write,\n published_write: p.published_write,\n planned_at: p.planned_at,\n }\n}\n\nfn forged_observation(o: BmcAccountStateObservation) -> BmcAccountStateObservation {\n BmcAccountStateObservation {\n subject: o.subject,\n endpoint: o.endpoint,\n managed: o.managed,\n read_floor: o.read_floor,\n managed_probe: o.managed_probe,\n channel_census: o.channel_census,\n census_evidence: o.census_evidence,\n census_observed_at: o.census_observed_at,\n published_probes: o.published_probes,\n published_user: o.published_user,\n published_account: o.published_account,\n controller_clock: o.controller_clock,\n }\n}\n\nfn controller_time_in_a_reading_field(reading: ControllerClockReading) -> ObservedReading {\n ObservedReading { evidence: evidence(), observed_at: reading }\n}\n\nfn controller_time_in_an_account_field(kind: PublishedAccountKind, reading: ControllerClockReading) -> ObservedPublishedAccount {\n ObservedPublishedAccount { kind: kind, evidence: evidence(), observed_at: reading }\n}\n\nfn borrowed_fixture_route() -> BmcRotationRouteStanding {\n cited_lab_route_managed_user()\n}\n" data harness_control_source: String = "module probe_bmc_secure_state_harness_control\nimport gunbc.machine_intake_bmc_secure { BmcSecurePhaseReceipt, bmc_secure_phase_receipt_evidence }\nimport gunbc.machine_intake_receipt { EvidenceRef }\nimport std.types { List }\nfn evidence_of(r: BmcSecurePhaseReceipt) -> List { bmc_secure_phase_receipt_evidence(receipt: r) }\n" @@ -87,8 +87,15 @@ test fn a_controller_clock_reading_in_an_ordering_field_refuses_at_the_seal() -> // ObserverClockInstant RECORD FIELD is accepted today -- gunbc.recurring_failure_mode // record_field_admits_a_distinct_product_value, which carries this specimen -- so the sealed // observation mint is the route this claim covers. +// SINCE cut O1a-2 THE OBSERVATION MINT ADMITS ONLY THE DRY READ, so the call above now refuses at the +// mint's admission (pinned in the_readback_projection_and_the_observation_mint_refuse_an_outside_caller) +// before its read_floor argument is judged. The read floor's only admitted producer takes the observer +// schedule as read_at_millis: EpochMs, and a controller's clock reading in that position is refused at +// the call argument -- the same wall, at the one route that can now reach the floor. test fn a_controller_clock_reading_cannot_be_the_read_floor() -> Bool { - blocking_count_for_class_and_subject(c: probe(), wanted: "DeclaredTypeNotInhabited", subject: "direct call argument for parameter 'read_floor'") >= 1 + let c = probe() + blocking_count_for_class_and_subject(c: c, wanted: "DeclaredTypeNotInhabited", subject: "direct call argument for parameter 'read_at_millis'") >= 1 + && blocking_count_for_class_and_subject(c: c, wanted: "ConstructorCallAdmissionRefused", subject: "observed_bmc_account_state") >= 1 } // THE PROJECTION IS NOT A CONSTRUCTOR PROXY (side-chat review of 8960bbe511). An outside call to From 74b10e4d9155959a650bf44c80cb0a0c8c5d71f3 Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Mon, 5 Oct 2026 08:18:18 +0000 Subject: [PATCH 21/22] O1a-2: the read-floor wall is the observation mint's admission (the argument-type diagnostic is no longer reached) Co-Authored-By: Claude Opus 5.5 (1M context) --- ...c_secure_state_forged_probe_witness_test.dag | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/dag/test/claim/machine_intake/machine_intake_bmc_secure_state_forged_probe_witness_test.dag b/dag/test/claim/machine_intake/machine_intake_bmc_secure_state_forged_probe_witness_test.dag index 7ebb1dd7a8b..591fb8b14ff 100644 --- a/dag/test/claim/machine_intake/machine_intake_bmc_secure_state_forged_probe_witness_test.dag +++ b/dag/test/claim/machine_intake/machine_intake_bmc_secure_state_forged_probe_witness_test.dag @@ -17,7 +17,7 @@ data live_tree_disposition: LiveTreeDisposition = SubstrateInputsOnly // diagnostic-census harness and requires each refusal CLASS at its SUBJECT by name, so a probe refusing // for another reason measures another wall; the class-scoped control shows a clean source reading the // same modules emits none of them. -data forged_probe_source: String = "module probe_bmc_secure_state_forged\n\nimport std.types { Bool, EpochMs, NonEmptyStr, String }\nimport std.content_hash { content_hash_of_value }\nimport gunbc.clock_read { ObserverClockInstant, ObserverClockModeled, observer_clock_modeled }\nimport gunbc.machine_intake_receipt { EvidenceRef }\nimport gunbc.machine_intake_bmc_rotation_route { BmcRotationRouteStanding }\nimport test.claim.machine_intake_bmc_secure_state_witness { cited_lab_route_managed_user }\nimport gunbc.machine_intake_subject { MachineIntakeSubject }\nimport extdeps.bmc.endpoint { BmcControllerEndpoint }\nimport extdeps.bmc.capability { BmcFirmwareReleaseIdentity }\nimport extdeps.bmc.ipmi_channel { IpmiControllerChannelCensus }\nimport gunbc.machine_intake_bmc_secure {\n ControllerClockReading, ObservedCredentialProbe, ObservedCredentialAccepted,\n ManagedCredentialGenerationStored, ManagedCredentialGenerationFetched, BmcAccountActionPlan,\n BmcAccountApplication, BmcSecurePhaseReceipt, BmcAccountStateObservation,\n ManagedCredentialReference, ObservedPublishedAccount, observed_bmc_account_state,\n ObservedReading, PublishedAccountKind, project_managed_administrator_readback, dry_read_bmc_account_state,\n}\nimport gunbc.bmc_model { BmcWorld }\nimport std.scoped_authorization { AttemptIdentity }\nimport gunbc.machine_intake_bmc_rotation_route { ManagedAdministratorReadback }\n\nfn evidence() -> EvidenceRef {\n EvidenceRef { label: \"forged\", digest: content_hash_of_value(value: \"forged\" as NonEmptyStr) }\n}\n\nfn forged_instant() -> ObserverClockInstant {\n ObserverClockInstant { millis: 946684800000, source: ObserverClockModeled { realization: \"forged\" } }\n}\n\nfn forged_modeled_instant() -> ObserverClockInstant {\n observer_clock_modeled(millis: 946684800000, realization: \"forged\" as NonEmptyStr)\n}\n\nfn controller_time_as_read_floor(\n subject: MachineIntakeSubject,\n endpoint: BmcControllerEndpoint,\n firmware: BmcFirmwareReleaseIdentity,\n managed: ManagedCredentialReference,\n reading: ControllerClockReading,\n probe: ObservedCredentialProbe,\n census: IpmiControllerChannelCensus,\n instant: ObserverClockInstant,\n account: ObservedPublishedAccount,\n) -> BmcAccountStateObservation {\n observed_bmc_account_state(\n subject: subject,\n endpoint: endpoint,\n firmware: firmware,\n managed: managed,\n managed_user: 3,\n attempt: \"forged\" as AttemptIdentity,\n read_floor: reading,\n managed_probe: probe,\n channel_census: census,\n census_evidence: evidence(),\n census_observed_at: instant,\n published_probes: [],\n published_user: 2,\n published_account: account,\n break_glass: managed,\n break_glass_probe: probe,\n controller_clock: none,\n )\n}\n\nfn readback_through_the_projection(o: BmcAccountStateObservation) -> ManagedAdministratorReadback? {\n project_managed_administrator_readback(observed: o)\n}\n\nfn controller_time_as_read_schedule(\n w: BmcWorld,\n subject: MachineIntakeSubject,\n endpoint: BmcControllerEndpoint,\n firmware: BmcFirmwareReleaseIdentity,\n managed: ManagedCredentialReference,\n census: IpmiControllerChannelCensus,\n account: PublishedAccountKind,\n reading: ControllerClockReading,\n) -> BmcAccountStateObservation {\n dry_read_bmc_account_state(\n world: w,\n subject: subject,\n endpoint: endpoint,\n firmware: firmware,\n managed: managed,\n managed_user: 3,\n managed_password: \"x\",\n census: census,\n published_user: 2,\n published_password: \"x\",\n published_account: account,\n break_glass: managed,\n break_glass_password: \"x\",\n attempt: \"forged\" as AttemptIdentity,\n read_at_millis: reading,\n )\n}\n\nfn forged_stored(s: ManagedCredentialGenerationStored) -> ManagedCredentialGenerationStored {\n ManagedCredentialGenerationStored { reference: s.reference, stored_version: s.stored_version, stored_at: s.stored_at }\n}\n\nfn forged_fetched(s: ManagedCredentialGenerationStored) -> ManagedCredentialGenerationFetched {\n ManagedCredentialGenerationFetched { stored: s, fetched_at: s.stored_at }\n}\n\nfn forged_application(p: BmcAccountActionPlan) -> BmcAccountApplication {\n BmcAccountApplication {\n plan: p,\n managed_write_completed: true,\n published_write_completed: true,\n request_receipt: evidence(),\n response_receipt: evidence(),\n applied_at: p.planned_at,\n }\n}\n\nfn forged_receipt(r: BmcSecurePhaseReceipt) -> BmcSecurePhaseReceipt {\n BmcSecurePhaseReceipt { subject: r.subject, phase: r.phase, goal: r.goal, decision: r.decision, held: r.held }\n}\n\nfn forged_plan(p: BmcAccountActionPlan) -> BmcAccountActionPlan {\n BmcAccountActionPlan {\n subject: p.subject,\n endpoint: p.endpoint,\n firmware: p.firmware,\n goal: p.goal,\n diverged: p.diverged,\n due: p.due,\n managed_write: p.managed_write,\n published_write: p.published_write,\n planned_at: p.planned_at,\n }\n}\n\nfn forged_observation(o: BmcAccountStateObservation) -> BmcAccountStateObservation {\n BmcAccountStateObservation {\n subject: o.subject,\n endpoint: o.endpoint,\n managed: o.managed,\n read_floor: o.read_floor,\n managed_probe: o.managed_probe,\n channel_census: o.channel_census,\n census_evidence: o.census_evidence,\n census_observed_at: o.census_observed_at,\n published_probes: o.published_probes,\n published_user: o.published_user,\n published_account: o.published_account,\n controller_clock: o.controller_clock,\n }\n}\n\nfn controller_time_in_a_reading_field(reading: ControllerClockReading) -> ObservedReading {\n ObservedReading { evidence: evidence(), observed_at: reading }\n}\n\nfn controller_time_in_an_account_field(kind: PublishedAccountKind, reading: ControllerClockReading) -> ObservedPublishedAccount {\n ObservedPublishedAccount { kind: kind, evidence: evidence(), observed_at: reading }\n}\n\nfn borrowed_fixture_route() -> BmcRotationRouteStanding {\n cited_lab_route_managed_user()\n}\n" +data forged_probe_source: String = "module probe_bmc_secure_state_forged\n\nimport std.types { Bool, EpochMs, NonEmptyStr, String }\nimport std.content_hash { content_hash_of_value }\nimport gunbc.clock_read { ObserverClockInstant, ObserverClockModeled, observer_clock_modeled }\nimport gunbc.machine_intake_receipt { EvidenceRef }\nimport gunbc.machine_intake_bmc_rotation_route { BmcRotationRouteStanding }\nimport test.claim.machine_intake_bmc_secure_state_witness { cited_lab_route_managed_user }\nimport gunbc.machine_intake_subject { MachineIntakeSubject }\nimport extdeps.bmc.endpoint { BmcControllerEndpoint }\nimport extdeps.bmc.capability { BmcFirmwareReleaseIdentity }\nimport extdeps.bmc.ipmi_channel { IpmiControllerChannelCensus }\nimport gunbc.machine_intake_bmc_secure {\n ControllerClockReading, ObservedCredentialProbe, ObservedCredentialAccepted,\n ManagedCredentialGenerationStored, ManagedCredentialGenerationFetched, BmcAccountActionPlan,\n BmcAccountApplication, BmcSecurePhaseReceipt, BmcAccountStateObservation,\n ManagedCredentialReference, ObservedPublishedAccount, observed_bmc_account_state,\n ObservedReading, PublishedAccountKind, project_managed_administrator_readback,\n}\nimport std.scoped_authorization { AttemptIdentity }\nimport gunbc.machine_intake_bmc_rotation_route { ManagedAdministratorReadback }\n\nfn evidence() -> EvidenceRef {\n EvidenceRef { label: \"forged\", digest: content_hash_of_value(value: \"forged\" as NonEmptyStr) }\n}\n\nfn forged_instant() -> ObserverClockInstant {\n ObserverClockInstant { millis: 946684800000, source: ObserverClockModeled { realization: \"forged\" } }\n}\n\nfn forged_modeled_instant() -> ObserverClockInstant {\n observer_clock_modeled(millis: 946684800000, realization: \"forged\" as NonEmptyStr)\n}\n\nfn controller_time_as_read_floor(\n subject: MachineIntakeSubject,\n endpoint: BmcControllerEndpoint,\n firmware: BmcFirmwareReleaseIdentity,\n managed: ManagedCredentialReference,\n reading: ControllerClockReading,\n probe: ObservedCredentialProbe,\n census: IpmiControllerChannelCensus,\n instant: ObserverClockInstant,\n account: ObservedPublishedAccount,\n) -> BmcAccountStateObservation {\n observed_bmc_account_state(\n subject: subject,\n endpoint: endpoint,\n firmware: firmware,\n managed: managed,\n managed_user: 3,\n attempt: \"forged\" as AttemptIdentity,\n read_floor: reading,\n managed_probe: probe,\n channel_census: census,\n census_evidence: evidence(),\n census_observed_at: instant,\n published_probes: [],\n published_user: 2,\n published_account: account,\n break_glass: managed,\n break_glass_probe: probe,\n controller_clock: none,\n )\n}\n\nfn readback_through_the_projection(o: BmcAccountStateObservation) -> ManagedAdministratorReadback? {\n project_managed_administrator_readback(observed: o)\n}\n\nfn forged_stored(s: ManagedCredentialGenerationStored) -> ManagedCredentialGenerationStored {\n ManagedCredentialGenerationStored { reference: s.reference, stored_version: s.stored_version, stored_at: s.stored_at }\n}\n\nfn forged_fetched(s: ManagedCredentialGenerationStored) -> ManagedCredentialGenerationFetched {\n ManagedCredentialGenerationFetched { stored: s, fetched_at: s.stored_at }\n}\n\nfn forged_application(p: BmcAccountActionPlan) -> BmcAccountApplication {\n BmcAccountApplication {\n plan: p,\n managed_write_completed: true,\n published_write_completed: true,\n request_receipt: evidence(),\n response_receipt: evidence(),\n applied_at: p.planned_at,\n }\n}\n\nfn forged_receipt(r: BmcSecurePhaseReceipt) -> BmcSecurePhaseReceipt {\n BmcSecurePhaseReceipt { subject: r.subject, phase: r.phase, goal: r.goal, decision: r.decision, held: r.held }\n}\n\nfn forged_plan(p: BmcAccountActionPlan) -> BmcAccountActionPlan {\n BmcAccountActionPlan {\n subject: p.subject,\n endpoint: p.endpoint,\n firmware: p.firmware,\n goal: p.goal,\n diverged: p.diverged,\n due: p.due,\n managed_write: p.managed_write,\n published_write: p.published_write,\n planned_at: p.planned_at,\n }\n}\n\nfn forged_observation(o: BmcAccountStateObservation) -> BmcAccountStateObservation {\n BmcAccountStateObservation {\n subject: o.subject,\n endpoint: o.endpoint,\n managed: o.managed,\n read_floor: o.read_floor,\n managed_probe: o.managed_probe,\n channel_census: o.channel_census,\n census_evidence: o.census_evidence,\n census_observed_at: o.census_observed_at,\n published_probes: o.published_probes,\n published_user: o.published_user,\n published_account: o.published_account,\n controller_clock: o.controller_clock,\n }\n}\n\nfn controller_time_in_a_reading_field(reading: ControllerClockReading) -> ObservedReading {\n ObservedReading { evidence: evidence(), observed_at: reading }\n}\n\nfn controller_time_in_an_account_field(kind: PublishedAccountKind, reading: ControllerClockReading) -> ObservedPublishedAccount {\n ObservedPublishedAccount { kind: kind, evidence: evidence(), observed_at: reading }\n}\n\nfn borrowed_fixture_route() -> BmcRotationRouteStanding {\n cited_lab_route_managed_user()\n}\n" data harness_control_source: String = "module probe_bmc_secure_state_harness_control\nimport gunbc.machine_intake_bmc_secure { BmcSecurePhaseReceipt, bmc_secure_phase_receipt_evidence }\nimport gunbc.machine_intake_receipt { EvidenceRef }\nimport std.types { List }\nfn evidence_of(r: BmcSecurePhaseReceipt) -> List { bmc_secure_phase_receipt_evidence(receipt: r) }\n" @@ -87,15 +87,14 @@ test fn a_controller_clock_reading_in_an_ordering_field_refuses_at_the_seal() -> // ObserverClockInstant RECORD FIELD is accepted today -- gunbc.recurring_failure_mode // record_field_admits_a_distinct_product_value, which carries this specimen -- so the sealed // observation mint is the route this claim covers. -// SINCE cut O1a-2 THE OBSERVATION MINT ADMITS ONLY THE DRY READ, so the call above now refuses at the -// mint's admission (pinned in the_readback_projection_and_the_observation_mint_refuse_an_outside_caller) -// before its read_floor argument is judged. The read floor's only admitted producer takes the observer -// schedule as read_at_millis: EpochMs, and a controller's clock reading in that position is refused at -// the call argument -- the same wall, at the one route that can now reach the floor. +// SINCE cut O1a-2 THE OBSERVATION MINT ADMITS ONLY THE DRY READ. The call above, which hands a +// controller's clock reading to the mint as the read floor, now refuses at the mint's admission, so no +// caller outside the dry realization can choose the read floor at all; the dry read derives it from its +// own modeled observer schedule, and the live read is bmc_secure_state_live_read_frontier. The wall is +// therefore construction-level (who may mint), where it was an argument-type refusal before, and that +// argument-type refusal is no longer emitted because the call no longer reaches argument judgement. test fn a_controller_clock_reading_cannot_be_the_read_floor() -> Bool { - let c = probe() - blocking_count_for_class_and_subject(c: c, wanted: "DeclaredTypeNotInhabited", subject: "direct call argument for parameter 'read_at_millis'") >= 1 - && blocking_count_for_class_and_subject(c: c, wanted: "ConstructorCallAdmissionRefused", subject: "observed_bmc_account_state") >= 1 + blocking_count_for_class_and_subject(c: probe(), wanted: "ConstructorCallAdmissionRefused", subject: "observed_bmc_account_state") >= 1 } // THE PROJECTION IS NOT A CONSTRUCTOR PROXY (side-chat review of 8960bbe511). An outside call to From 5cec3b209f84debfab08682b31bfcdf4f94cd2f8 Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Mon, 5 Oct 2026 08:29:08 +0000 Subject: [PATCH 22/22] O1a-2: the idempotent mtcollins1 qualification grounds acceptance only; the factory-admin close needs an effect-observing qualification (frontier) (review 76375) Co-Authored-By: Claude Opus 5.5 (1M context) --- .../bmc_rotation_route_evidence.dag | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/dag/gunbc/machine_intake/bmc_rotation_route_evidence.dag b/dag/gunbc/machine_intake/bmc_rotation_route_evidence.dag index 2eda3e17a26..d1705aba790 100644 --- a/dag/gunbc/machine_intake/bmc_rotation_route_evidence.dag +++ b/dag/gunbc/machine_intake/bmc_rotation_route_evidence.dag @@ -1,6 +1,7 @@ module gunbc.machine_intake_bmc_rotation_route_evidence import std.types { Int, NonEmptyStr, String } +import std.dissolution { DissolutionCondition, unbound_dissolution } import std.content_hash { Sha256Hash } import std.content_hash { sha256_hex_digest } import extdeps.bmc.endpoint { AmiMegaRac, BmcControllerEndpoint } @@ -69,9 +70,16 @@ fn mtcollins1_rotation_route_standing() -> BmcRotationRouteStanding { // controller and build, showing that user ALREADY at ADMINISTRATOR on channel 1 as the unique row for // the pair: so the write sets exactly the value just read, changes no access, and still exercises the // command and its readback. If the post-reflash managed id or channel differs, that readback refuses -// and nothing is written. Closing the factory administrator (user 2, the channels the operator reports -// it still holds, eager-gull-22 2026-10-04) is an ordinary Apply AFTER this route is grounded, and it -// passes the same administrator-retention precondition. +// and nothing is written. +// +// WHAT THIS QUALIFICATION CAN AND CANNOT GROUND, stated because the first wording of this paragraph got +// it wrong (review 76375). Because the write sets the value already read, its before and after readings +// match, so a live run of it grounds the operation as AcceptedEffectUnobserved: the controller accepts +// the privilege-limit request, and nothing more. admit_rotation_apply refuses every privilege-LOWERING +// Apply over such a route (RotationApplyRouteEffectUnobserved). Closing the factory administrator (user +// 2 to NO ACCESS on the channels the operator reports it still holds, eager-gull-22 2026-10-04) is +// therefore NOT reachable from this candidate. It needs a second, effect-observing qualification +// (mtcollins1_channel_close_effect_qualification_frontier). // // EVIDENCE IS THE PUBLIC STANDARD ONLY. The IPMI v2.0 specification defines Set User Access // (extdeps.bmc.ipmi_channel's cited authority). NO post-reflash channel-access observation is @@ -80,6 +88,10 @@ fn mtcollins1_rotation_route_standing() -> BmcRotationRouteStanding { // channel 0h-Fh (the post-reflash channel census), Get User Access for the published user on every // channel that census returns, and a version readback (Get Device ID / mc info) naming the installed // BMC build. +data mtcollins1_channel_close_effect_qualification_frontier: DissolutionCondition = unbound_dissolution( + description: "dissolves when a channel-access qualification on mtcollins1's current controller and build grounds the privilege-limit operation with EffectObserved: a request that is both non-destructive and discriminating, whose ESTABLISHED pre-write reading differs from the requested value and whose post-write readback matches it -- for example a spare user slot that a committed post-reflash Get User Access observation shows disabled or unused on a channel, changed, read back, then restored and read back -- so that admit_rotation_apply can admit the factory administrator's close; NOT satisfied by the idempotent re-assertion candidate above (accept-only by construction), by a modeled run, or by a slot chosen without a committed observation identifying it" as NonEmptyStr, +) + fn mtcollins1_current_bmc_firmware() -> BmcFirmwareReleaseIdentity { let v = mt_collins_bmc_0_45_3_hpm.version bmc_firmware_release_identity_of_wire(