Skip to content

Request Github token from Taskcluster's auth service - #825

Draft
ahal wants to merge 2 commits into
mozilla-releng:mainfrom
ahal:ahal/lnqrmntzxuxr
Draft

Request Github token from Taskcluster's auth service#825
ahal wants to merge 2 commits into
mozilla-releng:mainfrom
ahal:ahal/lnqrmntzxuxr

Conversation

@ahal

@ahal ahal commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@ahal ahal self-assigned this Sep 2, 2026
@ahal

ahal commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

This still needs:

  1. Testing
  2. Scopes granted to all the scriptworker clients for the auth service
  3. App to be installed in all repositories that need this

Though I might land this before steps 2 and 3 just to verify the fallback is working.

@ahal
ahal force-pushed the ahal/lnqrmntzxuxr branch from 56430bf to 94eff61 Compare September 2, 2026 18:04
Comment thread src/scriptworker/github.py Outdated
Comment thread src/scriptworker/cot/verify.py Outdated
Comment on lines -1213 to +1212
github_repo = GitHubRepository(owner=repo_definition["parent"]["owner"]["login"], repo_name=repo_definition["parent"]["name"], token=token)
github_repo = GitHubRepository(context, repo_definition["parent"]["owner"]["login"], repo_definition["parent"]["name"])

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this going to be a problem? If I open a PR from github.com/Eijebong/foo for github.com/mozilla-releng/foo, the task won't have scopes to get a read token for Eijebong/foo and the tc-auth token request will fail 100% of the time.
I'm not sure how we can do that but we probably want to use a read token minted for the parent repo and use that instead? AFAIK that'd work for public repos but not private ones though (although all fork commits are accessible on the parent directly, maybe that's enough to make this whole branch useless?).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking more about this, I think the private repo part of this is the same anyway since the token passed a secret wouldn't have access to it either

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch.

As implemented this won't be an immediate problem because we fallback to github_oauth_token if there's a problem fetching the token from the auth service.

But assuming the goal is to get rid of github_oauth_token, we'd need to implement something like this.

I'm thinking of leaving the github_oauth_token fallback for this PR, but add a comment to make sure we don't forget about the fork case when we eventually go to remove it?

Comment thread src/scriptworker/github.py Outdated
This is the first version that implements the auth service's ability to
hand out Github tokens.
@ahal
ahal force-pushed the ahal/lnqrmntzxuxr branch from 94eff61 to a01199e Compare September 8, 2026 14:59
…possible

If there's an error (e.g missing scopes or app not installed on the
target repo), we fallback to the existing github_oauth_token.
@ahal
ahal force-pushed the ahal/lnqrmntzxuxr branch from a01199e to 1afe69b Compare September 8, 2026 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants