fix(vault): declare the back-up URL the snapshot store writes - #232
Open
LKSNDRTMLKV wants to merge 1 commit into
Open
fix(vault): declare the back-up URL the snapshot store writes#232LKSNDRTMLKV wants to merge 1 commit into
LKSNDRTMLKV wants to merge 1 commit into
Conversation
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 0 |
| Duplication | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #225.
The snapshot store writes
{dppId}/public.json.publishdeclared the registry back-up at{dppId}.json, and.env.exampledocumented that second shape — so the code and its documentation agreed with each other and disagreed with the only thing that actually writes an object. An operator who setSNAPSHOT_PUBLIC_BASE_URLdeclared a link that fetches nothing.Why nothing caught it
RegistrationRequest::validatechecks the scheme and stops. Its own comment names this outcome —— and the check cannot see it, because
https://backup.example.com/dpp/{id}.jsonis a perfectly well-formed HTTPS URL that happens to address nothing. Reachability is the registry's check, so the first party to notice would have been the registry, on a live registration. No test covered the relationship either: the registry suite only ever exercisedbackup_url: None, which is the default and the only path there was.The fix, and the part that keeps it fixed
snapshot_json_keymoves todpp-types— the crate bothdpp-vaultanddpp-nodecan see, following the workspace's dependency direction — and both sides call it. The store delegates to it;publishbuilds the declaration from it through a newsnapshot_backup_url, extracted so the relationship is testable at all, which it was not before.That is the difference between fixing the string and fixing the defect. The two halves lived in different crates with no shared definition, so they could drift apart independently and did.
Verified by putting the bug back. With the original
{id}.jsonformat restored, the test fails and names both halves:A trailing slash on the configured base is also handled — it previously produced a double slash, which is a different path to most static servers.
Two judgement calls to check
{dppId}/public.htmlbelongs there. It does not, in my reading: the back-up link is consumed by machines and the JSON view is the one carrying the signatures a verifier needs. Recorded insnapshot_html_key's docs so the reasoning is where the next reader will look..env.examplenow states a real constraint — whatever serves the base must expose the bucket's own layout, not a flattened one. The alternative (keep{id}.jsonand require a rewrite at the serving layer) makes correct configuration depend on a step nothing here performs or checks, and its failure is silent. Removing the requirement beats documenting it.Scope
Latent rather than live:
SNAPSHOT_PUBLIC_BASE_URLis unset by default and commented out, so no back-up link is declared at all today — its own gap, but a safe one. Nothing needs migrating; no passport carries a stored back-up URL.Verification
just checkgreen — 923/923, integration compile, audit and deny,REAL_EXIT=0on the whole recipe.Checklist
just lintpasses locallyjust fmtappliedjust testpasses (unit) — 923/923println!/eprintln!/dbg!in service-cratesrc/.envfiles in the diff —.env.exampleonly, a comment correction.env.example, and the reasoning on both key functions