Skip to content

fix(#5037): server audit low-severity tail (info disclosure, HTTP codes, forced GC, cluster-token docs) - #5058

Merged
robfrank merged 5 commits into
mainfrom
fix/5037-server-audit-low-severity-tail
Jul 7, 2026
Merged

robfrank merged 5 commits into
mainfrom
fix/5037-server-audit-low-severity-tail

Conversation

@robfrank

@robfrank robfrank commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

Closes #5037

Addresses the low-severity tail from the 2026-07 server module audit. Five small, independent hardening items:

  1. Info disclosure (security): AbstractServerHttpHandler no longer leaks internal exception class names and cause-chain detail in production mode. A new package-private buildErrorBody(verbose, ...) returns a generic error message plus a requestId correlation id in production, while development/test keep the verbose body for debugging.
  2. Wrong HTTP status (correctness): POST /begin returns 409 Conflict (not 401) when a transaction is already started for the session, and isolationLevel is now optional (a payload without it begins with the default isolation instead of failing with 400).
  3. 500 on bad input (correctness): A malformed X-ArcadeDB-Read-After / legacy X-ArcadeDB-Commit-Index header now returns 400 instead of a 500, via a new validated parseReadBookmark helper.
  4. Forced GC (availability): Removed the System.gc() call in ServerMonitor under memory pressure; the critical condition is logged and heap management is left to the JVM collector.
  5. Cluster-token guidance (docs): Expanded the HA_CLUSTER_TOKEN configuration description with hardening guidance (explicit high-entropy token; never expose the replication HTTP port to untrusted networks).

Test plan

  • AbstractServerHttpHandlerErrorBodyTest - production conceals class name + cause chain, keeps correlation id; verbose mode still exposes them.
  • DatabaseAbstractHandlerBookmarkParseTest - null/blank -> -1, valid numeric parsed, malformed throws IllegalArgumentException.
  • Issue5037BeginHandlerIT - second /begin on same session -> 409; /begin with empty JSON body -> 204.
  • HTTPTransactionIT.beginWithPayloadWithoutIsolationLevelSucceeds - updated to assert the new optional-isolationLevel contract (204).
  • Regression: Issue3155NestedExceptionErrorIT, Issue4350DuplicatedKeyHttpStatusIT, AutoCommitParameterTest, ClusterInternalAuthTest, ErrorResponseNestedExceptionTest all pass (29 tests green).

🤖 Generated with Claude Code

…es, forced GC, cluster-token docs)

- Conceal internal exception details in production-mode HTTP error responses; keep a correlation id
- POST /begin returns 409 (not 401) for an already-started transaction; isolationLevel is now optional
- Malformed HA read-consistency bookmark header returns 400 instead of 500
- Remove forced System.gc() from the server monitor under memory pressure
- Document HA cluster-token hardening guidance

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@mergify

mergify Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@codacy-production

codacy-production Bot commented Jul 6, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 6 complexity

Metric Results
Complexity 6

View in Codacy

🟢 Coverage 89.74% diff coverage · -6.71% coverage variation

Metric Results
Coverage variation ✅ -6.71% coverage variation
Diff coverage ✅ 89.74% diff coverage

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (593f621) 134803 100334 74.43%
Head commit (f233895) 167303 (+32500) 113295 (+12961) 67.72% (-6.71%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#5058) 39 35 89.74%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request addresses several low-severity hardening items from a server module audit, including concealing verbose exception details in production HTTP error responses, returning a 409 Conflict for already-started transactions, making the transaction isolation level optional, parsing HA read bookmark headers safely to avoid 500 errors, and removing forced garbage collection in the server monitor. Feedback on these changes suggests using an identity-based visited set in buildDetailChain to robustly prevent infinite loops on cyclic exception chains, and utilizing payload.optString in PostBeginHandler to avoid the performance overhead and potential ClassCastException of payload.toMap().

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +665 to +670
Throwable current = e.getCause();
while (current != null && current != current.getCause() && current != e) {
buffer.append(" -> ");
buffer.append(current.getMessage() != null ? current.getMessage() : current.getClass().getSimpleName());
current = current.getCause();
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

The cycle detection logic in buildDetailChain only checks for direct self-references (current != current.getCause()) and references back to the root exception (current != e). It does not detect cycles deeper in the chain (e.g., e -> A -> B -> C -> B or e -> A -> B -> A), which can lead to an infinite loop and cause the thread to hang, consuming 100% CPU. Using a visited set with identity comparison is a much more robust way to prevent infinite loops in cyclic cause chains.

    final java.util.Set<Throwable> visited = java.util.Collections.newSetFromMap(new java.util.IdentityHashMap<>());
    visited.add(e);
    Throwable current = e.getCause();
    while (current != null && visited.add(current)) {
      buffer.append(" -> ");
      buffer.append(current.getMessage() != null ? current.getMessage() : current.getClass().getSimpleName());
      current = current.getCause();
    }

return new ExecutionResponse(400, "Missing parameter 'isolationLevel'");

// isolationLevel is optional: when a payload is present but omits it, fall back to the default isolation.
final String isolationLevel = payload != null ? (String) payload.toMap().get("isolationLevel") : null;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Calling payload.toMap() recursively copies the entire JSON object tree into Java Maps/Lists, which is highly inefficient on a hot path like transaction creation. Additionally, casting the result directly to (String) can throw a ClassCastException if the client sends a non-string value (e.g., a number or boolean). Using payload.optString("isolationLevel", null) is much more efficient, safe, and idiomatic.

Suggested change
final String isolationLevel = payload != null ? (String) payload.toMap().get("isolationLevel") : null;
final String isolationLevel = payload != null ? payload.optString("isolationLevel", null) : null;

@claude

claude Bot commented Jul 6, 2026

Copy link
Copy Markdown

PR Review: server audit low-severity tail (#5058)

Overall this is a clean, well-scoped set of independent hardening fixes. Each item has a clear rationale in code comments, tests are added for the testable items, and the style follows project conventions (package-private helpers for unit testing, final params, JSONObject). Nice work. A few notes below.

Must fix

1. Stray tool-call tags leaked into the committed docs file. docs/5037-server-audit-low-severity-tail.md ends with two spurious non-markdown lines: a closing content tag and a closing invoke tag (leftover XML artifacts from generation). They should be deleted; the file should end at "Production mode now conceals internal exception details."

Worth considering

2. error2json path still bypasses production concealment (minor inconsistency). sendErrorResponse now routes through buildErrorBody(...), but the snapshot-install path (AbstractServerHttpHandler.java:103) still calls error2json(...) directly. Here there is no exception attached so nothing sensitive leaks, but two error-body code paths now coexist. Consider routing it through the same helper (or a note) so a future exception-bearing call site does not silently reintroduce the leak this PR closes.

3. Item 3 has no test for the actual HTTP 400 mapping. DatabaseAbstractHandlerBookmarkParseTest covers parseReadBookmark(...) in isolation (good), but no IT asserts that a malformed X-ArcadeDB-Read-After / X-ArcadeDB-Commit-Index header actually yields a 400 (not 500) end-to-end. Since that status contract is the whole point of the item, a small IT would lock it in against handler-wiring regressions.

4. parseReadBookmark accepts negative values. parseReadBookmark("-5") returns -5, which collides with the "absent" sentinel -1 and is an otherwise-meaningless bookmark. This matches the pre-existing Long.parseLong behavior so it is not a regression, but rejecting values below -1 (or below 0) would be a natural extension of the new guard if you want strict validation.

Verified good

  • requestId correlation is sound: the request-id header is always set on the response (line 149) before any sendErrorResponse call, so buildErrorBody reliably picks up the correlation id in production, and the generated-UUID fallback guarantees it is never null in practice.
  • No client-side dependency on concealed fields: console/ and integration/ contain no non-test code that parses the exception/detail JSON fields, so hiding them in production mode will not break the bundled console or drivers. It is also opt-in (default development is unchanged aside from the additive requestId).
  • PostBeginHandler 409 + optional isolationLevel: logic is correct; a {} payload yields a null isolationLevel and a default begin(). An invalid isolationLevel still maps to 500 via valueOf, but that was pre-existing and out of scope.
  • System.gc() removal: correct call. Forcing a stop-the-world GC under memory pressure is an availability hazard; logging at WARNING and leaving it to the collector is the right move.
  • Cluster-token docs: the expanded HA_CLUSTER_TOKEN guidance is accurate and appropriately warns about replication-port exposure.

Only the docs stray-tags item is blocking; the rest are optional polish.

@codecov

codecov Bot commented Jul 6, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 82.05128% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 65.96%. Comparing base (593f621) to head (f233895).
⚠️ Report is 94 commits behind head on main.

Files with missing lines Patch % Lines
...b/server/http/handler/DatabaseAbstractHandler.java 66.66% 2 Missing and 1 partial ⚠️
...server/http/handler/AbstractServerHttpHandler.java 92.00% 0 Missing and 2 partials ⚠️
...ava/com/arcadedb/server/monitor/ServerMonitor.java 0.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #5058      +/-   ##
============================================
+ Coverage     65.44%   65.96%   +0.51%     
- Complexity      821      841      +20     
============================================
  Files          1687     1690       +3     
  Lines        134803   135500     +697     
  Branches      28824    28989     +165     
============================================
+ Hits          88226    89382    +1156     
+ Misses        34506    33885     -621     
- Partials      12071    12233     +162     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

…ring for isolationLevel, strip stray doc tags
@claude

claude Bot commented Jul 7, 2026

Copy link
Copy Markdown

Review: PR 5058 - server audit low-severity tail

Thanks for the well-organized, well-tested set of hardening fixes. The per-item docs, the correlation-id in error bodies, the cycle-safe buildDetailChain (nice touch with the IdentityHashMap and the deep-cycle test), the RFC-correct HTTP status codes, and dropping the forced System.gc() are all solid improvements. One item needs attention before merge, plus a few minor notes.

🔴 Blocking - Item 1 breaks the remote driver and HA exception propagation in production mode

buildErrorBody(verbose=...) strips exception, exceptionArgs, and detail whenever SERVER_MODE == production. But those three fields are not just attacker-facing noise - they are a wire contract consumed by two internal clients:

  1. The official remote Java driver - RemoteHttpComponent.manageException() (network/.../RemoteHttpComponent.java:635) keys its entire typed-exception reconstruction off the exception class-name field. When it is absent (exception == null), every typed error collapses to a generic RemoteException (line 703). Against a production-mode server: ServerIsNotTheLeaderException loses its leader-address hint (carried in exceptionArgs, line 643), so HA client leader-redirect stops working; and DuplicatedKeyException, RecordNotFoundException, ConcurrentModificationException, NeedRetryException, TransactionException, ... all degrade to opaque errors, so optimistic-concurrency retries and typed handling in client apps break.

  2. HA inter-node forwarding - RaftReplicatedDatabase.reconstructLeaderException() (ha-raft/.../RaftReplicatedDatabase.java:1832) parses the same exception/exceptionArgs/detail fields from the leader HTTP error body. With them stripped, exceptionClass == null, so it falls back to a generic TransactionException (line 1850). A duplicate-key conflict on a forwarded write in a production HA cluster would surface to the client as a bare TransactionException, losing the conflict semantics.

Production mode is precisely where HA clusters and remote drivers run, so this is a real regression rather than a corner case. Suggestions: keep exception (a bounded, controlled class name) and exceptionArgs (structured, non-sensitive: index name, keys, RID, leader address) in all modes, and only strip the free-form detail cause chain - that is where file paths / engine internals actually leak, and it satisfies the audit finding while preserving the driver/HA contract. Alternatively, distinguish trusted intra-cluster / driver requests (e.g. via the cluster token or a driver header) from anonymous external probes. Either way, please add coverage that exercises the remote driver and/or reconstructLeaderException against a production-mode server; the current tests only assert the raw body shape and do not catch this downstream breakage.

🟡 Minor

  • PostBeginHandler comment is slightly wrong (PostBeginHandler.java:58): "getString(name, default) ... never throws on a non-string value." It calls getElement(name).getAsString(), which does throw if isolationLevel is a JSON object/array. Fine for scalars (numbers stringify) and no worse than the old (String) requestMap.get(...) cast, but the comment overstates the guarantee.
  • help field dropped: buildErrorBody no longer emits the help key that error2json supported. It is always null at this call site today, so no behavior change, but the two builders have now diverged - worth a note or consolidating so a future help usage does not silently vanish.
  • Duplicate-key detail loss (subset of the blocking item): even for non-driver HTTP clients, concealing exceptionArgs in production removes which key conflicted from a 409 response, which is information clients legitimately act on.

✅ Looks good

  • Items 2, 3, 4 are correct and well-scoped. The 400-on-malformed-bookmark early return sits inside the try whose finally still runs cleanup, and parseReadBookmark is reached before setReadConsistencyContext, so no context is left dangling.
  • Removing System.gc() under memory pressure is the right call and the WARNING replacement is appropriate.
  • Cluster-token docs guidance is clear and useful.

Overall: great cleanup work - the main thing standing between this and a merge is reconciling the production-mode concealment (Item 1) with the driver/HA field contract.

Automated review by Claude Code

@claude

claude Bot commented Jul 7, 2026

Copy link
Copy Markdown

Review: PR #5058 - server audit low-severity tail

Nice, well-scoped hardening set. Each of the five items is independent, documented in docs/5037-...md, and backed by a focused test. Overall this is clean and I'd be comfortable merging after a look at the one behavioral trade-off below.

What looks good

  • Item 1 design is sound. The error top-level field is always a static constant ("Cannot execute command", "Record not found", ...), never e.getMessage(), so only the free-form detail cause chain can leak file paths - and that's exactly what's concealed in production. Good, targeted fix.
  • buildDetailChain cycle guard using Collections.newSetFromMap(new IdentityHashMap<>()) is the right call (identity, not equals), and the deep-cycle test (e -> a -> b -> a) covers the non-trivial case.
  • Item 2/3 correctly map state conflict -> 409 and malformed input -> 400; both helpers are package-private and unit-tested. parseReadBookmark wrapping NumberFormatException into a descriptive IllegalArgumentException and not echoing the raw hostile value back is the right instinct.
  • Item 4 removing System.gc() under memory pressure is a solid availability win; the rationale comment about HA election-timeout cascades is on point.

Main discussion point: production concealment degrades the remote-driver / HA exception contract

The PR states exception + exceptionArgs are preserved so the wire contract survives, and that's true - typed exceptions still reconstruct. But a couple of consumers also read detail, so in production mode their behavior changes:

  • RemoteHttpComponent.manageException parses the RID out of detail for RecordNotFoundException (detail.indexOf("#") ...). With detail concealed it falls back to "Unknown", so a remote Java driver against a production server gets RecordNotFoundException.getRID() == null. Handled gracefully (null fallback), but it is a behavior change for driver users.
  • Most other typed exceptions reconstruct with the message "Unknown" instead of the real detail. exceptionArgs-based ones (DuplicatedKeyException, ServerIsNotTheLeaderException) are unaffected since those args are preserved.
  • RaftReplicatedDatabase.reconstructLeaderException falls back detail -> error, so inter-node forwarded errors lose their detailed message when the leader runs in production mode. Functionally fine (typed + args preserved), message degraded.

This is a legitimate, conscious trade-off, but it's worth (a) calling out explicitly in the doc's "Impact" section that production servers behind the remote driver return null RIDs / generic messages for typed exceptions, and (b) ideally adding one IT that flips arcadedb.server.mode=production and asserts the round-trip through RemoteDatabase still reconstructs the typed exception. Right now AbstractServerHttpHandlerErrorBodyTest exercises buildErrorBody(false, ...) directly but nothing covers the isProductionMode() wiring or the production remote/HA reconstruction path end-to-end.

Minor / nits

  • exception (fully-qualified class name) is still emitted in production. That's a smaller info-disclosure surface than file paths and is required by the driver, so the trade-off is reasonable - just noting it so it's a deliberate choice on record.
  • Concealment only engages when an operator explicitly sets arcadedb.server.mode=production (default is development). A one-line reminder in the security guidance that the default mode is verbose would help operators.
  • isProductionMode(), getErrorLogLevel(), and getUserSevereErrorLogLevel() each re-read SERVER_MODE and string-compare on the error path. Negligible, but a single cached enum lookup would consolidate the three.
  • PostBeginHandler: a non-string isolationLevel (JSON object/array) reaches getAsString() and an unknown enum value reaches TRANSACTION_ISOLATION_LEVEL.valueOf(...), either of which could surface as a 500. This is pre-existing behavior (the old (String) cast had the same failure modes), so not a regression - flagging only in case you want to fold a 400 for bad isolationLevel into this same cleanup.
  • Issue5037BeginHandlerIT hardcodes port 2480 whereas HTTPTransactionIT uses 248 + serverIndex. Fine for the single-server BaseGraphServerTest, just inconsistent.

Compilation/style all consistent with the surrounding code (final params, imports resolved, Map import correctly removed from PostBeginHandler).

Great cleanup overall - the only thing I'd genuinely want before merge is the doc note + one production-mode round-trip test to lock in that the remote/HA contract still holds.

@claude

claude Bot commented Jul 7, 2026

Copy link
Copy Markdown

Review: server audit low-severity tail (PR 5058)

Reviewed all 11 files. A clean, well-scoped set of five independent hardening items with solid, targeted test coverage (unit tests for the pure helpers + ITs for the end-to-end wiring). The code matches the surrounding style, uses final consistently, imports classes rather than FQNs, and keeps allocations off the hot paths. Nice work. A few observations below, none blocking.

Item 1 - error-body info disclosure (AbstractServerHttpHandler)

  • The verbose split is a good design: concealing only the free-form detail cause chain while keeping the bounded exception class name and structured exceptionArgs for the driver/HA wire contract is the right call, and the Javadoc documenting why those two fields stay is excellent.
  • buildDetailChain with an identity-based IdentityHashMap visited-set is a strict improvement over the old current != current.getCause() && current != e guard (which only caught direct/self cycles). The deep-cycle test (e -> a -> b -> a) proves it.
  • Consideration (not a blocker): exceptionArgs for DuplicatedKeyException is indexName | keys | currentIndexedRID. In production this still returns the colliding key value and the existing records RID to the client. The key value is self-inflicted (the caller submitted it), but the RID of the pre-existing record is arguably data disclosure to a probe. Since it is genuinely needed for driver reconstruction, keeping it is defensible - but it may be worth a note in the audit doc that exceptionArgs is intentionally NOT concealed, so the "no leak in production" claim is understood to cover detail only.
  • Minor: error2json(...) is now used only by the snapshot-install 503 path (around line 106). Fine as-is (empty detail, null exception, so nothing leaks), just noting it is no longer the general error serializer.

Item 2 - begin status codes (PostBeginHandler)

  • 401 -> 409 for an already-started transaction is correct per RFC 9110, and making isolationLevel optional is a real usability fix.
  • Switching from payload.toMap() + (String) cast to getString("isolationLevel", null) is both cheaper and safer: a scalar now stringifies instead of throwing ClassCastException, and an invalid enum name surfaces as IllegalArgumentException -> 400 via TRANSACTION_ISOLATION_LEVEL.valueOf. A JSON object/array value still throws (500), same net behavior as before, so no regression.

Item 3 - bookmark header parsing (DatabaseAbstractHandler)

  • parseReadBookmark correctly turns a malformed client header into a 400 instead of a 500, and the raw value is deliberately not echoed back. Good unit coverage (null/blank/valid/Long.MAX_VALUE/malformed).
  • The early return new ExecutionResponse(400, ...) sits inside the try whose finally clears the read-consistency context and cleans the TL, so cleanup is preserved. One subtle note: because this is a returned (not thrown) response, a POST carrying an idempotency key would cache the 400 under that key. It is deterministic for identical input so harmless, but worth being aware of.

Item 4 - forced GC removal (ServerMonitor)

  • Removing System.gc() under memory pressure is the right move; the rationale comment (stop-the-world during pressure cascading into HA election timeouts) is helpful. The remaining WARNING log is appropriate. Confirmed no other live System.gc() calls remain in engine/server main.

Item 5 - HA_CLUSTER_TOKEN docs

  • Good hardening guidance. Consistent with the existing constantTimeEquals / forwarded-user auth path in AbstractServerHttpHandler.

Tests

  • Coverage is appropriate: pure helpers get fast unit tests, wiring gets ITs. The production-mode IT sets SERVER_MODE=production in setTestConfiguration(); confirmed BaseGraphServerTest.endTest() calls GlobalConfiguration.resetAll() in @AfterEach, so no static config leaks into sibling tests.

Overall: LGTM. The only thing I would genuinely consider addressing is clarifying (in the audit doc) that production concealment covers detail only and exceptionArgs is intentionally retained, so nobody later reads the fix as "all sensitive fields are stripped in production."

@claude

claude Bot commented Jul 7, 2026

Copy link
Copy Markdown

Code Review - PR #5058 (server audit low-severity tail)

Overall this is a clean, well-scoped, and unusually well-documented PR. The five items are genuinely independent, each has focused test coverage, and the accompanying docs/5037-*.md records the reasoning and trade-offs well. Reviewed against CLAUDE.md conventions and traced the runtime paths. None of the findings below are blocking.

Strengths

  • Item 1 (info disclosure): Good call to conceal only the free-form detail cause chain while keeping the bounded exception class name + structured exceptionArgs. I verified the wire-contract dependency in RemoteHttpComponent.manageException (network module, ~lines 623-677) and RaftReplicatedDatabase.reconstructLeaderException - stripping exceptionArgs would indeed break typed-exception and leader-redirect reconstruction. The identity-based cycle guard in buildDetailChain (Collections.newSetFromMap(new IdentityHashMap<>())) is the right fix and has a real cyclic-chain test.
  • Item 3: The early return new ExecutionResponse(400, ...) sits inside the try block, so the finally still clears the read-consistency ThreadLocal and rolls back - no resource leak. Not echoing the raw header value back is the correct anti-reflection choice.
  • Item 4: Removing System.gc() under memory pressure is a solid availability fix; the STW-cascade-into-HA-election rationale is sound.
  • Every generic top-level error string passed to sendErrorResponse is a static constant (verified all ~25 call sites), so the error field never leaks raw exception text even before concealment. Config is reset via GlobalConfiguration.resetAll() in BaseGraphServerTest teardown, so the production mode set by Issue5037ProductionErrorBodyIT won't leak into other tests.

Considerations (non-blocking)

  1. Item 1 - remote-driver message degradation in production (the main caveat). With production mode detail is absent, so RemoteHttpComponent.manageException falls back to "Unknown" for message-only typed exceptions (TransactionException, TimeoutException, SchemaException, ConcurrentModificationException, ...) and reconstructs RecordNotFoundException with a null RID. This affects legitimate remote Java clients' error handling/logging, not just attackers. It is documented as an accepted trade-off, so just a visibility note: consider surfacing it in the user-facing config/HA docs (not only the internal audit doc), since enabling production mode silently reduces client-side diagnosability.

  2. Item 2 - getString on a non-string isolationLevel. The comment claims a JSON object/array "would still be rejected." A nested object/array makes getElement(name).getAsString() throw and propagate as a 500, not a 400. A numeric scalar (e.g. {"isolationLevel": 5}) stringifies to "5" then fails TRANSACTION_ISOLATION_LEVEL.valueOf(...) -> also 500. Edge cases and pre-existing in spirit, so fine to leave; the comment is just slightly optimistic about the object/array path.

  3. Item 3 - no range check on the bookmark. parseReadBookmark("-5") returns -5 (only -1 is the sentinel), which then reaches setReadConsistencyContext. Almost certainly harmless (an always-satisfied index), but you could reject < -1 if you want strict validation. Optional.

  4. Minor: error2json(...) remains for the snapshot-installing path (~line 106) while sendErrorResponse now uses buildErrorBody. Two near-identical JSON-error builders now coexist - a candidate for future consolidation, not worth churning here.

Test coverage

Strong. Unit tests for buildErrorBody/buildDetailChain and parseReadBookmark (cyclic-chain + blank/malformed cases), plus end-to-end ITs for the 409/optional-isolation contract and the production-mode round-trip. The updated HTTPTransactionIT.beginWithPayloadWithoutIsolationLevelSucceeds correctly asserts the new 204 contract. One small gap: no test drives the malformed-bookmark path through the actual handler (only the helper is unit-tested) - a thin IT sending X-ArcadeDB-Read-After: abc would lock in the 500->400 fix end-to-end.

Nice work - the documentation-first approach makes the security trade-offs auditable, which is exactly right for this kind of change.

Reviewed by Claude (Opus 4.8)

@robfrank
robfrank merged commit be2d8ea into main Jul 7, 2026
24 of 31 checks passed
@robfrank
robfrank deleted the fix/5037-server-audit-low-severity-tail branch July 7, 2026 08:28
robfrank added a commit that referenced this pull request Aug 14, 2026
…es, forced GC, cluster-token docs) (#5058)

(cherry picked from commit be2d8ea)
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.

[server audit] Low-severity tail: error-response info disclosure, wrong HTTP status codes, forced System.gc, cluster-token guidance

1 participant