You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit cc30d3c
Browse filesBrowse the repository at this point in the historyBrowse files
fix(marketplace): re-check auto-register on every reconcile; de-register on privileged flip
A self-review with the cozy-review methodology found the privileged-auto-register
guard was create-time only: a repository could tap with a benign default variant
(auto-registered, standing Package created) and then ship a revision whose default
variant is privileged. The materializer only re-checked at Package creation, so the
existing Package survived and the Package reconciler installed the now-privileged
component with no confirmation and no admin action.
reconcileRegistrationPackage now converges the registration Package on every
reconcile: it de-registers (deletes) a tap-owned Package when the default variant
becomes privileged or is dropped, and records a durable, truthful reason on the
PackageSource (RegistrationStateAnnotation) alongside the Warning Event, instead
of a Package that stands while the event claims it did not register.
Also from the review:
- An unmarked Package of the same name (a user's cozypkg add, or one from before
this version) is treated as registration already satisfied: reconcile returns
nil instead of hard-erroring, which had hot-looped the whole tap and re-pulled
the artifact every backoff. It is neither adopted nor deleted.
- Delete the registration Package BEFORE the PackageSource in pruneMaterialized
and in the aggregated Tap Delete, so a transient Package-delete failure is
retryable instead of stranding the Package; a failed Package delete/check in
Delete now returns an error rather than only logging.
- runUntap aborts on a non-NotFound Package Get error instead of swallowing it
and deleting the PackageSource and source anyway.
- Correct the cozypkg tap output (apps register automatically except privileged).
- Hoist the duplicated privileged-component helper to collision.
Tests: privileged-flip de-register (mutation-verified non-vacuous), default-variant
dropped, unmarked-Package left, foreign-tap Package left, Package dry-run
propagation, operator foreign-Package ownership.
Signed-off-by: IvanHunters <[email protected]>
_, _=fmt.Fprintf(cmd.OutOrStdout(), "The repository's applications are registered automatically; browse them in the dashboard catalog and create instances there.\n")
333
+
_, _=fmt.Fprintf(cmd.OutOrStdout(), "The repository's applications register in the dashboard catalog automatically, except a variant needing privileged install (register that with 'cozypkg add --allow-privileged'). Check the source's events if an app does not appear.\n")
returnfmt.Errorf("package %s is still installed from this source; delete it with 'cozypkg del %s' first, or pass --yes to untap anyway (the Package stays installed)", name, name)
390
395
}
396
+
caseapierrors.IsNotFound(err):
397
+
// No registration Package; nothing to de-register.
398
+
default:
399
+
returnfmt.Errorf("failed to check registration Package %s: %w", name, err)
0 commit comments