There are a constant stream of support requests and confusion about what happens when you mark a release node as a "Security update". Probably the vast majority of contrib maintainers don't understand the implications of selecting this term when adding a release node.
So, we should form_alter() the release node form in here to add:
a) some extra description text for that form element.
b) extra validation if they select "Security update" that basically acts like a confirm form.
c) (perhaps) a new form element for them to input the SA associated with their security update (from bdragon in IRC).
Other suggestions welcome. Let's agree on how it should behave, then the FAPI changes will hopefully be fairly straight forward.
Comments
Comment #1
merlinofchaos commentedA and B -- I don't think we want C necessarily; most module authors can't author security announcements, really.
Comment #2
dwwsorry, i didn't mean the entire SA... just the SA identifier, e.g. "DRUPAL-SA-2008-008", etc.
Comment #3
dwwupon further thought, the SA identifier might not help much, unless we make it more complicated like adding a new table of identifiers mapped to project nids, and the sec team can create/allocate new ids, etc. if it's just a text field with little or no external validation, people will just input jibberish in there. this might be getting too complicated. perhaps the extra description and confirm form are enough.
Comment #4
dwwsee also http://drupal.org/node/212219
Comment #5
gregglesI like A and B only as well. I think C is overly complex. In most normal situations people would just use a CCK link field to hold that.
Also, seanr was just bitten by this issue and may have time to work on it (/me hopes).
Also, for those too lazy to click on the link in #4 the idea is to prevent the "Security update" taxonomy term for dev releases.
Comment #6
seanrI'll add this to my queue, having just been a victim of the inadequate language around this option myself. ;-) If A and B is the consensus, I'll work on a patch.
Comment #7
aclight commentedThat sounds good to me. However, a patch should be against the drupal.org module, not the project module.
Comment #8
seanrOK
Comment #9
gábor hojtsyWhat should happen if someone tries to tag an already published release with "security update"? Should this option be removed from the select list so that people cannot do this, or should we warn them that it will unpublish their release and require security team action? I am not sure the security team has a process for already published releases marked "security update".
Comment #10
gregglesI'd say we should remove it from the select box for non-admin users.
Comment #11
dwwI agree w/ greggles. Once it's published and out, it's too late to go back and call that a security release with all the various implications that has for end users. We should just remove it from the choices, and perhaps add some fine print help text saying something like "If you want to mark this release as a security update, contact the security team." I don't think the sec team has a process for this case, but preventing it is a good first step. ;)
Looks like seanr isn't actually working on this...
Comment #12
dgtlmoon commentedI wasnt too happy when this occured.. if we can save merlin some stress ... http://drupal.org/node/346502
Comment #13
dwwSeemed like no one's ever going to work on this unless I do it, so I just took an initial stab at this.
A) When adding a new release, there's now a (perhaps too verbose) description.
B) When editing an existing release that's not marked as a security update, the "Security update" option is gone for users without the 'administer projects' permission.
C) When editing an existing security update release, the entire 'Release type' selector is disabled for users without the 'administer projects' permission and there's a description.
See attached patch and screenshots.
This patch is also running on http://project.drupal.org, so you can try to see it there if you already maintain projects on d.o (though it's going to be hard for you to add new releases since you can't tag the project.d.o CVS repository).
Comment #14
dwwHere's a first draft of adding some kind of "Are you sure?!" validation when people select 'Security update' on a new release.
I was imagining a dynamic checkbox called "Are you sure you want to mark this as a 'Security update'?" which is hidden by JS until the user selects the 'Security update' term. If that term is selected and the checkbox isn't checked, it'd be a validation error for the form. That seems a lot easier than trying to add an entire new page on the node form which acts as a confirm form or something.
However...
If we put a checkbox inside the "Categories" fieldset, core's (rather lame) hard-coded handling in taxonomy_nodeapi() will get confused unless we jump through a lot of hoops to try to undo the checkbox before taxonomy_nodeapi() is called.
If we put a checkbox outside the "Categories" fieldset, I'm worried it's going to look wonky just floating around outside a fieldset. But, security updates are rare, and I guess it doesn't matter *that* much how aesthetically pleasing the form looks in that case. By moving the "Release type" vocab to the bottom of the "Categories" fieldset, this isn't that much of a problem...
So, this is *almost* all working, except I've never tried to use jQuery to attach to a multi-select form element, so that part isn't working. The JS part of this patch is broken, and the confirm checkbox is always visible, even if you didn't select "Security update", and I've commented out the lines that automatically hide the element by default and load the .js file, etc. Anyone with jQuery fu who wants to help with this would be most appreciated.
Also, I don't remember if FAPI ever marks checkboxes in the red error box when there's a form error. It's not happening with this patch, and I'm not sure if that's something I'm doing wrong or a limitation in FAPI itself.
Comment #15
aclight commentedRe #13, I wonder if the "contacted the security team" link should go to http://drupal.org/security-team#report-issue instead of http://drupal.org/contact. I personally think it's more obvious how to report a security issue at the first page rather than the on the contact form. Otherwise I think the description is good.
Re the patch itself, I think there's a case here where all falls to pieces :(
I created a new project release node (see http://project.drupal.org/node/343022/edit).
Initially, I selected only the Security update term in the release type field. I then filled in all of the other required fields and clicked submit. I didn't get any "are you sure?" confirmation either before or after clicking submit. Perhaps you haven't installed the patch from #14 yet, so this might be expected. After submitting the node, I was taken to the view page for that node. The node had a pink background, indicating that it was unpublished. It also had the 6.x and the Security update terms displayed.
So far, the only possibly unexpected thing is that I wasn't asked to confirm selection of the security update term.
Then, I went in to edit the release node. The term selector box did *not* have the Security update term available for me to select, nor was it visible (I think this is the expected behavior). I then checked the Publish box, and saved the node. The node was now published. However, the two terms assigned to the node were now 6.x and New features, even though I did not change the term at all.
I'm guessing that I'm a site administrator on p.d.o, so I have the permission to publish nodes but not the permission to see or modify the security update term once it's already been assigned. But since I can publish the node, and since it seems that you remove the security update term from the multiple select via form_alter, when the node is published it loses the security update term and that's replaced by the New features term.
Other than the bug reported above, I have a few additional concerns with how this works:
1. Given that site admins with "administer nodes" privs can publish release nodes that have been flagged with the security term, I think we need to do 1 of 2 things:
a. Require "administer projects" privs to publish release nodes (or release nodes with the security update term at least).
b. Allow anyone with "administer nodes" to also be able to see and alter the "Security updates" term.
I think we have to do one of these two things to keep privs consistent.
2. It seems like your patch does not provide any kind of notification to the security team when a user creates a release with the "Security update" term. I think this is key to improving the workflow here. I don't know that we can rely on everyone reading and understanding the note you've added. Now whether the security team has the manpower to follow through on automated reports of this type I don't know.
3. I'm a little worried that adding this additional information might make it less likely that maintainers will select the security update term even in cases where they should. In a way, our current system kind of traps releases made by (security process wise) clueless maintainers and prevents it from being extremely obvious that a release contains a security flaw. If they know ahead of time that choosing the security update term will require them to go through the whole security team process, maybe they'll just say, screw it, and not mark it with that term at all.
#3 is really more of a procedural/social problem and not something I think we can solve with code, so it's not entirely relevant to this patch review. But I thought it was worth bringing up, since we do want our description to inform people about the correct process but not scare them away from the security process. I think it does a pretty good job of that as is, but changing it too much might be problematic in one way or another.
Comment #16
dwwThanks for the review.
- Right, only #13 is applied on p.d.o -- until the JS is working I didn't want to deploy #14.
- Agreed that http://drupal.org/security-team#report-issue would be better.
- Seems like there's an edge-case bug in the logic somewhere -- it shouldn't hide the 'Security update' term if that's already selected.
- #15.1: Hrm, yeah, good point. I'm worried about the fact that a lot of people have 'administer nodes' on d.o, and any time I relax project* related validation for those folks, we get problems because the admins break something with their extra powers. So, I think I'd prefer (in drupalorg.module) to remove the "Published" checkbox from unpublished release nodes unless you have 'administer projects'. That should happen regardless of the security update, too, so I'm splitting that off into #346618: Remove "Published" checkbox from unpublished release nodes for most users. To avoid patch conflicts, let's just handle that (easy part) once the rest of this lands.
- #15.2: I agree we need that, but I was thinking that's out of scope for this issue. It seems like something the packaging script should do, although I guess it could be done via a custom submit handler for the release node form. Either way, I think that should also be a separate issue. This patch is already getting huge, and I don't want to make it any harder to review/test/commit. So, let's talk over at #346620: Notify security team whenever releases are marked "Security update".
- #15.3: Good points, thanks for raising them, but yeah, I don't know what else we can do about it right now.
Anyway, these patches clearly need work for the bug aclight described, the better "contact" link, #14 needs jQuery multi-select fu, and neither one addresses #212219: Dev package showing as security update yet.
Comment #17
dwwMight be overkill, but once a release is marked 'Security update', it might be nice if there was an auto-generated note when viewing the unpublished node that was something like:
"Since this release is a security update, it will not be published until the Drupal Security Team has published the security advisory and manually publishes this release. If you think this has been done in error, please contact the security team."
p.s. It'd also be nice to either update that "Types of releases" handbook page to more explicitly describe what's up with security updates and update_status, or add a new sub page specifically about that which can be linked from all these various places...
Comment #18
dww- Adds PHP constants for the various URLs we're using so we can change them in 1 place.
- Uses http://drupal.org/security-team#report-issue for contacting the sec team.
- Removes the 'Security update' option for all -dev release nodes, even for project admins.
Also, I just deployed this on p.d.o and ran the DB update to set the system weight for drupalorg heavier than cvslog. I wonder if that was the problem aclight was seeing on p.d.o.
TODO:
- see if aclight's reported bug from the top of #15 is still happening on p.d.o now that the weight is right.
- jQuery multi-select fu
- #17 if we want that
Comment #19
dwwGot some jQuery multi-select help from dmitrig01 and merlinofchaos in #drupal IRC just now, and that's now working. Yay! This current patch (#19) is now deployed on http://project.drupal.org if you want to try it there.
Setting this back to CNR, since it'd be nice to get confirmation if the system weight thing solved aclight's problem, and to get more feedback on all this. I think #17 can be punted to another issue if we want it.
Comment #20
dwwThere was a bug when you select "Security update" and preview where the checkbox disappeared on the new page load. That's because I was always adding the "js-hide" class, forgetting about the preview case. For some ungodly reason,
$form['taxonomy'][$vid]['#default_value']is an empty array even when some elements are selected on preview, so I'm inspecting $form['#post'] directly. Ugh. I don't know if this is something going wrong in all this nasty FAPI altering code, or if that's expected behavior. At least it works. ;)I think I've found a jQuery bug, however. Whatever values are selected when you hit preview, the jQuery always thinks those are selected on the new page, in addition to whatever else you've actually selected. :( So, it means that if you selected 'Security update' on the first page, the checkbox never disappears on the preview page, even if you deselect that option. Not sure what to do about this, but I suspect it'll go away when we upgrade to D6 and jQuery 1.2, so I don't want to spend much more time on it.
Comment #21
dwwAfter more UI discussion in IRC, we decided to move most of the warning text about what happens when you select 'Security update' as a description on the confirm checkbox, instead of always displaying it under the "Release type" element. Furthermore, we simplified the text to just be What is a release type?.
This is now deployed on p.d.o. See a new round of attached screenshots, if you prefer.
I think this is about RTBC now...
Comment #22
dwwchx: confirmed there's no more elegant way to check for which terms are currently selected in "Release type" to decide what classes to put on the div in the prefix for the "Are you sure...?" checkbox. If they were both the same form element, we could just use #process, but since they're different form elements, that won't work. Since we neither store nor print the value from #post, there's no security issue here.
Therefore, committed this to HEAD and deployed for real on d.o and p.d.o.
Comment #23
dgtlmoon commentedIs this something that can be solved with the workflow module?
Comment #24
dww@dgtlmoon: No, since workflow isn't running on d.o and we're not going to add new dependencies for something like this.