規格符合度
查閱 Zeabur Identity 各項規格要求對應的程式碼、測試與符合狀態。
這裡列出 Zeabur Identity 實作的每項 MUST 與 SHOULD 要求,以及對應的程式碼與測試。Zeabur Identity 還沒有取得 OpenID 認證。
規範用語遵循 RFC 2119 與 RFC 8174。各 crate 的文件列出所實作要求的完整引用來源,設計決策則寫在架構。用以下指令開啟 crate 文件:
cargo doc --workspace --open表格保留來源中的要求與狀態文字。各狀態的意思如下:
- Met:已有實作程式碼與測試。
- Partial:部分符合,該列會註明限制。
- Not implemented:尚未實作。
- N/A:不適用,該列會註明原因。
程式碼路徑以 crates/ 為基準。單元測試格式為 crate: module::tests::name,整合測試格式為 crate/tests/file.rs: name。
標記為 (cluster) 的測試使用 k3s v1.37.2,執行時加上 --run-ignored only。標記為 (e2e) 的測試位於 zeabur-identity-e2e/tests/e2e.rs,使用 Zeabur Identity 容器映像檔執行。標記為 (e2e, Keycloak) 的測試另外需要 Keycloak 伺服器,用 scripts/keycloak-e2e.sh 執行,不在 CI 中執行。
各項規格摘要
Section titled “各項規格摘要”| Specification | Version / status (2026-10) | Status |
|---|---|---|
| OpenID Connect Discovery 1.0 | Final (errata set 2) | Met |
| RFC 8414 OAuth 2.0 Authorization Server Metadata | RFC | Met |
| RFC 7515 JWS, RFC 7517 JWK, RFC 7518 JWA, RFC 7638 thumbprints | RFC | Met |
| RFC 7519 JWT, RFC 8725 JWT BCP, RFC 9068 JWT access tokens | RFC | Met |
KEP-3331 Structured Authentication Configuration (apiserver.config.k8s.io/v1) | GA in Kubernetes 1.34 | Met on k3s in CI; verified manually on RKE2 v1.36.5+rke2r1 |
| RFC 6749 OAuth 2.0 (authorization code, refresh) | RFC | Met |
| RFC 7636 PKCE | RFC | Met (S256 only) |
| RFC 9700 OAuth 2.0 Security BCP | BCP 240 | Partial: sender-constrained tokens (DPoP) not implemented |
| RFC 6750 Bearer token usage | RFC | Met for UserInfo |
| RFC 8707 Resource Indicators | RFC | Met (one resource per request) |
| RFC 7009 Token Revocation | RFC | Met (refresh tokens; access tokens answered with unsupported_token_type) |
| RFC 9126 PAR | RFC | Met |
| RFC 9207 Authorization server issuer identification | RFC | Met |
| OpenID Connect Core 1.0 | Final (errata set 2) | Partial: no single sign-on sessions, so every authorization request asks for a sign-in |
| W3C WebAuthn Level 3 | Recommendation | Met for registration, discoverable sign-in, and conditional mediation |
WebAuthn Signal API (signalAllAcceptedCredentials, signalUnknownCredential) | WebAuthn Level 3 | Met where the browser has it (feature-detected) |
| W3C A Well-Known URL for Relying Party Passkey Endpoints | Working Draft | Met |
| NIST SP 800-63B-4 | Final, Jul. 2025 | Partial: user-verified passkeys (AAL2-capable); passwords with a TOTP code as the second factor, which admin passwords need by default; with admin-sign-in: device-bound-passkey, admin accounts need a device-bound passkey (BE unset, self-reported: attestation is none); refresh sessions end after 1 h idle (15 min for admins with several teams or device-bound passkeys) and 12 h after sign-in; account-page sessions end after one hour and need a fresh verified passkey within five minutes to add or remove one, or to link or unlink an upstream account |
| Cookies (draft-ietf-httpbis-rfc6265bis) | Draft | Met for the __Host- cookies used |
| RFC 9457 Problem Details | RFC | Met for the sign-in endpoints |
| RFC 8176 Authentication Method Reference values | RFC | Met (swk, mfa for passkeys; pwd for passwords, with otp and mfa after a TOTP code, mfa after a recovery code) |
| RFC 6238 TOTP | RFC | Met (SHA-1, 6 digits, 30 s steps, one step of drift) |
| WCAG 2.2 AA | W3C Recommendation | Partial: contrast computed and met for every color pair used; no automated browser audit or screen-reader pass yet |
| OpenID Connect RP-Initiated Logout 1.0 | Final | Not implemented (no sessions) |
| OpenID Connect Back-Channel Logout 1.0 | Final | Not implemented |
| RFC 9449 DPoP | RFC | Not implemented: kube-apiserver accepts only bearer tokens |
| RFC 9396 Rich Authorization Requests | RFC | N/A: kube-apiserver cannot evaluate authorization_details; not advertised |
| RFC 9470 Step-up Authentication Challenge | RFC | N/A: kube-apiserver never sends the challenge. Admin rights come from a separate, passkey-only admin account instead |
| OAuth 2.1 (draft-ietf-oauth-v2-1) | Draft | Followed where it tightens OAuth 2.0 (PKCE always, S256 only) |
OpenID Foundation conformance suite, oidcc-basic-certification-test-plan | — | Not run yet |
| Requirement | Code | Check | Status |
|---|---|---|---|
unsafe_code = "forbid" | Cargo.toml [workspace.lints.rust]; #![forbid(unsafe_code)] in both binaries | CI clippy, unsafe-report | Met |
| Only OSI-approved licenses | deny.toml [licenses] | CI cargo-deny | Met |
| Known vulnerabilities rejected | deny.toml [advisories] | CI cargo-deny | Met |
Dependency unsafe/native code listed for approval | zeabur-oss-unsafe-report (zeabur-oss/.github), supply-chain/unsafe-allowlist.toml | CI unsafe-report | Met |
| clippy pedantic + restriction set, rustfmt | Cargo.toml [workspace.lints], clippy.toml, rustfmt.toml | CI clippy, format, docs | Met |
| DCO sign-off | CONTRIBUTING.md, zeabur-oss/.github dco.yml | CI dco | Met |
| One pinned Rust toolchain | flake.nix, flake.lock | CI clippy, format in nix develop | Met |
| Image: static binary, non-root, no shell | Containerfile, zeabur-identity-k8s/src/deployment.rs | zeabur-identity-k8s: deployment::tests::deployment_is_locked_down; (e2e) | Met |
| Image size and idle memory measured in CI | scripts/build-image.sh, e2e measurement | CI kubernetes job summary | Met (the Pod's working set after sign-in stays within the 30 MiB budget; CI reports image size only in the summary, with no size limit) |
| Image signing (Sigstore) and SBOM | .github/workflows/release.yml, scripts/release-build.sh, scripts/release-verify.sh | Exact-digest signature/SBOM verification and public pull in both native release rehearsal jobs | Partial: pipeline implemented; public OIDC publication evidence requires a successful tag-triggered run (release procedure) |
| Versioned CLI archives, checksums, signed provenance, and SBOMs | Same workflow; scripts/release-smoke.sh | Signed checksum manifest; downloaded archive execution and Kubernetes-backed container startup on Linux amd64/arm64 while release stays draft; separate maintainer publication after installation acceptance | Partial: pipeline implemented; local smoke is not evidence of a published release |
OpenID Connect Discovery 1.0 與 RFC 8414
Section titled “OpenID Connect Discovery 1.0 與 RFC 8414”| § | Requirement | Level | Code | Test | Status |
|---|---|---|---|---|---|
| Disc. 3 | issuer: https, no query or fragment | REQUIRED | zeabur-identity-core/src/config.rs BaseUrl::parse | zeabur-identity-core: config::tests::rejects_everything_else | Met |
| Disc. 3 | authorization_endpoint, token_endpoint, userinfo_endpoint, jwks_uri (https) | REQUIRED | zeabur-identity-oauth/src/discovery.rs | zeabur-identity-oauth: discovery::tests::required_members_are_present | Met |
| Disc. 3 | id_token_signing_alg_values_supported includes RS256 | MUST | discovery.rs, zeabur-identity-keys Algorithm::ALL | same | Met |
| Disc. 3 | scopes_supported includes openid | MUST | discovery.rs | same | Met |
| Disc. 3 | Defaults that would over-claim set explicitly | — | discovery.rs | zeabur-identity-oauth: discovery::tests::does_not_inherit_misleading_defaults | Met |
| Disc. 4, 4.3 | Document at /.well-known/openid-configuration; issuer identical | MUST | zeabur-identity-oauth/src/metadata.rs | zeabur-identity-oauth: metadata::tests::both_metadata_locations_serve_the_same_document | Met |
| 8414 §3, §3.3 | Well-known location; identical issuer; RFC 9068 §4 consistency | MUST | one document at both paths | same | Met |
| Disc. 7.1 | TLS for discovery | MUST | TLS at the ingress; the internal listener for kube-apiserver uses a private CA that cert-manager keeps | zeabur-identity: internal::tests::serves_metadata_with_the_issued_certificate_and_renews_in_place | Met |
JOSE:RFC 7515、7517、7518、7638、8725
Section titled “JOSE:RFC 7515、7517、7518、7638、8725”| § | Requirement | Level | Code | Test | Status |
|---|---|---|---|---|---|
| 7515 §4.1.1, §4.1.4 | alg present; kid identifies the key | MUST | zeabur-identity-keys/src/jws.rs | zeabur-identity-keys: jws::tests::independent_library_verifies_with_published_jwk | Met |
| 7515 §4.1.11 | Unknown critical extensions rejected | MUST | zeabur-identity-keys/src/verify.rs | zeabur-identity-keys: verify::tests::rejects_tampering_wrong_keys_and_algorithms | Met |
| 7517 §4.5, §4.3, §5 | Distinct kids; not use with key_ops; set format | SHOULD | zeabur-identity-keys/src/jwk.rs | zeabur-identity-keys: jwk::tests::*, rotation::tests::schedule_invariants | Met |
| 7518 §3.3, §3.4, §3.6 | RSA ≥ 2048 bits (3072 generated); fixed-width ES256; no none | MUST | zeabur-identity-keys/src/signing.rs, verify.rs | zeabur-identity-keys: signing::tests::*, verify::tests::* | Met |
| 7638 §3 | Thumbprint canonical form | MUST | jwk.rs | zeabur-identity-keys: jwk::tests::rfc7638_example_thumbprint | Met |
| 8725 §3.1 | One algorithm per key | MUST | signing.rs, verify.rs | zeabur-identity-keys: signing::tests::rejects_key_for_the_wrong_algorithm, verify::tests::an_rsa_key_never_verifies_an_es256_header | Met |
| 8725 §3.10, §3.11 | No jku/x5u/jwk headers; explicit typ | — / RECOMMENDED | jws.rs (at+jwt, JWT) | zeabur-identity-oauth/tests/oauth.rs: code_flow_issues_tokens_kubernetes_can_use | Met |
| OIDC Core §10.1.1 | Keep decommissioned keys published for a while | SHOULD | zeabur-identity-keys/src/rotation.rs | zeabur-identity-keys: rotation::tests::* | Met |
kube-apiserver 整合(KEP-3331)
Section titled “kube-apiserver 整合(KEP-3331)”| Source | Requirement | Code | Test | Status |
|---|---|---|---|---|
oidc.go | RS/ES/PS algorithms only | ES256 default, RS256 | — | Met |
| go-oidc v2 key cache | A new key is visible before it signs | zeabur-identity-keys/src/rotation.rs publish-ahead; max-age below it | zeabur-identity-keys: rotation::tests::schedule_invariants, zeabur-identity: cli::tests::rejects_bad_issuers_and_inconsistent_timings | Met |
validation.go | discoveryURL https and different from url | internal TLS listener at the Service's ClusterIP | (e2e) | Met |
oidc.go | Internal discovery keeps issuer; jwks_uri from that document | zeabur-identity-oauth/src/discovery.rs | zeabur-identity-oauth: discovery::tests::internal_variant_changes_only_the_jwks_uri; (e2e) | Met |
| AuthenticationConfiguration | Prefixed usernames and groups; no system:; access tokens only (has(claims.client_id)); lifetime bound | zeabur-identity-k8s/src/kube_config.rs | zeabur-identity-k8s: kube_config::tests::*; (e2e) passkey_sign_in_then_kubectl_auth_whoami | Met |
| Distributions | anonymous per distribution; install steps for K3s/RKE2 | kube_config.rs | zeabur-identity-k8s: kube_config::tests::* | Partial: configuration generation tested; CI cluster E2E covers k3s; verified manually on RKE2 v1.36.5+rke2r1 |
| Project requirement | kubectl auth whoami on k3s | — | (e2e) | Met |
Kubernetes 儲存
Section titled “Kubernetes 儲存”| Source | Requirement | Code | Test | Status |
|---|---|---|---|---|
| API concepts | Update with resourceVersion is compare-and-swap; delete preconditions; create of an existing name fails | zeabur-identity-k8s/src/objects.rs | zeabur-identity-k8s/tests/kubernetes.rs: exactly_one_racer_wins_each_primitive (cluster) | Met |
| CRD validation | CEL within the cost budget | zeabur-identity-api/src/*.rs | admission_rejects_invalid_objects (cluster) | Met |
| RBAC | 最小權限:只能依名稱存取 Secret,不能對 Secret 使用 create,也沒有 RBAC 操作權限;帳號頁面可對核心 Events 使用 create,對 credentials/status 使用 update/patch;只能讀取 upstreamproviders,並對唯一的上游 Secret 使用 get;不能對 credentials 使用 update 或 patch | zeabur-identity-k8s/src/rbac.rs | service_account_has_least_privilege, upstream_providers_admit_only_fitting_fields_and_are_read_only (cluster), zeabur-identity-k8s: rbac::tests::* | Met |
| RFC 9700 §2.1; RFC 8252 §7.3; RFC 6749 §3.1.2 | Redirect URI 必須是有主機的 https://,或帶路徑的 loopback http://;只能用可列印的 ASCII,不能有片段或使用者資訊。Admission 用 CEL isURL()/url() 檢查;zeabur-identityctl client create 還要求合法的 WHATWG URL,寫成序列化後的形式,百分比編碼也要正確,這樣完全比對時看到的就是瀏覽器使用的字串,admission 也會接受 | zeabur-identity-api/src/client.rs REDIRECT_URI_RULE, zeabur-identity-k8s/src/clients.rs redirect_uri_allowed | zeabur-identity-k8s: clients::tests::redirect_uris_are_https_or_loopback_in_the_form_a_browser_uses, clients::tests::invalid_registrations_are_rejected_with_the_offending_value; tests/redirect_uris.rs (性質測試:接受的 URI 經過 WHATWG 與 RFC 3986 剖析器和授權回應後不變,loopback 連接埠相符,瀏覽器的形式會被接受); admission_rejects_invalid_objects, admission_and_identityctl_agree_on_generated_redirect_uris (cluster)(產生的候選值;zeabur-identityctl 接受的都能通過 admission,而 admission 放行的,對瀏覽器來說絕不會是既非 HTTPS 也非 loopback、含片段或含帳密的目標) | Met |
| RFC 6749 §10.10 | Generated client secrets: 256 bits from the CSPRNG (guessing probability at most 2^-128 is a MUST, at most 2^-160 a SHOULD); only the hash is stored | zeabur-identity-k8s/src/clients.rs register | zeabur-identity-k8s: clients::tests::confidential_clients_get_a_fresh_random_secret_and_only_its_hash, clients::tests::emitted_objects_satisfy_the_schema_rules; oauth_flow_on_kubernetes_storage (cluster: the printed secret authenticates, a wrong one is invalid_client) | Met |
| Project requirement | Expired objects are cleaned up | zeabur-identity-k8s/src/gc.rs | garbage_collector_deletes_expired_objects_only (cluster) | Met |
| Project requirement | Signing keys in a Secret, rotation with overlap | zeabur-identity-k8s/src/keys.rs | signing_keys_persist_and_only_one_writer_wins (cluster) | Met |
| WebAuthn Level 3 §7.1 | A known credential ID fails registration | zeabur-identity-store passkey_credential_name, create-once | zeabur-identity-signin/tests/signin.rs; setup_link_is_single_use_and_replaceable (cluster) | Met |
| RFC 9700 §4.14.2 | Refresh rotation with reuse detection | zeabur-identity-k8s/src/grants.rs, zeabur-identity-store classify | grant_rotation_is_linearizable (cluster: 1 of 64 rotates) | Met |
| Project account-recovery policy; RFC 9700 §4.14.2 (security-event revocation, MAY) | Reset deletes pending invitations, then credentials, then refresh-token families before writing a setup link, including zero-credential retries after partial failure | zeabur-identity-k8s/src/setup.rs | Account-recovery tests | Met |
帳號救援測試
Section titled “帳號救援測試”zeabur-identity-k8s/tests/setup_reset.rs:reset_revokes_invitations_before_anything_else、reset_retries_grant_deletion_after_credentials_are_gone與reset_revokes_old_grants_without_credentials使用模擬的 Kubernetes HTTP API 和實際的 OAuth 路由器,測試部分步驟失敗後的救援流程。zeabur-identity-k8s/tests/kubernetes.rs:setup_link_is_single_use_and_replaceable在叢集上確認重設只會撤銷目標使用者的邀請。zeabur-identity-e2e/tests/e2e.rs:passkey_sign_in_then_kubectl_auth_whoami在叢集上確認更新權杖在重設前可用,重設後失效。
OAuth 2.0 與 OpenID Connect
Section titled “OAuth 2.0 與 OpenID Connect”除非另有註明,測試都位於 zeabur-identity-oauth/tests/oauth.rs。
| Spec § | Requirement | Level | Code (zeabur-identity-oauth/src/) | Test | Status |
|---|---|---|---|---|---|
| 6749 §3.1, §3.2 | Parameters not repeated | MUST | params.rs | authorization_endpoint_errors | Met |
| 6749 §3.1.2.3; 9700 §2.1 | Exact redirect URI match (loopback port excepted) | MUST | authorize.rs | zeabur-identity-oauth: authorize::tests::redirect_uri_rules | Met |
| 6749 §4.1.2.1 | No redirect for an invalid client or redirect URI | MUST NOT | endpoints.rs (HTML error page) | authorization_endpoint_errors; zeabur-identity-signin/tests/pages.rs: untrusted_authorization_requests_show_an_error_page | Met |
| 6749 §4.1.2 | Codes short-lived and single use; reuse revokes issued tokens | MUST | code.rs, endpoints.rs | code_is_single_use_and_reuse_revokes_what_it_issued, exactly_one_concurrent_redemption_succeeds | Met |
| 6749 §4.1.3 | Code bound to client and redirect_uri | MUST | endpoints.rs | pkce_and_code_binding_are_enforced | Met |
| 6749 §2.3.1, §5.2 | Client authentication; WWW-Authenticate for Basic | MUST | client_auth.rs | confidential_client_gets_rs256_id_tokens_and_must_authenticate | Met |
| 6749 §5.1 | Cache-Control: no-store | MUST | error.rs no_store | code_flow_issues_tokens_kubernetes_can_use | Met |
| 6749 §10.10 | Token guessing ≤ 2^-128 | MUST | 256-bit secrets; sealed codes | — | Met |
| 6749 §10.12 | CSRF protection for the authorization endpoint | MUST | approval is a same-origin JSON sign-in bound to the browser's sealed flow cookie | zeabur-identity-signin/tests/signin.rs: requests_from_other_sites_are_refused, sign_in_needs_a_pending_authorization_request | Met |
| 7636 §4.1, §4.4.1, §4.6 | Verifier format; challenge required; S256 compare | MUST | pkce.rs, authorize.rs | zeabur-identity-oauth: pkce::tests::*, authorize::tests::* | Met |
| 9700 §2.1.1, §2.2.2 | PKCE required; public-client refresh tokens rotated | MUST | authorize.rs, endpoints.rs | pkce_and_code_binding_are_enforced, refresh_rotates_and_reuse_revokes_the_family | Met |
| 9700 §4.11.2 | 303, never 307 | MUST NOT | endpoints.rs | code_flow_issues_tokens_kubernetes_can_use | Met |
| 9068 §2.1, §2.2, §5 | at+jwt; required claims; distinct aud per resource | MUST | tokens.rs, authorize.rs | code_flow_issues_tokens_kubernetes_can_use, authorization_endpoint_errors | Met |
| 8707 §2 | invalid_target for disallowed resources | — | authorize.rs | zeabur-identity-oauth: authorize::tests::* | Met |
| 9126 §2.1, §2.2, §4 | Authenticated PAR; one-time, client-bound, expiring request URI | MUST | endpoints.rs | pushed_authorization_requests | Met |
| 7009 §2.1, §2.2 | Revocation by the owning client with constant-time proof of a current or previous refresh secret; 200 for invalid tokens without deleting a grant | MUST | endpoints.rs, refresh.rs | revocation, guessed_refresh_secrets_cannot_revoke_a_known_grant, current_and_previous_refresh_secrets_authorize_family_revocation; zeabur-identity-e2e: passkey_sign_in_then_kubectl_auth_whoami (forged-secret smoke) | Met |
| 6749 §6 | Validate refresh token and client binding; wrong-client family deletion requires constant-time proof of a current or previous secret, never a grant name alone | MUST; deletion policy | endpoints.rs, refresh.rs | guessed_refresh_secrets_cannot_revoke_a_known_grant, current_and_previous_refresh_secrets_authorize_family_revocation; zeabur-identity-e2e: passkey_sign_in_then_kubectl_auth_whoami (second public-client forged-secret smoke) | Met |
| Kubernetes Object Names and IDs | A refresh token renews only for the User whose UID the grant recorded; a grant without a recorded UID belongs to no one, and none renews for a new User with the same name | Project requirement | endpoints.rs refresh | a_session_left_from_a_removed_user_does_not_refresh_as_a_new_user_of_that_name | Met |
| Kubernetes Object Names and IDs | An authorization code is redeemed only for the User whose UID it sealed at sign-in, never for a new User with the same name; no grant is created | Project requirement | code.rs CodeClaims, endpoints.rs exchange_code | a_code_for_a_removed_user_is_not_redeemed_for_a_new_user_of_that_name | Met |
| 9207 §2 | iss in authorization responses | MUST | authorize.rs | code_flow_issues_tokens_kubernetes_can_use | Met |
| OIDC Core §2, §3.1.3.6 | ID token claims; aud is the client; azp | REQUIRED | tokens.rs | code_flow_issues_tokens_kubernetes_can_use | Met |
| OIDC Core §3.1.2.1 | GET and POST; prompt=none without a session fails | MUST | endpoints.rs, authorize.rs | authorization_endpoint_accepts_post, authorization_endpoint_errors | Met |
| OIDC Core §3.1.2.1 | ui_locales | OPTIONAL | error page | zeabur-identity-signin/tests/pages.rs: untrusted_authorization_requests_show_an_error_page | Partial: the sign-in page does not use it |
| OIDC Core §5.3; RFC 6750 §2.1, §3 | UserInfo with bearer access tokens; challenges with error codes; current claims by scope | MUST | userinfo.rs | userinfo_returns_current_claims_for_access_tokens_only | Met |
| OIDC Core §5.3.2 | Always return the grant's sub; resolve metadata by UID and verify the directly read user's UID and enabled state | MUST; binding policy | userinfo.rs, zeabur-identity-k8s/src/directory.rs | userinfo_returns_current_claims_for_access_tokens_only, userinfo_rejects_deleted_and_recreated_users, userinfo_rejects_unknown_and_ambiguous_subjects | Met (client-side ID token subject comparison remains the client's responsibility) |
| OIDC Core §12.2 | Refreshed ID token keeps auth_time, no nonce | MUST | endpoints.rs | refresh_rotates_and_reuse_revokes_the_family | Met |
| OIDC Core §15.1 | max_age, prompt=login | MUST | every sign-in is a fresh ceremony (no sessions) | zeabur-identity-signin/tests/signin.rs: setup_link_then_passkey_sign_in_issues_tokens; auth_time_is_the_sign_in_and_survives_refresh (a request with max_age shows the sign-in page) | Met while there are no sessions |
帳號類型與工作階段
Section titled “帳號類型與工作階段”除非另有註明,OAuth 測試都位於 zeabur-identity-oauth/tests/oauth.rs。
| Requirement | Code | Test | Status |
|---|---|---|---|
Admin accounts sign in as admin-sign-in allows: any, every method; two-factor (default), a passkey, a password with a TOTP or recovery code, or an upstream provider marked mfa: Enforced; passkey, a passkey; device-bound-passkey, a device-bound passkey (BE unset); regular accounts are unaffected | zeabur-identity-core/src/account.rs allows | zeabur-identity-core: account::tests::each_level_allows_admins_what_it_names, account::tests::regular_accounts_use_every_method_at_every_level | Met |
| The token endpoint applies the same policy at code exchange and at every refresh, so a session that no longer qualifies ends at its next refresh | zeabur-identity-oauth/src/endpoints.rs | admin_accounts_follow_the_admin_sign_in_level | Met |
Unless admin-sign-in is any, admin accounts neither sign in with nor link a provider that is not marked mfa: Enforced, such as GitHub or Google. Under two-factor, they sign in with and link a marked OpenID provider; the callback reads the mark as it is then | zeabur-identity-signin/src/upstream.rs, lib.rs, account.rs | zeabur-identity-signin/tests/upstream.rs: admin_accounts_neither_sign_in_with_nor_link_github_or_google, an_admin_signs_in_through_a_provider_marked_as_enforcing_a_second_factor, an_admin_is_refused_when_the_mark_is_removed_during_sign_in, an_admin_links_only_marked_providers_from_the_account_page | Met |
| RFC 8176 §2; OIDC Core §2 | A sign-in through a provider marked mfa: Enforced carries amr = ["mfa"], on the operator's statement alone (the provider's own amr and acr are not read). The token endpoint maps an amr with neither swk nor pwd to an upstream sign-in, with a second factor only if it holds the exact, case-sensitive mfa; a missing value counts as none, and a level change ends the session at its next refresh | zeabur-identity-oauth/src/endpoints.rs check_policy; zeabur-identity-signin/src/upstream/provider.rs Provider::amr | zeabur-identity-oauth: an_admin_upstream_sign_in_needs_the_mfa_value_and_the_two_factor_level; zeabur-identity-signin/tests/upstream.rs: a_regular_account_through_a_marked_provider_gets_mfa_and_through_others_nothing |
With admin-sign-in: device-bound-passkey, a synced passkey can neither sign in to nor be enrolled for an admin account | zeabur-identity-signin/src/lib.rs, account.rs | zeabur-identity-signin/tests/signin.rs: with_device_bound_passkeys_an_admin_cannot_sign_in_with_a_synced_passkey, with_device_bound_passkeys_an_admin_enrols_only_a_device_bound_passkey | Met |
TOTP codes follow RFC 6238; each step and each recovery code works once; wrong codes count as failed password sign-ins; at two-factor, an admin sets a password only with an authenticator that gave a valid code; the secret is sealed at rest and recovery codes are stored as HMACs | zeabur-identity-core/src/totp.rs, zeabur-identity-signin/src/password.rs | zeabur-identity-core: totp::tests::codes_match_the_rfc_6238_test_vectors, a_code_works_within_one_step_and_only_once, recovery_codes_work_once_and_ignore_case_and_dashes; zeabur-identity-signin/tests/signin.rs: an_admin_password_needs_an_authenticator, an_admin_signs_in_with_a_password_and_a_code_that_works_once, a_recovery_code_works_once_in_place_of_a_code, wrong_codes_count_as_failed_sign_ins | Met |
Only admin accounts' tokens carry the admins group, and their tokens are shorter (5 min vs 10 min); the CRD refuses admins in spec.groups | zeabur-identity-oauth/src/tokens.rs, zeabur-identity-api/src/user.rs | only_admin_accounts_carry_the_admin_group_and_their_tokens_are_shorter | Met |
Refresh idle: 1 h, or 15 min for admins with teams: multiple or admin-sign-in: device-bound-passkey; every family ends 12 h after sign-in; refresh_expires_in in the token response | zeabur-identity-oauth/src/lib.rs Lifetimes::for_account, endpoints.rs | zeabur-identity-oauth: tests::lifetimes_per_account_type, refresh_idle_follows_the_account_type_and_the_settings; zeabur-identity-core: account::tests::short_admin_idle_follows_teams_or_device_bound_passkeys | Met |
auth_time is the sign-in and survives refresh; the 12 h limit counts from it | endpoints.rs | auth_time_is_the_sign_in_and_survives_refresh | Met |
Settings come from the ConfigMap zeabur-identity-settings, read at every sign-in and refresh; missing means default, a value not understood means the stricter setting | zeabur-identity-core/src/account.rs Settings::from_data, zeabur-identity-k8s/src/directory.rs | zeabur-identity-core: account::tests::settings_from_a_config_map | Met |
First admin: setup-link creates an admin account; zeabur:admins is bound to cluster-admin, so the admin has full rights without a second sign-in; a refresh needs no new sign-in and follows the account type (a regular account loses the rights) | zeabur-identity-k8s/src/rbac.rs, setup.rs | (e2e) passkey_sign_in_then_kubectl_auth_whoami | Met |
登入:通行密鑰、註冊連結與邀請
Section titled “登入:通行密鑰、註冊連結與邀請”除非另有註明,測試都位於 zeabur-identity-signin/tests/signin.rs。
| Source | Requirement | Level | Code (zeabur-identity-signin/src/) | Test | Status |
|---|---|---|---|---|---|
| Project requirement | Setup link works once and expires; no first-visitor admin | MUST | lib.rs (consume before storing), zeabur-identity-k8s/src/setup.rs | setup_token_is_single_use, concurrent_enrolments_with_one_token_add_one_passkey, setup_token_expires_and_must_match, setup_link_is_single_use_and_replaceable (cluster, 64 concurrent) | Met |
| Project requirement | Invitations work once, only for the invited user; the service account cannot create them | MUST | lib.rs, zeabur-identity-k8s/src/setup.rs, invitations.rs | invitation_enrols_the_invited_user_once, invitations_are_single_use_and_admin_only (cluster) | Met |
| WebAuthn §5.4.4, §5.4.6 | Discoverable credential, user verification required | — | passkeys.rs | zeabur-identity-signin: passkeys::tests::registration_requires_resident_keys_and_uv | Met |
| WebAuthn §7.1, §7.2 | UV verified; user handle is the owner's; challenge single use | MUST | passkeys.rs, lib.rs | passkeys_without_user_verification_are_refused (registration, client side), sign_in_without_user_verification_is_refused (signed assertion with UV clear, refused with no code or tokens; UV-positive control completes), unknown_passkeys_and_disabled_users_cannot_sign_in, assertions_cannot_be_replayed | Met |
| WebAuthn conditional mediation | Autofill (autocomplete="username webauthn") | — | passkeys.rs, ui/src/login.ts | zeabur-identity-signin/tests/pages.rs: login_offers_passkey_autofill_for_a_pending_request | Met |
| RFC 9457 §3 | Problem details | — | problem.rs | requests_from_other_sites_are_refused | Met |
| Fetch Metadata | Cross-site state-changing requests refused | — | request.rs check_request | requests_from_other_sites_are_refused, cross_site_requests_are_refused_before_the_body_is_read, zeabur-identity-signin: request::tests::same_origin_checks | Met |
| RFC 6265bis | __Host- cookies: Secure, Path=/, no Domain | MUST | lib.rs, upstream.rs | code_flow_issues_tokens_kubernetes_can_use | Met |
使用者可以在 /account 管理自己的通行密鑰、密碼與工作階段。除非另有註明,測試都位於 zeabur-identity-signin/tests/signin.rs 的 tests::account::*。
| Source | Requirement | Level | Code | Test | Status |
|---|---|---|---|---|---|
| Project requirement | Every read and write is filtered to the session's user by name and UID; names in requests only select among those | MUST | zeabur-identity-signin/src/account.rs, zeabur-identity-k8s/src/credentials.rs owned_passkeys, grants.rs list | the_page_lists_only_the_session_users_passkeys, changes_cannot_reach_another_users_objects; zeabur-identity-k8s/tests/account.rs: only_the_users_own_passkeys_are_listed_or_changed, grants_are_listed_by_uid_and_reauthenticated_by_secret | Met |
| Project requirement; NIST SP 800-63B-4 §2.2.3 | Adding or removing a passkey needs a user-verified assertion from the last 5 minutes, by one of the user's own passkeys, recorded on the session | MUST | account.rs is_fresh, reauth | adding_and_removing_need_a_recent_verified_passkey, changes_cannot_reach_another_users_objects | Met |
| Project requirement | The last passkey is never removed, including by concurrent removals | MUST | zeabur-identity-k8s/src/credentials.rs remove (revision bump on the others, then delete with preconditions) | the_last_passkey_cannot_be_removed, concurrent_removals_keep_one_passkey; zeabur-identity-k8s/tests/account.rs: interleaved_removals_keep_a_passkey, sequential_removals_stop_at_the_last_passkey | Met |
| Project requirement | Removing a passkey revokes every session and grant that signed in or re-authenticated with it | MUST | account.rs revoke_by_credential | removing_a_passkey_revokes_what_it_signed_in | Met |
| OWASP CSRF Prevention | Changes need the session cookie, same-origin Fetch Metadata (or an Origin equal to the issuer), and a JSON body | MUST | request.rs Account, SameOrigin, Body | changes_need_a_same_origin_json_request, cross_site_requests_are_refused_before_the_body_is_read | Met |
| RFC 6265bis | Session cookie __Host-, HttpOnly, SameSite=Lax; only the secret's hash is stored; one hour, not extended; ends when the user is disabled or recreated | MUST | account.rs | sessions_end_after_an_hour_and_with_the_user, sessions_can_be_revoked | Met |
| WebAuthn §5.4.3 | excludeCredentials lists the user's passkeys; resident key and UV required | SHOULD | account.rs add_options, passkeys.rs | adding_and_removing_need_a_recent_verified_passkey | Met |
| WebAuthn Signal API | signalAllAcceptedCredentials only with a complete, non-empty list; signalUnknownCredential for an unregistered credential | — | lib.rs accepted, Refused; ui/src/webauthn.ts signal | removing_a_passkey_revokes_what_it_signed_in | Met |
| Passkey Endpoints well-known URL | /.well-known/passkey-endpoints returns enroll and manage, 200 JSON, no redirect | — | account.rs passkey_endpoints | passkey_endpoints_are_published | Met |
| Project requirement | Add, rename, remove, and session revocation leave a zeabur_identity::audit log line and an Event on the User (actor, credential, AAGUID, client IP, user agent) | MUST | account.rs record; audit.rs Record::log; zeabur-identity-k8s/src/credentials.rs record | adding_and_removing_need_a_recent_verified_passkey, changes_need_a_same_origin_json_request; zeabur-identity-k8s/tests/account.rs: only_the_users_own_passkeys_are_listed_or_changed | Met |
| Project requirement | A passkey's label is the one the user typed; without one, the account page names it by its creation date | — | lib.rs new_passkey; zeabur-identity-ui/templates/account.html | a_passkey_without_a_label_shows_its_creation_date | Met |
| Project requirement | Changing or removing a password needs the current password, checked like a sign-in: wrong guesses count per browser and a held browser is refused; a new password follows the setup rules | MUST | zeabur-identity-signin/src/password.rs change, remove, check_current, strong | password::a_wrong_current_password_is_refused_and_counted, password::a_weak_new_password_is_refused, password::a_changed_password_signs_in_and_the_old_one_does_not | Met |
| Project requirement | A changed password keeps the authenticator, its last used step, and only the unused recovery codes; a removal deletes the authenticator with the password, never removes the user's last credential (also under a concurrent unlink), and refuses a password that changed since it was read | MUST | password.rs carried; zeabur-identity-k8s/src/credentials.rs remove_password | password::used_codes_stay_used_after_a_change, password::removing_the_password_removes_the_authenticator, password::the_only_way_in_cannot_be_removed, password::concurrent_changes_save_one_and_refuse_the_other; zeabur-identity-k8s/tests/account.rs: a_password_is_removed_only_while_the_user_keeps_another_way_in, a_password_removal_racing_an_unlink_keeps_a_credential | Met |
| Project requirement | A password change or removal ends every other session of the user, keeps the current one, and leaves a zeabur_identity::audit log line and an Event (PasswordChanged, PasswordRemoved) | MUST | account.rs revoke_all_but, record; audit.rs Record::log | password::a_change_or_removal_signs_out_every_other_session | Met |
| Project requirement | A password sign-in to the account page uses the same checks as /login/password: the same answer for an unknown user, a wrong password and a held unknown browser, the code step for a user with an authenticator, and the same per-browser counts. Its session is not user-verified, so changes that need a fresh passkey still ask for one | MUST | password.rs authenticate, account_session; account.rs start_session | password::a_user_with_only_a_password_signs_in_to_the_account_page_and_changes_it, password::an_admin_signs_in_to_the_account_page_with_a_password_and_a_code, password::account_sign_ins_count_against_the_sign_in_limits, password::an_unknown_user_gets_the_answer_of_a_wrong_password | Met |
上游登入(GitHub、OpenID 提供者)
Section titled “上游登入(GitHub、OpenID 提供者)”測試位於 zeabur-identity-signin/tests/upstream.rs。
| Source | Requirement | Code (zeabur-identity-signin/src/) | Test | Status |
|---|---|---|---|---|
| RFC 6749 §10.12; RFC 9700 §2.1 | state bound to the browser, compared in constant time, used once | upstream.rs | unlinked_disabled_and_replayed_sign_ins_fail | Met |
| RFC 9207 §2.4; RFC 6749 §3.1 | The callback compares iss with the issuer sealed in the pending request, by simple string comparison, before the code is sent. A different, empty or repeated iss is refused with issuer_mismatch. A pending request without the issuer, or for a provider whose issuer has changed, is refused. A response without iss is accepted (§2.4 MAY), so a provider that omits it gets no protection from this check | upstream.rs issuer_matches, callback | a_callback_with_another_empty_or_repeated_iss_is_refused_before_the_code_is_sent, a_callback_with_the_matching_or_no_iss_completes, a_pending_request_without_its_issuer_or_with_another_is_refused | Met |
| RFC 7636 | PKCE toward the provider | upstream/provider.rs | a_linked_github_account_signs_in_and_gets_a_code (fake provider checks the verifier) | Met |
| OIDC Discovery §4, §4.3, §3 | An OpenID provider's endpoints come from <issuer>/.well-known/openid-configuration. The document's issuer is identical to the configured issuer and its endpoints are https, or the sign-in fails with no fixed endpoint to fall back to | upstream/provider.rs metadata | the_openid_provider_is_reached_at_the_endpoints_its_discovery_document_names, an_unusable_discovery_document_ends_the_sign_in_with_no_other_endpoint_tried | Met |
| OIDC Core §3.1.3.7 | ID token: signature from the JWK set that discovery names, iss exactly the issuer (Google also accounts.google.com, the second form its documentation lists), aud exactly the client ID (no other audience trusted), azp if present equal to it, exp, iat, nonce | upstream/provider.rs | google_id_tokens_are_validated, another_openid_issuer_signs_in_through_the_same_checks | Met |
| Project requirement | Only linked accounts sign in; linking only through an enrollment link, once, or from a signed-in account page | upstream.rs | an_invitation_links_an_account_once, unlinked_disabled_and_replayed_sign_ins_fail, a_signed_in_user_links_an_account_on_the_account_page | Met |
| RFC 6749 §10.12 | A link from the account page starts only with a fresh verified passkey and a same-origin JSON request; its sealed state names the session, user, and UID, and the callback links nothing unless that session is still signed in for that user | upstream.rs account_start, Bound | linking_needs_a_fresh_confirmation_and_a_session | Met |
| Project requirement | An upstream account already linked to any user is not linked again; admin accounts link only providers that admin-sign-in allows, checked at the start and at the callback | upstream.rs finish_account_link | an_account_linked_to_anyone_is_not_linked_again, admin_accounts_cannot_link_from_the_account_page | Met |
| Project requirement | Unlinking needs a fresh verified passkey, never removes the user's last credential (also under concurrent unlinks), revokes what the account signed in, and records AccountUnlinked | account.rs unlink; zeabur-identity-k8s/src/credentials.rs unlink | unlinking_keeps_a_way_to_sign_in_and_ends_what_the_account_signed_in; zeabur-identity-k8s/tests/account.rs: the_last_credential_is_never_unlinked, interleaved_unlinks_keep_a_credential, only_linked_accounts_the_user_owns_are_listed_or_unlinked | Met |
| Kubernetes Object Names and IDs | A linked account signs in only as the User whose UID its owner reference names, never as a new User with the same name | upstream.rs callback; zeabur-identity-k8s/src/credentials.rs linked_account, link | a_link_left_from_a_removed_user_does_not_sign_in_as_a_new_user_of_that_name; zeabur-identity-k8s/tests/account.rs: a_linked_account_signs_in_only_as_the_user_that_owns_it | Met |
| Project requirement | An UpstreamProvider has clientId and exactly one of openid and github; openid needs issuer and may set mfa to Unknown (default) or Enforced; the issuer is https with a host and no user information, query or fragment; the name is a provider ID. The server checks each object again and leaves out one it cannot use | zeabur-identity-api/src/upstream_provider.rs; zeabur-identity/src/providers.rs build | upstream_providers_admit_only_fitting_fields_and_are_read_only (cluster); zeabur-identity: providers::tests::usable_objects_are_published_and_unusable_ones_left_out | Met |
| Project requirement | Added, changed and deleted providers and a rotated client secret apply at the next request without a restart; an unchanged provider keeps its caches; a request in flight whose provider was deleted or moved to another issuer ends before the code is sent | zeabur-identity-k8s/src/upstream.rs; zeabur-identity/src/providers.rs; upstream/provider.rs Providers, ClientSecret | provider_changes_and_secret_rotation_are_seen_without_a_restart (cluster); an_added_provider_starts_at_the_next_request, a_provider_deleted_or_changed_during_a_sign_in_ends_it_before_the_code_is_sent, the_client_secret_is_read_at_each_exchange; zeabur-identity-signin/tests/pages.rs: provider_buttons_follow_the_registry; zeabur-identity: providers::tests::an_unchanged_provider_is_kept_and_a_changed_or_deleted_one_is_not | Met |
| Project requirement | Deleting a provider deletes no linked account; the account page still lists and unlinks it, and a provider with the same issuer signs it in | upstream.rs, account.rs shown_provider | a_deleted_provider_keeps_its_linked_accounts | Met |
| Project requirement | A Credential is a passkey, a linked account or a password by the field it has, passkey, external or password. Credentials stored by v0.1.2 and v0.2.0, with type and provider, sign in and unlink under this version's CRD without a migration | zeabur-identity-api/src/credential.rs CredentialKind | credentials_stored_by_released_versions_sign_in_and_unlink (cluster); zeabur-identity-api: credential::tests::* | Met |
| Project requirement | UpstreamProvider 要有 clientId,並在 openid 和 github 中剛好設定一個;openid 必須有 issuer。Issuer 必須使用 HTTPS 並包含主機名稱,不能含有使用者資訊、查詢字串或片段;物件名稱就是提供者 ID。伺服器會再次檢查每個物件,略過無法使用的物件 | zeabur-identity-api/src/upstream_provider.rs; zeabur-identity/src/providers.rs build | upstream_providers_admit_only_fitting_fields_and_are_read_only (cluster); zeabur-identity: providers::tests::usable_objects_are_published_and_unusable_ones_left_out | Met |
| Project requirement | 新增、修改或刪除提供者,以及更換用戶端密鑰後,下次請求就會套用,不需要重新啟動;未變更的提供者會保留快取;如果進行中的請求所用的提供者遭到刪除,或改用其他 Issuer,請求會在送出授權碼前結束 | zeabur-identity-k8s/src/upstream.rs; zeabur-identity/src/providers.rs; upstream/provider.rs Providers, ClientSecret | provider_changes_and_secret_rotation_are_seen_without_a_restart (cluster); an_added_provider_starts_at_the_next_request, a_provider_deleted_or_changed_during_a_sign_in_ends_it_before_the_code_is_sent, the_client_secret_is_read_at_each_exchange; zeabur-identity-signin/tests/pages.rs: provider_buttons_follow_the_registry; zeabur-identity: providers::tests::an_unchanged_provider_is_kept_and_a_changed_or_deleted_one_is_not | Met |
| Project requirement | 刪除提供者不會刪除已連結的帳號;帳號頁面仍會列出這些帳號,也能解除連結;使用相同 Issuer 的提供者仍可讓這些帳號登入 | upstream.rs, account.rs shown_provider | a_deleted_provider_keeps_its_linked_accounts | Met |
| Project requirement | Credential 有 passkey 就是通行密鑰,有 external 就是連結的帳號,有 password 就是密碼。v0.1.2 與 v0.2.0 存下、帶有 type 與 provider 的 Credential,套用這個版本的 CRD 後不需遷移,仍可登入與解除連結 | zeabur-identity-api/src/credential.rs CredentialKind | credentials_stored_by_released_versions_sign_in_and_unlink (cluster); zeabur-identity-api: credential::tests::* | Met |
| OIDC Core §3.1; OIDC Discovery §4 | 與實際的 OpenID 提供者 Keycloak 互通。Keycloak 使用私人 CA,Pod 透過 SSL_CERT_FILE 與 SSL_CERT_DIR 信任它:未連結的帳號無法登入;從帳號頁面連結的兩個帳號都以所屬使用者登入;解除連結其中一個後,該帳號再次無法登入,另一個仍可登入 | scripts/keycloak-e2e.sh | keycloak_links_signs_in_and_unlinks (e2e, Keycloak) | Met |
| Kubernetes Object Names and IDs | An invitation or setup link enrolls a passkey or links an account only for the User whose UID its owner reference names | lib.rs valid_setup_token; zeabur-identity-k8s/src/setup.rs load_setup, load_invitation | signin.rs: a_link_left_from_a_removed_user_does_not_enrol_a_new_user_of_that_name; zeabur-identity-k8s/tests/account.rs: an_invitation_enrols_only_the_user_that_owns_it | Met |
測試位於 zeabur-identity-signin/tests/pages.rs。每個頁面測試都會檢查標頭,並確認頁面標記不需要使用 CSP 禁止的功能。
| Source | Requirement | Level | Code | Test | Status |
|---|---|---|---|---|---|
| RFC 9700 §4.16 | Prevent clickjacking (CSP frame-ancestors, X-Frame-Options) | MUST | zeabur-identity-ui/src/lib.rs harden | all page tests | Met |
| CSP Level 3, Trusted Types | No inline script, style, or handlers; no string-to-HTML sinks | — | zeabur-identity-ui, ui/src/*.ts | all page tests | Met |
| RFC 9110 §12.5.4, §12.4.2 | Accept-Language with quality values | — | zeabur-identity-ui/src/i18n.rs | zeabur-identity-ui: i18n::tests::*, language_follows_parameter_then_header | Met |
| Project requirement | Assets embedded, no CDN; built from source for every shipped binary; size measured | MUST | zeabur-identity-ui/src/assets.rs, zeabur-identity-ui/build.rs, scripts/build-ui.sh, scripts/ui-budget.sh | assets_are_embedded_versioned_and_immutable; CI ui | Met |
| Project requirement | No tokens in browser storage; cookies HttpOnly, Secure, SameSite | MUST | ui/src/*.ts, zeabur-identity-signin | bun run typecheck in ui/, review | Met |
| Project requirement | Fallback without passkey support or script; provider buttons only when configured | MUST | templates | login_offers_passkey_autofill_for_a_pending_request, provider_buttons_appear_only_when_configured | Met |
| Project requirement | Dark mode; en, zh-TW, zh-CN | MUST | ui/styles/app.css, zeabur-identity-ui/src/i18n.rs | language_follows_parameter_then_header | Met |
| Escaping | User-influenced text cannot inject markup | — | askama auto-escaping | user_controlled_text_is_escaped | Met |
| WCAG 2.2 1.4.3, 1.4.11 | Text ≥ 4.5:1; boundaries and focus ≥ 3:1 | AA | the design system's tokens, ui/styles/app.css | contrast.py (CI ui), computed table in the zeabur-identity-ui docs | Met for every pair used |
| WCAG 2.2 2.4.7, 2.5.8, 3.1.1, 3.1.2, 3.3.1, 4.1.3 | Focus, target size, language, errors, status messages | A / AA | templates | language_follows_parameter_then_header; review | Met by inspection |
| WCAG 2.2 | Automated audit and assistive-technology pass | — | — | — | Not done |