1866ede95SAlex Crichton# Vulnerability Runbook 2866ede95SAlex Crichton 3866ede95SAlex CrichtonThis document outlines how Wasmtime maintainers should respond to a security 4866ede95SAlex Crichtonvulnerability found in Wasmtime. This is intended to be a Wasmtime-specific 5866ede95SAlex Crichtonvariant of the [runbook 6866ede95SAlex CrichtonRFC](https://github.com/bytecodealliance/rfcs/blob/main/accepted/vulnerability-response-runbook.md) 7866ede95SAlex Crichtonoriginally created. More details are available in the RFC in some specific steps. 8866ede95SAlex Crichton 9866ede95SAlex CrichtonVulnerabilities and advisories are all primarily coordinated online through 10866ede95SAlex CrichtonGitHub Advisories on the Wasmtime repository. Anyone can make an advisory on 11866ede95SAlex CrichtonWasmtime, and once created anyone can be added to an advisory. Once an advisory 12866ede95SAlex Crichtonis created these steps are followed: 13866ede95SAlex Crichton 14866ede95SAlex Crichton1. An **Incident Manager** is selected. By default this is the Wasmtime 15866ede95SAlex Crichton maintainer that opened the advisory. If a contributor opened the advisory 16866ede95SAlex Crichton then it's by default the first responder on the advisory. The incident 17866ede95SAlex Crichton manager can, at any time, explicitly hand off this role to another 18866ede95SAlex Crichton maintainer. 19866ede95SAlex Crichton 20866ede95SAlex Crichton2. **Fill out the advisory details**. This step involves filling out all the 21866ede95SAlex Crichton fields on the GitHub Advisory page such as: 22866ede95SAlex Crichton 23866ede95SAlex Crichton * Description - the description field's initial placeholder has the various 24866ede95SAlex Crichton sections to fill out. At this point at least a brief description of the 25866ede95SAlex Crichton impact should be filled out. This will get fleshed out more later too. 26866ede95SAlex Crichton * Affected versions - determine which previously released versions of 27866ede95SAlex Crichton Wasmtime are affected by this issue. 28866ede95SAlex Crichton * Severity - use the CVSS calculator to determine the severity of this 29866ede95SAlex Crichton vulnerability. 30866ede95SAlex Crichton 31866ede95SAlex Crichton3. **Collaborate on a fix**. This should be done in a private fork created for 32866ede95SAlex Crichton the security advisory. This is also when any collaborators who can help with 33866ede95SAlex Crichton the development of the fix should also be invited. At this time only the 34866ede95SAlex Crichton `main` branch needs to have a fix. 35866ede95SAlex Crichton 36866ede95SAlex Crichton4. **Finalize vulnerability details and patched versions**. After a fix has been 37866ede95SAlex Crichton developed and the vulnerability is better understood at this point the 38866ede95SAlex Crichton description of the advisory should be fully filled out and be made ready to 39866ede95SAlex Crichton go to the public. This is also when the incident manager should determine the 402de55ccfSAlex Crichton number of versions of Wasmtime to patch. All [supported releases 412de55ccfSAlex Crichton documented](./stability-release.md) must be patched, but the incident manager 422de55ccfSAlex Crichton may also elect to patch more releases if desired. 43866ede95SAlex Crichton 44866ede95SAlex Crichton5. **Request a CVE**. Use the Big Green Button on the advisory to request a CVE 45866ede95SAlex Crichton number from GitHub staff. 46866ede95SAlex Crichton 47866ede95SAlex Crichton6. **Send advanced disclosure email**. The incident manager will decide on a 48866ede95SAlex Crichton disclosure date, typically no more than a week away, and send mail to 49866ede95SAlex Crichton [email protected] about the upcoming security release. An 50866ede95SAlex Crichton example mail [looks like 51866ede95SAlex Crichton this](https://groups.google.com/a/bytecodealliance.org/g/sec-announce/c/7SjEU_qSE4U/m/Y6baLYkhAgAJ) 52866ede95SAlex Crichton 53866ede95SAlex Crichton7. **Add more stakeholders** (optional). Users interested in getting advanced 54866ede95SAlex Crichton notice about this vulnerability may respond to the mailing list post. The 55866ede95SAlex Crichton incident manager will add them to the security advisory. 56866ede95SAlex Crichton 57866ede95SAlex Crichton8. **Prepare PRs for patch releases**. This will involve creating more pull 58866ede95SAlex Crichton requests in the private fork attached to the advisory. Each version of 59866ede95SAlex Crichton Wasmtime being patched should have a PR ready-to-go which cleanly applies. 60866ede95SAlex Crichton Be sure to write release notes on the PR for each release branch. 61866ede95SAlex Crichton 62866ede95SAlex Crichton9. **The full test suite should be run locally for `main`**. Locally try to run 63866ede95SAlex Crichton as much of the CI matrix as you can. You probably won't be able to run all of 64866ede95SAlex Crichton it, and that's ok, but try to get the ones that may have common failures. 65866ede95SAlex Crichton This is required because CI doesn't run on private forks. 66866ede95SAlex Crichton 67d335c07fSAlex Crichton10. **Release day: Open version bump PRs on the public repository**. Use the 68d335c07fSAlex Crichton [online trigger] for this workflow to open PRs for all versions that are 69d335c07fSAlex Crichton going to be patched. Patch notes should be included with the private PRs, so 70d335c07fSAlex Crichton no need to worry about that. Plan on merging these PRs after the PRs below 71d335c07fSAlex Crichton are merged. Note that CI should be green as we test that it's green weekly 72*c190d7c4SAlex Crichton for all supported branches, but if it's not you'll need to fix that. GitHub 73*c190d7c4SAlex Crichton Actions has a nontrivial chance of having an outage during a release. If 74*c190d7c4SAlex Crichton this is the case all that can be done is waiting for the outage to be 75*c190d7c4SAlex Crichton resolved. 767bf9be52SAndrew Brown 777bf9be52SAndrew Brown[online trigger]: https://github.com/bytecodealliance/wasmtime/actions/workflows/release-process.yml 78866ede95SAlex Crichton 79d335c07fSAlex Crichton11. **Release day: Manually make PRs to affected branches**. DO NOT merge via 80d335c07fSAlex Crichton the security advisory. This has generally not worked well historically 81d335c07fSAlex Crichton because there's too many CI failures and branch protections. On the day of 82d335c07fSAlex Crichton the release make public PRs from all of the previously-created PRs on the 83d335c07fSAlex Crichton private fork. You'll need to push the changes to your own personal 84d335c07fSAlex Crichton repository for this, but that's ok since it's time to make things public 85d335c07fSAlex Crichton anyway. Merge all PRs (including to `main`) once CI passes. 86866ede95SAlex Crichton 87d335c07fSAlex Crichton12. **Release day: Merge version bump PRs**. Once the fixes have all been merged 88d335c07fSAlex Crichton and CI is green merge all the version bump PRs. That will trigger the 89d335c07fSAlex Crichton automatic release process which will automatically publish to crates.io and 90d335c07fSAlex Crichton publish the release. 91866ede95SAlex Crichton 92d335c07fSAlex Crichton13. **Release day: Publish the GitHub Advisories**. Delete the private forks and 93d335c07fSAlex Crichton hit that Big Green Button to publish the advisory. 94866ede95SAlex Crichton 95d335c07fSAlex Crichton14. **Release day: Send mail about the security release**. Send another around 96d335c07fSAlex Crichton of mail to [email protected] describing the security 97d335c07fSAlex Crichton release. This mail looks [like 98866ede95SAlex Crichton this](https://groups.google.com/a/bytecodealliance.org/g/sec-announce/c/7SjEU_qSE4U/m/zjW9fWlcAAAJ). 99866ede95SAlex Crichton 10063f8267aSAlex Crichton14. **Add the advisory to the [RustSec 10163f8267aSAlex Crichton database](https://github.com/rustsec/advisory-db)**. We mirror our 10263f8267aSAlex Crichton advisories into the RustSec database for projects using Cargo-based tooling 10363f8267aSAlex Crichton to check for security issue with their dependencies. An example of this is 10463f8267aSAlex Crichton [RUSTSEC-2024-0440]. File a PR with the 10563f8267aSAlex Crichton [RustSec/advisory-db](https://github.com/rustsec/advisory-db) repository 10663f8267aSAlex Crichton adding a new file in the `crates/wasmtime` directory. You'll use the file 10763f8267aSAlex Crichton name `RUSTSEC-0000-0000.md` and can copy metadata from a previous advisory. 10863f8267aSAlex Crichton The description should just point to the GitHub advisory published prior. 10963f8267aSAlex Crichton 11063f8267aSAlex Crichton[RUSTSEC-2024-0440]: https://github.com/rustsec/advisory-db/blob/4584ad9a5ea16ce196317cf4d3593e974fb4a8a1/crates/wasmtime/RUSTSEC-2024-0440.md 11163f8267aSAlex Crichton 112866ede95SAlex CrichtonYou'll want to pay close attention to CI on release day. There's likely going to 113866ede95SAlex Crichtonbe CI failures with the fix for the vulnerability for some build configurations 114866ede95SAlex Crichtonor platforms and such. It should be easy to fix though so mostly try to stay on 115866ede95SAlex Crichtontop of it. Additionally be sure to carefully watch the publish process to 116866ede95SAlex Crichtoncrates.io. It's possible to hit rate limits in crate publication which 117866ede95SAlex Crichtonnecessitates a retry of the job later. You can also try publishing locally too 118866ede95SAlex Crichtonfrom the release branch, but it's best to do it through CI. 119