feat: add Okta SAML credential exchange with session cache - #245
feat: add Okta SAML credential exchange with session cache#245youngjinjung-linq wants to merge 2 commits into
Conversation
Introduce the okta_saml auth type so Okta-backed contexts can be defined ahead of runtime credential exchange (DevopsArtFactory#85). Config gains okta_org_url and okta_app_id fields in both the flat and structured auth forms, the context add wizard offers okta_saml with non-secret fields only (passwords and MFA secrets never touch config.yaml), and the repository/env flows reject okta_saml contexts with a clear not-implemented-yet error instead of misbehaving. Closes DevopsArtFactory#84 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BFhLrnpVxivu62cC3k9NZB
Implement runtime credential resolution for okta_saml contexts: `unic env` performs Okta primary authentication (prompting on stderr with no-echo password input, or UNIC_OKTA_USERNAME/UNIC_OKTA_PASSWORD for automation), fetches the SAML assertion from the app embed link, parses the AWS role/principal pairs, and exchanges the assertion via sts:AssumeRoleWithSAML. Role selection is deterministic: the context's role_arn wins, a single role is auto-selected, and multiple roles without a preference produce an explicit error listing the choices. Session credentials are cached under ~/.config/unic/cache/okta-saml/ (0700/0600, keyed by org|app|role) until expiry; the Okta password and session token are never persisted. The TUI passively reuses a valid cached session and otherwise points at `unic env <context>`. Okta MFA challenges are rejected with a clear error until DevopsArtFactory#87 lands. Closes DevopsArtFactory#85 Closes DevopsArtFactory#86 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BFhLrnpVxivu62cC3k9NZB
|
Warning Review limit reached
Next review available in: 17 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (12)
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 |
|
Recreated as #258 from an in-repo branch under the maintainer account; this PR is superseded. |
Summary
Implements #85 and #86 (Okta SAML track #26). Stacked on #244 — merge that first; this diff includes it until then.
internal/auth/okta.go): Okta primary authentication (/api/v1/authn) → one-time session token → SAML assertion scraped from the app embed link's auto-submit form →sts:AssumeRoleWithSAMLwith anonymous credentials.golang.org/x/term);UNIC_OKTA_USERNAME/UNIC_OKTA_PASSWORDenv vars override prompting for automation. Passwords, session tokens, and MFA secrets are never persisted.role_arnwins; a single assertion role is auto-selected; multiple roles without a preference produce an explicit error listing the ARNs.internal/services/aws/okta_saml_cache.go): exchanged AWS credentials cached under~/.config/unic/cache/okta-saml/(0700 dir / 0600 files, keyed by org|app|role hash) with a 2-minute expiry skew, mirroring the SSO and assume-role MFA cache patterns.unic envresolves cached-or-fresh sessions; the TUI (NewAwsRepository) passively reuses a valid cached session and otherwise fails fast withrun 'unic env <context>' first to sign in to Okta.MFA_REQUIRED/MFA_ENROLLresponses are rejected with a clear pointer to the upcoming feat: Add Okta MFA challenge flow for okta_saml #87 challenge flow.Testing
go test ./...passes: SAML role parsing (both role/provider orderings), role selection (preferred/single/multiple/missing), end-to-end resolve against anhttptestOkta (success, MFA_REQUIRED, 401), cache reuse without prompting, cache round-trip/expiry, and repository cache-hit/cache-miss paths.make buildpasses.Closes #85
Closes #86
Part of #26