Skip to content

Commit a9ef5e2

Browse files
committedOct 19, 2021
Bug 1736003 - tweak security patch landing guidance, r=dveditz DONTBUILD
Differential Revision: https://phabricator.services.mozilla.com/D128585
1 parent eefdd42 commit a9ef5e2

File tree

2 files changed

+87
-52
lines changed

2 files changed

+87
-52
lines changed
 

‎docs/bug-mgmt/processes/fixing-security-bugs.rst

+68-10
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ usually made public after 6 months and a couple of releases.
2727

2828
From the moment a security bug has been privately reported to the moment
2929
a fix is shipped and the bug is set public, all information about that
30-
bug need to be handled carefully in order to avoid an unmitigated
31-
vulnerability to be known and exploited out there before we release a
30+
bug needs to be handled carefully in order to avoid an unmitigated
31+
vulnerability becoming known and exploited before we release a
3232
fix (0-day).
3333

3434
During a normal process, information about the nature of bug can be
@@ -57,7 +57,9 @@ easily before we shipped the fix to our users. This includes:
5757
- In commit messages, code comments and test cases.
5858
- The fact that a bug / commit is security-related:
5959

60-
- **Trigger words** in the commit message or code comments such as "security", "exploitable" or the nature of a security vulnerability (overflow, use-after-free…)
60+
- **Trigger words** in the commit message or code comments such as
61+
"security", "exploitable", or the nature of a security vulnerability
62+
(overflow, use-after-free…)
6163
- **Security approver’s name** in a commit message.
6264
- The Firefox versions and components affected by the vulnerability.
6365
- Patches with an obvious fix.
@@ -68,9 +70,9 @@ In Bugzilla and other public channels
6870
In addition to commits, you’ll need to be mindful of not disclosing
6971
sensitive information about the bug in public places, such as Bugzilla:
7072

71-
- **Do not add public bugs in the “duplicate”, “depends on”, “blocks”
72-
or “see also” section if these bugs could give hints about the nature
73-
of the security issue.**
73+
- **Do not add public bugs in the “duplicate”, “depends on”, “blocks”,
74+
“regression”, “regressed by”, or “see also” section if these bugs
75+
could give hints about the nature of the security issue.**
7476

7577
- Mention the bugs in comment of the private bug instead.
7678
- Do not comment sensitive information in public related bugs.
@@ -84,8 +86,8 @@ password or with proper right access management)
8486
During Development
8587
------------------
8688

87-
Testing sec-high and sec-critical bugs
88-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
89+
Testing security bugs
90+
~~~~~~~~~~~~~~~~~~~~~
8991

9092
Pushing to Try servers requires Level 1 Commit access but **content
9193
viewing is publicly accessible**.
@@ -94,6 +96,13 @@ As much as possible, **do not push to Try servers**. Testing should be
9496
done locally before checkin in order to prevent public disclosing of the
9597
bug.
9698

99+
Because of the public visibility, pushing to Try has all the same concerns
100+
as committing the patch. Please heed the concerns in the
101+
:ref:`landing-your-patch` section before thinking about it, and check with
102+
the security team for an informal "sec-approval" before doing so.
103+
104+
**Do not push the bug's own vulnerability testcase to Try.**
105+
97106
If you need to push to Try servers, make sure your tests don’t disclose
98107
what the vulnerability is about or how to trigger it. Do not mention
99108
anywhere it is security related.
@@ -120,11 +129,60 @@ Requesting sec-approval
120129
See :ref:`Security Bug Approval Process`
121130
for more details
122131

132+
.. _landing-your-patch:
133+
134+
Landing your patch (with or without sec-approval)
135+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
136+
137+
Before asking for sec-approval or landing, ensure your patch does not disclose
138+
information about the security vulnerability unnecessarily. Specifically:
139+
140+
#. The patch commit message and its contents should not mention security,
141+
security bugs, or sec-approvers.
142+
Note that you can alter the commit message directly in phabricator,
143+
if that's the only thing you need to do - you don't need to amend your
144+
local commit and re-push it.
145+
While comprehensive commit messages are generally encouraged; they
146+
should be omitted for security bugs and instead be posted in the bug
147+
(which will eventually become public.)
148+
#. Separate out tests into a separate commit.
149+
**Do not land tests when landing the patch. Remember we don’t want
150+
to 0-day ourselves!** This includes when pushing to try.
151+
152+
- Tests should only be checked in later, after an official Firefox
153+
release that contains the fix has been live for at least
154+
four weeks. For example, if Firefox 53
155+
contains a security issue that affects the world and that issue is
156+
fixed in 54, tests for this fix should not be checked in
157+
until four weeks after 54 goes live.
158+
159+
The exception to this is if there is a security issue that doesn't
160+
affect any release branches, only mozilla-central and/or other
161+
development branches. Since the security problem was never
162+
released to the world, once the bug is fixed in all affected
163+
places, tests can be checked in to the various branches.
164+
- There are two main techniques for remembering to check in the
165+
tests later:
166+
167+
a. clone the sec bug into a separate "task" bug **that is also
168+
in a security-sensitive group to ensure it's not publicly visible**
169+
called something like "land tests for bug xxxxx" and assign to
170+
yourself. It should get a "sec-other" keyword rating.
171+
172+
Tip: In phabricator, you can change the bug linked to
173+
a commit with tests if the tests were already separate, while keeping
174+
the previously granted review, meaning you can just land the patch
175+
when ready, rather than having your reviewer and you have to remember
176+
what this was about a month or two down the line.
177+
b. Or, set the "in-testsuite" flag to "?", and later set it to "+"
178+
when the tests get checked in.
179+
180+
123181
Landing tests
124182
~~~~~~~~~~~~~
125183

126-
Tests can be landed **after the release has gone live** and **not before
127-
at least 4 weeks following that release**.
184+
Tests can be landed **once the release containing fixes has been live
185+
at least 4 weeks**.
128186

129187
The exception is if a security issue has never been shipped in a release
130188
build and has been fixed in all development branches.

‎docs/bug-mgmt/processes/security-approval.rst

+19-42
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,16 @@ Developing the Patch
7171
non-security work, in the same area.
7272

7373
Request review of the patch in the same process as normal. After the
74-
patch has received an r+ you will request sec-approval. See
74+
patch has been reviewed you will request sec-approval as needed. See
7575
:ref:`Fixing Security Bugs`
7676
for more examples/details of these points.
7777

78+
Preparing the patch for landing
79+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
80+
81+
See :ref:`Fixing Security Bugs`
82+
for more details.
83+
7884
On Requesting sec-approval
7985
~~~~~~~~~~~~~~~~~~~~~~~~~~
8086

@@ -91,48 +97,17 @@ explicit approval if:
9197
| **B)** The bug is a recent regression on mozilla-central. This means
9298
9399
- A specific regressing check-in has been identified
94-
- The developer can (**and has**) marked the status flags for ESR,
95-
Beta, and Aurora as "unaffected"
100+
- The developer can (**and has**) marked the status flags for ESR and
101+
Beta as "unaffected"
96102
- We have not shipped this vulnerability in anything other than a
97103
nightly build
98104

99-
If it meets the above criteria, check that patch in.
100-
101-
Otherwise, if the bug has a patch \*and\* is sec-high or sec-critical,
102-
the developer should prepare the patch for sec-approval. This entails:
103-
104-
- Commit should occur without specific mention of security, security
105-
bugs, or sec-approvers if possible. While comprehensive commit
106-
messages are generally encouraged; they should be omitted for
107-
security bugs and instead be posted in the bug (which will eventually
108-
become public.)
109-
- Separate out tests into a separate commit. **Do not commit tests when
110-
checking in** when the security bug fix is initially checked-in.
111-
**Remember we don’t want to 0-day ourselves!**
112-
113-
- Tests should only be checked in later, after an official Firefox
114-
release that contains the fix has gone live and not for at least
115-
four weeks following that release. For example, if Firefox 53
116-
contains a fix for a security issue that affects the world and is
117-
then fixed in 54, tests for this fix should not be checked in
118-
until four weeks after 54 goes live. The exception to this is if
119-
there is a security issue that hasn’t shipped in a release build
120-
and it is being fixed on multiple development branches (such as
121-
mozilla-central and beta). Since the security problem was never
122-
released to the world, once the bug is fixed in all affected
123-
places, tests can be checked in to the various branches.
124-
- There are two main techniques for remembering to check in the
125-
tests later:
126-
127-
- clone the sec bug into a hidden "task" bug "land tests for bug
128-
xxxxx" and assign to yourself. It should get a "sec-other"
129-
keyword rating.
130-
- Or, set the "in-testsuite" flag to "?", and later set it to "+"
131-
when the tests get checked in.
132-
133-
Following that, set the sec-approval flag to '?' on the patch when it is
134-
ready to be checked into mozilla-central (or elsewhere if it is branch
135-
only).
105+
If it meets the above criteria, developers do not need to ask for sec-approval.
106+
107+
In all other cases, developers should ask for sec-approval.
108+
Set the sec-approval flag to '?' on the patch when it is ready to be landed.
109+
You will find these flags in Bugzilla using the "Details" links in the
110+
Bugzilla attachment table (not directly on phabricator at time of writing).
136111

137112
If developers are unsure about a bug and it has a patch ready, just
138113
request sec-approval anyway and move on. Don't overthink it!
@@ -215,5 +190,7 @@ multiple axes:
215190
- reverse engineering risk
216191
- stability risk
217192

218-
The most common choice is: not much stability risk, not an immediate RE
219-
risk, moderate to high difficulty of exploitation: "land whenever"
193+
The most common choice is: not much stability risk, not an immediate
194+
reverse engineering risk, moderate to high difficulty of exploitation:
195+
"land whenever".
196+

0 commit comments

Comments
 (0)
Failed to load comments.