Skip to content

fix: bind jump permits to gate extension (shadow permit vulnerability) - #172

Open
0xxlegolas wants to merge 3 commits into
mainfrom
fix/jump-permit-vulnerability
Open

fix: bind jump permits to gate extension (shadow permit vulnerability)#172
0xxlegolas wants to merge 3 commits into
mainfrom
fix/jump-permit-vulnerability

Conversation

@0xxlegolas

@0xxlegolas 0xxlegolas commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixes the shadow-permit vulnerability in world::gate where a JumpPermit issued under one extension stayed valid after the gate's extension (Auth witness) was revoked or swapped. validate_jump_permit only checked route_hash, expiry, and character, never the extension -- so legacy permits could bypass the active extension's logic.

This is the fresh-deployment alternative to #153. Because we are deploying a new contract (no existing on-chain JumpPermit objects), we fix JumpPermit directly instead of introducing a backward-compatible JumpPermitV2 + migration path. No new entrypoints, no migration tooling, no client/script changes.

Store the issuing extension witness type on JumpPermit and verify it in
validate_jump_permit (and delete_jump_permit_with_auth). This prevents a
permit from being used after the gate's extension is revoked or swapped
(shadow permits). Targets a fresh contract deployment, so no V2/migration
is needed. Adds tests covering revoked and swapped extensions.
@0xxlegolas
0xxlegolas requested a review from a team as a code owner June 8, 2026 13:01
@0xxlegolas
0xxlegolas requested a review from Copilot June 8, 2026 13:43

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

Fixes the “shadow permit” vulnerability in world::gate by binding JumpPermit validity to the currently-configured gate extension witness type, preventing permits minted under a previous extension configuration from being used after revocation or swap.

Changes:

  • Adds extension_type: TypeName to JumpPermit and validates it against the gates’ configured extension during jump_with_permit.
  • Introduces new abort reasons for extension/permit mismatches and exposes a jump_permit_extension accessor.
  • Extends gate_tests with scenarios covering revocation and extension swapping to ensure old permits cannot be reused.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
contracts/world/sources/assemblies/gate.move Binds permits to extension type and enforces extension/permit consistency during validation and auth-based deletion.
contracts/world/tests/assemblies/gate_tests.move Adds regression tests for permit invalidation after extension revocation and after extension swaps.

Comment thread contracts/world/sources/assemblies/gate.move
Comment thread contracts/world/sources/assemblies/gate.move Outdated
Address PR review: make EExtensionNotConfigured generic (no longer
mentions freezing) and drop "Linked" from EGateExtensionMismatch since
the check runs before link validation.
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