Authorize console-triggered pipeline commands during bootstrap - #630
Merged
kayjoosten merged 2 commits intoJul 30, 2026
Merged
Conversation
Why is this change needed? Prior to this change, console bootstrap commands (identity, yubikey, sms, gssp, migrate) ran without a security token. Creating an identity for a not-yet-configured institution triggers InstitutionConfiguration- Processor to dispatch CreateInstitutionConfigurationCommand back through the full pipeline, which requires ROLE_MANAGEMENT. With no token present, AuthorizingStage rejected it and the whole bootstrap transaction rolled back with a ForbiddenException. How does it address the issue? TransactionHelper::beginTransaction() now sets a fully authorized console security token when none is present, so commands the pipeline dispatches internally during a console run are no longer rejected. Removed BootstrapCommandService::setToken(), an unused method from an earlier, unfinished attempt at this same fix. Refs: #629
johanib
reviewed
Jul 29, 2026
johanib
left a comment
Contributor
There was a problem hiding this comment.
Security-focused review of the console token change. No reachable vulnerability found — TransactionHelper is only injected into console commands and AuthorizingStage is a pure role check. The two inline comments are least-privilege and defense-in-depth points on the new branch in beginTransaction().
johanib
reviewed
Jul 29, 2026
Why is this change needed? The console token was set implicitly inside TransactionHelper::begin- Transaction(), granting ROLE_SS, ROLE_RA, ROLE_MANAGEMENT and ROLE_DEPROVISION to every caller. That conflated starting a database transaction with authorizing privileged pipeline commands: any future console command wired to TransactionHelper for its transaction handling would silently inherit elevated roles it never asked for, including ROLE_DEPROVISION, which nothing in these bootstrap flows actually needs. How does it address the issue? Split the responsibility into TransactionHelper::authorizeConsole- Context(), an explicit, opt-in call that each of the six bootstrap console commands now makes before starting its transaction. Dropped ROLE_DEPROVISION from the granted roles. beginTransaction() itself no longer touches the token storage. Refs: #629
johanib
approved these changes
Jul 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Why is this change needed?
Prior to this change, console bootstrap commands (identity, yubikey, sms, gssp, migrate) ran without a security token. Creating an identity for a not-yet-configured institution triggers InstitutionConfigurationProcessor to dispatch CreateInstitutionConfigurationCommand back through the full pipeline, which requires ROLE_MANAGEMENT. With no token present, AuthorizingStage rejected it and the whole bootstrap transaction rolled back with a ForbiddenException.
How does it address the issue?
TransactionHelper::beginTransaction() now sets a fully authorized console security token when none is present, so commands the pipeline dispatches internally during a console run are no longer rejected. Removed BootstrapCommandService::setToken(), an unused method from an earlier, unfinished attempt at this same fix.
Fixes #629
Test plan
middleware:bootstrap:identity-with-yubikeynow succeeds and persists identity + institution config + vetted token correctly