-
Notifications
You must be signed in to change notification settings - Fork 10
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
Tokenless support in the new CLI (for public repos and forks) #112
Comments
See: https://github.com/codecov/codecov-action/issues/1087 Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
see https://github.com/codecov/codecov-action/issues/1087 Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
@toddbaert this is a known and yet unsolved problem. We are investigating GitHub's OIDC to see if this will be a suitable replacement for token-less uploading (including forks) |
This reverts commit db9c0c3. Relates to codecov/codecov-action#1087
@thomasrockhu-codecov Thanks! For now we'll stick to v3! Happy to help you folks test v4 if you have a proposed solution for forks at some point. Should I close this issue? |
@toddbaert let's leave it open for now so that anyone watching will get an update if OIDC is the way to go for forks. For everyone else, you can add the
|
Yep, looks like there's some linked PRs/issues, so probably good to keep it open until there's a solution for forks. Thanks again! |
But this still requires changing |
There's an ongoing issue with v4. https://github.com/codecov/codecov-action/issues/1087 Signed-off-by: Michael Beemer <beeme1mr@users.noreply.github.com>
Revert to CodeCov v3 There's an ongoing issue with v4. https://github.com/codecov/codecov-action/issues/1087 Signed-off-by: Michael Beemer <beeme1mr@users.noreply.github.com>
Please note codecov v3 doesn't seem to work anymore. |
So I managed to fix this on my own CI. Somehow, the current behavior is completely undocumented but this is pretty simple.
Actually, codecov@v4 action detect forked workflow and use tokenless automatically in the case, even if a token is specified, the codecov output will tell you:
So here is how it looks in my CI:
hth |
@mwestphal - thanks for writing in, this was indeed documented before at https://docs.codecov.com/docs/codecov-uploader#supporting-tokenless-uploads. I am going to try to augment the docs with more detail, and also make this more prominent in the readme for the action |
Indeed, thanks for pointing out the doc!
I think this is why I missed it. The doc you linked is massive. I should have searched there for "tokenless" but I did not. |
I've started adding tokens to organisations. Unfortunately, my projects tend to be:
Is there a way to add a token to a personal account so it can be used by all repos, similar to adding an an org-level? What are the downsides of adding tokens in some shared plaintext file? |
For the following use-cases
you can grab the global upload token and either
For
see if you can access the settings page in the codecov UI for the repo (https://app.codecov.io/gh//settings If yes, then you can grab the token and
Re
If you are doing this to ensure uploads from forks are not impacted, this should largely already be in place see above and docs. As for risks, sharing your token means others can upload phony coverage and blow away your data. |
Thanks, I'll try these out.
I use the GitHub Action. Can an environment secret be set in my user account for all my repos, or does it need repeating for each repo at |
@rohan-at-sentry: correct, it's a really horrible idea to imagine secrets at an account level because people tend to willy-nilly fork repositories into their account, which is just inviting repositories to be written such that when they're forked they steal user's secrets. Instead anyone interested in doing things should create their own (single-account) org, and move/fork things from their account to their org. A nice benefit is that organizations also give you the ability to see current runners (you can't do that for actions running in repositories in your user account...). |
@jsoref exactly! |
Forcing a move to an org is a pretty unacceptable ask for codecov usability, though - while it sucks that GitHub treats user-owned repos as second-class, user-owned repos need love too :-) |
I agree, - to be clear I'm not advocating for user-owned repos to move to orgs (and I can see how my response could be interpreted that way). |
In theory, OIDC is the right way to go...
I'm not strongly advocating for using orgs, but I personally have moved to doing most of my work in them because the security benefits and additional concurrent runners / visibility I get from runners make them worthwhile. |
The original intent of this issue was to see if OIDC would be a reasonable replacement. We have added OIDC support, so if you have it implemented, you will be able to use it for uploads. Currently, we are making some changes to tokenless uploading for forks. I believe in the next few days we should see huge improvements where most users (if not all) will be able to upload coverage on their PRs if they come from forks (without a token). This means that the Codecov step should not fail your CIs for this case. I'm going to close this issue for now as it's been a bit of time and I believe needs have changed since. Please open a new issue if you, by the end of this week, are not able to upload coverage to your projects on a fork. |
Are there reasons that OIDC can not be used for public repos? This issue is for both "public repos and forks". Is there a timeline for this or it's not planned at all? |
@harryzcy OIDC and tokenless are mutually exclusive. OIDC can be used on public repos. |
Hello! I've recently updated a number of projects in our org to use the latest versions of the codecov action.
I see now that the codecov CLI is used to power this action, and that it requires a token. No problem, I went and got the token for the repositories in question, and all seemed to work... until we got a PR from a fork (something that happens quite frequently in our case). This results in a problem: secrets aren't available in PRs from forks (unless we use the
pull_request_target
trigger, which would allow malicious actors to potentially exfiltrate our secret(s)).So my question is, as an open-source project, how am I supposed to use the new action? I want to run the coverage analysis on the new code (which is untrusted) but in order to do that, I need to run in a trusted environment to get access to the secret. Am I missing something? 🤔
The text was updated successfully, but these errors were encountered: