Skip to content

Commit 9521994

Browse files
committed
Fix format of markdown query help files
1 parent afc78ce commit 9521994

32 files changed

+85
-152
lines changed

actions/ql/src/Security/CWE-077/EnvPathInjectionCritical.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
# Environment Path Injection
2-
3-
## Description
1+
## Overview
42

53
GitHub Actions allow to define the system PATH variable by writing to a file pointed to by the `GITHUB_PATH` environment variable. Writing to this file appends a directory to the system PATH variable and automatically makes it available to all subsequent actions in the current job.
64

@@ -12,11 +10,11 @@ echo "$HOME/.local/bin" >> $GITHUB_PATH
1210

1311
If an attacker can control the contents of the system PATH, they are able to influence what commands are run in subsequent steps of the same job.
1412

15-
## Recommendations
13+
## Recommendation
1614

1715
Do not allow untrusted data to influence the system PATH: Avoid using untrusted data sources (e.g., artifact content) to define the system PATH.
1816

19-
## Examples
17+
## Example
2018

2119
### Incorrect Usage
2220

actions/ql/src/Security/CWE-077/EnvPathInjectionMedium.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
# Environment Path Injection
2-
3-
## Description
1+
## Overview
42

53
GitHub Actions allow to define the system PATH variable by writing to a file pointed to by the `GITHUB_PATH` environment variable. Writing to this file appends a directory to the system PATH variable and automatically makes it available to all subsequent actions in the current job.
64

@@ -12,11 +10,11 @@ echo "$HOME/.local/bin" >> $GITHUB_PATH
1210

1311
If an attacker can control the contents of the system PATH, they are able to influence what commands are run in subsequent steps of the same job.
1412

15-
## Recommendations
13+
## Recommendation
1614

1715
Do not allow untrusted data to influence the system PATH: Avoid using untrusted data sources (e.g., artifact content) to define the system PATH.
1816

19-
## Examples
17+
## Example
2018

2119
### Incorrect Usage
2220

actions/ql/src/Security/CWE-077/EnvVarInjectionCritical.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
# Environment Variable Injection
2-
3-
## Description
1+
## Overview
42

53
GitHub Actions allow to define environment variables by writing to a file pointed to by the `GITHUB_ENV` environment variable:
64

@@ -37,7 +35,7 @@ steps:
3735

3836
If an attacker can control the values assigned to environment variables and there is no sanitization in place, the attacker will be able to inject additional variables by injecting new lines or `{delimiters}`.
3937

40-
## Recommendations
38+
## Recommendation
4139

4240
1. **Do not allow untrusted data to influence environment variables**:
4341

@@ -64,7 +62,7 @@ If an attacker can control the values assigned to environment variables and ther
6462
} >> "$GITHUB_ENV"
6563
```
6664

67-
## Examples
65+
## Example
6866

6967
### Example of Vulnerability
7068

actions/ql/src/Security/CWE-077/EnvVarInjectionMedium.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
# Environment Variable Injection
2-
3-
## Description
1+
## Overview
42

53
GitHub Actions allow to define environment variables by writing to a file pointed to by the `GITHUB_ENV` environment variable:
64

@@ -37,7 +35,7 @@ steps:
3735

3836
If an attacker can control the values assigned to environment variables and there is no sanitization in place, the attacker will be able to inject additional variables by injecting new lines or `{delimiters}`.
3937

40-
## Recommendations
38+
## Recommendation
4139

4240
1. **Do not allow untrusted data to influence environment variables**:
4341

@@ -64,7 +62,7 @@ If an attacker can control the values assigned to environment variables and ther
6462
} >> "$GITHUB_ENV"
6563
```
6664

67-
## Examples
65+
## Example
6866

6967
### Example of Vulnerability
7068

actions/ql/src/Security/CWE-094/CodeInjectionCritical.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
1-
# Code Injection in GitHub Actions
2-
3-
## Description
1+
## Overview
42

53
Using user-controlled input in GitHub Actions may lead to code injection in contexts like _run:_ or _script:_.
64

75
Code injection in GitHub Actions may allow an attacker to exfiltrate any secrets used in the workflow and the temporary GitHub repository authorization token. The token may have write access to the repository, allowing an attacker to make changes to the repository.
86

9-
## Recommendations
7+
## Recommendation
108

119
The best practice to avoid code injection vulnerabilities in GitHub workflows is to set the untrusted input value of the expression to an intermediate environment variable and then use the environment variable using the native syntax of the shell/script interpreter (that is, not _${{ env.VAR }}_).
1210

1311
It is also recommended to limit the permissions of any tokens used by a workflow such as the GITHUB_TOKEN.
1412

15-
## Examples
13+
## Example
1614

1715
### Incorrect Usage
1816

actions/ql/src/Security/CWE-094/CodeInjectionMedium.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
1-
# Code Injection in GitHub Actions
2-
3-
## Description
1+
## Overview
42

53
Using user-controlled input in GitHub Actions may lead to code injection in contexts like _run:_ or _script:_.
64

75
Code injection in GitHub Actions may allow an attacker to exfiltrate any secrets used in the workflow and the temporary GitHub repository authorization token. The token may have write access to the repository, allowing an attacker to make changes to the repository.
86

9-
## Recommendations
7+
## Recommendation
108

119
The best practice to avoid code injection vulnerabilities in GitHub workflows is to set the untrusted input value of the expression to an intermediate environment variable and then use the environment variable using the native syntax of the shell/script interpreter (that is, not _${{ env.VAR }}_).
1210

1311
It is also recommended to limit the permissions of any tokens used by a workflow such as the GITHUB_TOKEN.
1412

15-
## Examples
13+
## Example
1614

1715
### Incorrect Usage
1816

actions/ql/src/Security/CWE-1395/UseOfKnownVulnerableAction.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
# Use of Actions with known vulnerabilities
2-
3-
## Description
1+
## Overview
42

53
The security of the workflow and the repository could be compromised by GitHub Actions workflows that utilize GitHub Actions with known vulnerabilities.
64

7-
## Recommendations
5+
## Recommendation
86

97
Either remove the component from the workflow or upgrade it to a version that is not vulnerable.
108

actions/ql/src/Security/CWE-275/MissingActionsPermissions.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
# Actions Job and Workflow Permissions are not set
2-
3-
## Description
1+
## Overview
42

53
If a GitHub Actions job or workflow has no explicit permissions set, then the repository permissions are used. Repositories created under organizations inherit the organization permissions. The organizations or repositories created before February 2023 have the default permissions set to read-write. Often these permissions do not adhere to the principle of least privilege and can be reduced to read-only, leaving the `write` permission only to a specific types as `issues: write` or `pull-requests: write`.
64

7-
## Recommendations
5+
## Recommendation
86

97
Add the `permissions` key to the job or the root of workflow (in this case it is applied to all jobs in the workflow that do not have their own `permissions` key) and assign the least privileges required to complete the task:
108

actions/ql/src/Security/CWE-285/ImproperAccessControl.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
# Improper Access Control
2-
3-
## Description
1+
## Overview
42

53
Sometimes labels are used to approve GitHub Actions. An authorization check may not be properly implemented, allowing an attacker to mutate the code after it has been reviewed and approved by label.
64

7-
## Recommendations
5+
## Recommendation
86

97
When using labels, make sure that the code cannot be modified after it has been reviewed and the label has been set.
108

11-
## Examples
9+
## Example
1210

1311
### Incorrect Usage
1412

actions/ql/src/Security/CWE-312/ExcessiveSecretsExposure.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
# Excessive Secrets Exposure
2-
3-
## Description
1+
## Overview
42

53
When the workflow runner cannot determine what secrets are needed to run the workflow, it will pass all the available secrets to the runner including organization and repository secrets. This violates the least privileged principle and increases the impact of a potential vulnerability affecting the workflow.
64

7-
## Recommendations
5+
## Recommendation
86

97
Only pass those secrets that are needed by the workflow. Avoid using expressions such as `toJSON(secrets)` or dynamically accessed secrets such as `secrets[format('GH_PAT_%s', matrix.env)]` since the workflow will need to receive all secrets to decide at runtime which one needs to be used.
108

11-
## Examples
9+
## Example
1210

1311
### Incorrect Usage
1412

0 commit comments

Comments
 (0)