Skip to content

Conversation

andremig-bentley
Copy link
Contributor

@andremig-bentley andremig-bentley commented Sep 30, 2025

Resolves #6131.

This PR adds a mergify rule to automatically backport PRs with the "security" label to the latest minor version and the previous major version. It also adds logic to version-bump.yaml to update the branch names during minor releases, and it adds a PR template to be used for security/cve fix PRs.

@andremig-bentley andremig-bentley marked this pull request as ready for review October 9, 2025 22:39
@aruniverse aruniverse requested a review from Copilot October 10, 2025 19:59
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements an automated security fix backporting system that allows security PRs to be automatically propagated to supported release branches. The implementation adds mergify configuration to automatically backport PRs labeled "Security" to both the latest minor release branch and the previous major version branch.

  • Adds mergify rule for automatic backporting of security-labeled PRs to release branches
  • Updates version-bump workflow to maintain current branch references in mergify configuration
  • Provides a PR template to standardize security fix submissions

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
.github/mergify.yml Adds branch variables and backport rule for security fixes
common/config/azure-pipelines/jobs/version-bump.yaml Updates mergify branch references during minor releases
.github/PULL_REQUEST_TEMPLATE/security_fix.md Provides template for security fix PRs

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

# Configuration file for mergify

# Branch variables for backport targets
latestMinor: &latestMinor "release/5.2.x"
Copy link
Member

Choose a reason for hiding this comment

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

  1. plz link to docs explaining the syntax
  2. how can we automate update this latest minor branch name every time we do a release?
  3. latest minor is not 4.9, its 4.11

Copy link
Member

Choose a reason for hiding this comment

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

disregard 2; i see its handled in ver bump pipeline

Copy link
Contributor Author

Choose a reason for hiding this comment

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

re 1 - which syntax do you mean, the branch naming convention?

Copy link
Member

Choose a reason for hiding this comment

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

no the variable, &latestMinor

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Its using YAML's anchors and aliases:
https://yaml.org/spec/1.2.2/#anchors-and-aliases
https://yaml.org/spec/1.2.2/#alias-nodes
https://support.atlassian.com/bitbucket-cloud/docs/yaml-anchors/

It seemed like a better solution to me than just having the release branches directly named in step, but it is a little more complicated. It can be changed to just:

backport:
    branches:
        - "release/5.2.x"
        - "release/4.11.x"

Copy link
Member

Choose a reason for hiding this comment

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

why wouldnt hardcoding these instead of adding it to another var that is only referenced once and needs to be updated not be easier?

Copy link
Contributor Author

@andremig-bentley andremig-bentley Oct 13, 2025

Choose a reason for hiding this comment

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

it would be easier to just have them hardcoded, my main thinking was just clarity, as in what are these branches, why are we backporting to them specifically, etc. But, that can be taken care of with doc comments. In the latest commit, I've simplified it to hardcode the branch names, a simpler implementation with a doc comment is probably the better way to go.

andremig-bentley and others added 4 commits October 10, 2025 14:17
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

- bash: |
mergifyPath=".github/mergify.yml"
version=$(echo $(getVersion.version) | sed 's/\([0-9]*\.[0-9]*\)\.[0-9]*/\1.x/')
releaseBranch="release/$version"
Copy link
Contributor

Choose a reason for hiding this comment

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

if we were to update 4.11 to 12, would this still work? It looks fine, but just double checking updating prev major won't cause unintended problems

Copy link
Contributor Author

@andremig-bentley andremig-bentley Oct 15, 2025

Choose a reason for hiding this comment

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

I think there's a chance it would break with this current implementation. Currently it basically just takes the version created from the version bump step and sets the first release branch in the list to that value. If we were to run a version bump on release/4.11.x for a new minor, I think it would set 5.whatever.x to 4.12.x and leave 4.11.x there. There wouldn't be any problem with patches. Is there any precedent for us releasing a new minor on a previous major, though?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As a fail safe, the most recent commit changed the logic so that the version-bump step looks at the major version number of the new version, and updates the release branch which starts with that same major version number. This means that if we were to release a new minor on a previous major version (4.11 -> 4.12), the bump would update the correct branch.

# e.g. if this release is `release/5.0.x`, value in `gather-docs.yaml`
# should be `release/4.<whatever_last_minor_release_version_was>.x`
# additionally if major version bump, the `mergify.yml` also needs to be edited manually
# if this release is `release/5.0.x`,change the `latestMinor` variable to `release/5.0.x`
Copy link
Member

Choose a reason for hiding this comment

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

comments are out of date

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated in most recent commit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enforce backporting of security patches.

4 participants