Skip to content

fix(audit): text columns for URL and User-Agent; mask credentials in the audited URL - #70

Merged
dskripchenko merged 1 commit into
mainfrom
fix/audit-request-context
Oct 14, 2026
Merged

dskripchenko merged 1 commit into
mainfrom
fix/audit-request-context

Conversation

@dskripchenko

Copy link
Copy Markdown
Owner

Found by printable's SSO end-to-end run against a real Keycloak on PostgreSQL: the sign-in callback answered 500.

Bug. admin_audit_logs.url and .user_agent were varchar(255), while the values are cut to admin.audit.url_max_length (2048) and user_agent_max_length (1024). Any longer value — an OAuth callback carrying its code, a long User-Agent — failed the insert on PostgreSQL/MySQL, and the audited request with it. SQLite does not check string lengths, so the suite never saw it. A migration turns both columns into text.

Security. The audited URL kept credentials from the query string (the OAuth authorization code and state in this case; signed links' signatures elsewhere). The new admin.audit.redacted_query lists parameter names masked as [redacted]; AuditLog::requestContext() / AuditLog::redactUrl() build the context for Loggable, AuthAuditListener and packages writing their own rows.

Tests: redaction, context lengths, column types after the migration.

🤖 Generated with Claude Code

…dentials in the URL

The columns were varchar(255) while the values were cut to 2048/1024:
on PostgreSQL an OAuth callback URL failed the audit insert and the
request with it. A migration makes both text. AuditLog::requestContext()
builds the context once, masking the query parameters listed in
admin.audit.redacted_query (code, state, tokens, signature…).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@dskripchenko
dskripchenko merged commit 07060ff into main Oct 14, 2026
12 checks passed
@dskripchenko dskripchenko mentioned this pull request Oct 14, 2026
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