Analyze the security posture of one or more GitHub Actions
Project description
asa
asa (actions-security-analzyer) is a tool to analyze the security posture of your GitHub Actions.
Installation
Make sure you have
$HOME/.local/bin
in your PATH
pip3 install actions-security-analzyer
Usage
asa --file action.yml
asa -d directory-with-actions/ --verbose
asa --file action.yml --ignore-warnings
asa --list-checks
Use asa
in Your GitHub Workflows
Example
name: 'RunActionsSecurityAnalzyer'
on:
push:
branches:
- main
- dev
jobs:
RunAsa:
runs-on: ubuntu-latest
steps:
- name: "Checkout repo"
uses: actions/checkout@96f53100ba2a5449eb71d2e6604bbcd94b9449b5 # v3.5.3
- name: "Run asa scanner"
uses: "bin3xish477/asa@a6f5eb8c20e936c07326a1eb6aa6427b25494045"
with:
dir: "./actions/"
verbose: true
no-summary: true
ignore-checks: 'check_for_inline_script check_for_cache_action_usage'
Checks Performed by asa
-
Name:
check_for_3p_actions_without_hash
, Level:FAIL
- This check identifies any third-party GitHub Actions in use that have been referenced via a version number such as
v1.1
instead of commit SHA haah. Using a hash can help mitigate supply chain threats in a scenario where a threat actor has compromised the source repository where the 3P action lives.
- This check identifies any third-party GitHub Actions in use that have been referenced via a version number such as
-
Name:
check_for_allow_unsecure_commands
, Level:FAIL
- This check looks for the usage of environment variable called
ACTIONS_ALLOW_UNSECURE_COMMANDS
which allows for an Action to get access to dangerous commands (get-env
,add-path
) which can lead to code injection and credential thefts opportunities.
- This check looks for the usage of environment variable called
-
Name:
check_for_cache_action_usage
, Level:WARN
- This check finds any usage of GitHub's caching Action (
actions/cache
) which may result in sensitive information disclosure or cache poisoning.
- This check finds any usage of GitHub's caching Action (
-
Name:
check_for_dangerous_write_permissions
, Level:FAIL
- This check looks for write permissions granted to potentially dangerous scopes such as the
contents
scope which may allow an adversary write code into the target repository if they're able to compromise the workflow. It's also looks for usage of thewrite-all
which gives the action complete write access to all scopes.
- This check looks for write permissions granted to potentially dangerous scopes such as the
-
Name:
check_for_inline_script
, Level:WARN
- This check simply warns that you're using an inline script instead of GitHub Action. Inline scripts are susceptible to script injection attacks (another check covered by
asa
). It is recommended to write an action and pass any required context values as inputs to that action which removes script injection vector because action input are properly treated as arguments and are not evaluated as part of a script.
- This check simply warns that you're using an inline script instead of GitHub Action. Inline scripts are susceptible to script injection attacks (another check covered by
-
Name:
check_for_pull_request_target
, Level:FAIL
- This check looks for the usage of the dangerous event trigger
pull_request_target
which allows workflow executions to run in the context of the repository that defines the workflow, not the repository that the pull request originated from, potentially allowing a threat actor to gain access to a repositories sensitive secrets!
- This check looks for the usage of the dangerous event trigger
-
Name:
check_for_script_injection
, Level:FAIL
- This check looks for the most commonly known security risk to GitHub Action - script injection. Script injection occurs when an action directly includes (using the
${{ ... }}
syntax) a GitHub Context variable(s) in an inline script that can be controlled by an untrusted actor, resulting in command execution in the interpreted shell. These user-controllable parameters should be passed into an inline script as environment variables.
- This check looks for the most commonly known security risk to GitHub Action - script injection. Script injection occurs when an action directly includes (using the
-
Name:
check_for_self_hosted_runners
, Level:WARN
- This checks attempts to identify the usage of self-hosted runners. Self-hosted runners are dangerous because if the Action is compromised it may allow a threat actor to gain access to on premise environment or establish persistence mechanisms on a server you own/rent.
-
Name:
check_for_aws_configure_credentials_non_oidc
, Level:WARN
- This checks looks for the usage of AWS's
aws-actions/configure-aws-credentials
action and attempts to identify non-OIDC authentication parameters. Non-OIDC authentication types are less secure than OIDC because they require the creation of long-term credentials which can be compromised, however, OIDC tokens are short-lived and are usually scoped to only the permissions that are essential to a workflow and thus help reduce the attack surface.
- This checks looks for the usage of AWS's
-
Name:
check_for_pull_request_create_or_approve
, Level:WARN
- This check looks for Action that have logic related to creating or improving pull requests. Creating or approving pull requests via automation poses a security risk if sufficient controls aren't in place to protect against malicious code being merged into a repository.
References
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file actions_security_analyzer-1.2.3.tar.gz
.
File metadata
- Download URL: actions_security_analyzer-1.2.3.tar.gz
- Upload date:
- Size: 2.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.24.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f4accbf80110e69c90f01c44e389b27f7b5567832d66a8b17b67b2aa23e79505 |
|
MD5 | 149e493c701c859192cfaaa22933b170 |
|
BLAKE2b-256 | 3a5847be4fb032ae8fbb3a7a7a276c1f6531af594e57b2406e360140ce7274fa |
File details
Details for the file actions_security_analyzer-1.2.3-py3-none-any.whl
.
File metadata
- Download URL: actions_security_analyzer-1.2.3-py3-none-any.whl
- Upload date:
- Size: 10.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.24.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 72ee5ca7e9aee263ede0b7bda980b51246b713d90f395b97823ab67a61c7780c |
|
MD5 | f3f6b44004e3d2416237937a61386ee6 |
|
BLAKE2b-256 | 1d620eab93caebe04eb7e1ff149e4a3a6452853d8af3b36c940fe20b75de1bb4 |