Skip to content

gh aw compile generates CODEQL actions/code-inject alerts by inlining ${{ runner.temp }} in github-script #54295

Closed

Description

@kkruel8100

Summary

When running gh aw compile, it generates .lock.yml workflows that inline {{ runner.temp }} directly inside executable actions/github-script Javascript.

We have several workflows that use workflow-call and use a centralized repo ops pattern. The centralized workflow is extremely important to use to maintain workflows in one place.

This causes CodeQL actions/code-injection/medium alerts in generated lock files.

Version

This is occurring with the latest available version v0.86.2.

Example Generated Code

Generated lock file pattern:

with:
script: |
const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
setupGlobals(core, github, context, exec, io, getOctokit);
const { main } = require('${{ runner.temp }}/gh-aw/actions/generate_aw_info.cjs');
await main(core, context);

CodeQL Alert
Potential code injection in ${{ runner.temp }}, which may be controlled by an external user.

Expected Behavior

Generated lock files should avoid interpolating GitHub expressions directly into executable Javascript or shell script bodies.

Proposed Fix

Instead of generating

with:
script: |
const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');

Replace with

with:
script: |
const path = require('path');
const actionsDir = path.join(process.env.RUNNER_TEMP, 'gh-aw', 'actions');
const { setupGlobals } = require(path.join(actionsDir, 'setup_globals.cjs'));

For shell commands

Instead of generating

run: node ${{ runner.temp }}/gh-aw/actions/generate_usage_activity_summary.cjs

Replace with

run: node "${RUNNER_TEMP}/gh-aw/ations/generate_usage_activity_summary.cjs"

Request

Please update gh aw compile so generated lock workflows use runtime environment variables and safe path construction instead of inlining ${{ ... }} expressions inside executable script bodies.

This should make generated lock files clean without requiring patches for generated artifacts manually.

Impact

This has extremely high impact.

Thank you for reviewing the matter.

Activity

  1. locked and limited conversation to collaborators on Aug 20, 2026
  2. unlocked this conversation on Aug 20, 2026
  3. pelikhan commented on Aug 20, 2026

    @pelikhan
    Collaborator

    @copilot implement fix and add linter to enforce future regressions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions