Skip to content

fix: .gitignore excludes admin logs page + add deploy prerequisites - #4

Merged
voidvec merged 4 commits into
masterfrom
fix/deploy-docs-and-gitignore
Jun 23, 2026
Merged

voidvec merged 4 commits into
masterfrom
fix/deploy-docs-and-gitignore

Conversation

@voidvec

@voidvec voidvec commented Jun 22, 2026

Copy link
Copy Markdown
Owner

Summary

  • fix: The broad **/logs/ rule in .gitignore (intended for Drogon runtime log dirs) was also matching OAuth2Admin/src/pages/logs/, so LogsPage.vue was never tracked. On a fresh git clone, Docker builds failed with Could not resolve "../pages/logs/LogsPage.vue" from "src/router/index.ts". Added explicit exceptions for the admin source directory and tracked the file.
  • docs: Expanded docs/ops/deployment.md with prerequisite install steps (Docker, Docker user group, Git, OpenSSL, Certbot), a tested-in-China Docker registry-mirror section (resolves dial tcp registry-1.docker.io:443: i/o timeout), and DNS/firewall configuration guidance.

Commits

  1. fix: stop .gitignore from excluding admin console logs page source
  2. docs: expand deployment guide with prerequisites and mirror setup

Test plan

  • Fresh git clone of this branch, then docker compose -f deploy/docker/docker-compose.prod.yml --env-file .env.docker up -d builds the admin image successfully (no more Could not resolve LogsPage.vue)
  • git check-ignore -v OAuth2Admin/src/pages/logs/LogsPage.vue shows the !OAuth2Admin/src/pages/logs/** exception (not **/logs/)
  • On a China-mainland server, docker info | grep -A 5 "Registry Mirrors" shows the configured mirrors and docker pull postgres:15-alpine succeeds

🤖 Generated with Claude Code

voidvec and others added 4 commits June 22, 2026 23:27
The broad `**/logs/` rule (meant for Drogon runtime log dirs) also matched
`OAuth2Admin/src/pages/logs/`, so `LogsPage.vue` was never tracked. Docker
builds on a fresh `git clone` failed with `Could not resolve
"../pages/logs/LogsPage.vue" from "src/router/index.ts"`.

Add explicit exceptions for the admin source directory and track the file.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add prerequisite install steps (Docker, Docker user group, Git, OpenSSL,
Certbot) and a tested-in-China Docker registry-mirror section to resolve
`i/o timeout` when pulling images. Also add DNS/firewall config guidance.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
`proxy_pass http://oauth2-admin/;` (trailing slash) caused nginx to strip
the `/admin/` prefix before forwarding, so the admin container received
requests at `/` and responded with `302 /admin/` — creating an infinite
redirect loop (`/admin/` → `/` → 302 → `/admin/`).

Drop the trailing slash so the `/admin/` prefix passes through to the
admin container, whose own `location /admin/` serves the SPA correctly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
SchemaManager applied each .sql migration by passing the entire file
content to `trans->execSqlSync(sql)`. Drogon routes that through libpq's
prepared-statement path, and PostgreSQL prepared statements allow only a
single statement — so every migration file with >1 statement failed:

  ERROR: cannot insert multiple commands into a prepared statement

On production deploy this surfaced as V002 failing, which left tables
`users`, `oauth2_clients`, etc. uncreated, so seed scripts then errored
with `relation "users" does not exist`.

Add `SchemaManager::splitSqlStatements`: a character-scanning splitter
that tracks lexical state (single-quoted strings with '' escapes,
`--` line comments, `/* */` block comments, and $$/$tag$ dollar-quoting
for PL/pgSQL bodies) and emits statements split on top-level semicolons.
`applyMigration` now executes each statement separately within the same
transaction, preserving atomicity (any failure rolls back and the
version is not recorded).

Add 10 unit tests covering each lexical state and edge cases. Wire the
test target to compile SchemaManager.cc directly and expose the splitter
as a public static method so tests can reach it.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@voidvec
voidvec merged commit 0d7af2b into master Jun 23, 2026
3 checks passed
voidvec added a commit that referenced this pull request Jul 29, 2026
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
voidvec added a commit that referenced this pull request Jul 29, 2026
…) + comment #4/#8/#9

P1 #6 (RFC 6749 §5.1): expires_in / id_token exp / device refresh TTL were
hardcoded 3600/2592000; now use configured access_token_ttl/refresh_token_ttl
(OAuth2Plugin getAccessTokenTtl()/getRefreshTokenTtl() accessors). 6 sites:
TokenService auth_code expires_in + id_token exp + refresh expires_in;
client_credentials + device_code issuance in TokenEndpointController.

P1 #5 (RFC 8628 §3.4): device_code redemption now authenticates by client_type
-- CONFIDENTIAL clients require a valid client_secret (validateClient); PUBLIC
clients keep the client_id-vs-device-row binding. Lookup wrapped in a local
lambda captured BY VALUE (not [&]) because it runs from getClient's async
callback after token() has returned -- [&] would dangle deviceCodeHash/dbClient.

P1 #3 (RFC 6749 §4.1.2 single-use): device-code redemption check-then-delete
was non-atomic (two concurrent redemptions both issued). Replaced with a
pre-issue atomic UPDATE...WHERE status='approved' RETURNING; affected-row gate
makes exactly one concurrent winner issue, loser gets invalid_grant (fail-
closed). UPDATE...RETURNING is a db-operations.md raw-SQL exemption.

Comment-only (#4 [this] capture, #8 validateAccessToken no-self, #9 JWKS empty
response): document existing-correct behavior, deter repeat review reports.

Tests (live-server integration, PG+Redis): TokenExpiryTtlConfigTest,
DeviceCodeClientAuthTest (conf no-secret rejects / conf secret ok / pub ok),
DeviceCodeRaceConditionTest (concurrent redemption -> exactly one wins).
All pass + no regressions (RFC6749 compliance 4504 assertions, auth_code E2E,
refresh rotation, authorize PKCE passthrough).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
voidvec added a commit that referenced this pull request Aug 9, 2026
Addresses the actionable items from the PR #44 code review (benchmark
review intentionally excluded).

MINOR #1 (RateLimiter unbounded memory growth): RateLimiter.purgeOldLocked
only ran for the accessed key, so attacker keys recording one failure and
never touched again lingered indefinitely -> unbounded map growth under a
distributed attack. Added RateLimiterConfig.maxBuckets (default 10000) and a
sweepLocked() full purge triggered in recordFailure when the bucket count
exceeds the cap (drops every bucket with no in-window failures). Triggered
on the growth path, not the hot checkThrottled path.

MINOR #2 (scope.find("openid") substring vs token match): userInfo + the
device id_token path used scope.find("openid") (substring), inconsistent
with the new hasScope() token match and susceptible to a `myopenid`-style
false positive. Converted the two libs/drogon sites to hasScope(); for
TokenService (libs/oauth2, cannot depend on libs/drogon) added a
framework-free scopeContains() in the anonymous namespace and converted the
auth-code + refresh id_token-issuance sites.

MINOR #3 (Postgres LOG_DEBUG match result): removed the
"Secret validation PASSED/FAILED" LOG_DEBUG to match the Redis path's F-004
removal (the match result is already observable via the HTTP status, so this
is a uniformity fix, not a timing-side-channel fix).

NIT #5 (error param urlEncode): buildAuthorizeErrorRedirect now urlEncodes
the `error` param for defensive consistency with error_description/state.

MINOR #4 (refresh_token double getClient): intentionally NOT fixed in this
PR -- the reviewer flagged it as a non-blocking perf opportunity
(redundant DB round-trip). Threading the client optional through
dispatchGrant is invasive; deferred.

Verified: build GREEN with AUTHFORGE_WERROR=ON (CI parity);
manage.ps1 test-backend = 456/456; api-diff OK (additive RateLimiter
declarations ratified at v1.0.0).
voidvec added a commit that referenced this pull request Aug 9, 2026
Addresses the actionable items from the PR #44 code review (benchmark
review intentionally excluded).

MINOR #1 (RateLimiter unbounded memory growth): RateLimiter.purgeOldLocked
only ran for the accessed key, so attacker keys recording one failure and
never touched again lingered indefinitely -> unbounded map growth under a
distributed attack. Added RateLimiterConfig.maxBuckets (default 10000) and a
sweepLocked() full purge triggered in recordFailure when the bucket count
exceeds the cap (drops every bucket with no in-window failures). Triggered
on the growth path, not the hot checkThrottled path.

MINOR #2 (scope.find("openid") substring vs token match): userInfo + the
device id_token path used scope.find("openid") (substring), inconsistent
with the new hasScope() token match and susceptible to a `myopenid`-style
false positive. Converted the two libs/drogon sites to hasScope(); for
TokenService (libs/oauth2, cannot depend on libs/drogon) added a
framework-free scopeContains() in the anonymous namespace and converted the
auth-code + refresh id_token-issuance sites.

MINOR #3 (Postgres LOG_DEBUG match result): removed the
"Secret validation PASSED/FAILED" LOG_DEBUG to match the Redis path's F-004
removal (the match result is already observable via the HTTP status, so this
is a uniformity fix, not a timing-side-channel fix).

NIT #5 (error param urlEncode): buildAuthorizeErrorRedirect now urlEncodes
the `error` param for defensive consistency with error_description/state.

MINOR #4 (refresh_token double getClient): intentionally NOT fixed in this
PR -- the reviewer flagged it as a non-blocking perf opportunity
(redundant DB round-trip). Threading the client optional through
dispatchGrant is invasive; deferred.

Verified: build GREEN with AUTHFORGE_WERROR=ON (CI parity);
manage.ps1 test-backend = 456/456; api-diff OK (additive RateLimiter
declarations ratified at v1.0.0).
voidvec added a commit that referenced this pull request Aug 30, 2026
…loor, bootstrap self-heal, review cleanups

Address PR #141 review (1 must-fix, 8 should-fix, quick considers):

- #1 consent_csrf declared as a required query parameter in openapi.yaml
  and the C++ endpoint doc registration; apps/server/docs/api/openapi.json
  regenerated from a live server run; Python/Go clients regenerated.
- #2 nonce one-shot is now atomic: the find/verify/erase sequence is
  serialized by a process-wide mutex (consent traffic is tiny; in-process
  session storage).
- #3 identity AuthService no longer captures this in the async validateUser
  callback — the legacy-hash policy flag is value-captured
  (db-operations rule 4).
- #4/#12 AdminBootstrapper reworked as ensure-* steps: an existing admin
  user row is reused and role/mapping completed (partial failures self-heal
  on restart); the random password is printed only after the insert
  succeeded; a mapping failure no longer reports created=true.
- #5 POST /api/admin/users enforces auth.min_password_length
  (VALIDATION_PASSWORD_TOO_SHORT) — closing the admin bypass.
- #6 consent integration tests reworked: missing-nonce now drives the real
  authorize-minted slot (400), deny-to-unregistered-uri (400, no Location)
  and deny-to-registered-uri (302 access_denied) branches are covered.
- #7/#8 deployment.md: auto-bootstrap wording fixed, bogus ADMIN_SALT
  removed (PBKDF2 keeps salt empty); website i18n error table mirrored
  (3014/4007).
- #9 main.cc bootstrap probes with backoff (5 attempts) and LOG_WARN on
  failure instead of a single silent 2s probe.
- #13 unique-violation detection layered (SqlError 23505 -> constraint
  name -> english/zh localized text), mirroring the
  PostgresSocialAccountRepository pattern.
- #11 gate-4 comment corrected; #15 CHANGELOG duplicate Unreleased merged;
  #17 AGENTS.md consent.csp entry removed.

Considered-but-not-taken: #10 multi-slot nonces (tracked follow-up), #14
admin UI hardcode (server now enforces; hint stays), #18 MFA-pending
session through consent (pre-existing authorize behavior, tracked).
voidvec added a commit that referenced this pull request Aug 30, 2026
…loor, bootstrap self-heal, review cleanups

Address PR #141 review (1 must-fix, 8 should-fix, quick considers):

- #1 consent_csrf declared as a required query parameter in openapi.yaml
  and the C++ endpoint doc registration; apps/server/docs/api/openapi.json
  regenerated from a live server run; Python/Go clients regenerated.
- #2 nonce one-shot is now atomic: the find/verify/erase sequence is
  serialized by a process-wide mutex (consent traffic is tiny; in-process
  session storage).
- #3 identity AuthService no longer captures this in the async validateUser
  callback — the legacy-hash policy flag is value-captured
  (db-operations rule 4).
- #4/#12 AdminBootstrapper reworked as ensure-* steps: an existing admin
  user row is reused and role/mapping completed (partial failures self-heal
  on restart); the random password is printed only after the insert
  succeeded; a mapping failure no longer reports created=true.
- #5 POST /api/admin/users enforces auth.min_password_length
  (VALIDATION_PASSWORD_TOO_SHORT) — closing the admin bypass.
- #6 consent integration tests reworked: missing-nonce now drives the real
  authorize-minted slot (400), deny-to-unregistered-uri (400, no Location)
  and deny-to-registered-uri (302 access_denied) branches are covered.
- #7/#8 deployment.md: auto-bootstrap wording fixed, bogus ADMIN_SALT
  removed (PBKDF2 keeps salt empty); website i18n error table mirrored
  (3014/4007).
- #9 main.cc bootstrap probes with backoff (5 attempts) and LOG_WARN on
  failure instead of a single silent 2s probe.
- #13 unique-violation detection layered (SqlError 23505 -> constraint
  name -> english/zh localized text), mirroring the
  PostgresSocialAccountRepository pattern.
- #11 gate-4 comment corrected; #15 CHANGELOG duplicate Unreleased merged;
  #17 AGENTS.md consent.csp entry removed.

Considered-but-not-taken: #10 multi-slot nonces (tracked follow-up), #14
admin UI hardcode (server now enforces; hint stays), #18 MFA-pending
session through consent (pre-existing authorize behavior, tracked).
voidvec added a commit that referenced this pull request Nov 12, 2026
…release three-part gate docs

Closes the two v1.6.0 frontend-leg gaps from the 2026-11 P0/P1 retro
audit (#4: logs/export had no consumer; claim-mappings had no UI — the
follow-up declared in #293) and processizes the pre-release three-part
gate that v1.5.0 silently skipped (#5).

- Audit Logs page: time-windowed Export CSV action (datetime-local
  inputs; empty from/to defaults to the last 24h so the mandatory-window
  contract is never tripped by accident), blob download, and a
  blob-decoding error path so AUDIT_EXPORT_WINDOW_REQUIRED /
  AUDIT_EXPORT_TOO_LARGE surface through the normal catalog messages.
- New Claim Mappings page (/admin/claim-mappings, nav under Scopes):
  create/edit modals with the scope-name datalist and the
  custom_attributes.<key> / user.display_name source-whitelist hint,
  row-level enable toggle issuing the documented full-replace PUT,
  confirm-guarded delete — mirrors the P1-3 red lines in the mock and
  specs (reserved-claim 400, openid-scope 400).
- Release process: versioning-and-release.md gains the pre-release
  three-part gate section (five-scenario benchmark >= 90% in-tree,
  curated CHANGELOG, six-point version sync) in EN + zh mirror; the
  release-engineering checklist gains the same blocking gate; the PR
  template gains a release-PR checklist section.
- e2e: logs.spec +2 (window params, catalog error), claim-mappings.spec
  new (5 cases incl. contract-body assertions). Mock-api gains the
  export route (window guard + text/csv) and an in-memory claim-mappings
  CRUD mirroring the server red lines.

Verification: admin tsc+vite build green; vitest 4/4; Playwright
logs(12) + claim-mappings(5) + navigation/i18n regression suites green;
zh-mirror consistency 51/51; doc-links 356 green; llms regen zero drift.
voidvec added a commit that referenced this pull request Nov 12, 2026
…release three-part gate docs

Closes the two v1.6.0 frontend-leg gaps from the 2026-11 P0/P1 retro
audit (#4: logs/export had no consumer; claim-mappings had no UI — the
follow-up declared in #293) and processizes the pre-release three-part
gate that v1.5.0 silently skipped (#5).

- Audit Logs page: time-windowed Export CSV action (datetime-local
  inputs; empty from/to defaults to the last 24h so the mandatory-window
  contract is never tripped by accident), blob download, and a
  blob-decoding error path so AUDIT_EXPORT_WINDOW_REQUIRED /
  AUDIT_EXPORT_TOO_LARGE surface through the normal catalog messages.
- New Claim Mappings page (/admin/claim-mappings, nav under Scopes):
  create/edit modals with the scope-name datalist and the
  custom_attributes.<key> / user.display_name source-whitelist hint,
  row-level enable toggle issuing the documented full-replace PUT,
  confirm-guarded delete — mirrors the P1-3 red lines in the mock and
  specs (reserved-claim 400, openid-scope 400).
- Release process: versioning-and-release.md gains the pre-release
  three-part gate section (five-scenario benchmark >= 90% in-tree,
  curated CHANGELOG, six-point version sync) in EN + zh mirror; the
  release-engineering checklist gains the same blocking gate; the PR
  template gains a release-PR checklist section.
- e2e: logs.spec +2 (window params, catalog error), claim-mappings.spec
  new (5 cases incl. contract-body assertions). Mock-api gains the
  export route (window guard + text/csv) and an in-memory claim-mappings
  CRUD mirroring the server red lines.

Verification: admin tsc+vite build green; vitest 4/4; Playwright
logs(12) + claim-mappings(5) + navigation/i18n regression suites green;
zh-mirror consistency 51/51; doc-links 356 green; llms regen zero drift.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants