Skip to content

Fail fast on multitenant object store without shared kind#866

Merged
Schmarvinius merged 3 commits into
mainfrom
fix/oss-fail-fast-multitenancy-not-shared
Jul 21, 2026
Merged

Fail fast on multitenant object store without shared kind#866
Schmarvinius merged 3 commits into
mainfrom
fix/oss-fail-fast-multitenancy-not-shared

Conversation

@Schmarvinius

Copy link
Copy Markdown
Contributor

Issue

The OSS attachments handler only prefixes object keys with the tenant ID when cds.attachments.objectStore.kind is shared. If multitenancy is enabled with any other value (or none), buildObjectKey returns the raw contentId, so all tenants share a single unprefixed keyspace with no isolation. Separate per-tenant object stores are documented as not yet supported.

A misconfiguration (multitenancy on, kind not set to shared) therefore silently results in no tenant isolation in the bucket.

Fix

The OSS Registration now fails fast: when multitenancy is enabled and the object store kind is not shared, startup throws a ServiceException with a message pointing to cds.attachments.objectStore.kind: shared, instead of registering a handler that provides no isolation.

Tests

RegistrationTest updated: enabling multitenancy with a non-shared or unset kind now expects a ServiceException and no handler registration (previously these tests documented the insecure silent-fallback).

In multitenant deployments the OSS handler only prefixes object keys with
the tenant ID when the object store kind is 'shared'. With any other (or
no) kind, keys are unprefixed and tenants share a single keyspace with no
isolation, while separate per-tenant stores are not yet supported.

The OSS registration now refuses to start when multitenancy is enabled
and the object store kind is not 'shared', instead of silently
registering a handler that provides no tenant isolation.
Updates RegistrationTest so that enabling multitenancy with a non-shared
or unset object store kind now expects a ServiceException and no handler
registration, replacing the previous assertions that documented the
insecure silent-fallback behavior.
@Schmarvinius
Schmarvinius requested a review from a team as a code owner July 21, 2026 10:35
@hyperspace-pr-bot

Copy link
Copy Markdown
Contributor

Summary

The following content is AI-generated and provides a summary of the pull request:


Fail Fast on Multitenant Object Store Without Shared Kind

Bug Fix

🐛 Closes a silent security misconfiguration: when multitenancy is enabled but cds.attachments.objectStore.kind is not set to shared, object keys were not prefixed with the tenant ID, causing all tenants to share the same unprefixed keyspace in the bucket with no isolation. Instead of silently registering an insecure handler, the OSS Registration now throws a ServiceException at startup, forcing operators to explicitly configure a shared object store.

Changes

  • Registration.java: Added a fail-fast guard in eventHandlers(...) — if multitenancy is enabled and the object store kind is not "shared", a ServiceException is thrown immediately with a clear message directing users to set cds.attachments.objectStore.kind: shared. This prevents any handler from being registered in an insecure configuration.

  • RegistrationTest.java: Updated tests to reflect the new behavior:

    • testMtEnabledNonSharedKindRegistersOnlyOSSHandler → renamed to testMtEnabledNonSharedKindFailsStartup, now asserts a ServiceException is thrown and no handlers are registered.
    • testMtEnabledNullKindRegistersOnlyOSSHandler → renamed to testMtEnabledNullKindFailsStartup, same updated assertions.
    • Added assertThatThrownBy assertions checking for ServiceException with a message containing "shared" in both misconfiguration scenarios.

  • 🔄 Regenerate and Update Summary
  • ✏️ Insert as PR Description (deletes this comment)
  • 🗑️ Delete comment
PR Bot Information

Version: 1.28.2

  • Event Trigger: pull_request.opened
  • Summary Prompt: Default Prompt
  • Correlation ID: e45c2410-84ef-11f1-8a5b-8e98efce6618
  • File Content Strategy: Full file content
  • LLM: anthropic--claude-4.6-sonnet
  • Output Template: Default Template

@hyperspace-pr-bot hyperspace-pr-bot 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.

The PR correctly implements a fail-fast security guard against misconfigured multitenant setups, with well-updated tests. Two minor issues were flagged: the ServiceException should carry an explicit ErrorStatuses.BAD_REQUEST status to match the project convention and avoid a misleading 500, and the null-kind test should explicitly stub the objectStore.kind property to null for clarity rather than relying on Mockito's default unstubbed return.

PR Bot Information

Version: 1.28.2

  • Event Trigger: pull_request.opened
  • Correlation ID: e45c2410-84ef-11f1-8a5b-8e98efce6618
  • Agent Instructions:
  • File Content Strategy: Full file content
  • LLM: anthropic--claude-4.6-sonnet

@lisajulia lisajulia 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.

Thanks!

@Schmarvinius
Schmarvinius merged commit 694bbcd into main Jul 21, 2026
38 of 39 checks passed
@Schmarvinius
Schmarvinius deleted the fix/oss-fail-fast-multitenancy-not-shared branch July 21, 2026 12:19
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.

2 participants