Skip to content

Commit c4b5bb7

Browse files
authored
PAT vs App - Update compiled-languages-go.md
1 parent 161974f commit c4b5bb7

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

troubleshooting/codeql-builds/compiled-languages-go.md

+12-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ There are two options when it comes to private repositories:
77
- Set-up the Go environment within the Actions workflow (not vendoring then)
88
- Vendor the dependencies
99

10-
Setting up the Go environment can be done by adding a Actions step to update the [Go settings](https://go.dev/ref/mod#private-modules) pointing them to use a [GitHub Personal Access Token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token) with the corresponding access to the private repository.
10+
Setting up the Go environment can be done by adding a Actions step to update the [Go settings](https://go.dev/ref/mod#private-modules) pointing them to use an access token (ex: [GitHub Personal Access Token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token)) with the corresponding access to the private repository.
1111
The example below shows how this can be done using a single step before the CodeQL Initize step - storing the GitHub PAT in an Actions Secret.
1212

1313
**Example:**
@@ -38,3 +38,14 @@ Alternatively, pass the token into the CodeQL init action to allow it to be used
3838
with:
3939
external-repository-token: ${{ secrets.GOLANG_GITHUB_TOKEN }}
4040
```
41+
42+
43+
The auto generated GITHUB_TOKEN is strictly scoped to the repository for security reasons.
44+
45+
To interact with higher level resources(other repositories, use GitHub Apps with shortlived tokens instead of Personal Acces Tokens. The GitHub action for it here https://github.com/actions/create-github-app-token described in the docs here https://github.com/actions/create-github-app-token
46+
47+
48+
This is better than a PAT for a few reasons:
49+
- The tokens are short lived.
50+
- The token can be scoped to specific places in the workflow at time of creation.
51+
- It isn’t associated to a user, it is associated to an app.

0 commit comments

Comments
 (0)