|
| 1 | +======================== |
| 2 | +Suricata Backports Guide |
| 3 | +======================== |
| 4 | + |
| 5 | +This document describes the processes used to backport content to current stable |
| 6 | +Suricata releases. Most often, this means security and/or bug fixes; |
| 7 | +however, in some cases, features may be backported to previous Suricata releases. |
| 8 | + |
| 9 | +There are multiple versions of Suricata at any given time: |
| 10 | + * Main |
| 11 | + * Major stable release |
| 12 | + * Old stable release |
| 13 | + |
| 14 | +For example, at the moment, there are 3 releases based on these Suricata branches: |
| 15 | + * main: 9.0.0-dev, current development branch |
| 16 | + * main-8.0.x: major stable release |
| 17 | + * main-7.0.x: old stable release |
| 18 | + |
| 19 | +For Suricata's release cadence and *end of life* policies, please check |
| 20 | +https://suricata.io/our-story/eol-policy/. |
| 21 | + |
| 22 | +The next sections discuss when and what to backport, and some guidelines when |
| 23 | +doing so. |
| 24 | + |
| 25 | +What should be backported? |
| 26 | +-------------------------- |
| 27 | + |
| 28 | +Usually, when the team creates a ticket, we'll add the *Needs backport* related |
| 29 | +labels, so necessary backporting tickets will be automatically created. If you |
| 30 | +are working on a ticket that doesn't have such labels, nor backporting tasks |
| 31 | +associated, it probably doesn't need backporting. If you understand that the |
| 32 | +issue should be backported, please let us know in the ticket or related PR. But |
| 33 | +sometimes we'll miss those. |
| 34 | + |
| 35 | +The general principle used to determine what will be backported is: |
| 36 | + * security fixes (please see our `Security Policy <https://github.com/OISF/suricata/blob/main/SECURITY.md>`_) |
| 37 | + * bug fixes |
| 38 | + * in some cases, new features are backported if there are sufficient reasons to |
| 39 | + backport a new feature. |
| 40 | + |
| 41 | +.. note:: 7.0.x backports |
| 42 | + |
| 43 | + With the release of Suricata 8.0, Suricata 7 has reached a mature stage of its |
| 44 | + release cycle. Thus, as a rule, only critical issues (bugs and security), |
| 45 | + should be considered for backporting. |
| 46 | + |
| 47 | +.. Note:: Exceptions |
| 48 | + |
| 49 | + There can be cases where backports may be "missed" -- some issues may not be |
| 50 | + labeled as needing backports and some PRs may be merged without an issue. |
| 51 | + |
| 52 | + This guide may be insufficient for some situations. When in doubt, please reach |
| 53 | + out to the team on the backport ticket or PR. |
| 54 | + |
| 55 | +Selection overview |
| 56 | +------------------ |
| 57 | + |
| 58 | +All items considered for backports should be reviewed with the following: |
| 59 | + * risk estimate: will the change introduce new bugs? Consider the scope and |
| 60 | + items affected by the change. |
| 61 | + * behavioral change: how much will the behavior of the system be changed by the |
| 62 | + backport. For example, a small change to decode additional encapsulation |
| 63 | + protocols may result in more traffic being presented to Suricata. |
| 64 | + * default settings: if the issue alters behavior, can it be made optional, and |
| 65 | + at what cost? |
| 66 | + |
| 67 | +Creating backport tickets -- new issues |
| 68 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 69 | + |
| 70 | +Redmine: for security and bug fixes, when creating a new Redmine issue, |
| 71 | +label the Redmine issue with "Needs backport to x.0", where x.0 is a supported |
| 72 | +Suricata release, e.g, 8.0.x. |
| 73 | + |
| 74 | +Creating backport tickets -- existing issues/PRs |
| 75 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 76 | + |
| 77 | +We want to minimize the occurrence of "missed backports" -- that is, work that |
| 78 | +should be backported but wasn't. Sometimes this happens when there is no Redmine |
| 79 | +issue, or the Redmine issue wasn't labeled as needing a backport. |
| 80 | + |
| 81 | +Therefore, we will be periodically reviewing: |
| 82 | + * Redmine issues without backport labels, including recently closed issues, to |
| 83 | + see which require backport labels. |
| 84 | + * PRs without associated Redmine issues. Those requiring backports should be |
| 85 | + labeled with *needs backport*. |
| 86 | + |
| 87 | +Then, also periodically, we will create backport issues from those items |
| 88 | +identified in the previous steps. When doing so, we will evaluate what are the |
| 89 | +relevant target backport releases. Some issues reported against main or the |
| 90 | +current Suricata release may not apply to older releases. |
| 91 | + |
| 92 | +Git Backport Workflow |
| 93 | +--------------------- |
| 94 | + |
| 95 | +If you are working on a task that needs to be backported, only start the |
| 96 | +backporting process once the PR for main has been merged. Then: |
| 97 | + |
| 98 | + * *Identify the commit(s) needed* for the backport. Start with the PR that merged |
| 99 | + the commits into main and select only the commits from the issue being |
| 100 | + backported. |
| 101 | + * *Bring each commit into the new branch,* one at a time -- starting with the |
| 102 | + oldest commit. Use ``git cherry-pick -x commit-hash``, where ``commit-hash`` |
| 103 | + is the hash to the commit already in main or main-8.0x that is being |
| 104 | + backported, as it maintains the linkage with said cherry-picked commit. |
| 105 | + * *Resolve conflicts:* Some of the cherry-picked commits may contain merge |
| 106 | + conflicts. If the conflicts are small, include the corrections in the |
| 107 | + cherry-picked commit. |
| 108 | + * *Add additional commits*, if any are needed (e.g., to adjust cherry-picked code |
| 109 | + to old behavior). |
| 110 | + |
| 111 | +.. Note:: Commit hashes |
| 112 | + |
| 113 | + We have a CI check that ensures the validity of the cherry-pick line. |
| 114 | + |
| 115 | +.. Note:: Exceptions |
| 116 | + |
| 117 | + Sometimes, the fix for main will not work for the stable or old releases. |
| 118 | + In such cases, the backporting process won't be through cherry-picking, but |
| 119 | + through actually implementing a fix for the specific version. |
| 120 | + |
| 121 | +Create a PR: |
| 122 | +~~~~~~~~~~~~ |
| 123 | + |
| 124 | +Please indicate in the title that this is a backport PR, with something like |
| 125 | +*(8.0.x-backport)*, and add the related milestone label. |
| 126 | + |
| 127 | +In the PR description, indicate the backport ticket. |
| 128 | + |
| 129 | +QA |
| 130 | +-- |
| 131 | + |
| 132 | +Add suricata-verify PRs when needed. Some existing suricata-verify tests may require |
| 133 | +version specification changes. |
0 commit comments