reindexauth

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 16, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package reindexauth rechecks, before a queued remote reindex runs, that the caller who requested it still holds the credential and the Manage permission it was requested with. Queued work can run long after the request, so a revoked token, a changed password or a withdrawn grant must stop it.

Role

artifacts module, core layer: rechecks the credential a queued reindex was requested with before it runs. The application installs New's check as the item service's ReindexAuthorize, which hands it to the format as format.Env.CheckReindex for each queued reindex.

Inputs

  • The work item's credential reference (format.WorkRequest.Credential, a kernel.CredentialReference) and its requester (WorkRequest.By).
  • Driven: access/api's Authenticator, whose Current restores the credential as it is now, and its Authorizer, which evaluates the caller's permissions as they are now.

Outputs

  • New: the check, which allows the reindex (nil) or denies it with a permanent work error, so the job stays parked instead of retrying; other failures are wrapped, so the work retries.

Invariants

  • Only the credential reference in the queue payload is trusted, never a stored admin flag, group or permission.
  • The credential reference JSON is persisted in work items and stays byte-identical; internal/kernel/credential_golden_test.go pins it (ACC-02).

References

Status

Implemented P9. Moved here in P9d.

Testing

reindex_test.go runs the check over the access test kit (accesstest): a queued token keeps its scope and the caller's current authority, and a caller who lost Manage is refused.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

New returns the check that a queued remote reindex passes before it runs and whenever its format rechecks (format.Env.CheckReindex). It trusts only the credential reference in the queue payload, never a stored admin flag, group or permission: authn's Current restores the credential as it is now (a token's scope and expiry, or the password revision), and authz's Authorize evaluates the caller's permissions as they are now. The check refuses with a permanent work error when authn is nil, when the payload does not parse or names a user other than the request's or a registry token, when the credential no longer holds, and when the caller lacks Manage on the repository. Any other failure is wrapped as "reindex current credential: %w" or "reindex current permissions: %w", so the work retries.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL