Skip to content

fix: Limit exports - #12100

Merged
michael-weigelt merged 3 commits into
masterfrom
mwe/export_list
Nov 16, 2026
Merged

michael-weigelt merged 3 commits into
masterfrom
mwe/export_list

Conversation

@michael-weigelt

@michael-weigelt michael-weigelt commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Limits the number of exports a module may have (beyond the 1000 exported functions).

This new limit is also added to the interface spec.

@github-actions github-actions Bot added the fix label Nov 13, 2026
@michael-weigelt
michael-weigelt marked this pull request as ready for review November 16, 2026 09:33
@michael-weigelt
michael-weigelt requested a review from a team as a code owner November 16, 2026 09:33
Copilot AI balanced review requested due to automatic review settings November 16, 2026 09:33
@zeropath-ai

zeropath-ai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

✅ No security or compliance issues detected. Reviewed everything up to 7070110.

Security Overview
Detected Code Changes
Change Type Relevant files
Enhancement ► rs/config/src/embedders.rs
      Add MAX_NUMBER_EXPORTS constant and MAX_NUMBER_EXPORTS usage; introduce MAX_NUMBER_EXPORTS and MAX_NUMBER_EXPORTS into Config; update associated docs comments and public interface spec references
Enhancement ► rs/embedders/src/wasm_utils/validation.rs
      Track total number of exports (any kind); validate against max_number_exports; propagate max_number_exports into validate_wasm_binary and export section validation
Enhancement ► rs/embedders/tests/validation.rs
      Add test can_validate_too_many_total_exports to verify total exports constraint enforcement
Enhancement ► rs/types/wasm_types/src/errors.rs
      Add TooManyTotalExports error variant and display/help messaging

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.

🟡 Changes recommended

PocketIC does not relax the new total-export limit when function name length limits are disabled, causing previously valid modules with 1,101 short-named entry points to fail installation.

1 open issue
What changed in this PR

This PR adds a total-export limit to Wasm validation, covering exports that the existing canister-method limit does not count.

Changes:

  • Adds a configurable limit of 1,100 exports across all export kinds.
  • Enforces the limit with a dedicated validation error and user guidance.
  • Adds a regression test for multiple exports of a single global.
File Description
rs/​types/​wasm_types/​src/​errors.rs Adds the total-export validation error and help text.
rs/​embedders/​tests/​validation.rs Tests rejection of excessive global exports.
rs/​embedders/​src/​wasm_utils/​validation.rs Counts all exports and enforces the configured limit.
rs/​config/​src/​embedders.rs Defines the total-export setting and its default.

Review effort: Balanced

Comment thread rs/config/src/embedders.rs Resolved
Comment thread rs/config/src/embedders.rs Resolved
Comment thread rs/config/src/embedders.rs Resolved
Copilot AI balanced review requested due to automatic review settings November 16, 2026 12:01

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.

🔵 Needs a closer look

The new total-export cap breaks PocketIC’s existing limit opt-out by rejecting modules with 1,101 valid method exports; the override must be updated and covered by a regression test.

1 open issue
1 previously missed issue

In code that hasn't changed since last review

Medium severity Raise the total-export limit when exported-function limits are disabled

rs/​config/​src/​embedders.rs:298

Please also raise this limit in PocketIC's function_name_length_limits: Disabled configuration path (rs/pocket_ic_server/src/pocket_ic.rs:682–693). That path explicitly raises max_number_exported_functions to 1,000,000,000, but now leaves max_number_exports at 1,100. Consequently, a module with 1,101 short exported methods is rejected even when the existing method-count limit is disabled. Update the opt-out to account for the new total-export cap and add a regression test.

Review effort: Balanced

@michael-weigelt
michael-weigelt added this pull request to the merge queue Nov 16, 2026
Merged via the queue into master with commit 13935d9 Nov 16, 2026
40 checks passed
@michael-weigelt
michael-weigelt deleted the mwe/export_list branch November 16, 2026 17:06
q-uint pushed a commit to Swiss-Subnet/ic that referenced this pull request Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants