actions / actions/runner

GITHUB_TOKEN not present in script set as ACTIONS_RUNNER_HOOK_JOB_STARTED

Open
#2,813 8 comments 11 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Describe the bug
The env var GITHUB_TOKEN is not present in the context of the script set as ACTIONS_RUNNER_HOOK_JOB_STARTED.
Not sure if this has some security concern, but we would need a valid GITHUB_TOKEN during our pre-job script.

To Reproduce
Steps to reproduce the behavior:

  1. Create a simple bash script that run the command env and set its path as env var for ACTIONS_RUNNER_HOOK_JOB_STARTED
  2. Trigger the workflow
  3. See there is no GITHUB_TOKEN available.

Expected behavior
The env var GITHUB_TOKEN should be present in the context of the script set as ACTIONS_RUNNER_HOOK_JOB_STARTED.

Runner Version and Platform

Version of your runner?
2.308.0

OS of the machine running the runner?
Linux Debian 11, Kubernetes (GKE) using actions-runner-controller.

Thanks

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

Start by reproducing the ACTIONS_RUNNER_HOOK_JOB_STARTED behavior with the bash script that runs env, using runner version 2.308.0 on Linux. Trace how the pre-job hook environment is created and determine whether GITHUB_TOKEN can be exposed safely. Done means the expected token behavior is documented by a regression test or a confirmed security limitation.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, github-actions
Domain
ci-cd
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.