refactor(credentials): drop legacy cert-based Azure WIF path#31
Conversation
Azure Workload Identity Federation now has exactly one implementation:
KMS-signed client assertions via CUDly's OIDC issuer. The legacy
cert-based path (stored RSA private key + self-signed certificate,
x5t thumbprint in the JWT header) is gone.
The modern IaC templates at `internal/iacfiles/templates/azure-wif*`
were already federation-only ("no certificate, no private key, no
client secret is created or stored"). The legacy path lived on in
the backend, UI, and some operator docs as orphaned scaffolding.
Removing it aligns the whole stack and eliminates a secret-material
surface.
Frontend:
- Delete the RSA private-key textarea + instructions from the Azure
account modal. Tenant ID, Client ID, and Subscription ID are all
that's asked for in WIF mode now.
- Drop the WIF branch from the credential save path and the
private-key reset on modal open.
- Remove 'azure_wif_private_key' from the TS credential_type union
so the compiler catches stale callers.
- Simplify updateAzureAuthModeFields — only client_secret mode has
a field block to show/hide now.
Backend:
- credentials/resolver.go: delete buildAzureWIFCredential,
parsePEMBlob, processPEMBlock, parseRSAKeyBlock, and CredTypeAzureWIF.
Drop the crypto/rsa, crypto/sha1, crypto/x509, encoding/base64,
encoding/pem, and golang-jwt/v5 imports.
- credentials/azure_federated.go: resolveAzureWIFCredential becomes a
straight delegation to BuildAzureFederatedCredential. Fail fast with
an operator-facing error when opts.Signer/issuer are missing instead
of trying a legacy fallback.
- api/handler_accounts.go: remove 'azure_wif_private_key' from
validCredentialTypes and the error message. azureFederatedCredResult
loses the "legacy PEM stored → fall back" branch. credTypeForAccount
returns "" for Azure WIF (no stored credential to check); the new
checkCredentialPresence short-circuit surfaces an actionable error
for operators who hit the degraded-deployment state (Azure WIF
account + no wired OIDC signer).
- api/validation.go: drop the azure_wif_private_key payload schema
and switch arm.
- api/handler_federation.go: rewrite the Azure README generator to
match the federation-only templates it bundles.
- api/handler_registrations.go: refresh the accountHasCredentialFreePath
doc comment — no more "legacy PEM" caveats.
Tests:
- credentials/resolver_extra_test.go: delete all TestBuildAzureWIFCredential_*
cases, TestParsePEMBlob_* cases, and the generateTestKey*/generateECKey*
helpers. Reframe TestResolveAzureTokenCredential_WIF_* as a
"requires wired OIDC signer" assertion.
- api/coverage_gaps_test.go: TestCredTypeForAccount expects "" for
Azure WIF.
- api/validation_test.go: drop the two azure_wif_private_key cases.
DB: no migration. User confirmed no accounts rely on the legacy path;
any stray rows become dead data and are ignored by the runtime.
Closes #14.
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 25 minutes and 27 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (13)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
Summary
Drops the legacy cert-based Azure Workload Identity Federation path entirely. Azure WIF now has exactly one implementation: KMS-signed client assertions via CUDly's OIDC issuer — secret-free, nothing stored per-account. The cert path (stored RSA private key + self-signed certificate + x5t thumbprint) was scaffolding from before the federation redesign; the IaC templates already emit federation-only guidance, so removing the path aligns the whole stack.
Issue #14 reported "Azure WIF account submits without a required private key"; the correct fix isn't to require the key — it's to remove the obsolete field entirely so the reporter's scenario is impossible.
Changes
Frontend
'azure_wif_private_key'from the TScredential_typeunion.Backend — credential resolver
credentials/resolver.go: deletebuildAzureWIFCredential,parsePEMBlob,processPEMBlock,parseRSAKeyBlock,CredTypeAzureWIF. Dropcrypto/rsa,crypto/sha1,crypto/x509,encoding/base64,encoding/pem,golang-jwt/v5imports.credentials/azure_federated.go:resolveAzureWIFCredentialbecomes a straight delegation toBuildAzureFederatedCredential; fails fast with an operator-facing error when the OIDC signer isn't wired.Backend — API
api/handler_accounts.go: removeazure_wif_private_keyfromvalidCredentialTypesand error strings. Drop the legacy fallback inazureFederatedCredResult.credTypeForAccountreturns""for Azure WIF;checkCredentialPresenceshort-circuits empty credType with an actionable operator message (covers the degraded "signer not wired" case).api/validation.go: drop theazure_wif_private_keypayload schema and switch arm.api/handler_federation.go: rewrite the Azure README generator — federation-only guidance matches the bundled IaC templates.api/handler_registrations.go: refreshaccountHasCredentialFreePathcomment.Tests (net -345 lines)
credentials/resolver_extra_test.go: delete allTestBuildAzureWIFCredential_*,TestParsePEMBlob_*, and the cert-generation helpers. Reframe the Azure-WIF resolver tests as "requires wired OIDC signer".api/coverage_gaps_test.go:TestCredTypeForAccountexpects""for Azure WIF.api/validation_test.go: drop the twoazure_wif_private_keycases.DB
Risk
azure_wif_private_keycredentials breaks. This is an internal-only surface; only CUDly's own frontend uses it.Closes #14.
Test plan
go test ./...— all Go packages greengo build ./...— cleannpx jest— 1234 tests pass (35 suites)npx tsc --noEmit— clean/api/infoon the deployed AWS Lambda URL; open the Azure add-account modal in a browser and confirm the RSA Private Key textarea is gone.