Skip to content

[12/15] Log every request through an access-log interceptor - #165

Draft
UnknownJoe796 wants to merge 6 commits into
v53/engine-conformancefrom
v53/access-logging
Draft

[12/15] Log every request through an access-log interceptor#165
UnknownJoe796 wants to merge 6 commits into
v53/engine-conformancefrom
v53/access-logging

Conversation

@UnknownJoe796

Copy link
Copy Markdown
Contributor

Replaces logging scattered through request handling with a single
AccessLogInterceptor.

Read this before merging. Two things here are not a plain replay of history:

  • This squashes two commits (both titled "One more step"). The first added
    RequestLogDescriber.kt; the second deleted it again in favour of
    AccessLogInterceptor. Split across two PRs that is pure churn -- one PR
    proposing a file the next one removes -- so they are combined.
  • Authentication.kt had a conflict resolved by hand. The masquerade denial
    log is kept, in the simpler form this commit introduces
    ("$auth denied masquerade as $masquerade"). The separate AUDIT-prefixed
    grant/denial logging from an earlier commit is deliberately gone: it was
    superseded by this interceptor, and shipping it would have meant reviewing an
    approach already abandoned.

This PR also refines the request pipeline, session manager and settings around
the interceptor, which is why it touches more than the new file.

UnknownJoe796 and others added 3 commits July 28, 2026 16:51
KnownDeviceProofEndpoints previously called Uuid.parse() on the client-supplied
identifier segment with no error handling; a malformed UUID threw an unhandled
IllegalArgumentException, which the framework surfaces as a 500 Internal
Server Error rather than a 400 Bad Request. Wrap the parse in a try/catch and
surface a BadRequestException with the parse failure reason instead.

Reconstructed from stale origin/fixes commit 01b5f4e; clean apply, file was
untouched on version-5.3 since the fork point.
Covers the previous commit: a non-Uuid id segment must produce a
BadRequestException (400) rather than an unhandled IllegalArgumentException.
Return 400 instead of 500 for malformed known-device identifiers
// once, and in production every setting is pre-resolved single-threaded during ready(). An immutable Map
// (not a ConcurrentHashMap) is used so a null result is stored naturally, with no sentinel.
@Volatile
private var goal: Map<ServerSetting<*, *>, Any?> = emptyMap()

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WTF? Why is this getting reverted? Why are PRs stacking changes on each other?

Concurrent first-touch of a setting could resolve it more than once.
Transformed results are now published as an immutable snapshot: reads are
lock-free (once a setting is resolved, an immutable Map makes it visible
for good via a @volatile field), and writes replace the whole map under a
single lock (copy-on-write) -- cheap, since each setting resolves at most
once, and in production every setting is pre-resolved single-threaded
during ready(). A single reentrant lock guards transformation because a
setting's getter may resolve its own dependencies by calling get() again
on the same thread; per-setting locks could deadlock on mutually-dependent
settings instead.

(cherry picked from commit ed1d009)
Replaces the ad-hoc logging scattered through request handling with a
single AccessLogInterceptor, and refines the request pipeline, session
manager and settings around it.

Squashes two commits (both titled "One more step"): the first added
RequestLogDescriber.kt, the second deleted it in favour of
AccessLogInterceptor. Split across two PRs that would be pure churn, so
they're combined.

The masquerade *denial* log is kept, in the simpler form this commit
introduces. The separate AUDIT-prefixed grant/denial logging from an
earlier commit is deliberately gone: it was superseded by this
interceptor, and shipping it would have meant reviewing an approach
already abandoned.

Its ServerDefinition.kt/SecurityHeadersInterceptor.kt and
ServerSettings.kt changes, and the engine reliability tests' 408->503
follow-up, already shipped earlier in this de-linearized chain -- kept
here only to preserve authorship/history for the rest of the change.

Based directly on security-headers + engine-conformance + settings-thread-
safety, since AccessLogInterceptor's own tests reference
SecurityHeadersInterceptor and this commit further edits the shared
conformance suite and implementationHelpers.kt.
@UnknownJoe796
UnknownJoe796 force-pushed the v53/docs-migration-v52 branch from d2fd0af to faf3fc9 Compare July 30, 2026 02:20
@UnknownJoe796
UnknownJoe796 changed the base branch from v53/docs-migration-v52 to v53/engine-conformance July 30, 2026 02:24
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