Why does CodeRabbit need write access to the git repo? Why doesn't Github let me limit it's access?
Because it has the ability to write tests for the PR in question.
How we exploited CodeRabbit: From simple PR to RCE and write access on 1M repos
21–30 of 244 posts
Re: How we exploited CodeRabbit: From simple PR to RCE and write access on 1M repos
#22Based on the env vars seems like they're using anthropic, openai, etc. only?
Re: How we exploited CodeRabbit: From simple PR to RCE and write access on 1M repos
#23I did not understand something: why did CodeRabbit run external tools on external code within its own set of environment variables? Why are these variables needed for this entire tooling?
They are not. The Github API secret key should never be exposed in the environment, period; you're supposed to keep the key in an HSM and only use it to sign the per-repo access token. Per the GH docs [0]:
> The private key is the single most valuable secret for a GitHub App. Consider storing the key in a key vault, such as Azure Key Vault, and making it sign-only. This helps ensure that you can't lose the private key. Once the private key is uploaded to the key vault, it can never be read from there. It can only be used to sign things, and access to the private key is determined by your infrastructure rules.
> Alternatively, you can store the key as an environment variable. This is not as strong as storing the key in a key vault. If an attacker gains access to the environment, they can read the private key and gain persistent authentication as the GitHub App.
[0]: https://docs.github.com/en/apps/creating-github-apps/authent...
Re: How we exploited CodeRabbit: From simple PR to RCE and write access on 1M repos
#24Earlier quoted context omitted.
Because it has the ability to write tests for the PR in question.
Then it should open a PR for those tests so it can go through the normal CI and review process.
Re: How we exploited CodeRabbit: From simple PR to RCE and write access on 1M repos
#25if you want to learn how CodeRabbit does the isolation, here's a blog post about how: https://cloud.google.com/blog/products/ai-machine-learning/h...
Re: How we exploited CodeRabbit: From simple PR to RCE and write access on 1M repos
#26Re: How we exploited CodeRabbit: From simple PR to RCE and write access on 1M repos
#27Earlier quoted context omitted.
Then it should open a PR for those tests so it can go through the normal CI and review process.
It updates the existing PR with the tests, I believe. They'd still get reviewed and go through CI.
Re: How we exploited CodeRabbit: From simple PR to RCE and write access on 1M repos
#28i believe the answer here was to exchange the token for something scoped to the specific repo coderabbit is running in, but alas, that doesn't remove the "RCE" _on_ the repo
Re: How we exploited CodeRabbit: From simple PR to RCE and write access on 1M repos
#29hey, this is Howon from CodeRabbit here. we wish to note that this RCE was reported and fixed in January. it was entirely prospective and no customer data was affected. we have extensive sandboxing for basically any execution of anything now, including any and every tool and all generated code of any kind under the CodeRabbit umbrella. if you want to learn how CodeRabbit does the isolation, here's a blog post about h…
Re: How we exploited CodeRabbit: From simple PR to RCE and write access on 1M repos
#30hey, this is Howon from CodeRabbit here. we wish to note that this RCE was reported and fixed in January. it was entirely prospective and no customer data was affected. we have extensive sandboxing for basically any execution of anything now, including any and every tool and all generated code of any kind under the CodeRabbit umbrella. if you want to learn how CodeRabbit does the isolation, here's a blog post about h…