Skip to content

[BUG] APM self-update fails on Windows due to security policies #1389

@GregoireBo

Description

@GregoireBo

Describe the bug

The APM self-update process fails during installation on Windows due to security restrictions. The downloaded binary (apm.exe) cannot be executed and returns an Access is denied error.

Additionally, the installer cannot verify the checksum because Get-FileHash is not available in the environment.

As a result, the update process aborts without fallback (Python not available either).

As a workaround, it is possible to manually download the desired version, place it into the versions directory, and update the launcher script to point to the latest version (what I had to do to update to 0.13.0), but this is not practical for regular use.


To Reproduce

Steps to reproduce the behavior:

  1. Run command in a restricted environment:
    apm self-update
  2. Let APM detect and download the latest version
  3. Observe failure during binary execution

Expected behavior

The update process should:

  • Successfully install the new version
  • If security policy continue to block the process, provide a safe way to authorize execution for APM update

Environment (please complete the following information):

  • OS: Windows
  • Python Version: 3.14.0
  • APM Version: 0.13.0 (attempting update to 0.14.0)
  • VSCode Version (if relevant): N/A

Logs

PS <LOCAL_PATH>> apm self-update
[!] A new version of APM is available: 0.14.0 (current: 0.13.0)
Run apm update to upgrade

[i] Current version: 0.13.0
[>] Checking for updates...
[*] Latest version available: 0.14.0
[>] Downloading and installing update...
[*] Running installer...

===========================================================
                    APM Installer
             The NPM for AI-Native Development
===========================================================

Fetching latest release information...
Latest version: v0.14.0
Downloading apm-windows-x86_64.zip (v0.14.0)...
Download successful
Verifying download checksum...
Could not verify checksum (non-fatal): The term 'Get-FileHash' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Extracting package...
Testing binary...
Downloaded binary failed to run: Program 'apm.exe' failed to run: Access is deniedAt C:\Users\<LOCAL_USER>\AppData\Local\Temp\tmpktpixuky.ps1:540 char:23
+         $testOutput = & $exePath --version 2>&1
+                       ~~~~~~~~~~~~~~~~~~~~~~~~~.

Attempting automatic fallback to pip...
Python 3.9+ is not available - cannot fall back to pip.

Manual installation options:
  1. pip (recommended): pip install --user apm-cli
  2. From source:
     git clone https://github.com/microsoft/apm.git
     cd apm && uv sync && uv run pip install -e .

Need help? Create an issue at: https://github.com/microsoft/apm/issues
[x] Installation failed - see output above for details

Additional context

  • Image
  • The issue may be related to enterprise Windows security policies blocking execution of downloaded binaries (restricted temp folder execution).
  • The failure happens when running the binary from a temporary directory.
  • It might help to:
    • Run the installer from a trusted directory
    • Sign the binary ?
    • Add guidance for restricted environments

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/bugSomething does not work as documented.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    In Progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions