Skip to content

fix: revoke minted import grants when prepared payload validation fails #356

Open

Description

@danny-avila

In service/src/workspace-tools/import.ts, createWorkspaceImportService.prepare can successfully create an egress grant and then reject its returned payload or missing egressGrantToken. That IMPORT_UNAVAILABLE error occurs before the PreparedWorkspaceImport result reaches the caller. The immediate router has no preparedImport to revoke, and the durable submit path never receives its release callback, so the minted grant remains live until expiry.

Revoke a successfully created grant before throwing on post-creation validation failure. Cover invalid file payload, wrong file count, and missing token, including revocation failure handling. Preserve the existing ownership checks, one-object read-only grant scope, and original import error response.

Validated from prepare and both caller cleanup paths after a Bugbot finding during the #348 import.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions