Skip to content

Misleading script injection mitigation #17902

@laurentsimon

Description

@laurentsimon

Code of Conduct

What article on docs.github.com is affected?

https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-action-instead-of-an-inline-script-recommended

What part(s) of the article would you like to see updated?

The current "recommended" mitigation to script injections in GitHub workflows is to use a GitHub Action, see https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-action-instead-of-an-inline-script-recommended

I think this is mis-leading. All this recommendation is doing is tell users to use an action, basically moving the vulnerability inside the action instead of the workflow itself.

As a user, I may create a local Action and introduce the exact same vulnerability using a script, which is not going to mitigate the problem. If the intention is to say "don't use a script and use javascript, possibly inside an Action", I think that would be fine. But the way it's phrased right now is mis-leading. Using an Action does not mitigate script injections.

A drawback of GHA is that it's yet another dependency to maintain and another attack surface.

The right way to fix this vulnerability is to declare an env variable, which is given as a second option. Users worried about script injection in their script are unlikely to move to an Action, which takes additional work. Users use inline scripts because it's the easy option, so I think we should meet them where they're at.

Additional information

Content Plan

Content plan here

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    actionsThis issue or pull request should be reviewed by the docs actions teamcontentThis issue or pull request belongs to the Docs Content teamhelp wantedAnyone is welcome to open a pull request to fix this issuestaleThere is no recent activity on this issue or pull requestwaiting for reviewIssue/PR is waiting for a writer's review

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions