Skip to content

fix(station): reject self-validating external canister calls - #645

Open
MRmarioruci wants to merge 2 commits into
mainfrom
fix/external-call-self-validation
Open

fix(station): reject self-validating external canister calls#645
MRmarioruci wants to merge 2 commits into
mainfrom
fix/external-call-self-validation

Conversation

@MRmarioruci

@MRmarioruci MRmarioruci commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Change

The rule that an external-canister call's validation method must differ from its execution method was enforced in services/external_canister.rs but not in the generic model validator, so the two paths could disagree about whether a configuration was acceptable.

CallExternalCanisterOperationInput::validate now applies the same rule. The check runs before canister-existence validation so the ordering of the two cannot change the outcome.

Tests

  • validate_rejects_validation_method_equal_to_execution_method
  • existing validation tests unchanged

CallExternalCanisterOperationInput::validate now rejects a validation
method that resolves to the same (canister_id, method_name) as the
execution method, on the generic validation path. The check previously
existed only in services/external_canister.rs, so the generic path could
register a policy whose validation and execution targets are identical.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

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 closes a validation gap in the station request-operation model layer by ensuring an external canister call cannot “self-validate” (i.e., use the same (canister_id, method_name) for both validation and execution), which could otherwise allow a request to effectively approve itself depending on how validation is performed.

Changes:

  • Add a pre-check in CallExternalCanisterOperationInput::validate rejecting validation and execution methods that target the same canister method.
  • Add a unit test asserting the new guard returns ExternalCanisterValidationError::ValidationError and runs before canister-existence validation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@MRmarioruci
MRmarioruci marked this pull request as ready for review July 23, 2026 09:05
@MRmarioruci
MRmarioruci requested a review from a team as a code owner July 23, 2026 09:05
@MRmarioruci
MRmarioruci requested a review from aterga July 23, 2026 09:05
@zeropath-ai

zeropath-ai Bot commented Jul 23, 2026

Copy link
Copy Markdown

No security or compliance issues detected. Reviewed everything up to df1338e.

Security Overview
Detected Code Changes
Change Type Relevant files
Enhancement ► core/station/impl/src/models/request_operation.rs
     Add validation to ensure external canister validation method differs from execution method
► core/station/impl/src/models/request_operation.rs
     Add test fail_call_external_canister_with_matching_validation_and_execution_method

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants