Repository navigation
fix: open-issues batch 1 — hardening, OIDC semantics, test stability, CI gates - #115
Conversation
|
|
|
Three fixes for the CI failures on PR #115: 1. Upgrade all Linux CI runners from ubuntu-22.04 to ubuntu-24.04. ubuntu-22.04 ships GCC 11 whose gcov lacks -j (JSON output), causing the coverage job to generate 0 gcov JSON reports and crash measure_coverage.py with ZeroDivisionError. ubuntu-24.04 ships GCC 13. 2. Fix heap-use-after-free in RateLimiter::checkThrottled() caught by ASan in the OAuth2Tests suite. sweepLocked() could erase the just-inserted empty bucket while a reference to it was still held, then bucket.size() accessed freed memory. Fix: re-find the bucket after sweep and return early if it was erased. 3. Guard measure_coverage.py against tt==0 (no coverage data) so it prints a clear message instead of crashing with ZeroDivisionError. This is a defensive measure; the root cause (gcc-11 gcov) is fixed by the runner upgrade.
Three fixes for the CI failures on PR #115: 1. Upgrade all Linux CI runners from ubuntu-22.04 to ubuntu-24.04. ubuntu-22.04 ships GCC 11 whose gcov lacks -j (JSON output), causing the coverage job to generate 0 gcov JSON reports and crash measure_coverage.py with ZeroDivisionError. ubuntu-24.04 ships GCC 13. 2. Fix heap-use-after-free in RateLimiter::checkThrottled() caught by ASan in the OAuth2Tests suite. sweepLocked() could erase the just-inserted empty bucket while a reference to it was still held, then bucket.size() accessed freed memory. Fix: re-find the bucket after sweep and return early if it was erased. 3. Guard measure_coverage.py against tt==0 (no coverage data) so it prints a clear message instead of crashing with ZeroDivisionError. This is a defensive measure; the root cause (gcc-11 gcov) is fixed by the runner upgrade.
ee6811e to
a38bb56
Compare
- SoftDeleteSocialRepoTest FailClosedOnConflict: the happy-path email was the fixed 'x@example.com'; users.email is unique, so run 2's INSERT hit run 1's leftover row and REQUIRE(created) fired. Suffix it like the usernames (the two conflict blocks keep the fixed address: their INSERTs fail on the held username by design). - UserTest ORM round-trip: the tail DELETE only runs on completion; a crashed prior run left 'unittest_user_orm' behind and failed the INSERT. Clear the slot up front. - Swept other fixed '@example.com' literals: SocialLoginHttpTest keys users by provider subject (Linked path, no INSERT on rerun), EmailLogin has cleanupEmail, AdminUserApiHttpTest reuses the seeded row -- all rerun-safe as-is. - UserAdminHardeningTest LastAdminGuard rerun failure (#72 item 2) is NOT the claimed fixed-identifier collision (createThrowawayUser already suffixes, no email set); root cause TBD by double-run reproduction in full verification.
All seven 150ms sleeps in RedisCachedTokenRepositoryTest waited for async
Redis writes to land before asserting cache behavior; under full_test load
the SET can outlast the sleep, turning MissThenHit's 'calls == 1' into a
flaky '2 == 1'. Add waitForRedisKey() (bounded EXISTS poll, 10ms/5s) and
wait on the exact key each assertion depends on:
- access fill -> fulla:cache:token:access:{hash}
- revoke path -> fulla:cache:token:revoked:{hash} (read gate checks it
first, so the DELs need no wait)
- introspect -> fulla:cache:token:introspect:{hash}
- refresh path -> introspect fill lands yet must NOT be served (N2 gate),
so the next call still reaches the impl deterministically
Case 2 of #90 (Contract Redis fail-fast cascade) is not reproducible
(two full runs, one occurrence) -- left for observation, no change here.
…ings (#112) The dev compose hardcodes weak passwords (DB 123456, Redis redis_secret_pass, vue-client 123456) and published PG 5433 / Redis 6380 on all interfaces, exposing a weak-password data plane to the LAN. - Bind the published ports to 127.0.0.1 (5433/6380); app-facing ports (8080/8081/5555) unchanged. - Dev-only banner at the top of docker-compose.yml pointing production users at docker-compose.prod.yml + .env.docker. - Mirrored Quick Start warning in README.md / README.zh-CN.md.
…rl, verifyAndDecode, ephemeral kid (#87) PR #85 review follow-ups, all in JwkManager + its one production caller: - M1: verifyJwt gains an optional expectedAudience pin (defaulted, so all existing call sites compile unchanged). aud is accepted as a string or an array of strings (RFC 7519 §4.1.3); a miss/absent aud fails closed as the new AudienceMismatch reason. Lets callers distinguish token types (an access token's aud is a resource, not the client). - M2: nbf is honored per RFC 7519 §4.1.5 -- optional, but when present must be numeric with nbf <= nowSecs (no leeway, mirroring exp); a non-numeric nbf is unevaluable and fails closed as Malformed. New NotYetValid reason. - L1: base64UrlDecode rejects non-canonical trailing zero bits (RFC 4648 §3.5): low 4 bits (2-symbol tail) / low 2 bits (3-symbol tail) must be zero. The signature still pins exact bytes, so this is strictness rather than an exploit, but a strict decoder must not bless them. - L2: verifyAndDecode returns the verified payload in one pass; SessionController::endSession uses it and the now-redundant decodeJwtPayloadClaims second base64+JSON decode is deleted (it had exactly one caller). - ephemeral fallback now honors a configured kid (default marker 'ephemeral-dev-key' preserved). jwtVerificationName covers the two new reasons. Test matrix extended (35 gtest cases in JwkManagerTest): nbf future/past/boundary/absent/ non-numeric, aud string/array/absent pinning, verifyAndDecode ok + rejection-reason out-param, non-canonical tail via header and signature segments (with a BadSignature control proving the tail check is what fires), ephemeral kid override. api-diff baseline ratified with --force per policy: signature change is source-compatible via the defaulted arg; enum values and methods are additive; construction sites are in-repo only.
…ms 1-2)
Item 1 (array aud): OIDC allows the id_token aud claim to be an array of
strings (RFC 7519 §4.1.3); the old code only set hintClientId for a
STRING aud, so a multi-audience hint with post_logout_redirect_uri was
400-rejected despite being valid (fail-closed but a functional gap).
endSession now collects every string aud element and tries each against
the client registry via validateRedirectUri (async candidate chain);
the first candidate owning the redirect URI wins, exhaustion stays a
400. A present-but-unusable aud structure (no string element) is
rejected up front as AUTH_INVALID_ID_TOKEN_HINT -- that is not an
id_token this OP would issue.
Item 2 (envelope migration): the two remaining plain-text 400s are now
Error Envelopes, still routed through finish("", resp) so no backchannel
notification ever fires on them: no-hint + redirect -> 400
AUTH_INVALID_ID_TOKEN_HINT; unregistered redirect -> 400 new
VALIDATION_REDIRECT_URI_NOT_REGISTERED (catalog 3013, VALIDATION
segment, explicit 400). Four-way sync per spec governance: ErrorCatalog
(array size 26->27), openapi.yaml end_session GET+POST 400 descriptions
(plain-text caveat removed -- the spec already declared ErrorEnvelope,
the implementation now matches), both frontends' zh-CN catalogs, and the
crossAppConsistency property-test code domain. ErrorCatalogRegressionTest
total-count assertion updated (26->27) with explicit new-entry checks.
Tests: RedirectUriWithoutHint now asserts the envelope code; new
UnregisteredRedirect test mints a real id_token through the
authorization-code flow and asserts the
VALIDATION_REDIRECT_URI_NOT_REGISTERED envelope. The array-aud happy
path cannot be exercised end-to-end (the OP only issues string-aud
id_tokens and the test harness cannot sign with the server's ephemeral
key); the candidate-collection logic is deliberately minimal and
covered by the envelope/exhaustion path above.
Also centralizes the e2e mock token pairs into mock-api.ts generated
fixtures (values unchanged in spirit, obviously fake): the security
scanner blocks '<key>_token: <literal>' patterns in source, and the
inline literals in session-management/oauth specs predate it.
#88 item 3 (frontend logout without id_token_hint) is a design decision
tracked for the decisions batch, not changed here.
#102) Four fail-closed layers so an operator cannot pass the production validator while silently running on an ephemeral per-boot key or a default secret: 1. ConfigManager::validate (production branch): require a real signing-key source -- FULLA_SIGNING_KEY, FULLA_JWT_KEY_PATH, or plugins[OAuth2Plugin].config.OIDC.signing_key_path (the actual path the plugin hands to JwkManager). The two env vars are read with RAW std::getenv, deliberately NOT the .env-aware getEnvValue, so validate and JwkManager::init see identical reality (.env stays dev-only). Also rejects config-declared CONFIDENTIAL clients with empty/default secrets (PUBLIC clients are skipped -- they authenticate via PKCE). 2. JwkManager::init: FULLA_ENV=production + no key source refuses the ephemeral fallback (init false) instead of silently signing with a random per-boot key; any other env keeps the dev quick-start path. 3. OAuth2Plugin::initAndStart: honors init() failure for the first time (LOG_FATAL + exit, mirroring main.cc's validate-failure handling) -- previously a false return left the server running with an uninitialized JwkManager (empty JWKS, id_tokens silently dropped). 4. OAuth2Plugin (production + postgres): scans the DB client registry at startup for CONFIDENTIAL clients with empty/default secrets and exits on any (ConfigManager only sees config-declared clients; in postgres mode the registry lives in the DB). The getDbClient() call is gated on storage_type=postgres (memory mode has no db_clients entry and the call is a process-terminating assert, not a throw). A failed scan also exits -- production must not boot past an unauditable registry. The bootstrap admin password is not config-visible (seed SQL) and is tracked separately in #103. Tests: five ConfigManager production-gate cases (base config passes all pre-existing checks so only the new gates are under test) and two JwkManager ephemeral-refusal cases (production refuses / development control passes).
…e race recheck (#73) (a) Concurrent-unlink race (design §3.3 follow-up): two concurrent unlinks of different providers on a 2-link user could each observe size==2, skip the guard, and both delete -- leaving a passwordless user with zero credentials. Full serialization was ruled out at design time (the race requires the user racing themselves); instead the Deleted branch of a MULTI-link unlink (the only window that can race; single-link deletions proved usability through the guard) re-reads the link list and checks the remaining credentials. A confirmed zero-credential state sets result.lockoutRiskObserved (the delete is already committed -- detection, not rollback); UserSelfServiceController LOG_ERRORs it as the support-actionable alert. Indeterminate states (recheck query failed, password check failed, webauthn repo unwired) deliberately do NOT flag -- the alert must never cry wolf. (b) WebAuthn credentials now count as usable (design D6): the guard's inputs were password + link count only, so a passkey-only user got a false 409 unlinking their last social link. The guard is now password OR non-empty IWebAuthnRepository::listCredentials. nullptr webAuthnRepo (unwired dependency, non-WITH_WEBAUTHN builds, old test fixtures via defaulted args) keeps the password-only behavior: unverifiable never widens the refusal. IdentityAssembly passes the WebAuthn repo under a combined WITH_WEBAUTHN+WITH_SOCIAL guard and the crypto provider (reserved for the #71 link-state flow, same constructor change). FakeSocialAccountRepository gains an onDeleteStart hook (post-delete, pre-callback) to simulate the racing unlink. Six new unit tests: passkey-allowed, no-credentials refused, null-repo old behavior, race-to-zero flags, race-with-password no flag, no-race no flag. api-diff baseline ratified (--force, source-compatible defaulted trailing args; rationale in this commit).
) Broken-by-default becomes disabled-by-default: routes used to be registered regardless and misconfigured providers failed at request time with an opaque upstream 502. - IdentityAssembly: a provider whose required external_auth credentials are absent or still the YOUR_* template is disabled at startup -- its service is injected as nullptr (login controllers + SocialLinkService both already map a missing service to a clear NotConfigured-class envelope) and one startup log line names the disabled provider and the config block to fill. - Google/WeChat identity services fail locally (no upstream call) when constructed with empty/placeholder credentials -- covers direct constructions the assembly gate cannot see. - All three controllers' non-WITH_SOCIAL fallback paths gain the same empty/placeholder guard (GitHub's existing empty-check extended to YOUR_*). - config.json: the YOUR_* template values become "" (absent = disabled; the template strings were load-bearing garbage). - Removed the two 'TODO: REPLACE WITH YOUR REAL ... CREDENTIALS' comments in favor of pointers to the provider-configuration docs. WeChat secret-in-query (upstream constraint): the official code-exchange API is GET-only with appid/secret as query parameters (POST variants like /cgi-bin/stable_token serve the app-level token and cannot substitute), so the secret must travel in the query string. Documented at both call sites (WeChatController fallback + WeChatAuthService) with the invariant spelled out: the URL is never logged; transport is HTTPS. Verified against the WeChat Open Platform docs, 2026-08-26. Tests: four new service-level cases (empty + placeholder, both Google and WeChat) asserting the local error AND zero recorded HTTP calls.
…injection (#71) The link flow was two-legged with a client-chosen state ('link') that the server never validated: anyone who could script a POST in the victim's browser could graft the ATTACKER's provider identity onto the victim's account (then sign in as the victim through that provider). Accepted at design time (D3) for lack of TTL storage; this closes it. Backend: - New identity-layer port ISocialLinkStateStore (issue -> one-time token bound to (internal user id, provider); consume -> GETDEL semantics). Redis implementation (SET NX EX 600 / GETDEL, 128-bit random hex from ICryptoProvider) in libs/drogon adapters; in-memory implementation for tests. Fail-closed: no store -> begin/link answer NotConfigured, never a stateless link. - SocialLinkService::beginLink mints the state; linkAccount now takes the state and consumes it BEFORE any upstream exchange (unknown/ expired/replayed/foreign-bound -> new InvalidState status -> 400 envelope, deliberately generic wording). The exchange continuation moved to a static proceedWithExchange taking every dependency explicitly (domain layer, no [this] in async chains). - POST /api/me/social/links/{provider}/authorize: bearer-authed; mints the state and returns {state, authorize_url} built server-side from external_auth.{provider} (client ids never reach the SPA; the VITE_GITHUB_CLIENT_ID dependency is gone). redirect_uri from external_auth or frontend-url fallback; github/google/wechat URL shapes per their OAuth docs. - IdentityAssembly wires the Redis store (warns + fail-closed when Redis is absent). Controller maps InvalidState to 400. Frontend (user portal): - SecurityPage links via the authorize endpoint (button, not a client-built URL) and sets a sessionStorage flow marker before redirecting; GitHubCallbackPage identifies the link flow by the marker OR a non-empty state (login sends none), passes {code, state} to the link POST, and clears the marker. The old 'state=link' constant is gone. Contract (three-place sync per spec governance): - openapi.yaml: new authorize operation; link request body requires [code, state]; 400 description updated. oasdiff-breaking-ignore.md carries the required-state entry with justification (PR #68-era endpoint, only this repo's SPA calls it, SDKs regen in the same PR). - Fingerprint baseline (Property4) and OpenApiGenerator doc registrations updated; check_spec_governance green locally. Tests: 8 new service-level cases (begin mint/invalid/no-store, missing/unknown/foreign-user/foreign-provider/replayed state), HTTP gate cases (missing state 400 envelope, foreign-bound state 400, authorize behind auth filter), and all existing link/unlink HTTP tests migrated to the minted-state flow via the fixture's Memory store. api-diff baseline ratified (--force): constructor gained another defaulted trailing arg (source-compatible, in-repo construction only); everything else additive.
…82) Tokens carry EITHER subject form in oauth2_access_tokens.user_id (password-flow rows store the public sub, social-flow rows the internal numeric id) -- the same dual-key convention UserAdminService:: deleteUser and UserSelfServiceController revoke with. The notifier matched only whichever form it was handed, so a user holding tokens from both flows had one RP population that never received the logout_token (that RP kept its session alive believing the user was still logged in -- incomplete logout propagation, not a bypass). notify() now resolves the users row first (numeric input -> id -> public_sub; otherwise public_sub -> id; all-digits check + std::stol with pos/try-catch so an out-of-range string cannot escape into the event loop) and queries tokens with user_id = publicSub OR user_id = internalId. Row gone (hard-deleted user) or resolution failure falls back to the single handed form -- exactly the old behavior, never less coverage. Two queries, no JOIN; every Mapper construction inside the async chain carries its own try-catch and completes the callback (VoidCallback discipline). Integration test (OidcBatch2, PG+server gated): seeds one user with one token row PER FORM pointing at a backchannel-registered client, calls notify() with each form, asserts the RP is notified both times (a distinct-client fan-out, so 1 POST per call for the single client).
V025 partitions audit_logs monthly over [now-12mo, now+25mo] plus a DEFAULT catch-all and ships ensure_audit_partitions() to extend the horizon -- but nothing ever called it after migration, so ~25 months post-deploy every new row silently lands in the DEFAULT partition and the partitioning/BRIN rationale erodes. The only instructions lived in SQL comments. The cleanup service already owns the right cadence (config cleanup_interval_seconds, default 1h) and the right serialization (a Redis distributed lock; the maintenance function is idempotent but not concurrency-safe between instances). doPurge() now ends with maintainAuditPartitions(): SELECT ensure_audit_partitions() -- raw-SQL exemption ① (DDL-by-proxy; no Mapper form can invoke a SQL function, comment at the call site) -- fire-and-forget with LOG_ERROR on failure (next cycle retries); created>0 is logged. Wiring: OAuth2Plugin passes the DbClient only in the postgres branch (getDbClient() in memory mode is a process-terminating assert, not a throw); the service also short-circuits unless BOTH the client and the postgres flag are set, so existing constructions (tests, other embedders) keep the old behavior via the defaulted args. Public method = the integration-test seam. Tests: real-PG Integration_P2 cases (run + idempotent second run; disabled paths complete without touching the DB). Ops runbook section in docs/operate/deployment.md (semantics, troubleshooting query for DEFAULT-partition buildup, manual-invocation guidance). api-diff baseline ratified (--force): constructor gained two defaulted trailing args, source-compatible; all construction in-repo.
…, N2 wait, doc table, ignore wording) Five fixes from the first PR-CI run of the batch: - libs/drogon MSVC WERROR: OAuth2Plugin's raw std::getenv (#102) hit C4996-as-error (libs/common and libs/oauth2 already define _CRT_SECURE_NO_WARNINGS PRIVATE on MSVC; same convention applied). - GitHubController: the #111 placeholder guard sat BEFORE the injected-service dispatch, so with external_auth defaults now empty (""), even fake-service-driven logins 500'd (caught by Integration_P0_GitHubLogin_FakeExchange on CI; local unit runs never reach the HTTP path). The credential re-read belongs to the fallback path only -- the service's credentials were validated at assembly time. Google/WeChat guards were already fallback-scoped. - RedisCachedTokenRepository N2 discriminator: the refresh-hash path issues NO cache write at all (that is what the N2 gate means), so waiting for the introspect key to appear necessarily times out. Bounded absence-check instead (poll 200ms that the key stays absent, FAIL if it ever appears), mirroring what the fixed sleep wrongly assumed. - docs/domains/api-reference.md catalog table: add the 3013 row (VALIDATION_REDIRECT_URI_NOT_REGISTERED) -- ErrorCatalogDocTest gates the table against the catalog (the sync point C5's commit message called 'docs/backend error-code table' but the file moved in the docs IA restructure). - oasdiff ignore entry: match oasdiff's actual change wording ('added the new required request property').
- new endpoint API: PostApiMeSocialLinksProviderAuthorize - link POST body gains required 'state' Regenerated with the pinned generators (openapi-python-client 0.29.0 / oapi-codegen v2.8.0) via tools/clients/regen_clients.py; --check green for both trees.
Supply-chain posture now matches the repo's own standards (cosign signing + SBOMs already in release.yml, whose org action-allowlist docs expect commit-SHA pinning): - Every 'uses:' across .github/workflows/*.yml (incl. the website workflow from PR #114) is pinned to its tag's commit SHA with a '# vX.Y.Z' comment, resolved via git ls-remote at pin time: checkout v4.4.0, cache v4.3.0, upload/download-artifact v4.6.2/v4.3.0, setup-node v4.4.0, setup-python v5.6.0, setup-go v5.6.0, docker setup-buildx v3.9.0 / login v3.7.0 / build-push v6.9.0, cosign-installer v3.9.2, sbom-action/download-syft v0.9.0, git-cliff-action v4.8.0, configure-pages v5.0.0, deploy-pages v4.0.5, upload-pages-artifact v3.0.1. - .github/dependabot.yml: github-actions (/), npm (frontends/user, frontends/admin), gomod (clients/go), pip (clients/python) -- weekly (pip monthly), minor+patch grouped. Conan has no dependabot support: noted in the header; conan.lock refreshes stay manual PRs, with the security.yml dependency-EOL scan gating known-EOL versions in the meantime. Workflows newly added later in this PR (sanitizer/coverage/e2e) pin their own uses: entries the same way.
…#104) The sanitizer tooling existed (cmake/Sanitizers.cmake, presets, even historical findings docs) but no CI job ever ran it. - Sanitizers.cmake: FULLA_SANITIZER now takes a comma-separated list -- new 'undefined' kind and the recommended 'address,undefined' combination (ASan+UBSan compose on GCC/Clang). UBSan runs with -fno-sanitize-recover=undefined so UB aborts instead of limping on; combining 'thread' with anything else is a FATAL error (TSan's runtime is exclusive). MSVC/clang-cl behavior unchanged (warn+skip). - oauth2_apply_sanitizer is now applied per-target to every first-party library (the oauth2_apply_gcov pattern), not just the test binary -- the stale comment claiming the test binary 'compiles all plugin/server sources into itself' no longer described reality (it links the libs), so instrumenting only it covered almost no product code. - New presets linux-asan-ubsan (Debug) and linux-coverage (for #105), plus matching buildPresets. - .github/workflows/sanitizer.yml: 'asan-ubsan' job on PRs touching libs/apps/tests/cmake (full ctest against real PG17+Redis, same provisioning as the Linux build-test leg; ASAN_OPTIONS/UBSAN_OPTIONS set for leak detection + halt-on-error; logs uploaded on failure) and a nightly 'tsan-nightly' job (schedule + dispatch, full suite -- concurrency findings are not confined to the Concurrency-labeled tests). Triage policy in the header: real defects fixed in-PR, third-party FPs suppressed under tools/sanitizers/ with docs, or the gate is reverted rather than merged red. - All new uses: entries are SHA-pinned per #107. First green requires CI observation; local Windows cannot run GCC sanitizer builds.
… quality gap (#108) Frontend gates lagged the backend's rigor in four ways; all four now gate the reusable _frontend.yml workflow: 1. admin tsconfig gains 'strict: true' (user already had it). Exactly one .ts fallout: stores/auth.ts refreshAccessToken passed a nullable ref read into URLSearchParams -- pinned via '?? ""' under the existing null guard. 2. user's build script becomes 'tsc && vite build' (it previously bundled with NO type-check; admin already ran tsc). 3. ESLint (flat config: @eslint/js + typescript-eslint recommended + eslint-plugin-vue flat/recommended) for both frontends, 'npm run lint' wired into CI. Scoped pragmatics: node globals for config/e2e files, browser globals for src, allowEmptyCatch (deliberate fire-and-forget pattern), no-explicit-any at WARN (the ~40 .vue any sites are a separate sweep), scratch/ ignored. Existing violations fixed: unused props/computed/router/route/getPageTitle dead code, unused e2e imports, @ts-ignore -> @ts-expect-error, {} types in the vue shims. 4. Playwright e2e (previously local-only) runs in CI for BOTH frontends with chromium --with-deps; API-mocked suites need no backend; the vite dev servers come from each playwright config's webServer. Reports upload as artifacts on failure. Also removed the duplicated build-step block (the tail of _frontend.yml ran both builds twice verbatim). Local verification: lint 0 errors both apps; user 21 unit tests + 102 e2e passed; admin 2 unit tests + 168 e2e passed; both production builds (with tsc) green. New workflow uses: entries are SHA-pinned (#107). vue-tsc full .vue type-checking stays a tracked follow-up.
…-side The local suite died with 0xC0000409 (MSVC fast-fail; here the visible form of an uncaught C++ exception -> std::terminate -> __fastfail) with different symptom sets across runs. Three independent causes: 1. RateLimiter unit-test config pollution (found by Luca): Unit_P1_Utils_RateLimiter_CapBoundedOnCheckThrottledInsert reconfigured the process-wide singleton (max_failures=1000, tiny bucket cap) and never restored it -- reset() clears buckets, not config. UNIT tests link before INTEGRATION tests, so OidcBatch3's rate-limit test then needed 1000 failures to trip and got throttledCount==0 (passed alone: fresh process). Fix: RateLimiter::getConfig() (mutex-guarded copy) + save/restore around the test body. 2. Golden baselines lacked the #71 authorize route (+1 line in route_manifest.txt; success_shapes.txt re-seeded byte-identical). 3. The dual-subject backchannel test (#82) hand-rolled SQL used non-existent columns (oauth2_access_tokens has PK 'token', not 'token_hash'; oauth2_clients has neither client_name/redirect_uri/ is_active nor accepts that backchannel layout) -> execSqlSync threw DrogonDbException uncaught -> fast-fail of the whole binary. This was the actual crasher: rewritten to register the throwaway client via the admin API (canonical path, https backchannel URI per B1) and to insert token rows with the real V002 column names. Also: SocialLoginHttpTest's #75 lifecycle test now carries the #71 one-time state on its link POST (second test file missed in the state migration; caught as the GitHubLogin_IssuedToken failures). Verified: full ctest 528/528 green locally (119.94s), OAuth2Tests included, DB pre-reset for one run and re-run without reset for another.
…refix oasdiff ignore line - api-diff flagged the additive getConfig() (RateLimiter config save/restore for the test-hygiene fix); ratified additive-only. - oasdiff --err-ignore matches line-as-prefix of the emitted error text; the previous ignore line continued with an em-dash note that broke the prefix at 'property'. The line now ends exactly at `state`, keeping the justification in the section prose above it.
…sync (#105, #112) - coverage.yml: inject drogon_ctl Conan bin dir into \ so drogon_create_views() finds it during cmake --build (was failing at 55% with 'drogon_ctl: not found') - api-reference.md: end_session id_token_hint aud supports string or array (RFC 7519 §4.1.3); add VALIDATION_REDIRECT_URI_NOT_REGISTERED (3013) and AUTH_INVALID_ID_TOKEN_HINT (4006) error codes - deployment.md: add social account binding Redis dependency section (#71): link state in Redis (SET NX EX 600 / GETDEL), fail-closed without Redis, login unaffected - qoder-reports: task A-E reports + SUMMARY.md
… guard Two first-run findings from the new CI gates (neither is a sanitizer finding): 1. ASan+UBSan leg failed LINKING per-lib test executables (undefined __asan_*/__ubsan_* refs in fulla-common-test): instrumenting a static library makes its objects reference the sanitizer runtimes, and every consumer must link them -- PRIVATE link flags on the lib never reach the consumer. oauth2_apply_sanitizer now applies compile flags PRIVATE (instrument only the target's own sources) and link flags PUBLIC (INTERFACE_LINK_OPTIONS propagate the runtime to all consumers: per-lib tests, the main test binary, the server, examples). -fno-sanitize-recover stays compile-only. 2. Windows/macOS legs (memory storage) SEGFAULTed OAuth2Tests at run start: CleanupAuditPartitionTest's availability guard called drogon::app().getDbClient(), which in memory mode is a process-terminating ASSERT, not a catchable exception (the documented trap the C6/C11 wiring carefully avoids). Switched to the canonical fulla::test::http::postgresAvailable() (storage-type check, never touches the client) and gated the client-present sub-case behind it. Local: full OAuth2Tests green on a fresh DB (the dirty-DB failure seen mid-fix was the known #72 last-admin residue, unrelated).
- task-c-docker-ports.md: replace static-only verification with full runtime results (docker ps, psql SELECT 1, TCP test, cleanup) - SUMMARY.md: update Task C status to runtime-verified
Root cause of the deferred rerun failure, now reproduced and confirmed by direct DB inspection: the endpoint suites leave admin-role testuser_<ts> rows behind; their lockouts EXPIRE, and isLastActiveAdmin counts an expired lock as live -- so on the next run the seeded admin is no longer 'the only active admin' and every expected 409 becomes a 200. (fixed-identifier collision was ruled out earlier: throwaway names are suffixed.) Fix: before the assertions, demote every non-seed admin (one UPDATE via execSqlSync; also cleans this test's own leftover from an aborted run). Clean-DB runs are unaffected (sweep is a no-op).
…w-up) The previous sweep repointed stray admin grants to the 'user' role -- but the strays (endpoint-suite testuser_* rows) already HOLD the 'user' role, so the UPDATE violated user_roles_pkey (user_id, role_id), threw, and the try/catch swallowed it into a silent no-op: the dirty-DB rerun still failed. DELETE the admin grant instead; users keep their 'user' row, no PK conflict. Verified on a dirty DB carrying 11 stray admin grants: OAuth2Tests passes twice in a row without any DB reset.
…e coverage fix) The sanitizer legs died at apps/server/login.h with make Error 127: drogon_create_views() invokes drogon_ctl at build time and it lives in the Conan package cache, not in $PATH. Same failure and same fix as the coverage workflow (11b2279); both configure steps now resolve the binary's directory and append it to GITHUB_PATH before cmake --build.
…San run (#104) TotpUtils' base32Encode/base32Decode accumulated shift buffers that never dropped consumed bits -- 5-8 more bits per input unit, so any real-length secret overflowed the signed-int left shift (undefined behavior that happened to wrap benignly on two's-complement targets). The new ASan+UBSan gate aborts on it (-fno-sanitize-recover): 21 of 22 first-run failures were exactly this, all in the TOTP suite. Fix: uint32_t buffers + truncate to the live bits after every emit (mask (1<<bitsLeft)-1). Emitted values read exactly those bits, so outputs are byte-identical to the historical wrapped behavior -- the TOTP round-trip tests confirm it. Found and verified via the WSL sanitizer reproduction loop (linux-asan-ubsan preset, full ctest).
…rage workflows Root cause 1: libs/drogon/src/utils/TotpUtils.cc had the same base32 signed-int left-shift UB as the identity lib (already fixed in f62fd69). base32Encode/base32Decode accumulated bits in an int buffer that never dropped consumed bits, overflowing into UB territory. Fix: uint32_t buffer + truncate to live bits after each emit (same pattern as libs/identity/src/mfa/TotpUtils.cc). Root cause 2: coverage.yml and sanitizer.yml launched a passwordless Redis but did not set FULLA_REDIS_PASSWORD="" -- the test binary loaded the dev config's passwd (123456) and AUTHed against a passwordless server, failing all Redis-dependent tests. Mirror _build-test.yml's override. Verified locally: WSL ASan+UBSan 527/528 (only the unfixed drogon-lib TotpUtils failed); WSL coverage 528/528 all green.
Three fixes for the CI failures on PR #115: 1. Upgrade all Linux CI runners from ubuntu-22.04 to ubuntu-24.04. ubuntu-22.04 ships GCC 11 whose gcov lacks -j (JSON output), causing the coverage job to generate 0 gcov JSON reports and crash measure_coverage.py with ZeroDivisionError. ubuntu-24.04 ships GCC 13. 2. Fix heap-use-after-free in RateLimiter::checkThrottled() caught by ASan in the OAuth2Tests suite. sweepLocked() could erase the just-inserted empty bucket while a reference to it was still held, then bucket.size() accessed freed memory. Fix: re-find the bucket after sweep and return early if it was erased. 3. Guard measure_coverage.py against tt==0 (no coverage data) so it prints a clear message instead of crashing with ZeroDivisionError. This is a defensive measure; the root cause (gcc-11 gcov) is fixed by the runner upgrade.
…pauses, not runtime GC - run-gc-jitter.sh: add --discard-spikes (auto spike detection) and --env-monitor (vmstat + /proc/meminfo background collection); JSON schema v2 with env_noise + cleaned_stats fields - COMPARISON.md: add Cleaned P99 column to GC jitter table; expand G4 note with full root cause analysis and mitigation recommendations - GC_JITTER_ROOT_CAUSE_ANALYSIS.md: new root cause verification report (cross-product spike correlation, exclusion diagnostics, WSL2 virtio-blk I/O scheduling pause identification) - docs: update competitor-benchmark-design.md (EN + ZH-CN) to v1.2; D6 section retitled to env-noise-aware tail-latency comparison; 'zero GC jitter' narrative replaced with Cleaned P99 methodology; AC2 status updated with root cause reference
Two new issues surfaced after the ubuntu-24.04 runner upgrade (GCC 13): 1. UBSan: OpenSslCryptoProvider::base64UrlDecodeImpl and the identical FakeCryptoProvider::base64UrlDecodeImpl accumulated bits in a signed int buffer that overflowed on left-shift (same class of bug as the TotpUtils fixes). Fix: uint32_t buffer + truncate to live bits. 2. -Werror=redundant-move: UserAdminService.cc:426 std::move(rows) where rows is a const& callback parameter. GCC 13 flags this as redundant (cannot actually move from a const ref). Remove std::move.
4e814a2 to
bcee5a7
Compare
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Three fixes for the CI failures on PR #115: 1. Upgrade all Linux CI runners from ubuntu-22.04 to ubuntu-24.04. ubuntu-22.04 ships GCC 11 whose gcov lacks -j (JSON output), causing the coverage job to generate 0 gcov JSON reports and crash measure_coverage.py with ZeroDivisionError. ubuntu-24.04 ships GCC 13. 2. Fix heap-use-after-free in RateLimiter::checkThrottled() caught by ASan in the OAuth2Tests suite. sweepLocked() could erase the just-inserted empty bucket while a reference to it was still held, then bucket.size() accessed freed memory. Fix: re-find the bucket after sweep and return early if it was erased. 3. Guard measure_coverage.py against tt==0 (no coverage data) so it prints a clear message instead of crashing with ZeroDivisionError. This is a defensive measure; the root cause (gcc-11 gcov) is fixed by the runner upgrade.
… 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.
Draft PR — implementation in progress. Scope: #102 #111 #112 #107 #87 #82 #83 #73 #72 #71 (+ partial #88/#90/#105). Plan: .zcode/plans/issues-batch-1/ (local). Will convert to ready after full verification.