Skip to content

experiments: sandbox tool for code execution #26

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

justinsb
Copy link

@justinsb justinsb commented Jan 31, 2025

The sandbox executor will be useful for running untrusted / semi-trusted code.

It runs commands in a kubernetes pod, using an agent for efficiency.

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: justinsb
Once this PR has been reviewed and has the lgtm label, please assign mrbobbytables for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Jan 31, 2025
@justinsb
Copy link
Author

So I'm submitting this here as a first step towards creating tools to make maintainer's lives easier. cc @ameukam

This particular tool is basically a building block. The idea is to create a sandboxed executor that has no permissions (in particular, no github token). Then we can run scripts from repositories safely, and take the output and send it as a PR. The tool that drives that would be our second tool :-) And the goal is to run a script that lives in each repo, that updates the dependencies, and sends a PR. We need it for repos where dependabot simply doesn't work (in particular it seems to do badly for multi-module repos)

Of course once we have that functionality, repos can create more scripts to create PRs to do any toilsome task they want! And because they're PRs, worst case the outcome is PR spam.

@justinsb
Copy link
Author

The broader context is kubernetes/community#8297, and we're trying this here because of the consensus that (seemed to) arise around this being the right repo (thanks @dims ! )


# TODO: Compile ourselves?
RUN mkdir -p /opt/protoc
RUN wget -N -O /opt/protoc.zip https://github.com/protocolbuffers/protobuf/releases/download/v3.12.4/protoc-3.12.4-linux-x86_64.zip
Copy link
Member

Choose a reason for hiding this comment

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

We make the assumption we run locally this on x86 CPUs and exclude ARM environments. Maybe add more parameters to handle at least {linux,darwin} ?
Happy to do it as a follow-up PR

Copy link
Author

Choose a reason for hiding this comment

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

Yes, that's a good call. Maybe compiling it ourselves is a good option from that perspective also! (It should get cached after the first docker buildx)

The sandbox executor will be useful for running untrusted / semi-trusted code.

It runs commands in a kubernetes pod, using an agent for efficiency.
@justinsb
Copy link
Author

justinsb commented Feb 7, 2025

Tweaked to build protoc from source, TBH I like that better than depending on a binary anyway. It's somewhat slower the first time, but not catastrophically slow IMO.

Comment on lines +35 to +37
# Load the image into kind
echo "Loading image into kind"
kind load docker-image ${AGENT_IMAGE}
Copy link
Member

Choose a reason for hiding this comment

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

Maybe create a KIND cluster before ?

Copy link
Author

Choose a reason for hiding this comment

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

I'll do a follow on PR to run the e2e in GHA

Copy link
Author

Choose a reason for hiding this comment

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

Created #27

@Priyankasaggu11929
Copy link
Member

/hold

Per kubernetes/community#8297 (comment)

cc: @kubernetes-sigs/sig-contributor-experience-leads,
cc: SIG Testing leads (@aojea @BenTheElder @jbpratt @michelle192837 @pohly @xmcqueen)

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 17, 2025
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Mark this PR as fresh with /remove-lifecycle stale
  • Close this PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label May 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants