Skip to content

gh aw compile generates CodeQL injection alert for GH_AW_DEFAULT_DETECTION_MAX_AI_CREDITS in shell run block #57780

Closed

Description

@kkruel8100

Summary

gh aw compile generates lock workflows that interpolate ${{ GH_AW_DEFAULT_DETECTION_MAX_AI_CREDITS }} directly inside an executable shell run: block.

CodeQL flags this as actions/code-injection/medium.

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

CodeQL Alert

Potential code injection in ${{ vars.GH_AW_DEFAULT_DETECTION_MAX_AI_CREDITS || '400' }}, which may be controlled by external user.

Observed Context

This appears in generated .lock.yml files produced by gh aw compile.
The source .md workflow files do not contain this shell line. It is introduced by compilation, so manual editing is not durable.

Request

Please move this expression out of the executable shell body and into env, then reference the environment variable from the shell script. Please validate that it is an integer before writing the firewall config.

Impact

We have a centralized workflow with a large number of reusable workflows, so the count of CodeQL alerts is significant.

Thank you for reviewing the matter.

Activity

  1. locked and limited conversation to collaborators on Sep 1, 2026
  2. unlocked this conversation on Sep 1, 2026
  3. kkruel8100 commented on Sep 1, 2026

    @kkruel8100
    Author

    Current Code Block

    • name: Execute threat detection with AWF
      ...
      env:
      ...
      GH_AW_MAX_AI_CREDITS: ${{ vars.GH_AW_DEFAULT_DETECTION_MAX_AI_CREDITS || '400' }}
      ....
      run:
      ....
      GH_AW_MAX_AI_CREDITS: ${{ vars.GH_AW_DEFAULT_DETECTION_MAX_AI_CREDITS || '400' }}

    Update requested

    Remove the redundant script since the variable is already set in env

  4. locked and limited conversation to collaborators on Sep 1, 2026
  5. unlocked this conversation on Sep 1, 2026
  6. kkruel8100 commented on Sep 3, 2026

    @kkruel8100
    Author

    @pelikhan
    Would you be able to assign this to copilot as well? This is a different ticket.

    Thank you so much. :)

  7. locked and limited conversation to collaborators on Sep 3, 2026
  8. unlocked this conversation on Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions