Skip to content

GitHub App: remove token after cloning #12202

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
stsewd opened this issue May 22, 2025 · 1 comment · May be fixed by #12217
Open

GitHub App: remove token after cloning #12202

stsewd opened this issue May 22, 2025 · 1 comment · May be fixed by #12217
Labels
Needed: documentation Documentation is required

Comments

@stsewd
Copy link
Member

stsewd commented May 22, 2025

What's the problem this feature will solve?

When cloning a private repository, we generate a token with read-only access, with the "contents" permission (https://docs.github.com/en/rest/authentication/permissions-required-for-github-apps?apiVersion=2022-11-28#repository-permissions-for-contents). But GH by default also grants "Metadata" access (https://docs.github.com/en/rest/authentication/permissions-required-for-github-apps?apiVersion=2022-11-28#repository-permissions-for-metadata).

Having metadata access, gives the token access to things like querying the events of the repository, collaborators, comments done in a commit, and more, which feels leaky.

Describe the solution you'd like

Maybe remove the token after doing the clone. But this will mean users can't interact with the repository in the "post_checkout" step. We have several examples that rely on having access to the repository in that step (like unshallowing the repo).

Alternative solutions

Just document that behavior, and warn users that if they have a private repo, they should be aware of this and don't show the token on the build if they have a public version, and that anyone who can open a PR on the repository may be able to leak the token.

Additional context

#12115

@stsewd stsewd added the Needed: design decision A core team decision is required label May 22, 2025
@humitos
Copy link
Member

humitos commented May 28, 2025

We discussed about maybe just documenting this for now and opened an issue to eventually obfuscate them from build output logs https://github.com/readthedocs/readthedocs-corporate/issues/2004

@humitos humitos added Needed: documentation Documentation is required and removed Needed: design decision A core team decision is required labels May 28, 2025
@stsewd stsewd linked a pull request Jun 2, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needed: documentation Documentation is required
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants