Skip to content

Commit 126ddc3

Browse files
authored
Update manage-encrypted-secrets.md
1 parent ddc1a1a commit 126ddc3

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

learn-pr/github/manage-github-actions-enterprise/includes/manage-encrypted-secrets.md

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
Secrets are encrypted environment variables that store tokens, credentials, and other sensitive information. Your GitHub Actions workflows and actions can use these secrets when needed. Once created, secrets become accessible to workflows and actions that have permission to access the organization, repository, or environment where the secrets are defined.
22

3-
This section explains how to manage encrypted secrets using tools and strategies in GitHub Enterprise Cloud and GitHub Enterprise Server. You'll also learn how to use these secrets within your workflows and actions.
3+
This section explains how to manage encrypted secrets using tools and strategies in GitHub Enterprise Cloud and GitHub Enterprise Server. You also learn how to use these secrets within your workflows and actions.
44

55
## Manage encrypted secrets in the enterprise
66

7-
GitHub Actions lets you securely store and use sensitive data—such as API keys, authentication tokens, passwords, and certificates—through **encrypted secrets**. These secrets are securely stored and injected into workflows. This ensures they do not appear in logs or source code.
7+
GitHub Actions lets you securely store and use sensitive data—such as API keys, authentication tokens, passwords, and certificates—through **encrypted secrets**. These secrets are securely stored and injected into workflows. This design ensures they do not appear in logs or source code.
88

99
In an enterprise environment, effective secret management is critical. It helps maintain security, meet compliance requirements, and support operational efficiency. GitHub allows you to manage secrets at four levels: **enterprise**, **organization**, **repository**, and **environment**.
1010

@@ -17,7 +17,7 @@ Understanding the **scope** of secrets is essential for managing them securely i
1717
| **Enterprise-Level Secrets** | Apply to all repositories in a GitHub Enterprise Cloud organization. | Enterprise owners, security administrators | Share credentials across multiple repositories. |
1818
| **Organization-Level Secrets** | Apply to all repositories in an organization; optionally limit to selected repositories. | Organization owners, security administrators | Access cloud services and shared databases. |
1919
| **Repository-Level Secrets** | Apply only to a single repository. | Repository administrators, workflow runners | Secure credentials for deployment in one repository. |
20-
| **Environment-Level Secrets** | Apply to specific deployment environments within a repository (e.g., `staging`, `production`). | Workflow runners in the specified environment | Separate credentials by deployment environment. |
20+
| **Environment-Level Secrets** | Apply to specific deployment environments within a repository, such as staging or production. | Workflow runners in the specified environment | Separate credentials by deployment environment. |
2121

2222
**Key considerations:**
2323

@@ -118,7 +118,7 @@ steps:
118118
**Pass** the secret as an input parameter to the action. This method is commonly used when the action explicitly defines inputs in its `action.yml`.
119119

120120
- **Use `env`:**
121-
**Expose** the secret as an environment variable to the step. This is useful when the command in the step or a script inside the action expects an environment variable.
121+
**Expose** the secret as an environment variable to the step. This approach is useful when the command in the step or a script inside the action expects an environment variable.
122122

123123
### In Actions
124124

@@ -148,23 +148,23 @@ const token = core.getInput('super_secret');
148148

149149
## Configure security hardening for GitHub Actions
150150

151-
Security hardening for GitHub Actions plays a role in keeping your software supply chain secure. The following sections will walk you through recommended practices to strengthen the security of the actions you use in your workflows.
151+
Security hardening for GitHub Actions plays a role in keeping your software supply chain secure. The following sections walk you through recommended practices to strengthen the security of the actions you use in your workflows.
152152

153153
### Identify best practices for mitigating script injection attacks
154154

155155
Some best practices for mitigating script injection attacks on GitHub actions include:
156156

157157
1. *Use javascript actions instead of inline scripts*: Use JavaScript actions that accept context values as arguments instead of embedding those values in inline scripts. This approach reduces the risk of script injection because the context data is not used to generate or execute shell commands directly.
158158

159-
In the example below, passing a variable as an input to a JavaScript action helps prevent it from being used in a script injection attack.
159+
Passing a variable as an input to a JavaScript action helps prevent it from being used in a script injection attack.
160160

161161
```yml
162162
uses: fakeaction/checktitle@v3
163163
with:
164164
title: ${{ github.event.pull_request.title }}
165165
```
166166

167-
2. *Use intermediate environment variables in inline scripts*: When using inline scripts, evaluate variables as environment variables before using them in commands. This ensures the values are resolved before the script runs, reducing the risk of script injection.
167+
2. *Use intermediate environment variables in inline scripts*: When using inline scripts, evaluate variables as environment variables before using them in commands. This approach ensures the values are resolved before the script runs, reducing the risk of script injection.
168168
For example, using `github.event.pull_request.title` as an environment variable helps protect against injection vulnerabilities:
169169

170170
```yml
@@ -187,7 +187,7 @@ For example, using `github.event.pull_request.title` as an environment variable
187187
3. **Leverage workflow templates to implement code scanning**:
188188
**Navigate** to the repository’s **Actions** tab and select the **New Workflow** button on the left pane. On the **Choose a workflow** page, **locate** the **Security** section to access and apply workflow templates.
189189

190-
**Configure** the CodeQL scanner to run on specific events, enabling it to scan a branch's files and flag exposures (CWEs) in actions used within workflows, including vulnerabilities such as script injection.
190+
Configure the CodeQL scanner to run on specific events, enabling it to scan a branch's files and flag exposures CWEs(Common Weakness Enumerations) in actions used within workflows, including vulnerabilities such as script injection.
191191

192192
:::image type="content" source="../media/manage-encrypted-secrets_newworkflow.png" alt-text="Screenshot showing the creation of a new GitHub Actions workflow for managing encrypted secrets." border="false":::
193193

@@ -200,7 +200,7 @@ For example, using `github.event.pull_request.title` as an environment variable
200200
Follow these best practices to safely incorporate third-party actions into your workflows:
201201

202202
1. **Pin actions to a tag only if the author is trusted**
203-
Use version tags (e.g., `@v4`) only when the action's author is verified and trusted. This helps reduce the risk of unexpected changes in future releases.
203+
Use version tags such as `v1` or `v2`, only when the action's author is verified and trusted. This action helps reduce the risk of unexpected changes in future releases.
204204

205205
```yml
206206
- name: Checkout
@@ -223,7 +223,7 @@ Follow these best practices to safely incorporate third-party actions into your
223223
Use trusted actions to reduce risk in your workflows.
224224

225225
- **Look for the Verified badge:**
226-
Trustworthy actions appear in the GitHub Marketplace and display a **Verified creator** badge next to the title. This means the creator has been verified by GitHub.
226+
Trustworthy actions appear in the GitHub Marketplace and display a **Verified creator** badge next to the title informing you that the creator has been verified by GitHub.
227227

228228
- **Check documentation:**
229229
The `action.yml` file should be well documented and clearly describe how the action works.
@@ -283,18 +283,18 @@ Applying the principle of least privilege to the token’s permissions helps red
283283

284284
### Managing cross-repository access
285285

286-
When workflows require access to multiple repositories, it's important to choose credentials that minimize security risks. Below are the recommended options, listed from most to least preferred.
286+
When workflows require access to multiple repositories, it's important to choose credentials that minimize security risks. Some of the recommended options listed from most to least preferred include:
287287

288288
1. **`GITHUB_TOKEN`**
289289

290-
The `GITHUB_TOKEN` is automatically generated by GitHub for each workflow run. It is scoped to the single repository that triggers the workflow and provides permissions equivalent to a write-access user on that repository. The token is created at the start of each job and expires when the job completes.
290+
GitHub automatically generates the `GITHUB_TOKEN` for each workflow run. It is scoped to the single repository that triggers the workflow and provides permissions equivalent to a write-access user on that repository. The token is created at the start of each job and expires when the job completes.
291291

292292
Use the `GITHUB_TOKEN` whenever possible for secure and scoped authentication.
293293
For details, see [Automatic token authentication](https://docs.github.com/en/actions/security-for-github-actions/security-guides/automatic-token-authentication).
294294

295295
2. **Repository deploy key**
296296

297-
Deploy keys provide read or write access to a single repository and can be used within workflows to clone or push using Git.
297+
To clone or push using Git within workflows, use deploy keys that provide read or write access to a single repository.
298298

299299
However, deploy keys do not support access to GitHub's REST or GraphQL APIs. Use them only when API access is not required and Git access is sufficient.
300300

@@ -315,7 +315,7 @@ Note: This approach is difficult to scale and is best avoided in favor of deploy
315315

316316
5. **SSH keys on personal accounts**
317317

318-
Never use SSH keys from personal accounts in workflows. Like classic PATs, they grant access to all repositories associated with the account, including personal and organizational repositories. This exposes workflows to unnecessary risk.
318+
Never use SSH keys from personal accounts in workflows. Like classic PATs, they grant access to all repositories associated with the account, including personal and organizational repositories. This mistake exposes workflows to unnecessary risk.
319319

320320
If your use case involves cloning or pushing via Git, consider using deploy keys instead. They provide scoped access without exposing unrelated repositories or requiring personal credentials.
321321

@@ -333,11 +333,11 @@ Artifact attestations help establish the provenance of builds, improving softwar
333333

334334
#### What to attest
335335

336-
With GitHub Actions, you can attest to build provenance & SBOM's for binaries and container images.
336+
With GitHub Actions, you can attest to build provenance & SBOM's (Software Bill of Materials) for binaries and container images.
337337

338338
#### Generating artifact attestations for builds
339339

340-
When you generate an artifact attestation for builds you must ensure:
340+
When you generate an artifact attestation for builds, you must ensure:
341341

342342
* You have the appropriate permissions configured in the workflow
343343
* You have included a step in your workflow that uses the [attest-build-provenance](https://github.com/actions/attest-build-provenance) action.
@@ -364,7 +364,7 @@ The attestation establishes build provenance. You can view attestations in the r
364364
subject-path: 'PATH/TO/ARTIFACT'
365365
```
366366

367-
Note that the value of the `subject-path` parameter should be set to the path to the binary you will attest.
367+
>Note that the value of the `subject-path` parameter is set to the path of the binary you attest.
368368

369369
##### Generating an attestation for the build provenance of container images
370370

@@ -378,7 +378,7 @@ Note that the value of the `subject-path` parameter should be set to the path to
378378
packages: write
379379
```
380380

381-
2. Add this step after the container image has been built:
381+
2. Add this step after you build the container image:
382382

383383
```yml
384384
- name: Generate artifact attestation
@@ -395,11 +395,11 @@ Note that the value of the `subject-path` parameter should be set to the path to
395395

396396
#### Generating attestations for SBOMs
397397

398-
You have the ability to generate SBOM attestions for an SBOM. To generate and attest to an SBOM you must perform the following:
398+
You have the ability to generate SBOM attestions for an SBOM. To generate and attest to an SBOM you must carry out the following steps:
399399

400-
* Ensure you have set the appropriate permissions in the workflow (see examples below).
401-
* You must generate an SBOM for the artifact in a step in the workflow. For an example, see anchore-sbom-action in the GitHub Marketplace.
402-
* Include a step in your workflow that uses the attest-sbom action (see examples below)
400+
- Ensure you set the appropriate permissions in the workflow, as shown in the examples.
401+
- You must generate an SBOM for the artifact in a step in the workflow. For an example, see anchore-sbom-action in the GitHub Marketplace.
402+
- Include a step in your workflow that uses the attest-sbom action (see examples below)
403403

404404
##### Generating an SBOM attestation for binaries
405405

@@ -504,7 +504,7 @@ Many enterprises integrate GitHub Actions with external secret management soluti
504504
secret: secret/data/github/my-secret
505505
```
506506

507-
### 2. AWS Secrets Manager
507+
### 2. AWS (Amazon Web Services) Secrets Manager
508508
```yaml
509509
- name: Retrieve AWS Secret
510510
run: |

0 commit comments

Comments
 (0)