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

id-token: write not available on pull_requests #131

Open
ianlewis opened this issue May 30, 2022 · 11 comments
Open

id-token: write not available on pull_requests #131

ianlewis opened this issue May 30, 2022 · 11 comments
Labels
area:library Issue with the base reusable Go library type:discussion A point of discussion

Comments

@ianlewis
Copy link
Member

Adding id-token: write to workflows triggered by pull_request events doesn't seem to be allowed.

This seems a bit problematic that we would expect that folks only run our workflow when a tagged. I can imagine folks would run into issues if they only exercise the workflows when releasing new versions as there would be significant time and changes to their repo in between releases. If the builders don't run on pull_request it will be hard to ensure that new code works with the reusable workflows.

For comparison, go-releaser's example workflow runs on pull_request.
https://github.com/goreleaser/goreleaser-action#workflow

@ianlewis ianlewis added type:discussion A point of discussion area:library Issue with the base reusable Go library labels May 30, 2022
@ianlewis
Copy link
Member Author

Related #124

@laurentsimon
Copy link
Collaborator

laurentsimon commented May 31, 2022

Goreleaser works on PR but they cannot sign with keys, because the keys need to be stored in secrets that are not available on PRs.

To have access to the secrets or OIDC tokens, we could support pull_request_target instead.

@ianlewis are you suggesting we support PRs and not output provenance in this case (to be on par with Goreleaser)?

@ianlewis
Copy link
Member Author

@laurentsimon I'm not actually sure what's best right now. I just think we probably need to support PRs in some capacity even if we don't sign provenance because it would introduce differences between how building in PR pre-submits work and how it works on releases. I think it may be a future point of user friction.

Like for example, maybe just running the builder on PRs is the right way to go?

@laurentsimon
Copy link
Collaborator

laurentsimon commented Jun 1, 2022

I think that's fine, yes. I considered this to be low priority for v1, and wanted to see if we get push back from people. We can tackle this in the next iteration. Wdut?

@ianlewis
Copy link
Member Author

ianlewis commented Jun 3, 2022

I think that's fine, yes. I considered this to be low priority for v1, and wanted to see if we get push back from people. We can tackle this in the next iteration. Wdut?

I agree. I haven't included it in the v1 milestone.

@ianlewis
Copy link
Member Author

ianlewis commented Jun 3, 2022

As an aside, we currently use the NilClientProvider for pull requests which returns nil for both the OIDC and GitHub clients, but we should still be able to use the GitHub API in pull requests as it uses github.token for auth.
https://docs.github.com/en/actions/security-guides/automatic-token-authentication#permissions-for-the-github_token

That should allow us to set the invocation entry point properly and not have special code for that.

@laurentsimon
Copy link
Collaborator

+1, we can do that.

@ianlewis
Copy link
Member Author

ianlewis commented Jun 9, 2022

We can also look into supporting the pull_request_target event which may allow us to get the right permissions because it runs using workflow code at the base ref of the PR.

@laurentsimon
Copy link
Collaborator

agreed, that's the way to support pull requests if we need to.

@laurentsimon
Copy link
Collaborator

thinking more about this, it may be more complicated than it seems. The OIDC token will contain information from the repo at HEAD: repo name, commit hash, etc, not the PR's repo's information.

@ianlewis
Copy link
Member Author

Related #358 which tracks support overall.

johnandersen777 pushed a commit to johnandersen777/scitt-api-emulator that referenced this issue Sep 12, 2023
Token is not available within pull_request context.

Related: slsa-framework/slsa-github-generator#131
Related: slsa-framework/slsa-github-generator#358
Signed-off-by: John Andersen <[email protected]>
johnandersen777 pushed a commit to johnandersen777/scitt-api-emulator that referenced this issue Sep 12, 2023
Token is not available within pull_request context.

Related: slsa-framework/slsa-github-generator#131
Related: slsa-framework/slsa-github-generator#358
Signed-off-by: John Andersen <[email protected]>
johnandersen777 pushed a commit to johnandersen777/scitt-api-emulator that referenced this issue Sep 12, 2023
Token is not available within pull_request context.

Related: slsa-framework/slsa-github-generator#131
Related: slsa-framework/slsa-github-generator#358
Signed-off-by: John Andersen <[email protected]>
johnandersen777 pushed a commit to johnandersen777/scitt-api-emulator that referenced this issue Sep 12, 2023
Token is not available within pull_request context.

Related: slsa-framework/slsa-github-generator#131
Related: slsa-framework/slsa-github-generator#358
Signed-off-by: John Andersen <[email protected]>
johnandersen777 pushed a commit to johnandersen777/scitt-api-emulator that referenced this issue Sep 12, 2023
Token is not available within pull_request context.

Related: slsa-framework/slsa-github-generator#131
Related: slsa-framework/slsa-github-generator#358
Signed-off-by: John Andersen <[email protected]>
johnandersen777 pushed a commit to johnandersen777/scitt-api-emulator that referenced this issue Sep 12, 2023
Token is not available within pull_request context.

Related: slsa-framework/slsa-github-generator#131
Related: slsa-framework/slsa-github-generator#358
Signed-off-by: John Andersen <[email protected]>
SteveLasker pushed a commit to scitt-community/scitt-api-emulator that referenced this issue Oct 18, 2023
* Add plugin helper entrypoint_style_load() to assist with loading auth middleware
* Add server CLI arg for Flask middleware loaded via entrypoint style load plugin helper
* OIDC auth middleware plugin
* Refactor test Service expose url with bound port to Flask app
* In preperation for use by flask test app used as OIDC endpoints
* Tests for OIDC based auth middleware
* Update pip, setuptools, wheel to avoid deprecation warning on dependency install.
* Example CI job for GitHub Actions OIDC authenticated notary
* Token is not available within pull_request context.
* Document OIDC authentication middleware usage with GitHub Actions
* Validation of OIDC claims via JSON schema validator

Related: slsa-framework/slsa-github-generator#131
Related: slsa-framework/slsa-github-generator#358
Related: actions/runner#2417 (comment)

Signed-off-by: John Andersen <[email protected]>
johnandersen777 pushed a commit to johnandersen777/scitt-api-emulator that referenced this issue Nov 23, 2023
…unity#31)

* Add plugin helper entrypoint_style_load() to assist with loading auth middleware
* Add server CLI arg for Flask middleware loaded via entrypoint style load plugin helper
* OIDC auth middleware plugin
* Refactor test Service expose url with bound port to Flask app
* In preperation for use by flask test app used as OIDC endpoints
* Tests for OIDC based auth middleware
* Update pip, setuptools, wheel to avoid deprecation warning on dependency install.
* Example CI job for GitHub Actions OIDC authenticated notary
* Token is not available within pull_request context.
* Document OIDC authentication middleware usage with GitHub Actions
* Validation of OIDC claims via JSON schema validator

Related: slsa-framework/slsa-github-generator#131
Related: slsa-framework/slsa-github-generator#358
Related: actions/runner#2417 (comment)

Signed-off-by: John Andersen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:library Issue with the base reusable Go library type:discussion A point of discussion
Projects
None yet
Development

No branches or pull requests

2 participants