Repository navigation
fix(#5037): server audit low-severity tail (info disclosure, HTTP codes, forced GC, cluster-token docs) - #5058
Conversation
…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>
|
Tick the box to add this pull request to the merge queue (same as
|
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 6 |
🟢 Coverage 89.74% diff coverage · -6.71% coverage variation
Metric Results Coverage variation ✅ -6.71% coverage variation Diff coverage ✅ 89.74% diff coverage 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.
There was a problem hiding this comment.
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.
| 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(); | ||
| } |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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.
| final String isolationLevel = payload != null ? (String) payload.toMap().get("isolationLevel") : null; | |
| final String isolationLevel = payload != null ? payload.optString("isolationLevel", null) : null; |
|
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, Must fix 1. Stray tool-call tags leaked into the committed docs file. Worth considering 2. 3. Item 3 has no test for the actual HTTP 400 mapping. 4. Verified good
Only the docs stray-tags item is blocking; the rest are optional polish. |
Codecov Report❌ Patch coverage is 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. 🚀 New features to boost your workflow:
|
…ring for isolationLevel, strip stray doc tags
|
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 🔴 Blocking - Item 1 breaks the remote driver and HA exception propagation in
Production mode is precisely where HA clusters and remote drivers run, so this is a real regression rather than a corner case. Suggestions: keep 🟡 Minor
✅ Looks good
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 |
…duction, conceal only cause chain
Review: PR #5058 - server audit low-severity tailNice, well-scoped hardening set. Each of the five items is independent, documented in What looks good
Main discussion point: production concealment degrades the remote-driver / HA exception contractThe PR states
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 Minor / nits
Compilation/style all consistent with the surrounding code (final params, imports resolved, 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. |
…tion-mode round-trip IT
|
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 Item 1 - error-body info disclosure (
Item 2 - begin status codes (
Item 3 - bookmark header parsing (
Item 4 - forced GC removal (
Item 5 - HA_CLUSTER_TOKEN docs
Tests
Overall: LGTM. The only thing I would genuinely consider addressing is clarifying (in the audit doc) that production concealment covers |
…s intentionally retained
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 Strengths
Considerations (non-blocking)
Test coverageStrong. Unit tests for 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) |
Closes #5037
Addresses the low-severity tail from the 2026-07
servermodule audit. Five small, independent hardening items:AbstractServerHttpHandlerno longer leaks internal exception class names and cause-chaindetailinproductionmode. A new package-privatebuildErrorBody(verbose, ...)returns a genericerrormessage plus arequestIdcorrelation id in production, whiledevelopment/testkeep the verbose body for debugging.POST /beginreturns409 Conflict(not401) when a transaction is already started for the session, andisolationLevelis now optional (a payload without it begins with the default isolation instead of failing with400).X-ArcadeDB-Read-After/ legacyX-ArcadeDB-Commit-Indexheader now returns400instead of a500, via a new validatedparseReadBookmarkhelper.System.gc()call inServerMonitorunder memory pressure; the critical condition is logged and heap management is left to the JVM collector.HA_CLUSTER_TOKENconfiguration 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 throwsIllegalArgumentException.Issue5037BeginHandlerIT- second/beginon same session -> 409;/beginwith empty JSON body -> 204.HTTPTransactionIT.beginWithPayloadWithoutIsolationLevelSucceeds- updated to assert the new optional-isolationLevelcontract (204).Issue3155NestedExceptionErrorIT,Issue4350DuplicatedKeyHttpStatusIT,AutoCommitParameterTest,ClusterInternalAuthTest,ErrorResponseNestedExceptionTestall pass (29 tests green).🤖 Generated with Claude Code