Skip to content

Scope Invoke-MyCommand aliases to the calling module#45

Draft
Copilot wants to merge 1 commit into
mainfrom
copilot/feat-sandbox-calls-to-a-module
Draft

Scope Invoke-MyCommand aliases to the calling module#45
Copilot wants to merge 1 commit into
mainfrom
copilot/feat-sandbox-calls-to-a-module

Conversation

Copilot AI commented Jun 21, 2026

Copy link
Copy Markdown

This change enforces module-level sandboxing for registered command aliases to prevent cross-module alias collisions. Invoke-MyCommand now accepts a module identifier and only resolves aliases registered for that same module.

  • API change

    • Added -Module parameter to Invoke-MyCommand (and JSON wrapper path) so callers declare module context during alias invocation.
  • Alias resolution hardening

    • Extended alias metadata validation so invocation is allowed only when -Module matches the alias module/tag.
    • Added explicit rejection path for mismatched module calls to block cross-module execution.
  • Focused test coverage

    • Added tests for:
      • successful invocation when caller module matches alias module
      • failure when caller module does not match alias module
    • Tests follow the repository’s existing Test_* function naming expectation.
Set-InvokeCommandAlias -Alias 'GetUser' -Command 'echo "ok"' -Tag 'ModuleA'

Invoke-MyCommand -Command 'GetUser' -Module 'ModuleA'   # allowed
Invoke-MyCommand -Command 'GetUser' -Module 'ModuleB'   # throws

Copilot AI changed the title [WIP] Add module parameter to invoke-MyCommand for conflict resolution Scope Invoke-MyCommand aliases to the calling module Jun 21, 2026
Copilot AI requested a review from rulasg June 21, 2026 18:26
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