Skip to content

feat: add --skip-mint-check for self-provisioned mint services - #991

Merged
waynesun09 merged 4 commits into
mainfrom
feat-skip-mint-check
May 15, 2026
Merged

feat: add --skip-mint-check for self-provisioned mint services#991
waynesun09 merged 4 commits into
mainfrom
feat-skip-mint-check

Conversation

@waynesun09

Copy link
Copy Markdown
Member

Summary

  • Adds --skip-mint-check CLI flag to fullsend admin install that allows users to point at a self-provisioned mint service without requiring GCP IAM access to the mint project
  • When set, relaxes mint URL validation to any HTTPS URL, skips all GCP discovery/provisioning (Secret Manager, Cloud Functions, WIF), and skips GitHub App creation
  • --mint-project becomes optional; FULLSEND_MINT_URL repo variable is still set for runtime workflows

Resolves #983

Test plan

  • TestInstallCmd_SkipMintCheckRequiresMintURL — errors when --skip-mint-check without --mint-url
  • TestInstallCmd_SkipMintCheckAcceptsNonCloudRunURL — accepts arbitrary HTTPS URL with --dry-run
  • TestInstallCmd_SkipMintCheckSkipsMintProject — no --mint-project required
  • TestInstallCmd_SkipMintCheckRejectsHTTP — still rejects non-HTTPS URLs
  • All existing CLI tests pass (go test ./internal/cli/...)
  • go vet ./... clean
  • make lint clean

When users self-provision their mint service (non-GCP, or on a GCP
project they don't manage), the installer no longer requires GCP IAM
access to the mint project. The new --skip-mint-check flag:

- Accepts any valid HTTPS URL (not just .run.app/.cloudfunctions.net)
- Skips DiscoverMint() GCP API calls
- Skips GitHub App creation and PEM storage
- Skips all mint provisioning (Secret Manager, EnsureOrgInMint, WIF)
- Makes --mint-project optional
- Still sets FULLSEND_MINT_URL repo variable for runtime workflows

Resolves #983

Signed-off-by: Wayne Sun <gsun@redhat.com>
@github-actions

Copy link
Copy Markdown

fullsend review is working on this — view logs

@github-actions

github-actions Bot commented May 15, 2026

Copy link
Copy Markdown

Site preview

Preview: https://c5e1527f-site.fullsend-ai.workers.dev

Commit: b1047d38effd7617b7f78d5a6c5d64dfe7350054

@fullsend-ai-review

fullsend-ai-review Bot commented May 15, 2026

Copy link
Copy Markdown

Review: #991

Head SHA: b1047d3
Timestamp: 2026-05-15T12:00:00Z
Outcome: approve

Summary

This PR cleanly implements a --skip-mint-check flag for fullsend admin install that bypasses GCP discovery, Secret Manager, Cloud Functions provisioning, and GitHub App setup when the user has a self-provisioned mint service. The implementation correctly satisfies the dispatch.Dispatcher interface with a minimal skipMintDispatcher, properly guards all GCP-dependent code paths in both per-org and per-repo flows (including dry-run), refactors URL validation to separate HTTPS enforcement from Cloud Run domain checks, and adds a new embedded-credentials rejection check that benefits all paths. Test coverage is thorough across validation, dispatcher behavior, and CLI integration. No critical or high findings.

Findings

Info

  • [Style] internal/cli/admin.go — The --skip-mint-check flag is a functional superset of --skip-app-setup (it implies skipping app setup). Using both flags simultaneously is harmless but redundant. Consider documenting this relationship in the flag help text or adding a warning when both are set, to reduce user confusion.

  • [Correctness] internal/cli/admin.go — The new validateMintURLHTTPS function adds a userinfo rejection check (parsed.User != nil) that was not present in the original validateMintURL. This is a security improvement, but it also applies to the non-skip-mint-check path — any previously-accepted URLs with embedded credentials will now be rejected. This is almost certainly the right behavior, but worth noting as a subtle behavioral change beyond the stated scope.

Footer

Outcome: approve
This review applies to SHA b1047d38effd7617b7f78d5a6c5d64dfe7350054. Any push to the PR head clears this review and requires a new evaluation.

Previous run

Review: #991

Head SHA: 6b9bfd0
Timestamp: 2026-05-15T00:00:00Z
Outcome: approve

Summary

This PR cleanly addresses #983 by adding a --skip-mint-check flag that bypasses all GCP API calls (Secret Manager, Cloud Functions) when the user supplies a self-provisioned mint URL. The implementation is well-structured: a new skipMintDispatcher satisfies the dispatch.Dispatcher interface with safe no-ops, validateMintURL is refactored into two layers (validateMintURLHTTPS for all paths, plus Cloud Run domain check for the standard path), and both per-org and per-repo flows are properly gated. The refactoring also hardens all mint URL validation by adding a userinfo/embedded-credentials check that was previously absent. Test coverage is thorough across six test cases covering both positive and negative validation paths.

Findings

Info

  • [correctness] internal/cli/admin.go — The validateMintURLHTTPS refactoring adds a parsed.User != nil check that now applies to all mint URL validation (including the standard Cloud Run path via validateMintURLvalidateMintURLHTTPS). This is a good security hardening that goes slightly beyond the PR's stated scope but is clearly beneficial.

  • [style] internal/cli/admin.go — The skipMintDispatcher methods use unnamed parameters (context.Context, string, string, []byte) rather than named ones (ctx context.Context, org, role string, pem []byte). This is fine for stub implementations but differs from the interface declaration style. Very minor.

Footer

Outcome: approve
This review applies to SHA 6b9bfd09a5077888f75458969708b31ebb72edf0. Any push to the PR head clears this review and requires a new evaluation.

Previous run (2)

Review: #991

Head SHA: 49d07d9
Timestamp: 2026-05-15T00:00:00Z
Outcome: approve

Summary

Clean, well-scoped change that adds --skip-mint-check for per-repo installs pointing at a self-provisioned mint. The flag correctly gates all GCP discovery/provisioning code paths (Secret Manager, Cloud Functions, app creation) while preserving WIF provisioning for the installer's own inference project — matching the intent of #983. URL validation is maintained (HTTPS required, embedded credentials rejected), and the refactoring of validateMintURL into validateMintURL + validateMintURLHTTPS is structurally clean. Tests cover the key scenarios: missing --mint-url, non-Cloud-Run URLs, per-org rejection, userinfo rejection, and HTTP rejection.

Findings

Medium / Low / Info

  • [correctness] internal/cli/admin.govalidateMintURL now parses the URL twice: once inside validateMintURLHTTPS and again in itself. Not a bug, but a minor inefficiency. Consider having validateMintURLHTTPS return the parsed *url.URL so validateMintURL can reuse it.

  • [style] internal/cli/admin_test.go — No test exercises the dry-run output path specific to --skip-mint-check (the "Mint checks skipped" output block). The non-dry-run path can't be unit-tested without GCP/GitHub credentials, so the dry-run output path is the best place to verify the skip messaging. Consider adding one.

Footer

Outcome: approve
This review applies to SHA 49d07d94f61413cf9ad0b096c07398abad3c8539. Any push to the PR head clears this review and requires a new evaluation.

Previous run (3)

Review: #991

Head SHA: dc74f2a
Timestamp: 2026-05-15T12:00:00Z
Outcome: comment-only

Summary

Clean, well-scoped change that adds --skip-mint-check to bypass GCP-based mint validation for self-provisioned mints. The refactoring of validateMintURL into two functions is sound, the control flow changes correctly gate all GCP discovery/provisioning behind the new flag, and HTTPS validation is properly retained. Two minor findings below — neither is blocking.

Findings

Medium / Low / Info

  • [correctness] internal/cli/admin_test.go:1269TestInstallCmd_SkipMintCheckAcceptsNonCloudRunURL and TestInstallCmd_SkipMintCheckSkipsMintProject (line 1280) use identical arguments and assertions. The "SkipsMintProject" test doesn't actually verify that --mint-project is absent — both tests include --inference-project but neither includes --mint-project, so they exercise the same code path. To make the second test meaningful, either (a) add a variant that passes --mint-project and verifies it's ignored, or (b) consolidate into one test.
    Remediation: Differentiate the test inputs or merge them.

  • [style/conventions] internal/cli/admin.go — The validateMintURL function calls validateMintURLHTTPS then does a second url.Parse with discarded error (parsed, _ := url.Parse(raw)). While safe (the HTTPS validator already verified parsing succeeds), a comment explaining why the error is discarded would aid readability, or the parsed URL could be returned from validateMintURLHTTPS to avoid the redundant parse.
    Remediation: Either add a brief comment or refactor validateMintURLHTTPS to return the parsed *url.URL.

Footer

Outcome: comment-only
This review applies to SHA dc74f2ab595f613f7a3d18c231be06694cd9d15e. Any push to the PR head clears this review and requires a new evaluation.

- Reject --skip-mint-check in per-org mode with clear error message
- Reject mint URLs with embedded credentials (userinfo) to prevent
  leaking auth data via repo variables
- Fix suppressed parse error in validateMintURL (double url.Parse)
- Differentiate SkipMintCheckSkipsMintProject test from AcceptsNonCloudRunURL
- Add tests for per-org rejection and userinfo rejection

Signed-off-by: Wayne Sun <gsun@redhat.com>
@github-actions

Copy link
Copy Markdown

fullsend review is working on this — view logs

Comment thread internal/cli/admin.go Outdated
Comment on lines +239 to +241
if cmd.Flags().Changed("skip-mint-check") {
return fmt.Errorf("--skip-mint-check is only valid for per-repo installation (fullsend admin install <owner/repo>)")
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At some point this should be allowed for org mode as well.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, my plan was set to as unified flag for all modes, but my review squad have change that in second commit, new commit is fixing this

Add skipMintDispatcher that implements dispatch.Dispatcher to return
the user-provided mint URL without GCP API calls. In per-org mode,
--skip-mint-check now skips mint-project/mint-provider validation,
app setup, PEM storage, and uses the no-op dispatcher in the layer
stack instead of the GCF provisioner.

Signed-off-by: Wayne Sun <gsun@redhat.com>
@github-actions

Copy link
Copy Markdown

fullsend review is working on this — view logs

…alidation

- Pass skipMintCheck/mintURL to runDryRun so per-org dry-run uses
  skipMintDispatcher instead of a dummy GCF provisioner
- Extract validateSkipMintCheck helper to eliminate duplicated
  validation logic between per-org and per-repo paths
- Add skip-mint-check flag assertion to TestInstallCmd_Flags
- Add skipMintDispatcher unit test verifying Dispatcher contract
- Add table-driven tests for validateMintURLHTTPS edge cases
- Update flag help text to document --mint-url requirement

Signed-off-by: Wayne Sun <gsun@redhat.com>
@github-actions

Copy link
Copy Markdown

fullsend review is working on this — view logs

@waynesun09
waynesun09 added this pull request to the merge queue May 15, 2026
Merged via the queue into main with commit 920efe9 May 15, 2026
36 checks passed
@waynesun09
waynesun09 deleted the feat-skip-mint-check branch May 15, 2026 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

--mint-url install requires GCP access to mint project it shouldn't need

2 participants