fix(party): allow delegated access without instantiation rights#4326
Conversation
PartyProvider rejected every authenticated user whose allowed-to-instantiate party list was empty, even when the URL already identified an existing instance. This prevented delegated users from opening instances the backend authorized them to access. Limit the empty-party error to entry without an instance ID. Cover the distinction with a signing flow where the signer has real delegated access while the allowed-to-instantiate response is deliberately empty.
📝 WalkthroughWalkthrough
ChangesDelegated signer instance access
Estimated code review effort: 3 (Moderate) | ~20 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@test/e2e/integration/signering-brukerstyrt/delegated-signer-instance-access.ts`:
- Around line 20-27: Update the cy.intercept call for the allowed-parties GET
request to provide the response body type as IParty[] through its generic
parameters, then remove the res.body cast and use the inferred typed value in
the filtering logic.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 03fe8482-fadd-4826-871c-76e6cb7e0c9b
📒 Files selected for processing (2)
src/features/party/PartiesProvider.tsxtest/e2e/integration/signering-brukerstyrt/delegated-signer-instance-access.ts
Tenor party IDs differ between localtest and TT02, and newly delegated signing access is not reliable in TT02 due to authorization caching. Those environment details obscured the frontend regression the test is meant to protect. Select the organization by its stable Tenor number and reopen the instance as its original user. Mock only the instantiation-party response on the second load so the test isolates the frontend guard while retaining real backend instance authorization in both environments.
The TT02-compatible regression initially used a Tenor identity that is not available in localtest, so the test could not validate the fix in both target environments. Use Human Andrefiolin and select their organization by its stable organization number. This keeps the instance authorization real while allowing the same negative-control test to run in podman and TT02.
|
✅ Automatic backport successful! A backport PR has been automatically created for the The release branch The cherry-pick was clean with no conflicts. Please review the backport PR when it appears. |
* party: allow delegated access without instantiation parties PartyProvider rejected every authenticated user whose allowed-to-instantiate party list was empty, even when the URL already identified an existing instance. This prevented delegated users from opening instances the backend authorized them to access. Limit the empty-party error to entry without an instance ID. Cover the distinction with a signing flow where the signer has real delegated access while the allowed-to-instantiate response is deliberately empty. * test: make existing instance access portable to TT02 Tenor party IDs differ between localtest and TT02, and newly delegated signing access is not reliable in TT02 due to authorization caching. Those environment details obscured the frontend regression the test is meant to protect. Select the organization by its stable Tenor number and reopen the instance as its original user. Mock only the instantiation-party response on the second load so the test isolates the frontend guard while retaining real backend instance authorization in both environments. * test: use Tenor user shared by localtest and TT02 The TT02-compatible regression initially used a Tenor identity that is not available in localtest, so the test could not validate the fix in both target environments. Use Human Andrefiolin and select their organization by its stable organization number. This keeps the instance authorization real while allowing the same negative-control test to run in podman and TT02. --------- Co-authored-by: Ole Martin Handeland <git@olemartin.org>
Description
Users with delegated access to an existing app instance could be shown a 403 error when they were not also allowed to start new instances of that app.
The party provider now applies the requirement for an instantiation-capable party only when entering the app without an existing instance. Backend authorization remains responsible for deciding whether the user can open a specific instance.
A Cypress regression test creates and saves an organization-owned instance, removes the user's allowed-to-instantiate parties from the frontend response when reopening it, and verifies that the user can still open the existing instance through real backend authorization.
Related Issue(s)
Verification/QA
Automated verification performed:
npx cypress run --env environment=podman -s test/e2e/integration/signering-brukerstyrt/existing-instance-access.ts --config retries=0 --reporter spec— 1 passingnpx cypress run --env environment=tt02 -s test/e2e/integration/signering-brukerstyrt/existing-instance-access.ts --config retries=0 --reporter spec— 1 passingNegative control with the bug fix temporarily reverted — the same test failed in podman and TT02 because the existing instance form did not render
yarn eslint src/features/party/PartiesProvider.tsx test/e2e/integration/signering-brukerstyrt/existing-instance-access.ts— passedyarn tsc— passedManual functionality testing
Automated tests
UU/WCAG (follow these guidelines until we have our own)
User documentation @ altinn-studio-docs
Support in Altinn Studio
Sprint board
Labels
kind/*andbackport*label to this PR for proper release notes grouping