Skip to content

[InvokeHelper] Scope Invoke-MyCommand aliases to the calling module#45

Draft
rulasg with Copilot wants to merge 7 commits into
mainfrom
copilot/feat-sandbox-calls-to-a-module
Draft

[InvokeHelper] Scope Invoke-MyCommand aliases to the calling module#45
rulasg with Copilot wants to merge 7 commits 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
Copilot stopped work on behalf of rulasg due to an error June 24, 2026 20:56
@rulasg rulasg changed the title Scope Invoke-MyCommand aliases to the calling module [InvokeHelper] Scope Invoke-MyCommand aliases to the calling module Jun 30, 2026
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