Repository navigation
fix: P0 issues #143/#103/#70/#142 — consent mapping invariant, legacy-hash retirement, social login closure, real WebAuthn verification - #149
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
…me, passkey liveness gate, UV alignment B-1 (BLOCKER): the username-collision retry in AccountLinkFlow held its self-referencing attempt function via weak_ptr only; with the fully async production repository the initiating stack frame is gone when the INSERT round-trip returns, so the retry (and the terminal error path) silently dropped — the request hung until client timeout. The shared synchronous test fake masked exactly this shape. Rewritten as a free function recursing through a shared AttemptContext: the in-flight repository callback strongly owns the context, the chain stays alive across every round-trip, and all owners drop on the terminal branches. Pinned by two new DeferredSocialAccountRepository tests that queue every callback and drain it only AFTER login() returned (230/230 identity tests). M-1 (MAJOR): findByCredentialId now enforces user liveness on the passkey path — soft-deleted (deleted_at IS NULL filter) and locked (locked_until > now -> generic nullopt) users can no longer authenticate via /oauth2/webauthn/authenticate/finish; parity with the password and social paths (V024/#54 'disabled means cannot log in through ANY flow'). Minor: registration finish enforces UV=1 too (begin advertises required; a UV-less registration would mint a credential that can never authenticate); authenticateBegin mints ONE challenge instead of two (the old path discarded a CSPRNG draw); the three remaining bare Mapper constructions in PostgresWebAuthnRepository wrapped per db-operations.md rule 1; subject-mapping backfill now RETURNING-counted so the heal log is truthful. Full suite re-verified after the fixes: full_test 8/8 steps, 583/583 ctest x2 configs, 55/55 admin endpoint scripts; identity 230/230; static gates re-run green (api-diff/migration/arch/naming/ spec-governance/clients-sdk).
对抗性评审处置(评审代理裁决 REQUEST-CHANGES → 全部处置完毕,626a0b8b)
评审同时明确核实无误:#142 密码学逐步对照(COSE 定界/ED 跳过/signCount BE/rpIdHash/验签输入串/DER/tokenBinding/CborReader DoS 防护)、challenge 生命周期(无条件消费、TTL、预解析无绕过)、#70 publicSub 线程完整性、#103 翻转/锁定语义、#143 单次回调不变量、迁移幂等、旧部署无 webauthn 块 fail-closed。 修复后全量复验:full_test 8/8 步、583/583 ctest ×2 配置(+2 为新异步钉死测试)、55/55 admin 端点;identity 230/230;静态门复跑全绿。 |
…148 token system PR #148 (Machined Trust) remapped the palette to OKLCH semantic tokens; red-* is replaced by error-* (AppAlert's own error variant idiom). The new #149 callback page still used the legacy red-* classes -- swap to bg/text/border-error-* so it renders correctly under the remapped dark palette. (The Google/WeChat login buttons already match: #148 kept the GitHub button's neutral-* classes, and the neutral ramp is remapped in place.)
评审报告(已与分支代码逐条对齐复核)评审范围:按安全优先级聚焦 4 个 P0 issue 的核心路径 —— WebAuthn 加密核心(CborReader / WebAuthnCrypto / WebAuthnService / Controller)、社交登录令牌签发(SocialTokenIssuer + 三个 provider + AccountLinkFlow)、遗留哈希退役(PasswordHasher / AuthService / Assembly)、consent 映射迁移(V027/V028)、Postgres 存储层与对应测试。前端、e2e、bench、文档为略读。 总体结论:整体质量非常高,未发现可被利用的高危漏洞。 加密流程、挑战绑定、降级路径均处理严谨,测试覆盖(含真实签名集成测试)扎实。以下按严重级别列出发现。 发现[Medium] crossOrigin=true 被解析但未强制校验(WebAuthn L2 合规缺口)
[Low] 注册挑战 map 无限增长(内存泄漏)
[Low] signCount 克隆检测存在 check-then-async-update 竞态
[Low] SocialTokenIssuer 未校验
|
外部评审处置(7 条发现全部先核实真伪再处置,23dd2b00)
修复后全量复验:full_test 8/8 步、584/584 ctest ×2 配置(+1 crossOrigin e2e)、55/55 admin 端点、identity 231/231、静态门全绿、api-diff 加性缝重新 ratify(184 headers)。 评审"做得好的地方"清单(CborReader DoS 预扫描、无条件消费、枚举防护、#103 锁定语义、COSE 不信任客户端等 10 项)与我们的实现认知一致,无需动作。 |
… 500 Users created via self-registration (/api/register) and the admin API (POST /api/admin/users) got no (local, <id>) row in oauth2_subject_mappings; consent's getInternalUserId resolves users exclusively through that table, so those users 500'd on authorize -> consent. Three idempotent layers: - A1 PostgresIdentityRepository::create: every completion path (role lookup/assignment outcomes included) falls through to a INSERT ... ON CONFLICT (provider, subject) DO NOTHING mapping write before the callback; failure is logged and tolerated (mirrors role semantics — a loud failure would trap a USERNAME_TAKEN retry). - A2 UserAdminService::createUser: same mapping write ahead of the 201. - B V027 one-time backfill (deliberately not filtering deleted_at; consent-side liveness checks reject soft-deleted users regardless). - C AdminBootstrapper::backfillLocalSubjectMappings startup self-heal (same SQL shape), scheduled from main.cc — turns the mapping into a startup invariant instead of a one-shot migration. Tests: full self-register and admin-create consent chains (302 + code), V027 rerun idempotency + id-consistency, startup backfill healing; the manual re-seed workaround in ConsentAuthGateHttpTest is gone (the dev seed already ships the admin mapping). Fixes #143
The legacy verification path (sha256(password+salt), the pre-1.0 dev-seed
format) is retired and closed by default on every path:
- Assembly default flipped: IdentityAssembly treats a missing
auth.allow_legacy_hash key as false (AuthService.h's field initializer
stays true only so the api-diff SDK baseline line is untouched); all 5
tracked configs set allow_legacy_hash=false.
- drogon PasswordHasher::verify rejects non-PBKDF2 hashes outright (the
legacy branch is deleted); the rehash-on-login block in drogon
AuthService became dead code and is removed. needsRehash is kept as the
format discriminator (unit tests unchanged semantics).
- Identity-side policy denial fixed: a legacy rejection is NOT a wrong
password — it no longer advances the account-lockout counter (username
knowledge must not lock legacy users out, and a reopened window must
not stay blocked by locked_until). New additive observability hook
setLegacyHashRejectionNotifier wired to a WARN carrying the internal
user id; the response stays generic AUTH_INVALID_CREDENTIALS (no
oracle).
- Seeds/scripts converted to PBKDF2 (passwords unchanged): dev_admin_user
seed, reset-admin-password.{sh,ps1}, common-test-functions.{sh,ps1}
reset_admin_account.
- bench_users.sql moved to benchmarks/fulla/seed (benchmark-only; no
longer shipped with the prod image via Dockerfile's seed COPY),
converted to PBKDF2, and wired into benchmarks/fulla/setup.sh;
setup-database.{sh,bat} now load an explicit seed list so bench users
never land in a dev/test database.
- Docs: account-lockout runbook SQL (EN + zh-CN) rewritten to the PBKDF2
hash; configuration-guide gains a 'legacy hash migration window' section
with the corrected semantics (email/admin reset DOES migrate;
change-password is rejected for legacy users; window reopen does not
require unlocking); observability registers AUTH_LEGACY_HASH_REJECTED;
README dev-compose notes PBKDF2 storage; testing-guide documents the
full_test/bench serialization rule.
- Helm: secrets.bootstrapAdminPassword passthrough to
FULLA_BOOTSTRAP_ADMIN_PASSWORD.
- Tests: PasswordHasherTest legacy cases rewritten to rejection
semantics; AuthServiceTest covers window-closed rejection (no lockout
advance, notifier fires, hash untouched) and explicit window reopen
with rehash; new AdminBootstrapLegacyHashHttpTest covers bootstrapper
idempotence, the first-boot env-password path (admin temporarily
renamed away, exact restore), and HTTP-level legacy rejection with no
lockout advance.
Legacy users migrate via password reset (rewrites PBKDF2) or a temporary
auth.allow_legacy_hash=true window; change-password cannot self-migrate
them. The identity-side window code is scheduled for removal in v1.1.
Fixes #103
…ssue first-party tokens All three providers now run the same closed loop (upstream code exchange -> subject-mapping lookup -> first-login auto-create -> first-party token pair); Google/WeChat previously returned only the filtered profile — linking them had no sign-in effect. Service layer (identity): - Google/WeChat services gain an additive setAccountRepository / setAutoCreate seam (constructors unchanged; assembly always injects the repo when built with WITH_SOCIAL + DB storage — profile-only remains the degraded direct-construction shape) and their Result structs carry userId/username/isNewUser/publicSub. - New provider-agnostic AccountLinkFlow (src/-internal): the four-state resolution GitHub used (Linked / AccountUnavailable->generic 401 / RepositoryError->DB error, never falls through to creation / NoMapping -> auto-create gate), plus a one-shot random-suffix retry on username collision then VALIDATION_USERNAME_TAKEN. GitHub login() refactored onto the same helper; its NoMapping branch now also honors the gate. - ISocialAccountRepository lookups/results carry users.public_sub (what token rows must store); Postgres implementation reads/returns it. Token issuance (drogon): - New shared SocialTokenIssuer (extracted from GitHubController): mints + persists the pair via plugin->saveTokenPair with token rows keyed on the PLATFORM SUBJECT (users.public_sub) — fixing the pre-existing GitHub defect where the internal numeric id was stored, making its tokens 404 on every Bearer-authenticated handler. Client configurable (external_auth.social_token_client_id, default vue-client, first-party only), scope openid profile email. - Compliance: issuance writes a SOCIAL_LOGIN_TOKEN_ISSUED audit event (provider/client/scope/internal id), NOT an oauth2_user_consents row — a consent row would silently satisfy the consent screen's Tier-3 check and pre-approve the client for scopes the user was never prompted for. Explicit social-consent interaction registered as follow-up. - Google/WeChat controllers gain the resolvePlugin seam and the account-linked path; GitHub issueTokensForUser delegates (tail-default publicSub param — additive seam; empty fails closed, no token minted against an unresolvable subject). New error code AUTH_SOCIAL_ACCOUNT_NOT_LINKED (5003, AUTHORIZATION -> 403): 'not linked' is an authorization state the client can act on, not an authentication failure; probing needs the target account's own upstream code (no cross-user enumeration). Catalog (both capacity literals) + api-reference 5.1 + openapi descriptions synced. openapi/SDK: google/wechat 200 responses now the SocialLoginTokenResponse schema with a 403 entry; GitHub's stale profile schema corrected to what the runtime has returned since the linking flow landed. Python+Go SDKs regenerated. Frontend (user): generalized SocialCallbackPage (/callback/google, /callback/wechat; login flow stores the token pair, link flow keeps the #71 short-circuit), gated Google button on VITE_GOOGLE_CLIENT_ID (unconfigured = hidden), WeChat desktop hint only (QR scan needs a WeChat-enabled surface — explicit desktop flow is follow-up); env example extended; e2e: google login-callback happy path added. Tests: SocialMockFixture injects the fake account repo into Google/WeChat (repos now carry synthesized publicSub); Google/WeChat happy paths assert tokens + linkage; auto-create-off -> 403 with zero side effects; linked WeChat user -> tokens without extra accounts; username-collision retry; PG e2e maps the fake to the admin's real public_sub so social tokens resolve across introspection/userinfo/links like password-flow tokens. api-diff: additive seam ratified via --update-baseline (183 headers; defaulted-param append recognized for issueTokensForUser). Fixes #70
… (ES256, fmt none)
The WebAuthn endpoints previously performed ZERO cryptography:
registerFinish trusted client-submitted {credential_id, public_key}
verbatim, and authenticateFinish accepted a bare credential_id as proof
of possession (a credential-id oracle); the challenges written at begin
were never read back. This lands real W3C WebAuthn Level 2 §7.1/§6.1
verification:
Crypto core (libs/identity/src/webauthn/):
- CborReader: typed read-only wrapper over libcbor 0.13.0 (re-added via
conan; PUBLIC link so test TUs including the header get <cbor/...>),
with structure pre-scan limits: depth<=8, items<=1024, strings<=64KB,
input<=128KB, indefinite-length rejected — DoS-hardened, never throws.
- WebAuthnCrypto: parseClientDataJSON (type/challenge/origin/tokenBinding
— status 'present' rejected), parseAttestationObject (fmt='none' with
empty attStmt only), parseAuthData (rpIdHash, flags UP/UV/AT/ED,
signCount BE, credIdLen<=1023, COSE-key byte-range recovery, ED skip),
parseCoseKeyEs256 (kty=2/alg=-7/crv=1/x,y 32B), verifyEs256Signature
over authData || SHA256(clientDataJSON) via OpenSSL EVP.
53 unit tests (fixed CBOR vectors + real P-256 keygen/signatures),
shared with the HTTP tests via testing/WebAuthnTestBuilders.h.
Service (WebAuthnService, additive seams):
- Registration challenges bound to the Bearer SUBJECT (register routes
sit behind OAuth2AuthFilter; the SPA sends no session cookie) in an
in-process TTL-bound store (300s, single-instance documented);
authentication challenges session-carried as challenge|issuedAt with
code-level TTL. Both consumed UNCONDITIONALLY (no validity oracle).
- finishRegistrationVerified: challenge gate first, then
clientDataJSON/attestation/authData/COSE checks; stores canonical
base64url of RAW credential id + COSE bytes (client public_key field
ignored). finishAuthenticationVerified: userHandle owner check,
UV=1 enforced, signature verified against the STORED COSE key
(findByCredentialId now returns publicKey), signCount clone policy
(stored>0 && new<=stored -> reject + webauthn_clone_detected audit
notifier; both-zero legal skip). Repository lookup gains publicKey +
per-Mapper try/catch rule compliance; updateSignCount updates from the
found row (partial-object update silently failed before).
- Legacy finishRegistration/finishAuthentication keep their SDK-baseline
declarations but FAIL CLOSED (never store / never authenticate).
Controller:
- begin advertises EXACTLY what finish enforces: ES256 only (-257
dropped), userVerification=required (UV-incapable authenticators
excluded from the supported surface), user.id = base64url(internal id
bytes), excludeCredentials from the user's stored credentials.
- finish accepts the browser PublicKeyCredential shapes; authenticate
success establishes the session mirroring SessionController::login
(userId/sub/auth_time/amr) — amr 'hwk user' (RFC 8176 values; the
server cannot distinguish PIN vs biometrics, so no 'pin').
- The raw-SQL fallbacks are DELETED: memory-storage deployments get an
explicit fail-closed envelope instead of a silently vulnerable path.
Migration V028 clears webauthn_credentials (every pre-existing row was
unverified client-asserted material that can never satisfy the new
verifier and preserved the credential-id oracle; DO-block form per the
migration checker's M4 rule). webauthn.rp_id/rp_origins config in all
tracked configs (prod as commented sample; empty allowlist = finish
fails closed); new error codes WEBAUTHN_INVALID_ATTESTATION(3015)/
WEBAUTHN_CHALLENGE_MISMATCH(3016) catalog+api-reference synced;
openapi request schemas for both finish endpoints + policy descriptions;
SDK regenerated; api-diff additive seams ratified (184 headers).
Frontend: SecurityPage sends the real attestation envelope (server
options threaded verbatim: ES256/UV-required/excludeCredentials); e2e
asserts the new body shape and the absence of the client public_key.
Tests: WebAuthnHttpTest rebuilt as 10 verified-chain cases (real P-256
material: registration 201 + stored COSE check, replay 400, duplicate
409, legacy-body rejection, begin policy, assertion 200 + session +
sign_count persistence, tampered signature/wrong origin/no challenge
401s, credential-id-only oracle killed); service tests cover the
challenge stores (unconditional consumption, TTL) and fail-closed
legacy contracts.
Fixes #142
…g dep, quoting, regression formula - AdminBootstrapper first-boot insert set no salt: users.salt is NOT NULL, so the fresh-admin path failed on the constraint (latent since the bootstrapper landed — dev seeds always pre-created admin, the new #103 fresh-DB test exposed it). Set the empty-string salt like every other creation path. - AdminBootstrapLegacyHashHttpTest rename guard now moves the EMAIL aside too: the bootstrapped admin carries admin@example.com and the renamed original still holding it tripped idx_users_email_unique (a genuinely fresh database has neither row). - SDK packaging: fulla-identity's exported config lacked find_dependency(libcbor), so SdkSmoke's external find_package(fulla-identity) consumer failed with 'libcbor::libcbor not found' (libcbor is PRIVATE-linked but still crosses the export boundary as LINK_ONLY). Declared in DEPENDENCIES; libcbor linked directly on the identity TEST target for its direct CborReader includes. - The four admin-reset scripts embedded the PBKDF2 hash in double quotes — bash/PowerShell expanded $pbkdf2 (empty variable) and wrote a corrupted hash to the admin row, 401-ing every later admin login (root cause of the first full-suite run's 52 endpoint failures). Single-quoted everywhere; setup-database now lists ALL four seed files (the earlier explicit-list change had dropped the three client seeds, breaking admin-console login). - ErrorCatalogRegressionTest count formula +3 (#70 + #142 codes); GitHub conflicting-username test rewritten for the #70 retry semantics (suffixed retry succeeds; adoption still impossible).
…me, passkey liveness gate, UV alignment B-1 (BLOCKER): the username-collision retry in AccountLinkFlow held its self-referencing attempt function via weak_ptr only; with the fully async production repository the initiating stack frame is gone when the INSERT round-trip returns, so the retry (and the terminal error path) silently dropped — the request hung until client timeout. The shared synchronous test fake masked exactly this shape. Rewritten as a free function recursing through a shared AttemptContext: the in-flight repository callback strongly owns the context, the chain stays alive across every round-trip, and all owners drop on the terminal branches. Pinned by two new DeferredSocialAccountRepository tests that queue every callback and drain it only AFTER login() returned (230/230 identity tests). M-1 (MAJOR): findByCredentialId now enforces user liveness on the passkey path — soft-deleted (deleted_at IS NULL filter) and locked (locked_until > now -> generic nullopt) users can no longer authenticate via /oauth2/webauthn/authenticate/finish; parity with the password and social paths (V024/#54 'disabled means cannot log in through ANY flow'). Minor: registration finish enforces UV=1 too (begin advertises required; a UV-less registration would mint a credential that can never authenticate); authenticateBegin mints ONE challenge instead of two (the old path discarded a CSPRNG draw); the three remaining bare Mapper constructions in PostgresWebAuthnRepository wrapped per db-operations.md rule 1; subject-mapping backfill now RETURNING-counted so the heal log is truthful. Full suite re-verified after the fixes: full_test 8/8 steps, 583/583 ctest x2 configs, 55/55 admin endpoint scripts; identity 230/230; static gates re-run green (api-diff/migration/arch/naming/ spec-governance/clients-sdk).
…d of regenerating The Windows-profile lockfile regeneration dropped Linux-only graph entries (util-linux-libuuid & co.), failing the Linux sanitizer/coverage legs with 'Requirement not in lockfile requires'. Restore the master lockfile (generated across the full platform matrix) and insert the single new requirement by hand (RREV + timestamp from the local cache).
The CI property-test leg runs the dev server WITHOUT a live backend; the post-login fetchUser chain can probe the refresh endpoint, and an un-mocked pass-through dies with ECONNREFUSED, breaking the redirect assertion (the local all-mocked run never saw it).
…rage contract setTokens keeps the access token in memory only (http.ts — only the refresh_token persists); the old assertions required a localStorage key that is deliberately never written. Assert the persisted refresh_token, the redirect, and the authenticated dashboard instead. The CI error- context snapshot made this obvious: the login had actually succeeded (Dashboard rendered) while the storage key stayed null.
… dead placeholder helper The CI matrix builds with FULLA_WERROR=ON; GCC/Clang flagged a CRLF-merge that glued two #include directives onto one line and an unused placeholder function. Verified with a full local -DFULLA_WERROR=ON rebuild.
…36 toolchain - AdminBootstrapLegacyHashHttpTest: compare against drogon::HttpStatusCode instead of unsigned (MSVC C4389; GCC/Clang see the enum's underlying type as matching, so the CI -Werror matrix never caught it). - Strip the non-ASCII punctuation introduced by this PR's comments (em dashes, arrows, section signs) from WebAuthnService.cc / GoogleAuthService.cc / WeChatAuthService.cc / AccountLinkFlow.h — they trigger MSVC C4819 on simplified-Chinese Windows (code page 936), another local-only warning class the CI matrix cannot see. The remaining C4819 carriers (WeChatAuthService's quoted WeChat-doc term, ICryptoProvider.h, examples/*, ...) are pre-existing on master and left as-is (comments only, zero runtime risk).
CREATE DATABASE needs the role to hold CREATEDB, DROP only needs ownership — so a hand-created fulla_user (typical on WSL/local Linux installs) drops fine and then dies on create, and the old error text gave no repair path. - sh (Linux/macOS/WSL): on create failure, check rolcreatedb; when the local postgres superuser is reachable via passwordless 'sudo -u postgres psql' (peer auth), grant CREATEDB once and retry the create; otherwise print the exact one-line fixes (native + docker forms). - bat (Windows): no sudo path exists — print the exact superuser fix commands (native psql + docker exec forms) and exit non-zero. Databases created by the official dev containers/compose are unaffected (their POSTGRES_USER is a superuser).
…148 token system PR #148 (Machined Trust) remapped the palette to OKLCH semantic tokens; red-* is replaced by error-* (AppAlert's own error variant idiom). The new #149 callback page still used the legacy red-* classes -- swap to bg/text/border-error-* so it renders correctly under the remapped dark palette. (The Google/WeChat login buttons already match: #148 kept the GitHub button's neutral-* classes, and the neutral ramp is remapped in place.)
The WSL report (CREATE DATABASE permission denied) exposed that the
scripts diagnosed nothing: DROP swallows every error by design, and the
CREATE failure printed one generic hint regardless of cause. Now every
root cause gets detected and its exact fix printed (sh), or a
message-matched fix table (bat):
1. server unreachable -> pg_isready exit-code probe (sh); connect-error
table entry (bat)
2. wrong password / missing role -> login probe; PostgreSQL answers both
with the SAME error (anti-enumeration), so one fix block covers both
(check FULLA_DB_PASSWORD, else CREATE ROLE from a superuser shell)
3. role lacks CREATEDB -> rolcreatedb query; sh self-heals once via
'sudo -u postgres psql' (peer auth, typical on Linux/WSL) and retries,
else prints ALTER ROLE (native + docker forms)
4. database exists and could not be dropped (open connection, e.g. a
running fulla-server) -> detected by querying pg_database (NOT by
message text -- localized Windows installs report it in GBK); prints
the DROP ... WITH (FORCE) escape hatch
Implementation notes: classification is driven by exit codes and SQL
results only (psql message text is localized on Windows and LC_MESSAGES
cannot override the bundled catalog); probe SQL goes through stdin with
:'variable' interpolation (psql -c does not interpolate, keeping the
query parameterized); set -e is suspended around probes (a failed probe
is data, not an abort -- the first cut silently died there).
Verified locally by injecting each failure: wrong user, wrong password,
wrong port, and a pg_sleep session holding the database (both scripts
print the matching fix and exit non-zero; normal path unaffected).
When CREATE reports the database still exists, the suppressed DROP failed for one of two reasons: an open connection, or the database's owner is not the configured role (DROP needs ownership). Both share the same superuser DROP ... WITH (FORCE) escape hatch; say both so the operator is not sent hunting for a connection that does not exist.
…e sweep, signCount CAS, client registration check External review of the branch (7 findings) — all verified real against the code before fixing: [Medium] crossOrigin=true parsed but never enforced (L2 7.1 step 9 / 6.1 step 5): this RP declares no cross-origin support (strict origin allowlist), so a ceremony driven inside a cross-origin iframe — the phishing vector the field exists to surface — must be rejected. Both finish paths now fail on crossOriginPresent && crossOrigin (registration side: WEBAUTHN_CHALLENGE_MISMATCH; assertion side: the generic rejection). New e2e: same-key VALID signature with crossOrigin=true answers 401. [Low] registration-challenge map never reclaimed entries for subjects that begin but never finish (TTL rejected, never erased). Lazy sweep on every issue (O(live subjects)); header comment's 'TTL-bound' claim corrected to say what it actually does. [Low] signCount clone check was read-compare-then-async-update: two concurrent assertions with the same counter both passed. Now an atomic compare-and-set via the new additive IWebAuthnRepository:: updateSignCountIfCurrent (PG: conditional UPDATE ... RETURNING 1 — Result::size() is 0 without RETURNING, caught by the e2e suite; losing the CAS = concurrent assertion of the same credential = clone/replay evidence -> reject; both-zero counters skip the write, the legal no-counter case). Interface default keeps in-memory fakes working. [Low] SocialTokenIssuer minted tokens for social_token_client_id without checking the client is REGISTERED — a typo'd id silently produced tokens no introspection/refresh path could resolve. getClient gate before issuance (INTERNAL_ERROR + LOG_ERROR when unregistered); first-party-ness stays an operator contract (no data-model flag), as documented. [Info] assertion-side audit/response now carries the server-normalized credential id (WebAuthnAuthResult.credentialId) instead of the client-submitted encoding. Registration-side response keeps echoing the client's id (harmless, client-chosen label of its own credential). Verified: full_test 8/8 steps, 584/584 ctest x2 configs, 55/55 admin endpoints; identity 231/231; static gates green; api-diff additive seams re-ratified (184 headers).
…ing before the config.ci.json swap
ea1f62d to
7fe3123
Compare
…me, passkey liveness gate, UV alignment B-1 (BLOCKER): the username-collision retry in AccountLinkFlow held its self-referencing attempt function via weak_ptr only; with the fully async production repository the initiating stack frame is gone when the INSERT round-trip returns, so the retry (and the terminal error path) silently dropped — the request hung until client timeout. The shared synchronous test fake masked exactly this shape. Rewritten as a free function recursing through a shared AttemptContext: the in-flight repository callback strongly owns the context, the chain stays alive across every round-trip, and all owners drop on the terminal branches. Pinned by two new DeferredSocialAccountRepository tests that queue every callback and drain it only AFTER login() returned (230/230 identity tests). M-1 (MAJOR): findByCredentialId now enforces user liveness on the passkey path — soft-deleted (deleted_at IS NULL filter) and locked (locked_until > now -> generic nullopt) users can no longer authenticate via /oauth2/webauthn/authenticate/finish; parity with the password and social paths (V024/#54 'disabled means cannot log in through ANY flow'). Minor: registration finish enforces UV=1 too (begin advertises required; a UV-less registration would mint a credential that can never authenticate); authenticateBegin mints ONE challenge instead of two (the old path discarded a CSPRNG draw); the three remaining bare Mapper constructions in PostgresWebAuthnRepository wrapped per db-operations.md rule 1; subject-mapping backfill now RETURNING-counted so the heal log is truthful. Full suite re-verified after the fixes: full_test 8/8 steps, 583/583 ctest x2 configs, 55/55 admin endpoint scripts; identity 230/230; static gates re-run green (api-diff/migration/arch/naming/ spec-governance/clients-sdk).
…148 token system PR #148 (Machined Trust) remapped the palette to OKLCH semantic tokens; red-* is replaced by error-* (AppAlert's own error variant idiom). The new #149 callback page still used the legacy red-* classes -- swap to bg/text/border-error-* so it renders correctly under the remapped dark palette. (The Google/WeChat login buttons already match: #148 kept the GitHub button's neutral-* classes, and the neutral ramp is remapped in place.)
… and hooks Consolidates the recurring lessons from the 2026-08/09 engineering sessions (previously only in AI-session memory) into versioned, tool-agnostic assets: - skills: ci-gate-sync (sync-point policies for error codes/endpoints/ migrations/headers), ci-failure-triage (cross-compiler WERROR blind spots, flake taxonomy), release-engineering (six-point + ~15 version carriers, tag recovery, PyPI first publish), pr-workflow (rebase-merge repair, rebase value-loss audit, PAT permission boundary), local-env-runbook (Windows/WSL/Docker/Mimosa/multi-session rules), test-methodology (two test layers, mock injection seam, Playwright pitfalls), and benchmark-methodology (wrk Lua model, A/B discipline, measurement-artifact taxonomy). - rules (path-scoped): sync-points (8-point error-code and 5-point endpoint hard checklists), frontend-contract (verified frontend/backend contract facts), async-cpp-gotchas (traps beyond db-operations: Session::insert no-overwrite, callback double-move, ::drogon:: shadowing). - commands: /preflight (local gate sweep before pushing), /ci-triage (failure classification workflow). - hooks: local-gates.sh (wired to the git-commit PreToolUse hook, replacing the broken full-ctest gate), port-guard.sh, redis-watchdog.ps1. Provenance (source retrospectives): ci-gate-sync/rules.sync-points from PR #115/#141/#149/#157/#179/#180 CI post-mortems; release-engineering from the v1.0.0-v1.1.0 release runs; test-methodology from the coverage push (48.5%->57.2%) and PR #140/#156 e2e work; benchmark-methodology from the four-product comparison campaign; local-env-runbook from environment incident records. AGENTS.md indexes the new rules and skills.
Summary
Implements all four P0 issues from the reviewed plan v2 (+ v3 adjudications from three fresh review agents: architecture / adversarial RFC-correctness / CI-gates — all APPROVE-WITH-CHANGES, findings incorporated; the adjudication log lives in the plan file's v3 block).
allow_legacy_hashnow false by default (missing key = closed), drogon legacy verify branch deleted, seeds/scripts → PBKDF2,bench_users.sqlmoved out of the prod image, policy rejection does NOT advance lockout, WARN+audit notifier (additive seam), helm passthroughSocialTokenIssuerstoring public_sub (also fixes GitHub's existing 404-on-/api/me defect); issuance traced bySOCIAL_LOGIN_TOKEN_ISSUEDaudit (NOT a consent row — a consent row would silently satisfy the Tier-3 consent screen; explicit social consent is follow-up); 403AUTH_SOCIAL_ACCOUNT_NOT_LINKED(5003); frontend SocialCallbackPage + gated Google buttonhwk user)Review-adjudicated deviations from the plan (v3)
users.public_sub), not the internal id — the plan-as-written would have shipped tokens unusable on every authenticated endpoint.DO $$(migration-check M4); begin advertisesuserVerification:"required"(matches enforced UV=1 — "preferred" would mint unusable credentials); amr carries no invented "pin".Migration numbers
V027 (subject-mapping backfill, #143) and V028 (webauthn purge, #142) — both registered in the migration-check baseline. Later PRs take V029+.
Contract/gate status (all verified locally)
bool allowLegacyHash_ = true;untouchedAUTH_SOCIAL_ACCOUNT_NOT_LINKED(5003/403),WEBAUTHN_INVALID_ATTESTATION(3015),WEBAUTHN_CHALLENGE_MISMATCH(3016) — catalog (both capacity literals) + api-reference §5.1 + ErrorCatalogDocTestTesting
full_test: 8/8 steps, 581/581 ctest ×2 configs (standard + config.ci.json), 59 OAuth2 + 52 admin endpoint scripts — all greensalt(latent, NOT NULL violation), SDK package config missingfind_dependency(libcbor)(SdkSmoke), PowerShell/bash$pbkdf2interpolation corrupting the admin reset hash, setup-database seed list dropping the three client seedsVersioning
No bump in this PR. Per⚠️ Breaking (security hardening) items in the Release Notes + migration pointers (already drafted in CHANGELOG [Unreleased]).
docs/contribute/versioning-and-release.md§3 (security-hardening gray zone): target vehicle is v1.1.0 at release time, with the threeFixes #143, fixes #103, fixes #70, fixes #142