GeezerVison is showing github.com — fix(#10462): HA derives its cluster token from rootPasswordPath, and the StatefulSet mounts its own token by robfrank · Pull Request #10479 · ArcadeData/arcadedb
Conversation
robfrank
commented
Oct 20, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Closes #10462
Summary
An HA node with no explicit cluster token derives one from the root password, but ClusterTokenProvider only looked at arcadedb.server.rootPassword. A server that gets its root password from a file (arcadedb.server.rootPasswordPath, which the shipped StatefulSet uses so the password stays off the command line) has a root password but could not derive a token, so HA failed with Cannot start HA mode without authentication and the pod never became Ready.
This PR applies both fixes the issue suggests:
ClusterTokenProvider falls back to rootPasswordPath, with the same precedence as ServerSecurity.askForRootPassword() (inline password first, then the file). Both now read the file through one shared reader, the new public static ServerSecurity.readRootPasswordFile(String), which drops one trailing CR/LF with the existing, still package-private stripTrailingNewline. So the root user and the HA token get the very same password out of the same file, and a node given the password inline and a node reading it from a file derive the same token. If the file can't be read or is empty, it throws a ConfigurationException that names the path and keeps the cause. The "no root password" errors now list all four sources. initClusterTokenForTest uses the same resolver.
- The StatefulSet mounts its own cluster token: the header's
kubectl create secret now adds a clusterToken key (openssl rand -hex 32), the Secret volume projects it, and the server gets -Darcadedb.ha.clusterTokenPath=/etc/arcadedb/secrets/clusterToken. A separate high-entropy token stays secure when the root password is weak (the derived one uses a fixed public salt), and it can be rotated without touching the root password.
GlobalConfiguration.SERVER_ROOT_PASSWORD_PATH's description now says the HA token is derived from it.
Deployment note (release-note candidate): the manifest now needs the arcadedb-credentials Secret to have a clusterToken key. If a Secret was created only with rootPassword, Kubernetes will not mount the volume (couldn't find key clusterToken). The manifest header now includes the kubectl patch secret command that adds the key. The manifest as shipped never reached Ready in HA anyway, so no working deployment loses anything.
Finding ledger
| # |
Finding (from the issue) |
Status |
| 1 |
ClusterTokenProvider ignores rootPasswordPath; fall back to it with the same trailing-newline stripping as ServerSecurity |
Fixed here |
| 2 |
The StatefulSet sets arcadedb.ha.clusterTokenPath from its own Secret key; PackagingManifestsTest asserts that an HA manifest with no rootPassword names a token source |
Fixed here |
Completeness
Invariant: a server that has a root password, whether inline or from rootPasswordPath, can derive the HA cluster token, and every node derives the same token from the same password.
Sweep: grep -rn 'SERVER_ROOT_PASSWORD[^_]' --include='*.java' . | grep /src/main/
| Entry point |
Status |
ClusterTokenProvider.initClusterToken() (live path: RaftHAServer.start(), the frame in the issue's stack trace) |
Fixed here, tested |
ClusterTokenProvider.initClusterTokenForTest() |
Fixed here, tested |
ServerSecurity.askForRootPassword() |
Already honours the path; now goes through the shared readRootPasswordFile, tested directly in RootPasswordFromFileTest |
ArcadeDBServer security-audit log ("Root password: set via configuration") |
Not affected: it only warns about the inline form, and the file form is the recommended one |
MCPStdioServer.main() requires SERVER_ROOT_PASSWORD and ignores the path |
Same shape, different invariant: filed as #10478 |
| Shipped StatefulSet |
Fixed here, tested by PackagingManifestsTest |
Helm chart (ArcadeData/arcadedb-helm, separate repo) |
Not checked from here |
Coverage
ClusterTokenProvider.initClusterToken() and initClusterTokenForTest(): token from the root password file, the same token as inline, only the trailing CR/LF dropped, inline password beats the file, clusterTokenPath beats the file, unreadable or empty file errors, error message names the new settings
package/src/main/config/arcadedb-statefulset.yaml: names a token path, the path is mounted, the Secret item is projected, the documented kubectl create secret fills the key
Known gaps:
Test plan
-
ClusterTokenProviderTest: 8 new tests, 6 of them red before the fix, 18/18 green after
-
PackagingManifestsTest.statefulSetNamesAnHaClusterTokenSource: red before the manifest change, 27/27 green after
-
RootPasswordFromFileTest: 3 new tests for the shared readRootPasswordFile (CR/LF stripping, missing file, empty file), 9/9 green
- Related:
RootPasswordFromFileTest, SupportRedactorTest, Issue9554ClusterTokenRetainedAfterStopTest, RaftHAServer*Test all green
- Optional manual check: on kind, create the Secret as the header says,
kubectl apply with replicas: 1, and confirm the pod becomes 1/1 Ready
Adversarial pass
No subagent could be spawned in this run (this agent has no subagent tool), so this is the author's own review:
- Rotating the Secret's
rootPassword changes the derived token but not the root user's password, since the user is only created on first start. This is the same as with the inline password and is already covered by the existing "Changing root password does NOT rotate this token" production warning. The shipped manifest sidesteps it with an explicit clusterToken.
- A Secret created before this change has no
clusterToken key, so the pod fails to mount it (see the deployment note above). Kubernetes has no per-item optional flag, so this can't be made soft without dropping the dedicated token.
Review cycles
| Cycle |
Head |
Changes |
claude review outcome |
| 1 |
dd4e683456 |
Initial fix |
6 points: vacuous early return in the manifest test; duplicated file-read logic; empty-file symmetry; check-then-act; upgrade note; widened API surface |
| 2 |
722c92119e |
One shared ServerSecurity.readRootPasswordFile (no isReadable pre-check, stripTrailingNewline back to package-private); dropped the early return |
5 points: direct test for the shared reader; scope/Javadoc check; kubectl patch hint; rename valueOf; cosmetic comment |
| 3 |
7e35d2e03e |
Shared-reader tests in RootPasswordFromFileTest; kubectl patch secret hint in the manifest header; valueOf renamed to nonEmptyValue |
No blocking issues, "Looks good to merge once the description is corrected". The description is corrected in this edit |
Deferred / skipped items
Final state
clean-approval. Merge is the developer's call.
🤖 Generated with Claude Code
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
…sswordPath, and the StatefulSet mounts its own token
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
coderabbitai
Bot
commented
Oct 20, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|

Warning
Review limit reached
You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.
Next included review available in 35 minutes.
Check out review usage here.
View limit details
-
Limit details: You’ve used all 4 included reviews currently available.
Learn how review limits work.
Review configuration:
⚙️ Run configuration
-
- Configuration used: defaults
- Review profile: CHILL
- Plan: Advanced
- Run ID:
af400950-7f65-4b7e-8d37-762e7ea1df8b
📥 Commits
-
Reviewing files that changed from the base of the PR and between dd4e683 and 7e35d2e.
📒 Files selected for processing: 5
-
ha-raft/src/main/java/com/arcadedb/server/ha/raft/ClusterTokenProvider.java
package/src/main/config/arcadedb-statefulset.yaml
server/src/main/java/com/arcadedb/server/security/ServerSecurity.java
server/src/test/java/com/arcadedb/server/PackagingManifestsTest.java
server/src/test/java/com/arcadedb/server/security/RootPasswordFromFileTest.java
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
-
⚙️ Run configuration
-
- Configuration used: defaults
- Review profile: CHILL
- Plan: Advanced
- Run ID:
02602abb-f9fe-4ee7-87aa-abf31d7dff8b
📥 Commits
-
Reviewing files that changed from the base of the PR and between 66e6cad and dd4e683.
📒 Files selected for processing: 6
-
engine/src/main/java/com/arcadedb/GlobalConfiguration.java
ha-raft/src/main/java/com/arcadedb/server/ha/raft/ClusterTokenProvider.java
ha-raft/src/test/java/com/arcadedb/server/ha/raft/ClusterTokenProviderTest.java
package/src/main/config/arcadedb-statefulset.yaml
server/src/main/java/com/arcadedb/server/security/ServerSecurity.java
server/src/test/java/com/arcadedb/server/PackagingManifestsTest.java
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 0 remain after this review.
📝 Walkthrough
-
ClusterTokenProvider now derives HA cluster tokens from root-password files when an explicit token is not configured. The StatefulSet creates and mounts a shared cluster-token Secret file. Tests cover password-file handling and StatefulSet token configuration.
Changes: HA cluster token sources
| Layer / File(s) |
Summary |
Root-password file derivation engine/src/main/java/com/arcadedb/GlobalConfiguration.java, ha-raft/src/main/java/com/arcadedb/server/ha/raft/ClusterTokenProvider.java, server/src/main/java/com/arcadedb/server/security/ServerSecurity.java, ha-raft/src/test/java/com/arcadedb/server/ha/raft/ClusterTokenProviderTest.java |
ClusterTokenProvider resolves passwords from inline settings before password paths, with server-specific settings before global defaults. It strips one trailing newline from file contents and reports missing, unreadable, or empty values as configuration errors. Tests cover precedence, normalization, and token derivation. |
StatefulSet cluster-token Secret package/src/main/config/arcadedb-statefulset.yaml, server/src/test/java/com/arcadedb/server/PackagingManifestsTest.java |
The setup creates a clusterToken Secret entry. The StatefulSet mounts it and configures ArcadeDB to read it through arcadedb.ha.clusterTokenPath. The manifest test checks the Secret projection and HA configuration. |
Priority: ⚪ Pending latest changes
Estimated code review effort: 3 (Moderate) | ~20 minutes
Change: Bug fix · Severity of issue fixed: Medium
Sequence Diagram(s)
sequenceDiagram
participant SecretSetup as Secret setup command
participant KubernetesSecret as Kubernetes Secret
participant StatefulSet
participant ArcadeDBServer as ArcadeDB server
SecretSetup->>KubernetesSecret: Create clusterToken key
StatefulSet->>KubernetesSecret: Configure clusterToken projection
KubernetesSecret->>ArcadeDBServer: Expose mounted clusterToken file
ArcadeDBServer->>ArcadeDBServer: Read file via arcadedb.ha.clusterTokenPath
Loading
Suggested reviewers: lvca
Merge Risk: ⚪ Minimal · up to dd4e6
-
No actionable merge-blocking issue remains; the reported precedence and empty-password concerns do not affect the supported configuration path.
Pre-merge checks: 4 · 1
-
Failed checks: 1 warning
| Check name |
Status |
Explanation |
Resolution |
| Docstring Coverage |
 |
Docstring coverage is 38.89% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 18 functions across 5 files. (1 skipped: … |
Write docstrings for the functions missing them to satisfy the coverage threshold. |
Passed checks: 4 passed
-
| Check name |
Status |
Explanation |
| Title check |
 |
The title clearly summarizes both primary changes: root-password-path token derivation and StatefulSet token mounting. It is specific and related to the pull request. |
| Linked Issues check |
 |
Issue #10462 requires HA token derivation from rootPasswordPath with inline-password precedence and matching trailing-newline handling. ClusterTokenProvider resolves inline configuration before th… |
| Out of Scope Changes check |
 |
The changes stay within issue #10462. The GlobalConfiguration description, public ServerSecurity.stripTrailingNewline, resolver tests, manifest comments, and packaging assertions directly support … |
| Description check |
 |
The pull request description is detailed and covers the change, motivation, related issue, implementation notes, test coverage, known gaps, and deployment considerations. It does not use the exact tem… |
Full details: Linked Issues check
-
Explanation
Issue #10462 requires HA token derivation from rootPasswordPath with inline-password precedence and matching trailing-newline handling. ClusterTokenProvider resolves inline configuration before the password file and calls ServerSecurity.stripTrailingNewline; both runtime and test initialization use this resolver. It reports unreadable and empty files and lists the password-path setting. The StatefulSet mounts the clusterToken Secret item and sets -Darcadedb.ha.clusterTokenPath=/etc/arcadedb/secrets/clusterToken. ClusterTokenProviderTest and PackagingManifestsTest.statefulSetNamesAnHaClusterTokenSource cover these requirements.
Full details: Out of Scope Changes check
-
Explanation
The changes stay within issue #10462. The GlobalConfiguration description, public ServerSecurity.stripTrailingNewline, resolver tests, manifest comments, and packaging assertions directly support password-file token derivation or the StatefulSet token source. The PR does not require the separate MCP or Helm work identified in the issue context.
Full details: Description check
-
Explanation
The pull request description is detailed and covers the change, motivation, related issue, implementation notes, test coverage, known gaps, and deployment considerations. It does not use the exact template headings, and it does not confirm that mvn clean package was run, but it includes the required success and failure test coverage information.
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 38.89% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 18 functions across 5 files. (1 skipped: 1 unsupported.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
✨ Finishing Touches: 💡 1
-
📝 Generate docstrings: 💡
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
mergify
Bot
commented
Oct 20, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|
This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Review
Overall this is a clean, well-scoped fix. The fallback mirrors ServerSecurity.askForRootPassword() precedence, reuses stripTrailingNewline, and the tests cover the important invariants (file token equals inline token, newline handling, precedence, error paths).
Things worth considering
- Silent weakening in
PackagingManifestsTest.statefulSetNamesAnHaClusterTokenSource: the early return when the manifest has an inline -Darcadedb.server.rootPassword= makes the test pass vacuously. That is fine today, but a one-line comment, or assumeThat, would make the skipped branch visible in reports instead of looking like a pass.
- Duplicated file-read logic:
resolveRootPassword re-implements the readable/read/strip/empty checks that ServerSecurity.askForRootPassword() already has. Two copies can drift (for example, one later gains charset handling or a size cap). Consider extracting one shared helper in ServerSecurity that both call, rather than only exposing stripTrailingNewline.
- Empty-file behavior asymmetry: you throw on an empty password file here. Please confirm
askForRootPassword() treats an empty file the same way. If it only warns or falls through, a node could start with a root user but fail HA, which is a confusing split.
Files.isReadable then readString is a small check-then-act. It is harmless since IOException is also handled, so the pre-check could be dropped to simplify (the message is identical).
- Deployment note: requiring
clusterToken in the Secret is a breaking manifest change for anyone who already created the Secret. You documented it in the PR body, and it would also help to mention it in the release notes or docs, since the failure mode (couldn't find key clusterToken) is a stuck pod.
- Module coupling:
ha-raft now imports com.arcadedb.server.security.ServerSecurity. It looks to be within the existing server dependency, but making a package-private util public widens the API surface. A small note in its Javadoc that it is shared with HA would help.
Security: Reading from a mounted file keeps the secret off the command line, and the separate high-entropy token is a good call. Error messages name the path only, never the content. No concerns.
Performance: Startup-only path, no concerns.
Tests: Good coverage per CLAUDE.md (regression tests, assertThat style, @TempDir). No port or timing hazards.
Nice work, and thanks for filing #10478 for the MCP sibling.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Up to standards ✅
🟢 Issues 0 issues
Results:
0 new issues
View in Codacy
🟢 Metrics 0 complexity
| Metric |
Results |
| Complexity |
0 |
View in Codacy
🟢 Coverage 100.00% diff coverage · -4.93% coverage variation
| Metric |
Results |
| Coverage variation |
✅ -4.93% coverage variation |
| Diff coverage |
✅ 100.00% diff coverage |
View coverage diff in Codacy
Coverage variation details
|
Coverable lines |
Covered lines |
Coverage |
| Common ancestor commit (66e6cad) |
245062 |
212671 |
86.78% |
| Head commit (7e35d2e) |
277775 (+32713) |
227362 (+14691) |
81.85% (-4.93%) |
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 (#10479) |
26 |
26 |
100.00% |
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.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
…urity and HA, drop the vacuous manifest-test branch
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Review
Overall this is a clean, well-scoped fix. I read the diff only and did not run the tests.
What's good
- Extracting
ServerSecurity.readRootPasswordFile means root-user creation and token derivation read the file through one code path, so inline and file-based nodes derive the same token. The test that compares a trailing \r\n file against the inline value pins this down.
- The precedence is the same as
askForRootPassword() (inline, then file), and an explicit token path still wins. Both are tested.
- Errors name the path and the settings to change. The password is never logged.
- The StatefulSet keeps the token off the command line.
PackagingManifestsTest cross-checks the -D arg, the volume mount, the projected item and the documented kubectl create secret.
Points to consider
-
Behavior change in askForRootPassword. The old code called Files.isReadable first. The new code relies on Files.readString throwing IOException or InvalidPathException. The outcome is equivalent, and the exception now carries the cause, which is better. Two things to confirm:
ServerSecurityException is unchecked, since readRootPasswordFile declares no throws.
askForRootPassword still compiles cleanly, because it declares throws IOException but no longer throws one directly.
A small server-side test for readRootPasswordFile (missing file, empty file, \n and \r\n) would cover the shared helper directly. Today it is covered only indirectly through the ha-raft tests.
-
Cross-module coupling. ha-raft now calls a public static on ServerSecurity, and stripTrailingNewline is made public according to the PR description. Check that ha-raft has arcadedb-server on its classpath in provided scope, which is the project standard. Make sure the helper's Javadoc marks it as intended for internal use.
-
Upgrade path. The manifest now requires a clusterToken key in the Secret, otherwise the pod stays in ContainerCreating. The PR notes this. Consider also adding a one-liner in the manifest header for existing users, for example kubectl patch secret ... clusterToken.
-
Minor. valueOf falls back to the global default when the server config value is empty. That matches the old behavior, but the name is generic. getNonEmptyValue would be clearer.
-
Test comment. The comment in statefulSetNamesAnHaClusterTokenSource says "with no inline root password" while the assertion message says the same. The two could be merged, but this is cosmetic.
No security or performance concerns. Derivation runs once at startup. LGTM once the points above are checked.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
…atching an existing Secret, rename nonEmptyValue
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
|
Review of #10462 fix
Overall this is a clean, well-tested fix. I found no blocking issues.
What I checked
ClusterTokenProvider now resolves the root password in the same order as ServerSecurity.askForRootPassword(): inline value first, then rootPasswordPath. Both go through one shared reader, ServerSecurity.readRootPasswordFile, so a node given the password inline and a node reading it from a file derive the same token.
- The
ConfigurationException names the path and keeps the cause. The "no root password" messages now list all four sources.
- The StatefulSet change is consistent. The Secret item, the
-Darcadedb.ha.clusterTokenPath flag and the header instructions all agree, and PackagingManifestsTest checks each of them.
- The new tests cover the inline-over-file precedence, the trailing-newline handling, an unreadable file, an empty file, the error message content, and the
initClusterTokenForTest path. They use the preferred AssertJ style.
Minor points
- The PR description says
stripTrailingNewline is now public. The diff keeps it package-private and adds a new public readRootPasswordFile instead. The code is fine, so the description should be updated.
askForRootPassword used to check Files.isReadable and throw a ServerSecurityException with no cause. It now catches IOException and InvalidPathException and keeps the cause. That is better, but a directory path now fails with a different message. It is still a ServerSecurityException, so I don't expect callers to care.
nonEmptyValue falls back to the global value when the server's own configuration is empty. That matches the old behaviour. A one-line comment saying the fallback is intentional (for system properties) would help future readers.
- The new Secret key is a breaking change for existing deployments. You documented it with a
kubectl patch hint, which is good. Consider also mentioning it in the release notes or upgrade docs.
- The
clusterToken Secret key makes the derived-token path unused in the shipped manifest. That is fine, and the weak-password reasoning in the comments is sound. The rootPasswordPath fallback is still useful for other deployments.
Looks good to merge once the description is corrected.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
❌ Patch coverage is 88.46154% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.67%. Comparing base (66e6cad) to head (7e35d2e).
Additional details and impacted files
@@ Coverage Diff @@
## main #10479 +/- ##
============================================
- Coverage 78.67% 78.67% -0.01%
- Complexity 4729 4737 +8
============================================
Files 2279 2279
Lines 245062 245074 +12
Branches 53236 53237 +1
============================================
+ Hits 192798 192802 +4
- Misses 32432 32433 +1
- Partials 19832 19839 +7
☔ 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.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Oct 21, 2026
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|