Skip to content

fix(#6380, #6381): stale bucket-selection total after bucket removal, and restore's unrevalidated HTTP redirects - #6449

Merged
lvca merged 4 commits into
mainfrom
issue-6380-6381
Aug 19, 2026
Merged

lvca merged 4 commits into
mainfrom
issue-6380-6381

Conversation

@lvca

@lvca lvca commented Aug 19, 2026

Copy link
Copy Markdown
Member

Summary

  • removeBucketInternal leaves the bucket-selection strategy's total stale: IndexOutOfBounds on insert after ALTER TYPE ... BUCKET -b #6380 - LocalDocumentType.removeBucketInternal shrank the bucket list but never re-bound the bucket-selection strategy, so a round-robin (or thread, or partitioned) strategy kept its pre-removal bucket count and could hand out an index one past the new last bucket, throwing IndexOutOfBoundsException on an ordinary insert after ALTER TYPE ... BUCKET -b. Fixed by calling bucketSelectionStrategy.setType(this) at the end of removeBucketInternal, symmetric to the existing call in addBucketInternal.
  • restore database follows HTTP redirects with no per-hop revalidation (SSRF); import's SafeHttpFetcher fix not applied to restore #6381 - restore database's HTTP(S) input path used a bare HttpURLConnection, which follows same-protocol 3xx redirects itself with no revalidation of the redirect target. The server's one-shot pre-check only validates the original hostname before handing the URL to restore, so a redirect (or DNS rebinding) to a blocked address bypassed it - the class of SSRF bypass IMPORT DATABASE was already hardened against. openInputFile() now routes through the shared SafeHttpFetcher, which re-validates scheme and address on every hop, gated by the existing SERVER_RESTORE_IMPORT_ALLOW_LOCAL_URLS setting.

Test plan

  • Issue6380RemoveBucketStrategyRefreshTest: new regression test - fails with IndexOutOfBoundsException against the pre-fix code, passes after the fix.
  • Issue6381RestoreSsrfTest: new regression test - proves restore refuses a local/blocked address by default and follows a redirect only when the operator explicitly opts in via SERVER_RESTORE_IMPORT_ALLOW_LOCAL_URLS.
  • Full engine and integration module test suites run green (mvn -o -pl integration -am test -DexcludedGroups=benchmark,slow,vector): 588+ tests, 0 failures.
  • Targeted com.arcadedb.schema.*Test run (436 tests) green.

🔗 Closes #6380, closes #6381

…BUCKET -b, and restore database following unrevalidated HTTP redirects

#6380 - LocalDocumentType.removeBucketInternal shrank the bucket list but never
re-bound the type's bucket-selection strategy, so a round-robin (or thread, or
partitioned) strategy kept handing out indexes sized to the pre-removal bucket
count. The very next index at the old boundary landed on buckets.get(index) for
an index that no longer existed, throwing IndexOutOfBoundsException on an
otherwise ordinary insert. addBucketInternal already rebinds after growing the
list; removeBucketInternal now does the same after shrinking it.

#6381 - restore database opened its HTTP(S) input with a bare
HttpURLConnection, which follows same-protocol 3xx redirects on its own with no
revalidation of the redirect target. The server's one-shot pre-check
(PostServerCommandHandler.validateClientRestoreImportUrl) only resolves and
checks the original hostname before handing the raw URL to restore, so a
public-looking host that redirects to a private or link-local address walked
straight past it - the same class of bypass IMPORT DATABASE was hardened
against. openInputFile() now opens the connection through SafeHttpFetcher, the
shared fetcher that re-validates scheme and address on every hop and is gated
by the same SERVER_RESTORE_IMPORT_ALLOW_LOCAL_URLS setting the pre-check uses.
@lvca lvca added this to the 26.9.1 milestone Aug 19, 2026
@lvca lvca self-assigned this Aug 19, 2026
@mergify

mergify Bot commented Aug 19, 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 Aug 19, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity

Metric Results
Complexity 0

View in Codacy

🟢 Coverage 92.31% diff coverage · -6.53% coverage variation

Metric Results
Coverage variation ✅ -6.53% coverage variation
Diff coverage ✅ 92.31% diff coverage

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (1dd19de) 162935 129963 79.76%
Head commit (7993a29) 195329 (+32394) 143046 (+13083) 73.23% (-6.53%)

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 (#6449) 13 12 92.31%

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.

@claude

claude Bot commented Aug 19, 2026

Copy link
Copy Markdown

Review

Both fixes are narrowly scoped, well-reasoned, and each ships a regression test that fails on pre-fix code. Nice work.

#6380 - stale bucket-selection strategy after ALTER TYPE ... BUCKET -b

  • removeBucketInternal now mirrors addBucketInternal by calling bucketSelectionStrategy.setType(this) after shrinking buckets. I traced the bug through RoundRobinBucketSelectionStrategy/ThreadBucketSelectionStrategy: both cache total = type.getBuckets(false).size() and index with it, so a stale (larger) total after a bucket removal really can hand back an index one past the shrunk list -> IndexOutOfBoundsException. The fix is correct and placed at the same point in the method as the sibling logic that maintains polymorphic caches.
  • PartitionedBucketSelectionStrategy.setType() is a pure rebind (per its own javadoc: "must never throw"), so calling it unconditionally on every removal is safe even for a partitioned type - good, since removeBucketInternal already sets needsRepartition a few lines above when appropriate.
  • Regression test (Issue6380RemoveBucketStrategyRefreshTest) walks through the exact round-robin cursor math (-1 -> 0 -> 1 -> 2) that trips the stale bound; the reasoning in the comment matches the actual RoundRobinBucketSelectionStrategy.getBucketIdByRecord implementation. Good, targeted test.
  • Coverage note (minor): the test only exercises the default round-robin strategy. Since total is a field on the shared base class ThreadBucketSelectionStrategy, the fix structurally covers thread/partitioned strategies too, so I don't think an additional test is required - just flagging that the explicit coverage is round-robin only.

#6381 - restore's unrevalidated HTTP(S) redirects (SSRF)

  • openInputFile() now routes through SafeHttpFetcher.open(...), the exact pattern ImportSecurityValidator.openRemoteConnection already uses for IMPORT DATABASE (down to the blocked predicate shape: address -> !allowLocalUrls && RESERVED_ADDRESSES.isBlocked(address)). This closes the real gap described in the PR: PostServerCommandHandler.validateClientRestoreImportUrl only validates the original host once, before handing the URL to a plain HttpURLConnection that follows same-protocol redirects on its own with no revalidation.
  • SafeHttpFetcher re-validates scheme + every resolved address on each hop and pins DNS resolution for the connection window (PinnedDnsResolution), closing the TOCTOU/rebinding gap too - consistent with how it's already used elsewhere.
  • Gating on SERVER_RESTORE_IMPORT_ALLOW_LOCAL_URLS reuses the same config the existing pre-check in PostServerCommandHandler uses, so the two layers agree on the opt-out. Defense-in-depth: the fetch-time check is now the actual guard regardless of caller (e.g. a direct/CLI invocation of FullRestoreFormat that never goes through PostServerCommandHandler), which is the right place for it.
  • RESERVED_ADDRESSES is a static final referencing IPAddressBlocklist.defaultReservedRanges(), which is documented to hand back one shared parsed instance - so despite three call sites each holding their own reference (FullRestoreFormat, ImportSecurityValidator, PostServerCommandHandler), there's no per-caller duplication of the actual CIDR list, matching the comment's intent.
  • Test (Issue6381RestoreSsrfTest) correctly avoids re-testing SafeHttpFetcher's own redirect-chain behavior (already covered by SafeHttpFetcherTest, per the class javadoc) and instead proves the restore-specific wiring end to end: blocked-by-default, and the opt-in flag genuinely follows a redirect. Good scoping.
  • Minor/pre-existing, not introduced by this PR: openInputFile() never calls connection.disconnect() on the HttpURLConnection SafeHttpFetcher.open returns - same as the code before this change. Relies on the consumer closing the returned InputStream. Not a regression, just noting it wasn't addressed while the method was touched.

General

  • No new dependencies, no System.out left behind, final used consistently, no fully-qualified names introduced.
  • Both changes are minimal and match the surrounding code's existing patterns rather than introducing new abstractions - appropriate for a targeted bug/security fix.
  • I did not run the test suite in this environment (no mvn execution available here), so I've verified correctness by static tracing through RoundRobinBucketSelectionStrategy/ThreadBucketSelectionStrategy and SafeHttpFetcher/IPAddressBlocklist rather than by executing Issue6380RemoveBucketStrategyRefreshTest/Issue6381RestoreSsrfTest. Per the PR description these were run locally (588+ tests green), which lines up with what I traced.

No blocking issues found.

Codacy's PMD flagged RESERVED_ADDRESSES declared after the private
RestoreCallback interface. Moved above it, matching the class's other
field-then-nested-type ordering.
@claude

claude Bot commented Aug 19, 2026

Copy link
Copy Markdown

Review

Both fixes are targeted, well-reasoned, and each ships a regression test that reproduces the original bug and fails against pre-fix code. Nice use of the shared SafeHttpFetcher/IPAddressBlocklist infrastructure instead of duplicating SSRF logic (the GHSA-67m7-7w7g-mpmh lesson clearly informed this).

#6380 — stale bucket-selection strategy after ALTER TYPE ... BUCKET -b

bucketSelectionStrategy.setType(this) at the end of removeBucketInternal (LocalDocumentType.java:1739) is exactly symmetric to the existing call in addBucketInternal, and RoundRobinBucketSelectionStrategy.setType already resets current when it's >= total, so no follow-up change was needed there. Issue6380RemoveBucketStrategyRefreshTest reproduces the IndexOutOfBoundsException cleanly. Looks correct.

#6381 — restore's unrevalidated HTTP redirects

Routing openInputFile() through SafeHttpFetcher.open() closes the same redirect-revalidation gap that was already fixed for IMPORT DATABASE (ImportSecurityValidator.openRemoteConnection), and the predicate/context wiring mirrors that call site closely. Issue6381RestoreSsrfTest is a good regression test — spinning up a real loopback HttpServer with an actual redirect hop is more convincing than mocking the connection.

One thing worth a look before merge: the two enforcement points for SERVER_RESTORE_IMPORT_ALLOW_LOCAL_URLS read from different configuration sources, and now that this PR adds a second enforcement point, that divergence is live:

  • PostServerCommandHandler.validateClientRestoreImportUrl (the pre-check) reads httpServer.getServer().getConfiguration().getValueAsBoolean(...) — a per-server-instance ContextConfiguration.
  • FullRestoreFormat.openInputFile() (the actual fetch, this PR) reads GlobalConfiguration.SERVER_RESTORE_IMPORT_ALLOW_LOCAL_URLS.getValueAsBoolean() directly — the static, JVM-wide value.

ContextConfiguration.getValue() only falls back to the global static value when the key isn't present in its own map, so these two agree as long as the setting is only ever set via a system property/env var. But if an operator enables it through the server's own config map (e.g. a settings map/JSON passed at server construction, without also setting the JVM property), the handler's pre-check would let the request through while FullRestoreFormat would still throw SecurityException on the same request. That's fail-closed, not an SSRF hole, but it silently breaks the documented opt-out for that configuration path and could be confusing to debug. Given FullRestoreFormat has no server object to consult (it can run from the CLI with no server at all — same reasoning as the existing resolveThreads() comment), the more robust fix is probably on the handler side: have validateClientRestoreImportUrl's pre-check read the same static GlobalConfiguration value FullRestoreFormat does, rather than the other way around. Not a blocker, but worth a one-line note or follow-up issue.

Minor: the field-before-nested-type reorder in the second commit is a good catch of the PMD complaint and doesn't affect behavior.

Test coverage

Both new tests are focused, regression-shaped, and appear to directly validate the fix rather than incidental behavior. I wasn't able to execute mvn in this review sandbox to confirm a green run, so please make sure CI passes, but the PR description already reports the full engine/integration suites and targeted schema tests green locally.

…server's own configuration

The claude-review round on this PR pointed out that the fetch-time check added for
#6381 (FullRestoreFormat.openInputFile) reads the static, JVM-wide
GlobalConfiguration value, while the server's pre-check
(PostServerCommandHandler.validateClientRestoreImportUrl) reads the setting from
its own per-instance ContextConfiguration. An operator who enables
SERVER_RESTORE_IMPORT_ALLOW_LOCAL_URLS only on that server's own configuration
(the mechanism the existing tests already exercise) would have the pre-check
accept a restore that the fetch then refused anyway - fail-closed, not an SSRF
hole, but a silent break of the documented opt-out.

Restore has no server object to consult on its own: it is invoked reflectively
from PostServerCommandHandler, but also runs standalone from the CLI with no
server at all. So rather than making FullRestoreFormat guess at a server
context, the caller that already resolved the setting threads its answer
through explicitly: RestoreSettings gains a nullable allowLocalUrls override,
Restore.setAllowLocalUrls(boolean) sets it (mirroring the existing setLogger/
setRestoreThreads reflective setters), and the handler calls it with the exact
boolean its own pre-check already used. A CLI/embedded caller that never sets
it keeps falling back to the static default, unchanged.
@claude

claude Bot commented Aug 19, 2026

Copy link
Copy Markdown

Review

Reviewed the two fixes and their regression tests. Both are correct, minimal, and well-targeted.

#6380 - stale bucket-selection strategy after ALTER TYPE ... BUCKET -b

removeBucketInternal now calls bucketSelectionStrategy.setType(this) right after the bucket list is shrunk, mirroring the existing call at the end of addBucketInternal (LocalDocumentType.java:1473). I checked RoundRobinBucketSelectionStrategy.setType: it recomputes total from the current bucket count and only resets current when it's out of range, so the call is cheap and idempotent, and the ordering relative to the super-type polymorphic cache update and the index-drop step is consistent with the add path. PartitionedBucketSelectionStrategy inherits the same method, so the fix covers round-robin, thread, and partitioned strategies uniformly.

The regression test (Issue6380RemoveBucketStrategyRefreshTest) reproduces the bug precisely: 3 buckets, remove the last one, then drive 6 inserts through round-robin. Before the fix, total stays at 3 and the third insert lands on the stale index 2, throwing IndexOutOfBoundsException - the test's inline comment walks through this correctly.

One minor nit: the fix and its regression test both live only in engine, but PartitionedBucketSelectionStrategy and ThreadBucketSelectionStrategy aren't separately exercised by a regression test - not required (the shared setType code path makes a round-robin test a reasonable proxy), just noting it as a gap if you want extra confidence later.

#6381 - restore's unrevalidated HTTP redirects (SSRF)

Routing FullRestoreFormat.openInputFile() through SafeHttpFetcher.open() closes the redirect-revalidation and DNS-rebinding gaps the same way ImportSecurityValidator already does for IMPORT DATABASE. The shared IPAddressBlocklist.defaultReservedRanges() singleton is reused rather than re-implemented, avoiding a second copy of the reserved-range logic to keep in sync (per the GHSA-67m7-7w7g-mpmh note in the comment).

The follow-up commit (cdc51e6) closes a real gap that the first commit's approach would have left: the fetch-time check originally read the static GlobalConfiguration value directly, while the server's pre-check (validateClientRestoreImportUrl) reads from its own per-instance ContextConfiguration. Threading the resolved boolean through RestoreSettings.allowLocalUrls -> Restore.setAllowLocalUrls -> PostServerCommandHandler (both the SSE and synchronous restore paths call setAllowLocalUrls before restoreDatabase) makes the two checks agree on the same server instance, while a CLI/embedded caller with no server context still falls back to the static default. Good catch, and good that it was caught before merge rather than after.

restoreBackup's file:// URL path is untouched by this change and correctly bypasses openInputFile's http(s) branch entirely, so no behavior change there - it's still server-resolved and not attacker-controlled.

Test coverage (Issue6381RestoreSsrfTest) is thorough: default-blocks-loopback, follows-redirect-when-explicitly-allowed, and the explicit-override-takes-priority-over-static-default case that specifically exercises the second commit's fix. Nice touch letting SafeHttpFetcherTest own the exhaustive redirect-chain/blocked-scheme/loop coverage and keeping these tests focused on the restore-specific wiring.

Minor observations (non-blocking)

  • The all-caps inline comments (e.g. LocalDocumentType.java:1737-1738, FullRestoreFormat.java:47-48,221-229) are a lot louder than the surrounding code's comment style, which is normal sentence case. Not wrong, just inconsistent - might be worth normalizing case if you're touching these files again.
  • FullRestoreFormat's RESERVED_ADDRESSES field is a separate instance from ImportSecurityValidator's and PostServerCommandHandler's (same factory method, three call sites), which is fine since IPAddressBlocklist is immutable/stateless and defaultReservedRanges() already hands back a shared singleton internally - just flagging that "SHARED WITH" in the comment means "same shared singleton via the factory," not "same field reference," in case a future reader misreads it as the latter.

Overall: solid, narrowly-scoped fixes with good regression tests for both. Compilation of the affected modules wasn't run in this review pass (sandboxed environment), so please confirm CI is green before merging, but nothing in the diff looks like it would fail to compile or break existing tests.

…cked local restore fetch

The integration-tests CI lane failed on
Issue6086ParallelRestoreIT.anArchiveReadOverHttpFallsBackToTheSequentialWalk after
the #6381 fix: the test restores from its own loopback HttpServer, and
SERVER_RESTORE_IMPORT_ALLOW_LOCAL_URLS now defaults to false, so the fetch
correctly refused to reach 127.0.0.1 - exactly the new protection working as
intended, just against test infrastructure rather than an attacker. The test
now opts in the same way a trusting operator would, mirroring
Issue6381RestoreSsrfTest's own use of the same flag.
@claude

claude Bot commented Aug 19, 2026

Copy link
Copy Markdown

Review of #6449

Reviewed both fixes end-to-end (bucket-strategy staleness + restore SSRF), including the follow-up commits that tightened them. Solid work overall - the fixes are minimal, symmetric with existing patterns, and each is backed by a regression test that actually reproduces the pre-fix failure.

#6380 - stale bucket-selection strategy after ALTER TYPE ... BUCKET -b

  • LocalDocumentType.removeBucketInternal now calls bucketSelectionStrategy.setType(this) after shrinking buckets, mirroring addBucketInternal. Traced through RoundRobinBucketSelectionStrategy.setType/getBucketIdByRecord: before the fix, total stays at the pre-removal count while current is untouched, so round-robin can hand back an index the shrunk buckets list no longer has - exactly the IndexOutOfBoundsException described. The fix's placement (after the list mutation, before the index-drop step) is correct and consistent with addBucketInternal's ordering.
  • Issue6380RemoveBucketStrategyRefreshTest reproduces this precisely: 3 buckets, remove last, 6 inserts. I walked through the round-robin arithmetic by hand and confirmed it throws pre-fix on the 3rd insert and cycles correctly post-fix. Good, tight regression test.
  • Minor: this only rebinds the strategy configured directly on the type. ThreadBucketSelectionStrategy (parent of round-robin) and PartitionedBucketSelectionStrategy also cache bucket-derived state (total, modulus) - worth double-checking (or a follow-up test) that a thread-based or partitioned strategy on a type that loses a bucket doesn't have similar residual staleness in any per-thread caches, since setType only updates the shared total. If that's already covered elsewhere, feel free to disregard.

#6381 - restore's unrevalidated HTTP redirects (SSRF)

  • Routing FullRestoreFormat.openInputFile() through the existing SafeHttpFetcher (already used elsewhere, e.g. IMPORT DATABASE) instead of a bare HttpURLConnection is the right fix and good reuse of a shared, well-documented component rather than a new one-off implementation - matches the project's "reuse existing components" guidance.
  • RESERVED_ADDRESSES = IPAddressBlocklist.defaultReservedRanges() reuses the same singleton blocklist as PostServerCommandHandler and the import path, avoiding the duplicated-logic root cause called out for GHSA-67m7-7w7g-mpmh. Good attention to that history.
  • The third commit's fix (threading allowLocalUrls explicitly from PostServerCommandHandler's per-instance ContextConfiguration through Restore.setAllowLocalUrls to RestoreSettings.allowLocalUrls, rather than letting the fetch fall back to the static GlobalConfiguration default) closes a real gap: without it, a server with a per-instance override would have its pre-check accept a URL the fetch then silently refused. Nice catch, and the nullable-Boolean-with-explicit-override design is clean.
  • Both performRestore call sites (SSE and synchronous) now invoke setAllowLocalUrls before restoreDatabase, so the two paths stay consistent.
  • Issue6381RestoreSsrfTest covers: default-blocked loopback, explicit opt-in following a redirect, and the settings-override-beats-static-default case in both directions. Good breadth, and it deliberately doesn't re-test generic redirect-chain behavior already covered by SafeHttpFetcherTest.
  • The 4th commit fixing Issue6086ParallelRestoreIT to opt in to SERVER_RESTORE_IMPORT_ALLOW_LOCAL_URLS is the correct fix for that failure (the test's own loopback server is now correctly blocked by default) rather than weakening the new protection.

Minor / non-blocking notes

  • Issue6086ParallelRestoreIT and Issue6381RestoreSsrfTest both flip the static GlobalConfiguration.SERVER_RESTORE_IMPORT_ALLOW_LOCAL_URLS and reset it in finally/@AfterEach. That's consistent with existing conventions elsewhere in the suite, but as with any static/global JVM setting it's only test-isolation-safe if these integration tests don't run concurrently with other tests reading the same key - worth a quick sanity check if the integration module's Surefire/Failsafe config ever parallelizes classes.
  • FullRestoreFormat's old connection.setDoOutput(true) was dropped along with the manual connection setup - correct, since it's a GET and SafeHttpFetcher.open doesn't set it either.
  • Field/nested-type reordering in commit 2 (RESERVED_ADDRESSES before the RestoreCallback interface) is a good, low-risk response to the PMD flag.

Compilation / test verification

I wasn't able to run mvn compile/mvn verify in this environment (sandboxed, requires interactive approval I didn't have), so I reviewed the diff and cross-referenced the actual RoundRobinBucketSelectionStrategy, SafeHttpFetcher, IPAddressBlocklist, and GlobalConfiguration sources by hand rather than relying on a build. Everything traced through consistently, but please treat the "compiles and tests pass" claim in the PR description as the authoritative verification rather than this review.

Nice, well-scoped PR - two independent, well-isolated bug fixes with real regression tests and good reuse of existing security infrastructure.

@codecov

codecov Bot commented Aug 19, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 84.61538% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.06%. Comparing base (1dd19de) to head (7993a29).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
.../integration/restore/format/FullRestoreFormat.java 83.33% 0 Missing and 1 partial ⚠️
.../server/http/handler/PostServerCommandHandler.java 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6449      +/-   ##
==========================================
+ Coverage   71.04%   71.06%   +0.01%     
==========================================
  Files        1861     1861              
  Lines      162935   162942       +7     
  Branches    34390    34391       +1     
==========================================
+ Hits       115764   115798      +34     
+ Misses      33012    32981      -31     
- Partials    14159    14163       +4     

☔ 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.

@lvca
lvca merged commit 55b9c93 into main Aug 19, 2026
48 of 49 checks passed
@lvca
lvca deleted the issue-6380-6381 branch August 19, 2026 16:31
oc007us pushed a commit to oc007us/arcadedb-grpc that referenced this pull request Aug 20, 2026
…isagreed on the local-URL policy

PostServerCommandHandler's 'import database' pre-check validated the URL against
SERVER_RESTORE_IMPORT_ALLOW_LOCAL_URLS (read from this server's own configuration), while the
actual fetch deep inside SourceDiscovery re-derived its own answer from the different, static-only
SERVER_SECURITY_IMPORT_BLOCK_LOCAL_NETWORKS. An operator enabling the documented opt-out on their
server's own configuration therefore got past the pre-check, only to have the fetch refuse the same
URL anyway - both fail closed today, so not an active bypass, but exactly the same class of
divergence already fixed for 'restore database' in ArcadeData#6381/ArcadeData#6449.

Threads the pre-check's resolved boolean explicitly into the importer, mirroring the restore-side
fix: Importer.setAllowLocalUrls() for the SSE path (same reflective call restore already makes),
and the SQL command's per-call ContextConfiguration for the synchronous fallback, which goes through
ImportDatabaseStatement instead of constructing Importer directly. The override is deliberately not
exposed through IMPORT DATABASE's own 'WITH ...' settings syntax, so a client cannot self-authorize
past the SSRF guard from SQL text alone.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant