Skip to content

Fix OIDC audit logging and polish admin/dashboard UI - #33

Merged
panteLx merged 2 commits into
mainfrom
fix/oidc-audit-logging
Jul 29, 2026
Merged

Fix OIDC audit logging and polish admin/dashboard UI#33
panteLx merged 2 commits into
mainfrom
fix/oidc-audit-logging

Conversation

@panteLx

@panteLx panteLx commented Jul 29, 2026

Copy link
Copy Markdown
Owner

Summary

Audit log fix:

  • The audit-logging wrapper in app/api/auth/[...all]/route.ts only matched credential-auth paths (/sign-in/email, /sign-up/email), so OIDC sign-in (POST /sign-in/oauth2, GET /oauth2/callback/:providerId) never produced a user_login/user_registered entry in the admin log.
  • Moved the logging into better-auth's databaseHooks (user.create.after, session.create.after) in lib/auth.ts, which fire uniformly at the database layer for every auth method (credentials and OIDC alike), instead of relying on brittle path string-matching.
  • A small in-memory dedupe map prevents a registration's immediate follow-up session from also logging a redundant user_login.
  • app/api/auth/[...all]/route.ts is now a trivial passthrough.

UI polish:

  • Show the full resource ID in admin logs instead of truncating it
  • Only render the system settings card for superadmins
  • Hide the stat-tile icon and quick-add label on small screens
  • Default the transactions filter panel to collapsed
  • Responsive stat-tile grid tweaks and misc formatting/copy fixes

Test plan

  • npx tsc --noEmit passes
  • npm run lint passes on changed files
  • npm run build succeeds
  • Smoke-tested against the dev DB: credential sign-up produces exactly one user_registered row (no duplicate login), subsequent sign-in produces exactly one user_login row; test data cleaned up afterward
  • OIDC round-trip not manually re-tested live (points at a real external IdP requiring interactive browser consent), but verified at the source level that better-auth's createOAuthUser/OIDC callback createSession calls go through the same internalAdapter hooks as the credential flow

🤖 Generated with Claude Code

panteLx added 2 commits July 29, 2026 18:13
The audit-logging wrapper in app/api/auth/[...all]/route.ts only matched
credential-auth paths (/sign-in/email, /sign-up/email), so OIDC sign-in
(POST /sign-in/oauth2, GET /oauth2/callback/:providerId) never produced a
user_login or user_registered entry.

Move the logging into better-auth's databaseHooks (user.create.after,
session.create.after), which fire uniformly at the DB layer for every auth
method, including OIDC.
- Show full resource ID in admin logs instead of truncating it
- Only render the system settings card for superadmins
- Hide the stat-tile icon and quick-add label on small screens
- Default the transactions filter panel to collapsed
- Responsive stat-tile grid tweaks and misc formatting/copy fixes
@panteLx panteLx changed the title Fix admin audit log missing OIDC logins and registrations Fix OIDC audit logging and polish admin/dashboard UI Jul 29, 2026
@panteLx
panteLx merged commit c23e537 into main Jul 29, 2026
1 check passed
@panteLx
panteLx deleted the fix/oidc-audit-logging branch July 29, 2026 16:16
@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@panteLx, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 58 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: c3af67e2-1e54-4766-97c8-680ea1796d53

📥 Commits

Reviewing files that changed from the base of the PR and between c0295e4 and a711024.

📒 Files selected for processing (10)
  • app/api/auth/[...all]/route.ts
  • components/admin/admin-logs-client.tsx
  • components/admin/admin-settings-client.tsx
  • components/layout/app-header.tsx
  • components/layout/quick-add-sheet.tsx
  • components/schedules/schedules-client.tsx
  • components/transactions/transactions-client.tsx
  • components/ui/stat-tile.tsx
  • lib/audit-log.ts
  • lib/auth.ts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

1 participant