Skip to content
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

[results-processor] Provide GitHub token for api.github.com #4025

Conversation

gsnedders
Copy link
Member

@gsnedders gsnedders commented Oct 1, 2024

Sometimes (e.g., from GitHub Actions), we might get passed a URL to process which on api.github.com, which requires a token to access. Thus, we should pull down our GitHub token and add that as a header.

See also #4020, which this hopefully fixes.

results-processor/processor.py Dismissed Show resolved Hide resolved
results-processor/processor.py Dismissed Show resolved Hide resolved
Copy link
Collaborator

@jcscottiii jcscottiii left a comment

Choose a reason for hiding this comment

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

This is my first time really digging into the processor code.

LGTM with some nits.

@@ -112,6 +112,14 @@ def known_extension(path):
return e
return None

def _secret(self, token_name):
key = self.datastore.key('Token', token_name)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think all paths that trigger this code are guarded by _internal_only. Which ensures that '/api/results/process' is only called by the task queue. So we are good. But any other code starts to use this in the future, we probably want to have some more control over reading this secret when hitting '/api/results/process'. Or at least some more logging to tell help.

The other thing that helps: We are only doing GET requests with the token, so the damage is limited.

Copy link
Member Author

Choose a reason for hiding this comment

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

Figuring out how to pass that through to the processor (which doesn't inherently rely on Flask/main/etc. today) seems kinda difficult. We can certainly add logging, though?

Copy link
Collaborator

@jcscottiii jcscottiii Oct 8, 2024

Choose a reason for hiding this comment

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

Can you add a follow up issue for this? We can address that part later.

Something around logging which uploader is accessing the secret.

After you add the issue and the lint errors, feel free to merge.

Copy link
Member Author

Choose a reason for hiding this comment

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

Filed #4044

results-processor/processor.py Dismissed Show resolved Hide resolved
results-processor/processor.py Dismissed Show resolved Hide resolved
results-processor/processor.py Outdated Show resolved Hide resolved
results-processor/processor.py Outdated Show resolved Hide resolved
results-processor/processor.py Outdated Show resolved Hide resolved
@gsnedders gsnedders force-pushed the results-processor-github-api-token branch from 48512b3 to f2b7494 Compare October 7, 2024 22:04
Sometimes (e.g., from GitHub Actions), we might get passed a URL to
process which on api.github.com, which requires a token to access.
Thus, we should pull down our GitHub token and add that as a header.
@gsnedders gsnedders force-pushed the results-processor-github-api-token branch from f2b7494 to ff7d947 Compare October 10, 2024 01:16
@gsnedders
Copy link
Member Author

I haven't had the time to investigate, but it looks like the web_components_test CI job is just constantly failing now?

@gsnedders
Copy link
Member Author

I haven't had the time to investigate, but it looks like the web_components_test CI job is just constantly failing now?

Filed #4046 for this; I'm just going to land this despite the failing check because it's pre-existing.

@gsnedders gsnedders merged commit 20fa6f9 into web-platform-tests:main Oct 10, 2024
11 of 12 checks passed
@gsnedders gsnedders deleted the results-processor-github-api-token branch October 10, 2024 19:25
@gsnedders
Copy link
Member Author

https://staging.wpt.fyi/status seems to show everything getting stuck as WPTFYI_PROCESSING, though not showing up as empty any more. But probably time to go back to #4020 to analyse what's going on?

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