actions / actions/runner

GitHub needs to digitally sign the ps1 scripts.

Open
#686 15 comments 8 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Runner Bug
Dominant language
C#
Stars
6.3k
Forks
1.4k
Avg merge
1d 16h
Merged PRs (30d)
24

Description

Description

GitHub/Microsoft does not sign autogenerated ps1 scripted steps, this causes a failure on a self-hosted Windows runners.

For example, let's take this step:

Run dotnet restore some.csproj

Which is turned into the following ps1 file that gets downloaded to the runner:

C:\actions-runner\_work\_temp\7af2df60-c729-42fb-85a1-d9de2fd74369.ps1

However, when the runner tries to execute it, you get the expected trust error:

The file C:\actions-runner\_work\_temp\7af2df60-c729-42fb-85a1-d9de2fd74369.ps1 is not digitally signed. You cannot run this script on the current system.

The workaround is to change execution policy, but this is extremely dangerous and a very bad idea. Microsoft should sign any ps1 steps it creates.

Area for Triage:

  • .NET Core
  • Scripting and command line

Question, Bug, or Feature?:

Bug

Virtual environments affected

  • macOS 10.15
  • Ubuntu 16.04 LTS
  • Ubuntu 18.04 LTS
  • Ubuntu 20.04 LTS
  • Windows Server 2016 R2
  • Windows Server 2019
  • Self-Hosted Windows Runner

Expected behavior

Steps work

Actual behavior

Steps fail due to unsigned ps1 file.

Run dotnet restore $env:SolutionPath --configfile $env:NugetConfigPath --runtime $env:RID

. : File C:\actions-runner\_work\_temp\7af2df60-c729-42fb-85a1-d9de2fd74369.ps1 cannot be loaded. The file 
C:\actions-runner\_work\_temp\7af2df60-c729-42fb-85a1-d9de2fd74369.ps1 is not digitally signed. You cannot run this 
script on the current system. For more information about running scripts and setting execution policy, see 
about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:3
+ . 'C:\actions-runner\_work\_temp\7af2df60-c729-42fb-85a1-d9de2fd74369 ...
+   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess
##[error]Process completed with exit code 1.

Repro steps
A description with steps to reproduce the issue. If your have a public example or repo to share,
please provide the link.

  1. Create a Windows self-hosted runner
  2. Run a workflow that uses any steps that creates a ps1 file for the step's instructions.

For a repro example, you can use the following:

name: GitHub Actions Repro

on:
  push

jobs:
  build:
    runs-on: self-hosted

    steps:
    - name: Checkout
      uses: actions/checkout@v2

    - uses: actions/setup-dotnet@v1
      with:
        dotnet-version: '3.1.302'

    # This will fail
    - name: NuGet Restore
      run: dotnet restore some.csproj --runtime win-x86

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure on a self-hosted Windows runner using the YAML workflow shown, then trace how the runner creates and executes the temporary .ps1 file. Investigate the signing and execution-policy constraints before defining a safe implementation. Done means the example workflow runs without weakening the system execution policy.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
devops, operating-systems, security
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.