Skip to content

credentials: pick cloudflare auth mode once and switch on it#80

Merged
tamalsaha merged 1 commit into
masterfrom
refactor/cloudflare-cred-branch
Jun 6, 2026
Merged

credentials: pick cloudflare auth mode once and switch on it#80
tamalsaha merged 1 commit into
masterfrom
refactor/cloudflare-cred-branch

Conversation

@tamalsaha

Copy link
Copy Markdown
Contributor

Summary

`setCloudflareCredentials` used `validCFSecret` to decide if the secret was acceptable, then re-derived the same token-vs-key/email decision via a separate `len(...) > 0` check. Two checks of the same condition, two chances to drift.

Replace `validCFSecret` with `cfSecretMode` that returns the chosen auth mode (token / key+email / invalid). The caller switches on it and sets the right env vars. Closes the "key present but empty" inconsistency between the old checks.

Test plan

  • `go build ./...`
  • Verify token-only, key+email, and invalid secrets each go down the expected branch

setCloudflareCredentials called validCFSecret to decide if a secret was
acceptable, then re-derived the same token-vs-key choice further down
via len(secret.Data[tokenKey]) > 0. Two checks of the same condition,
two chances to drift.

Replace validCFSecret with cfSecretMode that returns the chosen auth
mode (token / key+email / invalid). The caller switches on it and sets
the right env vars. Closes a class of "what if the key is present but
the bytes are empty" inconsistencies between the two checks.

Signed-off-by: Tamal Saha <tamal@appscode.com>
@tamalsaha tamalsaha merged commit 4092b4f into master Jun 6, 2026
4 checks passed
@tamalsaha tamalsaha deleted the refactor/cloudflare-cred-branch branch June 6, 2026 16:08
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.

1 participant