GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(auth): only the platform admin may create a Träger (#352) by kiodreambau · Pull Request #372 · OpenResilienceInitiative/ORISO-TenantService

Conversation

@kiodreambau

@kiodreambau kiodreambau commented Nov 17, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

A Träger admin could create a whole new organisation through the API, because their role carries the same "create tenant" right as the platform admin. Creating organisations is the platform admin's job. With this change a Träger admin is refused with 403 straight away, before anything is written, so there is nothing half-created to roll back.

Closes #352
Part of OpenResilienceInitiative/ORISO-Admin#1335

What changed

  • TenantFacadeAuthorisationService.assertMayCreateTenants(): a caller holding CREATE_TENANT must come from the platform tenant 0 (isSuperAdmin()), otherwise AccessDeniedException → 403.
  • TenantServiceFacade.createTenant calls it as its very first check, before sanitising, ID allocation, the tenant insert, the consulting-type step or any rollback.
  • Callers without CREATE_TENANT (technical identity, config-wizard task identity used by the UserService onboarding) keep the existing reservation-only check. The legacy technical identity carrying tenant-admin at tenant 0 keeps its full create right, as pinned by TechnicalServiceIdentityAuthorizationIT.
  • The controller @PreAuthorize stays as is: it also admits the reservation-only identities, and the tenant claim is decided in the facade like the other platform-only guards (listing, DPA publishing).

Callers checked

  • Admin UI: "create Träger" is already only offered to the super admin (userRolesToPermissions.ts: Tenant.create: isSuperAdmin). No change needed.
  • UserService public onboarding (TenantCreationClient): uses the CONFIG_WIZARD task identity with the invite's reservation. Unaffected.

Tests (test-first: the new Träger-admin ITs were red with 200 before the fix)

TraegerAdminTenantIsolationIT (real role mapping, String tenant claim)
  traegerAdmin_Should_beRefusedBeforeAnyWrite_When_creatingATraeger
    -> 403, tenant count + ID ledger unchanged, no consulting-type call
  traegerAdmin_Should_notConsumeAReservation_When_creatingATraegerWithItsToken
    -> 403, platform-minted reservation stays RESERVED, no tenant row
  platformAdmin_Should_createATraegerWithItsDefaultConsultingType
    -> 200, tenant stored, createDefaultConsultingTypes(newId) called
TenantFacadeAuthorisationServiceTest: Träger admin refused, missing tenant claim refused,
  platform admin passes, reservation-only callers untouched
TenantServiceFacadeTest: refusal -> no sanitise, no create, no consulting type, no rollback
TenantIdAllocationControllerIT: platformAdmin() fixture now names tenant 0 like TenantControllerIT

./mvnw -B test  ->  Tests run: 1308, Failures: 0, Errors: 0  (includes spotless:check)

Verified: local only (JDK 21, H2 test profile). No image built, nothing deployed.

How should I test this?

  • As a Träger admin (token tenantId = own Träger), POST /service/tenantadmin with a new organisation → 403 immediately; no new Träger appears in the platform admin's list
  • As the platform admin, create a Träger in the Admin panel → it is created, including its default consulting type
  • Public Träger onboarding through an invite link still creates the Träger (reservation path unchanged)

Not in this PR

The tenant-ID reservation endpoints (reserve, next free ID, availability, release) are still gated by CREATE_TENANT alone, so a Träger admin can still reserve an ID. They can no longer consume it. Tracked in #373.

🤖 Generated with Claude Code

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@kiodreambau @claude
fix(auth): only the platform admin may create a Träger (#352)
b429651
Every Träger admin holds tenant-admin and with it CREATE_TENANT, so
POST /tenantadmin let them create an organisation. Since
ConsultingTypeService#190 the call failed at the consulting-type step and
was rolled back; with that step passing (as in tests), the tenant was
created and even a platform-minted ID reservation was consumed.

createTenant now refuses a CREATE_TENANT holder whose token does not name
the platform tenant 0 before anything is sanitised, allocated or written,
so there is no rollback path. Reservation-only callers (technical
identity, config-wizard task) keep the existing reservation check; the
legacy technical identity with tenant-admin at tenant 0 is unchanged.

Closes #352

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kiodreambau kiodreambau self-assigned this Nov 17, 2026
@kiodreambau
kiodreambau requested review from Hassan9215 and Shirloin November 17, 2026 22:00
@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Pre-merge checks: Passed 1

Check name Status Explanation
Validation Evidence Passed Summary: The PR changes product behavior. It adds an authorization refusal to createTenant (Träger admins get 403). The check therefore applies, and it passes because the PR includes relevant automa…
Full details: Validation Evidence

Explanation

Summary: The PR changes product behavior. It adds an authorization refusal to createTenant (Träger admins get 403). The check therefore applies, and it passes because the PR includes relevant automated tests and a stated validation command with its result. Evidence: - The PR description lists new tests: TraegerAdminTenantIsolationIT, TenantFacadeAuthorisationServiceTest, TenantServiceFacadeTest, and an updated TenantIdAllocationControllerIT. - The description gives the exact command (./mvnw -B test) and result (Tests run: 1308, Failures: 0, Errors: 0). It also states the environment (JDK 21, H2 test profile) and that the run was local only. - In the checked-out tree, these test files exist. TechnicalServiceIdentityAuthorizationIT also exists and covers the legacy identity path the description cites. - assertMayCreateTenants is defined in TenantFacadeAuthorisationService.java (line 115) and called from TenantServiceFacade.java (line 263). Test methods in TenantFacadeAuthorisationServiceTest.java (lines 806–844) and TenantServiceFacadeTest.java (line 877) exercise it. Gaps (not affecting the verdict): I did not run the test suite. The description says the new Träger-admin ITs failed before the fix, but I did not verify that claim. The "How should I test this" items are manual checklist items, not automated evidence. Neither gap is required by the check.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@kiodreambau kiodreambau mentioned this pull request Nov 17, 2026
EPIC: Admin settings refactoring and security fixes found during the tile redesign OpenResilienceInitiative/ORISO-Admin#1335
Open
@Storypapst Storypapst mentioned this pull request Nov 17, 2026
v2.0.17 merge queue OpenResilienceInitiative/ORISO-Frontend#2277
Open
62 tasks done
@kiodreambau kiodreambau assigned Storypapst Nov 18, 2026
shazia-k
shazia-k approved these changes Nov 18, 2026
View reviewed changes
@shazia-k
shazia-k added this pull request to the merge queue Nov 18, 2026
Merged via the queue into dev with commit e952f0c Nov 18, 2026
8 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@shazia-k
shazia-k deleted the fix/352-create-tenant-platform-admin-only branch November 18, 2026 05:17
@kiodreambau kiodreambau mentioned this pull request Nov 18, 2026
Creating an organisation: only the platform admin may call it #352
Open
1 of 3 tasks
@Hassan9215 Hassan9215 mentioned this pull request Nov 18, 2026
Release TenantService v2.0.17 #375
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@shazia-k shazia-k shazia-k approved these changes
@Hassan9215 Hassan9215 Awaiting requested review from Hassan9215
@Shirloin Shirloin Awaiting requested review from Shirloin

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@Storypapst Storypapst

@kiodreambau kiodreambau

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@kiodreambau @shazia-k @Storypapst
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.