Skip to content

feat(multi-tenancy): differentiate tenant-scoped user creation (#7613) - #7637

Open
Gaetan Santucci (GaetanSantucci) wants to merge 3 commits into
mainfrom
issue/7613
Open

feat(multi-tenancy): differentiate tenant-scoped user creation (#7613)#7637
Gaetan Santucci (GaetanSantucci) wants to merge 3 commits into
mainfrom
issue/7613

Conversation

@GaetanSantucci

@GaetanSantucci Gaetan Santucci (GaetanSantucci) commented Aug 27, 2026

Copy link
Copy Markdown
Member

Proposed changes

  • Introduced tenant-aware user creation flow so that user provisioning behavior is explicitly scoped to the current tenant context.
  • Differentiated user creation logic between tenant-scoped and non-tenant/global contexts to avoid ambiguous ownership and cross-tenant side effects.
  • Updated related service/controller handling to consistently propagate and enforce tenant scope during user creation operations.

Testing Instructions

  1. Prepare at least two tenants in a test environment (e.g., tenant-a and tenant-b) with appropriate admin/operator roles.
  2. From tenant-a context, create a new user and verify:
    • user is created successfully,
    • user is attached only to tenant-a,
    • no visibility/association appears in tenant-b.
  3. From tenant-b context, create a new user and verify equivalent tenant isolation behavior.
  4. (If supported) Execute user creation in a non-tenant/global context and verify expected fallback behavior is preserved.
  5. Validate error cases:
    • missing/invalid tenant scope,
    • unauthorized actor attempting tenant-scoped creation,
    • duplicate/conflicting identity in same tenant rules.
  6. Run automated tests covering user creation and tenancy boundaries; ensure no regressions in existing user provisioning flows.

Related issues

Checklist

  • I consider the submitted work as finished
  • I tested the code for its functionality
  • I wrote test cases for the relevant uses case
  • I added/update the relevant documentation (either on github or on notion)
  • Where necessary I refactored code to improve the overall quality
  • For bug fix -> I implemented a test that covers the bug

Further comments

This change focuses on making tenant boundaries explicit at user creation time to reduce accidental cross-tenant coupling and improve predictability in multi-tenant environments.
The implementation favors explicit scope propagation and validation over implicit inference, which makes the behavior easier to reason about and safer for future extensions.

@github-actions

github-actions Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

📖 Documentation check — ✅ Passed

5 functional file(s), 0 doc file(s) changed.

No documentation gaps detected.

@github-actions github-actions Bot added the filigran team Item from the Filigran team. label Aug 27, 2026
@github-actions

github-actions Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Container vulnerability scan — Passed

Previously reported findings are no longer present.

Image Critical High Total Status
Standard 0 0 0 ✅ Clear
UBI9 0 0 0 ✅ Clear

View workflow run · Standard JSON report · UBI9 JSON report

Updated from CI run attempt 1.

Copilot AI 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.

Pull request overview

This PR fixes multi-tenancy user provisioning so that users created from within a tenant do not receive platform-scope “auto-assign” groups, addressing issue #7613 and preventing cross-scope privilege leakage.

Changes:

  • Added an explicit tenant-scoped user creation entry point in UserService that skips platform-scope auto-assign group assignment.
  • Updated TenantUserService#createOrAttach to use the tenant-scoped creation path.
  • Added integration tests to assert platform auto-assign groups are not applied during tenant user creation and that tenant IDs provided in input are ignored.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
openaev-api/src/test/java/io/openaev/service/tenants/TenantUserServiceTest.java Adds regression tests ensuring tenant-created users don’t join platform auto-assign groups and that input tenant IDs are ignored.
openaev-api/src/main/java/io/openaev/service/UserService.java Introduces createTenantUser(...) and threads an includePlatformScope flag to prevent platform auto-assign groups during tenant-scoped creation.
openaev-api/src/main/java/io/openaev/service/tenants/TenantUserService.java Switches tenant user creation to userService.createTenantUser(...) to enforce tenant-only scope on creation.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.


/** Creates a user for internal/technical purposes (SSO login, connector provisioning). */
@Transactional(rollbackFor = Exception.class)
public User createInternalUser(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

TODO: since every method calling this one are calling attachTenant just after, I am wondering if we need to put a false on createUser, OR do a little refacto and having just two way to create a user: tenant or platform, not internal.

}

@Transactional(rollbackFor = Exception.class)
public User createTenantUser(UserInput input) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

todo: seems weird to have createTenantUser inside userservice to call just after createUser. Why not call direclty createUser ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

filigran team Item from the Filigran team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(multi-tenancy): a tenant admin creating a user grants them the platform-wide auto-assign groups

3 participants