|
| 1 | +--- |
| 2 | +layout: post |
| 3 | +title: 'Strengthening the Release Process for Quarkiverse and SmallRye' |
| 4 | +date: 2024-10-17 |
| 5 | +tags: security |
| 6 | +synopsis: 'A description of the new Quarkiverse and SmallRye release process.' |
| 7 | +author: cescoffier |
| 8 | +--- |
| 9 | +:imagesdir: /assets/images/posts/release_process |
| 10 | + |
| 11 | + |
| 12 | +In May, we were alerted about a potential leak in the https://smallrye.io/[SmallRye] release process. |
| 13 | +We acted swiftly to mitigate the issue; fortunately, no damage was done. |
| 14 | +Even if Quarkiverse has no reported leak, during our investigation, we uncovered a deeper flaw that affected not only SmallRye but also Quarkiverse. |
| 15 | + |
| 16 | +In this blog post, we’ll explain the vulnerability we discovered and introduce a more secure release pipeline for both Quarkiverse and SmallRye repositories. |
| 17 | + |
| 18 | +**TL;DR:** We’ve uncovered a security flaw in the release process for Quarkiverse and SmallRye that could have allowed malicious actors to impersonate projects and publish compromised artifacts. |
| 19 | +We’ve implemented a new, more secure release pipeline to address this. |
| 20 | +If you’re a maintainer, you’ve received a pull request to migrate to the new process. |
| 21 | +Quarkus itself is not affected by this issue, only SmallRye and Quarkiverse. |
| 22 | + |
| 23 | +Please act immediately, as the old release process will be retired by October 16th, 2024. |
| 24 | +So make sure to merge the pull request before then to avoid any disruptions in your releases. |
| 25 | +If you have any questions or concerns, please contact us on https://quarkusio.zulipchat.com/#narrow/stream/187038-dev[Zulip] or https://github.com/quarkusio/quarkus/discussions[GitHub Discussions]. |
| 26 | +Details on this change are <<Call for action: Migrating to the new release process, below>>. |
| 27 | + |
| 28 | +For more details on the issue, the solution, and how to adapt, read on! |
| 29 | + |
| 30 | +== The Flaw: A Closer Look at the Release Process |
| 31 | + |
| 32 | +To understand the flaw, it’s important to outline the release process Quarkiverse and SmallRye used first. |
| 33 | +Quarkiverse and SmallRye offer development facilities to ease the development of Quarkus extensions and SmallRye projects used in Quarkus, respectively. |
| 34 | +There is no central supervision of all these repositories; they evolve at their own pace, individually. |
| 35 | + |
| 36 | +Both organizations use GitHub repositories and GitHub Actions as CI and automation framework. |
| 37 | +Here’s how the release project worked: |
| 38 | + |
| 39 | +1. A developer opens a pull request in the repository, updating the version number in the project’s `project.yaml` file (See https://github.com/quarkiverse/quarkus-langchain4j/pull/904[this PR] as an example). |
| 40 | +2. The regular build workflow runs to ensure it builds successfully. |
| 41 | +A specific pre-release flow also runs to verify that the YAML file is correctly formatted. |
| 42 | +3. Once the pull request is merged, a release workflow is triggered. |
| 43 | +4. The release workflow starts by _preparing_ the release. |
| 44 | +It sets the project's version to the configured version and creates a tag with the new updated code. |
| 45 | +It also updates the main branch (or the source branch of the pull request) to the next development version and commits this change to the branch. |
| 46 | +5. Once the preparation step is complete, the tag is checked out, and the release artifacts are created. |
| 47 | +This phase is called _release perform_. |
| 48 | +During that phase, binary artifacts are created from the tagged sources. |
| 49 | +The artifacts are signed and pushed to Maven Central. |
| 50 | + |
| 51 | +image::original-release-process.png[The release process used by Quarkiverse and SmallRye,float="center",align="center"] |
| 52 | + |
| 53 | +The last step, the _release perform_, is where the flaw exists. Here’s why: |
| 54 | + |
| 55 | +* To sign the artifacts, the workflow uses an organization-wide GPG key |
| 56 | +* To publish the artifacts, the workflow uses organization-wide credentials |
| 57 | + |
| 58 | +image::flaw.png[The flaw in the release process,float="center",align="center"] |
| 59 | + |
| 60 | +The GPG passphrase and the Maven Central credential are stored as secrets in the project’s GitHub repository but shared across the entire organization. |
| 61 | +They are not freely accessible. |
| 62 | +You cannot print them in the log (without a bit of magic), and cannot be accessed from forks. |
| 63 | + |
| 64 | +At this point, everything seems fine. |
| 65 | +Both SmallRye and Quarkiverse provide maintainers with great freedom to customize GitHub Action workflows to fit their needs. |
| 66 | +This flexibility, while empowering, also introduces risks. |
| 67 | +And ... here we go.... |
| 68 | + |
| 69 | +== The Problem: A Risk of Credential Exposure (and Impersonification) |
| 70 | + |
| 71 | +We said that secrets are not freely accessible. |
| 72 | +That’s true, except for one case. |
| 73 | +GitHub Actions (see Github Action Security overview) running in the project itself can access them. |
| 74 | +Even tests can access them. |
| 75 | +Anything running during the workflow (actions, scripts...) can access these secrets... and leak them. |
| 76 | + |
| 77 | +When a developer includes an external or third-party GitHub Action, Maven / Gradle plugin, or Junit Extension... in their workflow, that code gains access to the organization-wide credentials. |
| 78 | +Any code running during the workflow on the repository — not a fork — can potentially expose these secrets. |
| 79 | +The ramifications are severe: |
| 80 | + |
| 81 | +* An attacker could release compromised yet legitimate-looking project versions signed with the organization’s GPG key to Maven Central. |
| 82 | +* Worse still, they could push malicious artifacts to Maven Central under the Quarkiverse or SmallRye banner, impersonating the entire organization. |
| 83 | + |
| 84 | +In short, with access to these credentials, an attacker could impersonate Quarkiverse or SmallRye, bypassing typical protections like signed commits or branch protection. |
| 85 | +The vulnerability arises from the fact that these credentials are shared and available to any code running during the workflow. |
| 86 | + |
| 87 | +Despite quickly mitigating the initial SmallRye leak, discovering this larger flaw prompted us to reevaluate our release process. |
| 88 | +It became clear that we needed a more secure and resilient approach to prevent such risks in the future. |
| 89 | + |
| 90 | +== The Solution: A new release process |
| 91 | + |
| 92 | +After careful consideration, we concluded that relying on organization-wide secrets for releases was no longer viable. |
| 93 | +We needed a more secure approach. |
| 94 | + |
| 95 | +At first, we explored the idea of using repository-specific credentials. |
| 96 | +While this would limit the blast radius in case of a leak, it would be difficult to manage at scale and slow down the onboarding process. |
| 97 | +Additionally, an individual repository could still be compromised and impersonated even with this approach. |
| 98 | +Therefore, we decided against this solution. |
| 99 | + |
| 100 | +Instead, we devised a more robust and secure solution involving two repositories: one for the code being released and a separate one for executing the release perform phase itself. |
| 101 | +Crucially, the repository with the source code no longer has access to organization-wide credentials—only the second repository does. |
| 102 | + |
| 103 | +image::new-release-process.png[The new release process,float="center",align="center"] |
| 104 | + |
| 105 | +When the second workflow (red) is complete, it unblocks the first one (blue). |
| 106 | +Thus, you know when the second workflow is completed and if it was successful. |
| 107 | + |
| 108 | +=== How It Works: A Step-by-Step Breakdown |
| 109 | + |
| 110 | +With this new approach, the initial stages of the release process remain unchanged. |
| 111 | +Here’s what happens now: |
| 112 | + |
| 113 | +1. A developer opens a pull request, updating the version number in the `project.yaml` file. |
| 114 | +2. The pre-release workflow is triggered within the repository, ensuring the build is correct and the version is appropriately updated. |
| 115 | +3. Once the pull request is merged, the release process diverges from the previous approach: |
| 116 | + |
| 117 | + * The first repository executes the preparation steps, such as version updates, tag creation, and setting the next development version. |
| 118 | + * The release artifacts are generated but not signed or pushed to Maven Central. |
| 119 | + |
| 120 | +At this point, a second workflow is triggered in a separate repository. |
| 121 | +This is where the critical actions happen: |
| 122 | + |
| 123 | +* The second repository, which contains the necessary credentials (Maven Central credentials and GPG passphrase), downloads the release artifacts. |
| 124 | +* It verifies the integrity of the artifacts using attestations. |
| 125 | +* The artifacts are then signed and pushed to Maven Central. |
| 126 | + |
| 127 | +This second repository is crucial for security. |
| 128 | +It’s locked down and non-modifiable, meaning no developer can customize the workflow or inadvertently introduce a vulnerability. |
| 129 | +By isolating the sensitive release steps in this secured environment, we’ve significantly reduced the risk of leaks or unauthorized access. |
| 130 | + |
| 131 | +This new process provides a much-needed layer of separation, ensuring that the credentials remain protected and that the possibility of a leak is greatly diminished. |
| 132 | + |
| 133 | +=== Balancing Security with Developer Freedom |
| 134 | + |
| 135 | +As highlighted earlier, both Quarkiverse and SmallRye strongly emphasize empowering developers by minimizing the overhead of maintaining open-source components. |
| 136 | +Our new release process maintains this philosophy, ensuring developers still have the flexibility to adjust workflows in their component repositories as needed. |
| 137 | + |
| 138 | +Developers and maintainers can continue to modify workflows, introduce custom CI steps, and tailor their processes to meet specific project needs. |
| 139 | +The only significant change is that part of the release process—the critical signing and publishing steps—now occurs in a separate, secured repository. |
| 140 | + |
| 141 | +Importantly, maintainers retain the ability to trigger a release at any time, from any branch, just as they could before. |
| 142 | +The handoff to the second repository happens seamlessly, so the developer experience remains largely the same. |
| 143 | + |
| 144 | +This flexibility remains intact for projects that have heavily customized their release pipelines (for example, incorporating pre-release validations or automating tasks like website updates, release note generation, or breaking change detection). |
| 145 | +These projects can still trigger: |
| 146 | + |
| 147 | +* Validation workflows when the `project.yaml` file is updated via a pull request. |
| 148 | +* Post-release workflows, triggered when a new tag is created, allow tasks such as documentation updates or notifications to continue unhindered. |
| 149 | + |
| 150 | +By preserving this level of freedom, we ensure that developers can adapt their workflows to the needs of their projects while benefiting from a more secure release pipeline. |
| 151 | + |
| 152 | +=== Resilience: Preparing for the Unexpected |
| 153 | + |
| 154 | + |
| 155 | +The release process, by its nature, is a complex and multi-step operation where things can occasionally go wrong. |
| 156 | +While the new release pipeline adds another layer of complexity due to its split-repository design, we have built resilience into the system to mitigate potential issues. |
| 157 | + |
| 158 | +To address this, we’ve ensured that the new process is idempotent, meaning it can be safely retried without causing inconsistencies or errors. |
| 159 | +If a failure occurs at any point during the release — whether due to network issues, build failures, or artifact verification problems — the process can be restarted from the failed workflow. |
| 160 | +This allows the release to proceed without needing to repeat previous steps unnecessarily. |
| 161 | + |
| 162 | +Additionally, we have built in various checks and verifications at key stages of the release process, such as verifying artifact integrity (using attestation) are completed before moving on to the next stage. |
| 163 | +These safeguards help reduce the risk of an incomplete or erroneous release. |
| 164 | + |
| 165 | +Should any unexpected issues arise, both the component repository and the secured release repository provide detailed logs, allowing developers to diagnose and resolve problems quickly. |
| 166 | +This transparency ensures that maintainers remain in control, even when things don’t go as planned. |
| 167 | + |
| 168 | +These measures aim to provide a more resilient, fault-tolerant release process that doesn’t compromise on security or developer experience. |
| 169 | + |
| 170 | +== Call for action: Migrating to the new release process |
| 171 | + |
| 172 | +If you are a Quarkiverse or SmallRye project maintainer, you’ve received a pull request that updates your project to the new, more secure release process. |
| 173 | +For most maintainers, this update will be seamless and require no other changes. |
| 174 | + |
| 175 | +However, as mentioned earlier, if your project uses a customized or more sophisticated release pipeline, you may need to make a few adjustments to ensure compatibility with the new system. |
| 176 | +This could involve updating custom workflows that handle pre-validation steps, website publishing, or release note generation. |
| 177 | +Please take the time to review and test the changes in your repository to ensure everything works as expected. |
| 178 | + |
| 179 | +== Important Timeline: Deprecation of the Old Release Process |
| 180 | + |
| 181 | +The previous release process has now been deprecated and will be fully blocked by October 16th, 2024. |
| 182 | +After this date, releasing your project using the old pipeline will no longer be possible. |
| 183 | +Thus, you must adopt the new release process pull request before this deadline to avoid disrupting your project’s release cycle. |
| 184 | + |
| 185 | +For maintainers with more complex setups, we encourage you to start the migration as soon as possible to ensure a smooth transition. |
| 186 | +Roberto Cortez, George Gastaldi, and the rest of the Quarkus and SmallRye teams are here to help if you need assistance. |
| 187 | + |
| 188 | +__Next Steps:__ |
| 189 | + |
| 190 | +* Review the Pull Request: Check the automated pull request in your repository and verify that it updates your release process to the new system. |
| 191 | +* Merge the Changes: Merge the changes before the deprecation date to avoid release interruptions. |
| 192 | +* Test Your Workflow: If you’ve customized your release process, run tests to ensure everything still functions as expected under the new pipeline. |
| 193 | +* Reach Out for Support: If you have any questions or need help with the migration, please contact us on https://quarkusio.zulipchat.com/#narrow/stream/187038-dev[Zulip] or https://github.com/quarkusio/quarkus/discussions[GitHub Discussions]. |
| 194 | + |
| 195 | +This new release process is a vital step in improving the security of Quarkiverse and SmallRye, and your swift action in migrating will help us ensure the integrity of these projects moving forward. |
| 196 | + |
| 197 | +== Summary: Nothing Changes for You — It’s Just More Secure |
| 198 | + |
| 199 | +From a Smallrye and Quarkiverse developer’s perspective, the release process for Quarkiverse and SmallRye remains essentially the same. |
| 200 | +You still have the freedom to modify workflows, customize release steps, and trigger releases as needed. |
| 201 | +The flexibility and control you’ve come to rely on haven’t changed. |
| 202 | + |
| 203 | +The main difference is behind the scenes: a separate, secured repository now handles the critical steps of signing and publishing your release. |
| 204 | +This means the process is more robust, with sensitive credentials locked down, and the risk of leaks or impersonation significantly reduced. |
| 205 | + |
| 206 | +In short, while we’ve enhanced the security of the release pipeline, we’ve done so in a way that minimizes disruption. |
| 207 | +You’ll still enjoy the same developer experience — only now, with the added peace of mind that your releases are more secure than ever. |
| 208 | + |
| 209 | +== A Special Thank You |
| 210 | + |
| 211 | +Redefining a more secure and reliable release process was no small feat, and it certainly wasn’t something we could accomplish without some dedicated and enthusiastic developers. |
| 212 | +I’d like to extend our heartfelt thanks to George Gastaldi and Roberto Cortez for carrying out much of the heavy lifting throughout this process. |
| 213 | +Your dedication and expertise were invaluable. |
| 214 | + |
| 215 | +I’d also like to give a special shoutout to Andres Almiray, whose support with JReleaser was absolutely instrumental. |
| 216 | +The new release process simply wouldn’t have been possible without his reactivity and guidance. |
| 217 | + |
| 218 | + |
| 219 | + |
| 220 | + |
0 commit comments