Closed (fixed)
Project:
Drupal core
Version:
8.5.x-dev
Component:
update.module
Priority:
Critical
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
3 Aug 2018 at 17:49 UTC
Updated:
5 Sep 2018 at 10:19 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
tedbowHere are the current tests from #2804155: If the next minor version of core has a security release, status still says "Security update required!" even if the site is on an equivalent, secure release already
Some will fail. but just wanted to start with all cases.
I marked this as critical issue because @xjm said we should get this 1 in first and the other issue is critical.
Comment #3
tedbowremoved debug line
Comment #6
tedbowRemoved 2 core tests cases that are broken and will be fixed in #2804155: If the next minor version of core has a security release, status still says "Security update required!" even if the site is on an equivalent, secure release already
Removed 4 contrib test cases that are broken they might not be in #2804155
The page says "Security update required!" but link to update is not shown.
No update shown.
Not supported! shown 😕
The page says "Security update required!" but link to update is not shown.
Also to get a quick test result I am only testing "update" group. I don't know how to test 2 classes.
Comment #8
tedbowNooooooooooooooooo!
Comment #9
saurabh-chugh commented@tedbow I am testing the patch.
Can you please elaborate this second point
No security release available for site minor release 0 but release not marked as insecure. Security release available for next minor.
Comment #10
tedbowThis test case.
which uses this test xml file core/modules/update/tests/modules/update_test/drupal.1.2-sec.xml
If you look at that test case there is
<term><name>Release type</name><value>Insecure</value></term>meaning if you are 8.0.* you don't have security problem(in this test case). This mimics a security problem that was introduced in the 8.1.x branch but doesn't exist in the 8.0.x branch(probably because it is new feature added to 8.1.x)
A new feature on Drupal.org update xml is to explicitly mark releases as insecure. This should be the authority on what is secure vs insecure.
Comment #11
saurabh-chugh commented@tedbow Thanks for explaination.
Comment #12
xjmI don't think these changes should be here?
Comment #13
tedbow@xjm I was just adding changes to this file so that I could run few tests and get the results faster while I working on this issue.
Will remove them now.
Added beta tests.
Comment #14
samuel.mortensonNice work so far!
I don't see test coverage for going from alpha -> beta, or beta -> beta, or alpha -> rc. Also don't see a test for when there's a security update for a previous branch, i.e. if you're on 8.x-2.0 and there's a security update in 8.x-1.2, there should be no expected security release.
Comment #15
xjmSo this is an interesting case now that the "insecure" metadata has been populated. 8.x-2.0 might be secure, or it might be insecure. If it's insecure and there's no secure version on 8.x-2.x, then what do we expect to happen? What is the current behavior in HEAD?
Comment #16
tedbowI added a test for this case
Site on 8.x-2.2
No 8.x-2.x releases marked as insecure
8.x-1.2 has security release
8.x-1.1. 8.x-1.0 marked as
insecureThis fails now because it says 8.x-2.2 is unsupported.
I think we could fix this in #2989616: The update report does not honor drupal.org's info about what releases are secure or not
Comment #17
xjmThe second inline comment here looks incorrect; should it be "Security release also available for the previous major"?
That's a lot of negatives. :)
Does this imply that in the prior cases, all security releases besides the latest were marked as insecure? (The default behavior, but only since a couple months ago.)
Maybe it'd be helpful to just list a quick summary the releases in the fixture in the docs, e.g.:
Comment #19
tedbow@xjm thanks for review!
1. Yeah just want to upload failing tests here so we can make sure we cover them in other issues.
2. fixed
3. Added the list of which releases each fixture file has to the phpdoc for the @dataProvider methods.
Removing a fixture file that should have been removed in #6 when I removed the failing test.
Also renamed the security fixtures files to be [project_name].sec.*.xml because this groups them together and makes them easier to find.
I guess this fixtures there test classes were made before we used
/[module]/tests/fixturesfolders? This makes the listing confusing.Comment #20
tedbowWhoops looks #19 had a bunch of unrelated changes.
re #14
I have added this just as relates to security releases.
If you are any one of these releases and it is tagged as insecure the expected security release should be the 1 from the previous minor.
This gets the same mentioned in #6
I am adding the failing so we can back through issue and make sure all currently failing test will be in a followup.
This test cases has a passing test for core.
Comment #22
samuel.mortensonThis doesn't make sense to me - we should never suggest that users downgrade. Is this just how the current behavior is? I have the same comment for the other new tests that do this.
Comment #23
tedbow#22 makes sense. It looks like the current behavior is wrong. This patch will add pre-release tests that currently pass and are the correct behavior.
This patch adds
Comment #24
samuel.mortensonThis looks like a good amount of tests to start from when working on test logic changes. Marking as RTBC assuming the full test run passes.
Comment #25
xjmThanks @tedbow and @samuel.mortenson! I'll finish reviewing this tomorrow. Meanwhile:
1nsecure would be an excellent name for a boyband.
Comment #26
xjmLast line also looks to contain a typo here.
Comment #27
tedbowComment #28
tedbowI was working on re-rolling the patch for #2804155: If the next minor version of core has a security release, status still says "Security update required!" even if the site is on an equivalent, secure release already on top of this patch and I was adding the test cases I removed in this issue that should be passing with the fix in the other
In #6 I removed the contrib test case
This was actually because of
These release in the fixture from #3 should not have both terms
Security updateandInsecureSo that is why the tested failed. I added the test case back.
I looked at all of the test cases removed in this issue and none of the others have a problem.
Comment #29
samuel.mortensonBack to RTBC assuming tests pass.
Comment #30
tedbowThis links are set up incorrectly and aren't in the format that test would look for them.
This test case was set up for
8.x-2.*.betareleases but actually in the fixture files it is8.x-3.*.beta8.x-3.*.betawas intended.The 1st and third line here are actually the same assertion. Deleting
Comment #31
samuel.mortensonThis still looks good to me - hopefully my credibility isn't getting dinged! :-)
Comment #32
xjmReally great work on this. Thanks @tedbow for your careful attention to detail here. I am really glad we split this issue out.
I finally read through this carefully from the top. I want to read over the providers one more time but here are my notes from the rest (don't want to lose the review).
Why didn't this cause a fail before? (Or did it -- is that the source of the fail in #20?)
Hmm. Is this correct? This fixture has stable releases for 8.x-2.x too. Wouldn't this include both major versions? Why is the test passing if so? Maybe this doesn't actually affect the part of the behavior that we're testing? Need to double-check against the provider.
Same question here.
Is this
<security>message a c&p error? This is actually an RC if I'm reading the XML right.This probably has no impact on the test results and I'm not even sure if/how it's used in core, but could cause confusion with the fixture in the future. Maybe we should check what d.o actually outputs and verify this is still there as such.
Aside: I have trouble typing "XML" because it's too close to my username. :P
Same thing, except this one is an alpha.
I still think "expected security release" is unclear. Should this maybe say something like:
Is that accurate?
Also, this implies that only one security release is "expected". That's the default behavior with the changes to d.o's metadata and will likely be the preferred behavior based on UX review on #2865920: Add tests for when a single supported branch has 2 security updates that are both not insecure, but previously, multiple security releases were "expected". Are we sure we want to hardcode that there is only one? I think it's still technically possible for d.o to output multiple ones under certain circumstances. Should it be a
string[]instead, single-value everywhere for now, and add a reference/@todo for #2865920: Add tests for when a single supported branch has 2 security updates that are both not insecure? That way we can keep that out of the scope here.The other option is just calling it something like
$expected_latest_security_release.OTOH, since there are only two cases (core and contrib) the duplication might be NBD or something that a normal followup could address. What do you think?
Nit: I think the correct case is
Security update. Either that or the other ones are cased incorrectly. :)Comment #33
tedbow@xjm thanks for the detailed review!
1. The bad links didn't cause a test failure because none of the test cases had at that point a beta version as the
expected_security_releaseso none went on to check these links. It was important to fix them anyways because we may add test cases that point to them. As I did in #302. Good catch. No it is not correct fixing.
It didn't cause test failures I believe because from
update_calculate_project_update_status(my . comments in all CAPS)But that leads to the question in the above logic we hit:
$project_data['status'] = UPDATE_NOT_SUPPORTED;But then why doesn't this fail?
Because after this we loop through all the releases
And all our tests case where the
module_patch_versionwas 2 it was on an insecure release. SoUPDATE_NOT_SECUREover wroteUPDATE_NOT_SUPPORTED.But this is why this previous test case that I removed in #6
I will add back this test case
3. same problem fixed
sorry that is all I have time to review now. Will look at the rest of your points as soon as I can.
Comment #34
tedbowContinuing to address #32
4. Fixed
5. Fixed
6. Changes to multiple releases.
7.
The classes already both extend
UpdateTestBaseso I am moving the logic for checking the security updates on the report page to the base class. This remove duplicate logic.The only change I had to make to the fixtures for this is change download links for
aaa_update_testto dashes in the file names so they are the same for the core fixtures.8. changed all to "Security update"
Comment #35
xjmThose changes all look pretty good; thanks @tedbow.
Can we confirm that this is what d.o actually outputs for RCs? I would expect "Release candidates" but I don't know what, if anything, is actually there in the XML.
This one could have the array typehint too, right?
Now that we have an array, should we also be asserting that no security releases other than the expected security releases are shown?
Comment #36
xjmFor these to be formatted correctly as a nested list, the releases should have a
-at the beginning too. I think we can get rid of the line "contains releases" and instead say something like:Comment #37
xjmLooks like a typo as the same release is listed twice?
Comment #38
xjmThis fixture name doesn't appear in the docblock above?
Nit: When "2" is a word in a sentence (as in the quantity of something) rather than a string, we should spell it out as "two".
Nit: Should the second example look more like the first for easier scanning of the test cases?
Adding an item to the array after the fact is a bit brittle. I'd rather just have a separate test case for 8.2.0-rc2 after the foreach. That would also allow combining the two foreach loops into one.
Hm, quite the run-on. How about:
I had to read this a couple times to understand it on account of the double negative. Maybe:
This is interesting especially as a passing test case because it raises that release managers/sec team members need to remember to manually mark such pre-release milestones as insecure as I did when I rolled 8.6.0-beta2. By default, I think d.o only presents previous releases to be marked insecure on the security release publishing form. That's not relevant to this issue, but definitely something we need to keep in mind going forward.
Comment #39
tedbow1. Confirmed, yes this how it is output from d.o. I uploaded
real_drupal_update.xml.txtfile that I made from step debugging. So we can have it for future questions. Probably made a couple days ago.2. Fixed and fixed for
assertSecurityUpdates3. Yes adding
This points out failures in our test case that weren't detected before. A couple can be fixed by updating the dataprovider cases but I think most point to bugs. They could be problem with the fixtures also.
For contrib
Contrib fail case 1
Removing 8.x-2.2 as expected release.
This shown as "Also available" which I think makes sense the installed version 8.x-1.0 and there is security release for this major. but would like @xjm and @samuel.mortenson's opinion.
Contrib fail case 2
The expected release is correct in this data set but the test fails because it will also show
8.x-1.2as a security release.This would be a downgrade.
Contrib fail case 3
Removing the expected security release here.
The beta is not marked as a security release.
This case will still fail because 8.x-2.2 and 8.x-1.2 still shows as security releases.
Since these would both be downgrade this does not make sense
We should make a follow up. And remove this test case(leaving to show for now)
For core:
Core fail case 1
This needs the 2.0-rc2 to be added to the expected security releases.
but it will still fail because
8.0.2will be shown as a security release, a downgrade.Core fail case 2
All these will fail because
8.0.2and8.1.2will be shown as security updates, both downgrades.If these failures are not a problem with the fixtures then there is problem with showing security releases for previous minors.
I will investigate more but could use a sanity check. Will address the rest of @xjm's review afterwards.
Also adding back the changes to
core/drupalci.ymlto speed the testing cycle.Comment #41
xjmGoing to add some headers to Ted's review above just to make sure I'm not mixing stuff together.
Comment #42
xjmComment #43
tedbowfixing failures in #39
Contrib fail case 1
fixed in #39
Contrib fail case 2
removing test case and adding @todo for https://www.drupal.org/project/drupal/issues/2865920
Contrib fail case 3
Adding 8.x-2.2 and 8.x-1.2 as expected security updates as per @xjm comment in #42
Core fail case 1
removing test case and adding @todo for https://www.drupal.org/project/drupal/issues/2865920
Core fail case 2
re @xjm
Chatted with @xjm and actually core RC(not contrib) can be security updates according to policy. this doesn't happen right now because of bugs with the update module would cause problem with the previous minor to show it needing a security update even if it didn't.
So removing test case and adding @todo for https://www.drupal.org/project/drupal/issues/2865920
Comment #44
tedbowBack to the rest of @xjm's review
Also changed
No future releases for next minorto justNo releases for next minor. Next minor releases could actually be have been released in the past depending on how behind a site is.Also removing changes to drupalci.yml
Comment #45
samuel.mortensonBack to RTBC
Comment #46
xjmCan we attach a patch with the removed test cases to #2865920: Add tests for when a single supported branch has 2 security updates that are both not insecure? It won't apply yet but "Test with" can be set to "Do not test" on upload.
Hm, so even if it shows 2.2 it definitely should not be showing 1.2. So let's remove this test cases as well, insert the @todo, and include it in the patch for #2865920: Add tests for when a single supported branch has 2 security updates that are both not insecure.
Comment #47
tedbowRemoving the test case and adding the @todo
Will add test cases to #2865920: Add tests for when a single supported branch has 2 security updates that are both not insecure
Comment #48
samuel.mortensonRecent changes look good to me.
Comment #49
xjmNit: extra blank line.
Saving issue credit.
Comment #53
xjmI fixed the blank line on commit. Committed and pushed to 8.7.x, 8.6.x, and 8.5.x since we may need to backport code related to this for security coverage.
Thanks everyone for your patience on this issue! I feel a lot safer now about fixing the various bugs and changes needed with the update status report.
Comment #54
idebr commented@xjm I updated the 'Version' to the earliest branch this commit is available in. This information relevant for projects that are built with patches from Drupal.org and that update to a new minor version (8.5.x -> 8.6.x), since it indicates the issue has been fixed in the project itself and the patch can be removed.