Skip to content
This repository has been archived by the owner on May 2, 2024. It is now read-only.

give child processes access to all of process.env #19

Open
titaniumbones opened this issue May 5, 2020 · 5 comments
Open

give child processes access to all of process.env #19

titaniumbones opened this issue May 5, 2020 · 5 comments

Comments

@titaniumbones
Copy link

right now, it doesn't seem to be possible to pass additonal environment variables to one (or all) of the autograde tests. This is a bit of a limitation when we might want to use the same test suites for students and autograding, with environment parameters modulating the precise test outcome. Looks like this should be doable in the spawn function of runner.ts, but whe nI try to make the changes myself I run into errors. Sorry I can't provide working code.

@jeffrafter
Copy link
Contributor

Sorry for the slow reply! You're right that passing the env is possible in spawn, unfortunately restricting the environment is done for security reasons - for example if the student has access to the GitHub Actions environment they could craft code that would automatically pass the build, change the outcome of the tests, and in some cases modify the tamper-seals, etc.

Instead of restricting specific environment variables we went with a much more strict policy to be more future-proof. We could potentially allow-list specific variables or construct a configuration for that. Can you give a more specific example of which variables you would be looking for?

@titaniumbones
Copy link
Author

titaniumbones commented May 12, 2020 via email

@jeffrafter
Copy link
Contributor

I can look into the actor's GitHub user id. I think that would be reasonable and easy to add.

I want to check that there are at least n commits by the student, and maybe they the tree includes only instructor and GitHub user id commits

Can you clarify this?

@you06
Copy link

you06 commented Aug 5, 2021

As @jeffrafter says, the security issue can not be ignored, however, some variables need to be passed to the child process since they need them. e.g. I'm currently making a course that uses golang, this language requires inheriting GOROOT and HOME variables for its development environment. I did some hard code in my fork as a workaround.

What about an allow list config so that we can specify which variables can be passed to child processes?

@diamondburned
Copy link

diamondburned commented Dec 14, 2022

You're right that passing the env is possible in spawn, unfortunately restricting the environment is done for security reasons - for example if the student has access to the GitHub Actions environment they could craft code that would automatically pass the build, change the outcome of the tests, and in some cases modify the tamper-seals, etc.

Isn't this already possible? I'm not sure if GitHub Classroom has anything that verifies the author of commits made to .github. (I actually cannot verify that our university does this correctly, however I ended up having to write a custom solution to verify .github integrity. See this old GitHub Education Community post or this fairly-recent discussion).

I'm also making this comment as a +1: I currently rely on a few NIX_ environment variables, and the build tools don't work right without any of them.

Is it possible to make it configurable somewhere?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants