Repository navigation
Conversation
Preparing a request can await an external validation call, so the requester's status and permission are checked again before the request is stored. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
✅ No security or compliance issues detected. Reviewed everything up to 771fb6c. Security OverviewDetected Code Changes
|
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Public permissions still allow inactive requesters through the guard, and the regression test does not cover deactivation during suspended preparation.
2 open issues
What changed in this PR
This PR strengthens station request creation by reloading the requester and checking authorization after potentially asynchronous preparation, before storing the request.
Changes:
- Capture the request resource and recheck requester identity and authorization after preparation.
- Grant required permissions in existing test fixtures.
- Add a regression test for request creation using a previously authorized, now-inactive requester.
| File | Description |
|---|---|
core/station/impl/src/services/request.rs |
Add post-preparation authorization checks and update request tests. |
core/station/impl/src/models/request_policy.rs |
Grant user-creation permission in the request-policy test helper. |
Review effort: Balanced
…ending Adds an integration test that keeps a call external canister request's validation call pending, deactivates the requester meanwhile, and checks that the request is refused once validation replies. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The re-check after preparing a request now requires the requester to be active independently of the resource permission, so a public permission does not let a deactivated requester's request through. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This branch has not been deployed
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.


Summary
RequestService::create_requestnow re-checks the requester after the request has been prepared and before it is stored. Preparing a request can await an external call (the validation method of aCallExternalCanisterrequest), and the caller was only authorized once, before that await. The service now reloads the caller's user and runs the same authorization thecreate_requestendpoint runs, for the same resource. If the caller no longer maps to the same user, the user is no longer active, or the permission no longer allows the request, creation fails withRequestError::Unauthorizedand nothing is stored.Changes
services/request.rs: compute the request'sResourcebefore the input moves into the factory, and after the factory returns, refuse creation unless the caller still resolves to the requester andAuthorization::is_allowedpasses.create_requestdirectly now grant the permission their request needs, because the service checks it as well as the endpoint.Tests
create_request_refuses_requester_deactivated_after_authorization: an active requester creates a request, then the same call context (authorized while the user was active) is refused withUNAUTHORIZEDafter the user is set inactive, and no second request is stored. The test fails without the change.cargo test -p station --lib: 410 passed, 0 failed.cargo fmt --checkandcargo clippy -p station --tests -- -D warningsare clean.🤖 Generated with Claude Code