|
| 1 | +title: GitHub deploy keys with write access to repositories will be disabled |
| 2 | +date: July 1, 2025 |
| 3 | +description: SSH keys linked to GitHub deploy keys with write access will be disabled. We discuss what is changing, how to reconfigure your deploy keys, and impact to your projects. |
| 4 | +category: Security |
| 5 | +tags: security, github |
| 6 | +authors: Santos Gallegos |
| 7 | +status: published |
| 8 | +image: /images/ssh-keys-with-write-access.png |
| 9 | +image_credit: Photo by <a href="https://unsplash.com/@scottrodgerson?utm_content=creditCopyText&utm_medium=referral&utm_source=unsplash">Scott Rodgerson</a> on <a href="https://unsplash.com/photos/black-and-yellow-striped-line-BwMcYuHI9OI?utm_content=creditCopyText&utm_medium=referral&utm_source=unsplash">Unsplash</a> |
| 10 | + |
| 11 | +Starting on July 31, SSH keys linked to deploy keys with write permissions to a repository will be disabled. |
| 12 | +If your project is still using one after this date, your project's builds will fail. |
| 13 | + |
| 14 | +Deploy keys are used by Read the Docs to clone private repositories and build your documentation. |
| 15 | +These keys are automatically created when you create a project from a private repository on Read the Docs Business. |
| 16 | + |
| 17 | +In the past, we have created deploy keys with write permission to repositories before other options were available. |
| 18 | +However, Read the Docs does not require write access to build your documentation. |
| 19 | +We are migrating all keys to read-only as a security measure, |
| 20 | +and plan to migrate to a [GitHub App](https://about.readthedocs.com/blog/2025/06/announcing-our-github-app-beta/) in the near future which doesn't require deploy keys at all. |
| 21 | + |
| 22 | +While the private key itself is never exposed, |
| 23 | +our team discovered that under certain conditions, a malicious user may be able to make use of the SSH agent to gain write access to a repository. |
| 24 | +**We have seen no evidence that this was exploited in the wild.** |
| 25 | + |
| 26 | +Once we discovered the issue, we followed these steps: |
| 27 | + |
| 28 | +- Fixed the bug to ensure new deploy keys are created with read-only access |
| 29 | +- Migrated existing deploy keys to read-only where possible |
| 30 | +- Contacted affected users with instructions to ensure their deploy keys are read-only |
| 31 | +- Implemented safeguards to prevent exploitation of any remaining projects with deploy keys with write access |
| 32 | + |
| 33 | +## Is my project affected? |
| 34 | + |
| 35 | +If you added a private GitHub repository to Read the Docs Business before April 23, 2025, |
| 36 | +a deploy key with write access may have been created in your repository. |
| 37 | +We have contacted all affected users via email. |
| 38 | + |
| 39 | +## Is my project safe? |
| 40 | + |
| 41 | +Yes. We have resolved the issue, ensuring new deploy keys are read-only, |
| 42 | +and implemented safeguards to prevent exploitation of any remaining projects with deploy keys with write access. |
| 43 | +**We have seen no evidence that this was exploited in the wild.** |
| 44 | + |
| 45 | +## How could this issue have been exploited? |
| 46 | + |
| 47 | +To abuse this vulnerability, a malicious user would have needed: |
| 48 | + |
| 49 | +1. The ability to create a branch or open a pull request on the affected repository. |
| 50 | +2. The ability to trigger a build on the associated Read the Docs project. |
| 51 | + |
| 52 | +Under these conditions, the user could potentially leverage the SSH agent used during the cloning process to gain unintended write access to the repository. |
| 53 | + |
| 54 | +## Are projects from Read the Docs Community affected? |
| 55 | + |
| 56 | +No. |
| 57 | +This issue only affected projects on Read the Docs Business (<https://app.readthedocs.com>). |
| 58 | +Projects on Read the Docs Community (<https://app.readthedocs.org>) are public and do not require deploy keys. |
| 59 | + |
| 60 | +## What action should I take? |
| 61 | + |
| 62 | +We recommend verifying that your deploy keys are read-only. |
| 63 | +If you received an email or notification from us, please follow these steps: |
| 64 | + |
| 65 | +**How to verify that a deploy key is read-only:** |
| 66 | + |
| 67 | +1. Go to your GitHub repository. |
| 68 | +2. Click on "Settings" and then on "Deploy keys". |
| 69 | +3. Look for keys titled " [email protected] ( <project-slug >)". |
| 70 | +4. If the key is marked as "Read-only", no action is needed. |
| 71 | +5. If the key is marked as "Read/write", delete it and re-add it as read-only (see below). |
| 72 | + |
| 73 | +**How to re-add the key as read-only:** |
| 74 | + |
| 75 | +1. Go to your Read the Docs project. |
| 76 | +2. Click on "Settings" and then on "SSH keys". |
| 77 | +3. Click on the key, and copy the contents of the public key. |
| 78 | +4. Locate the corresponding key in GitHub following the steps above, and delete it. |
| 79 | +5. Add the key again by clicking "Add deploy key", and paste the public key you copied from Read the Docs. |
| 80 | +6. Use a title like " [email protected] ( <project-slug >)". |
| 81 | +7. Ensure the "Allow write access" checkbox is unchecked. |
| 82 | +8. Click "Add key". |
| 83 | + |
| 84 | +Note: if your project is public, you can remove the deploy key entirely, |
| 85 | +as Read the Docs can access the repository without a deploy key. |
| 86 | + |
| 87 | +## Whatโs next |
| 88 | + |
| 89 | +We are working on migrating our GitHub OAuth app to a [GitHub App](https://docs.github.com/en/apps/overview), |
| 90 | +which will allow us to clone private repositories using scoped temporary tokens instead of deploy keys. |
| 91 | + |
| 92 | +## Learn more |
| 93 | + |
| 94 | +You can find more details in our [security advisory](https://github.com/readthedocs/readthedocs.org/security/advisories/GHSA-jqm9-f79c-8wx6). |
| 95 | +We apologize for any inconvenience caused and remain committed to keep your data safe and secure, |
| 96 | +and being transparent about any issues that may arise. |
| 97 | +If you have questions or need help, contact us via our [support channels](https://docs.readthedocs.com/platform/stable/support.html). |
0 commit comments