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

Build without write permissions #82

Open
lazka opened this issue Oct 23, 2023 · 2 comments
Open

Build without write permissions #82

lazka opened this issue Oct 23, 2023 · 2 comments

Comments

@lazka
Copy link
Member

lazka commented Oct 23, 2023

This would be a large change. To avoid package builds gaining write permissions to the GH assets we currently clean out the env, so they can't get to the token easily (

def clean_environ(environ: Dict[str, str]) -> Dict[str, str]:
"""Returns an environment without any CI related variables.
This is to avoid leaking secrets to package build scripts we call.
While in theory we trust them this can't hurt.
"""
new_env = environ.copy()
for key in list(new_env):
if key.startswith(("GITHUB_", "RUNNER_")):
del new_env[key]
return new_env
). But that's not bullet proof.

Ideally we would separate the third party code into an environment that doesn't have write permissions.

@lazka
Copy link
Member Author

lazka commented Jan 17, 2024

In theory https://github.com/actions/toolkit/tree/main/packages/artifact#v2---whats-new would allow us to upload packages for the job without write permissions, and other jobs could iterate all other active jobs in addition to the assets. From what I see we would need to shell out to JS though to upload artifacts though, as the API isn't publicly documented.

@lazka
Copy link
Member Author

lazka commented Oct 27, 2024

Another option would be to:

  • keep built files locally
  • upload as job artifact at the end
  • have one more job in the end that only uploads to assets

Downside being it would build various things twice potentially

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

No branches or pull requests

1 participant