~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/bugs/doc/security-teams.txt

  • Committer: Stuart Bishop
  • Date: 2011-09-28 12:49:24 UTC
  • mfrom: (9893.10.1 trivial)
  • mto: This revision was merged to the branch mainline in revision 14178.
  • Revision ID: stuart.bishop@canonical.com-20110928124924-m5a22fymqghw6c5i
Merged trivial into distinct-db-users.

Show diffs side-by-side

added added

removed removed

Lines of Context:
232
232
    >>> bug_product_changed = ObjectModifiedEvent(
233
233
    ...     bug_in_evolution, old_state, ["product"])
234
234
 
235
 
First, let's publish the change event with the bug still marked private,
236
 
and notice that the subscription list doesn't change:
 
235
First, let's set the bug to non security related with the bug still marked,
 
236
private and notice that the subscription list doesn't change:
237
237
 
238
238
    >>> bug.private
239
239
    True
240
240
 
241
 
    >>> notify(bug_product_changed)
 
241
    >>> bug.setSecurityRelated(False, getUtility(ILaunchBag).user)
 
242
    True
242
243
 
243
244
    >>> subscriber_names(bug)
244
245
    [u'name12', u'name16']
245
246
 
246
 
Also verify the same event again, when marked public does cause
 
247
Now the bug is marked as security related, when also marked public does cause
247
248
stub to get subscribed:
248
249
 
249
250
    >>> bug.setPrivate(False, getUtility(ILaunchBag).user)
250
251
    True
251
252
 
 
253
    >>> bug.setSecurityRelated(True, getUtility(ILaunchBag).user)
 
254
    True
 
255
 
252
256
    >>> bug.security_related
253
257
    True
254
258
 
255
 
    >>> notify(bug_product_changed)
256
 
 
257
259
    >>> subscriber_names(bug)
258
260
    [u'name12', u'name16', u'stub']
259
261
 
265
267
    >>> subscriber_names(bug)
266
268
    [u'name12', u'name16']
267
269
 
268
 
    >>> bug.setSecurityRelated(False)
 
270
    >>> bug.setSecurityRelated(False, getUtility(ILaunchBag).user)
269
271
    True
270
272
 
271
273
    >>> bug.security_related
278
280
 
279
281
 
280
282
When a bug becomes security-related, the security contacts for the pillars it
281
 
affects are subscribed to it.
 
283
affects are subscribed to it. This happens regardless of whether the feature
 
284
flag is set.
 
285
 
 
286
We current use a feature flag to control who is subscribed when a bug is made
 
287
security related.
 
288
 
 
289
    >>> from lp.services.features.testing import FeatureFixture
 
290
    >>> feature_flag = {'disclosure.enhanced_private_bug_subscriptions.enabled': 'on'}
 
291
    >>> flags = FeatureFixture(feature_flag)
 
292
    >>> flags.setUp()
282
293
 
283
294
    >>> from zope.event import notify
284
295
    >>> from lazr.lifecycle.event import ObjectModifiedEvent
296
307
    >>> bug.addTask(owner=reporter, target=distribution)
297
308
    <BugTask ...>
298
309
    >>> old_state = Snapshot(bug, providing=IBug)
299
 
    >>> bug.setSecurityRelated(True)
 
310
    >>> bug.setSecurityRelated(True, getUtility(ILaunchBag).user)
 
311
    True
 
312
    >>> notify(ObjectModifiedEvent(bug, old_state, ['security_related']))
 
313
    >>> for subscriber_name in sorted(
 
314
    ...     s.displayname for s in bug.getDirectSubscribers()):
 
315
    ...         print subscriber_name
 
316
    Bug Reporter
 
317
    Distribution Security Contact
 
318
    Product Security Contact
 
319
 
 
320
Clean up the feature flag.
 
321
 
 
322
    >>> flags.cleanUp()
 
323
 
 
324
And once more without the feature flag.
 
325
 
 
326
    >>> product = factory.makeProduct()
 
327
    >>> product.security_contact = factory.makePerson(
 
328
    ...     displayname='Product Security Contact')
 
329
    >>> distribution = factory.makeDistribution()
 
330
    >>> distribution.security_contact = factory.makePerson(
 
331
    ...     displayname='Distribution Security Contact')
 
332
    >>> reporter = factory.makePerson(displayname=u'Bug Reporter')
 
333
    >>> bug = factory.makeBug(product=product, owner=reporter)
 
334
    >>> bug.addTask(owner=reporter, target=distribution)
 
335
    <BugTask ...>
 
336
    >>> old_state = Snapshot(bug, providing=IBug)
 
337
    >>> bug.setSecurityRelated(True, getUtility(ILaunchBag).user)
300
338
    True
301
339
    >>> notify(ObjectModifiedEvent(bug, old_state, ['security_related']))
302
340
    >>> for subscriber_name in sorted(