Export the local_auth_refresh projection as a function of a registry #35
Labels
No labels
blocked
bug
decision
duplicate
enhancement
handoff
help wanted
invalid
landed?
question
ready-to-merge
stale
wontfix
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
allod/secrets#35
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Export the validated
local_auth_refreshprojection as a function of a registry, so a fork that validates its own registry calls the constructor instead of re-spelling the mapping and gating it itself.Primary goals:
lib.mkLocalAuthRefreshSourcestakes a registry and returns the validated projection, andlib.localAuthRefreshSourcesbecomes that constructor applied to this repository's registry, the same pairinglib.mkPiCredentialContractalready has withlib.piCredentialsand its siblings.lib.localAuthRefreshDiagnosticsis empty before projecting, so a fork cannot get the projection without the validation, and cannot get the validation's diagnostics text wrong by re-spelling it.allod/nexusscripts/refresh-local-authkeeps readinglib.localAuthRefreshSourceswith the same shape; nothing about the public registry or its projection changes.local-auth-refreshcheck forces the projection and runs the sabotage fixtures through the same binding that is exported, so a drift between the constructor and the applied result is impossible by construction rather than pinned by a second check.Current state and specifics
The projection is built in two private bindings in
flake.nix:localAuthRefreshSourcesForatflake.nix:282maps each group's entries to{ contract; system; local_username; source_credential; secret_path; }, andvalidateLocalAuthRefreshatflake.nix:296assertslocalAuthRefreshDiagnostics registry == []and then applies it. Only the applied result is exported, atflake.nix:378:lib.localAuthRefreshSources = validateLocalAuthRefresh rotationRegistry;. The diagnostics function beside it,lib.localAuthRefreshDiagnosticsatflake.nix:377, is exported as a function of a registry.The private handoff on allod/secrets#29 found the gap. A deployment's fork of this repository validates its own registry, not this one, so
lib.localAuthRefreshDiagnosticsis usable there butlib.localAuthRefreshSourcesis not: the fork has to copy the field mapping fromlocalAuthRefreshSourcesForand wrap it in its own assertion on the diagnostics. That is a fourth spelling of a mapping this issue's parent exists to keep at one, and the assertion text a consumer sees at preflight now depends on which copy it was evaluated by.The Pi credential contract already shows the shape the consumers expect.
mkPiCredentialContractatflake.nix:20is a function of caller-supplied data,piCredentialContractatflake.nix:22is it applied to this repository's registry, and both are exported: the applied projections aslib.piCredentialsand siblings, the constructor aslib.mkPiCredentialContractatflake.nix:389. A fork calls the constructor on its own data and gets the same validation and the same derived shape.Default: rename
validateLocalAuthRefreshtomkLocalAuthRefreshSources, export it aslib.mkLocalAuthRefreshSources, and definelib.localAuthRefreshSources = mkLocalAuthRefreshSources rotationRegistry. Thelocal-auth-refreshcheck already applies that binding to the public registry and to every sabotage registry, so it witnesses the export as it stands. The README export table gains one row besidelib.localAuthRefreshSources.Validation:
nix flake checkin this repository;nix eval .#lib.mkLocalAuthRefreshSources --apply 'f: f {}'evaluates to an empty attribute set, and applying it to the public registry equalslib.localAuthRefreshSources;tests/refresh-local-auth.shinallod/nexusstill passes against this checkout, since the script's contract is unchanged.Scope
In: the exported constructor, the applied result defined through it, and the README row.
Out: the
formatpolicy inside the diagnostics.localAuthRefreshDiagnosticsgates a source credential withisCredentialStoreUrlSource, this registry's ownformatrule; a fork whose registry validator composes a differentformatpolicy onlib.isCredentialStoreUrlTemplateinherits this one at refresh time. No fork has asked for a different answer there, so parameterising the constructor over the predicate waits for one that does. Consumer changes inallod/nexusandallod/archetypesare not needed; both keep reading the applied export.Refs allod/secrets#29.