Closed (fixed)
Project:
Security Review
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
14 Nov 2014 at 13:36 UTC
Updated:
22 Nov 2023 at 10:52 UTC
Jump to comment: Most recent
banviktor is working on this as part of Google Summer of Code 2015. The latest code is at https://github.com/banviktor/security_review, developer blog can be found at http://blog.banviktor.me/gsoc15.
Additional checks may be created but should be coordinated via a new issue, this ticket is about upgrading and matching most of the feature set of Security Review 7.x-1.x.
Comments
Comment #1
coltraneComment #2
coltraneRegarding the architecture and implementation of security checks, a limitation of the D7 design has been its reliance on anonymous arrays. While not required, I'd recommend that the design adapt to a more object-orientated architecture, but I leave the feasibility of that up to those carrying out the work. For inspiration see the checks of https://www.drupal.org/project/site_audit.
Comment #3
banviktor commentedComment #4
coltraneNoting GSOC project in summray.
There's now a 8.x-1.x branch for hosting the code so eventually it'll also live here on drupal.org
Comment #5
raulmuroc commentedWhat is GSOC?
Is it not a little out of sense to write with abbreviations? Drupal community is intended to help everybody related to users, from the most high-skilled technical stuff to the most low-skilled basic user and most of them (last group) doesn't know the meaning. If I write: AFAIK, the Concurrent Versions Systems AKA CVS have to be delivered ASAP. Makes it difficult to understand instead of ease it.
Comment #6
anavarreI use http://www.acronymfinder.com/ when an acronym is unknown to me. Also, @coltrane has updated the issue summary before with the link to the GSOC (Google Summer of Code) page and even Google uses GSOC in the URL and elsewhere to refer to it.
One of the only Drupal-specific acronyms you cannot find out about outside of the Drupal Community is 'IS' which stands for Issue Summary.
Comment #7
banviktor commentedI've taken out the proposal link as it wasn't accessible to the public. Also updated the text considering the abbreviation issue mentioned above. Additional changes to this issue will be made throughout the project, and a bigger update will come this week to actualize the tasks and timeline.
Comment #8
banviktor commentedAdded detailed plan.
Just a little update for those who don't want to get into the code to know where I am:
I've finished implementing the new architecture and connecting it to the UI, the Base URL check is in the code as an example, it doesn't check your base URL setting yet, but serves as an example for how checks should be implemented. I've already tested the API by writing an other module that defined a check and it worked well.
So until the first push to drupal.org I have to:
Comment #9
banviktor commentedMade a checklist.
Comment #10
banviktor commentedComment #11
banviktor commentedThe new API documentation can be found here.
Comment #13
banviktor commentedComment #14
banviktor commentedDrush interface port is ready.
Comment #17
banviktor commentedAdded "Drupal permissions" check to the list of checks (I've just ported it and didn't find it here).
Also removed the checklist, it might have been a little unprofessional.
Comment #18
banviktor commentedCorrected "code is so far at", as there is already an 8.x-1.x branch with most of the code in it.
Comment #20
banviktor commentedUpdated blog link and check porting progress.
Comment #23
banviktor commentedPorted Executable PHP check.
Comment #24
banviktor commentedAdded check PHP Access to the "not to be ported" list. Looks like the PHP module died and no one wants to resurrect it. Confirmation on my find would be nice.
Could make a check that tests whether the module is enabled tho.
Comment #26
banviktor commentedPorted Text formats and Temporary files.
Comment #28
banviktor commentedPorted Database errors, Failed logins and Views access.
Comment #30
banviktor commentedFinished porting the checks. However still lacking some parts of the documentation (Drush usage, alterables), and the runCli() for File system permissions and Executable PHP, so still at Port existing checks.
Comment #32
banviktor commentedRemaining tasks:
Comment #35
serundeputy commentedHi @banviktor.
Thanks for your excellent work on this!
I can install the module on `8.0.x` branch of drupal 8 on 18 July 2015
I can verify that output report from the GUI `/admin/reports/security-review` and `drush security-review` report the same information.
Anything else you would like tested?
~Geoff
Comment #36
serundeputy commentedHi @banviktor.
I went through the tests that failed the security review for me:
For (1) I set the
$base_urlin settings.php as instructed in the Details of the report. Well done.For (2) on the Details report (/admin/reports/security-review/help/security_review/file_perms) it says:
So, I checked the `security_review` directory and there was no `file_write_test.YYYYMMDDHHMMSS` that is good presumably the test could not write that file.
The IGNOREME.txt file was/is there; I think that is fine and what would be bad is if it were IGNOREME{timestamp}.txt, but I was not sure if that is correct. So, I think either make the language clear on the `details` (/admin/reports/security-review/help/security_review/file_perms) page, or split out the tests into separate line items on the security report so that the user knows what to fix and how to fix it. Does that make sense?
For (3)
I think these are all legitimate solutions and which is right for a user depends on who there `Authenticated users` are for their site. Maybe we could layout some circumstances in which one of the above solutions is correct, i.e. if your `Authenticated users` are internal staff and know not to put javascript in the image tag then we can trust them.
I'm not sure just thinking aloud.
Private files feature is not enabled. test is in background color #dfefff ; does that mean that it is fine, but was just not tested since it is not enabled? If so giving the user some reassuring language I think would be good. Perhaps a message that says if they are to enable `private` files later they should come back and run the report again to make sure they are secure.
A nice to have for UI would be a progress bar as the tests take around 30s to run. An inexperienced user may not know anything is happening in the background.
~Geoff
Comment #37
banviktor commentedHi @serundeputy
Thank you for testing the module.
(2) IGNOREME.txt
The timestamp gets appended inside the file's contents (if it's writable). Changing the text would need a separate issue as this text was directly copied from the D7 version.
(3) The check result depends on which roles are set as untrusted on the Settings tab, so I think providing scenarios on this page is unnecessary.
Private files feature is not enabled.
That means it's fine. Only warnings and errors are considered to be vulnerabilites.
30s check runs.
Could you tell me about your test environment?
OS, filesystem? 30s check runs are normal on NTFS filesystems (sadly), but a progress bar would be a nice feature (the old version had one), so I will add that later.
Comment #38
serundeputy commentedExecution time:
Test Environment:
Comment #39
banviktor commentedThank you @serundeputy for the additional information
The slowness is most likely caused by determining which files are writable in your Drupal installation directory. If you click on Details next to "Drupal installation files and directories (except required) are not writable by the server." it probably takes about 30 seconds to show the results.
This slowness does not exist on ext filesystems (haven't tried all of them though). In the D7 version the difference wasn't noticeable because there were only ~1500 files while D8 consists of ~16500 files.
For more information on this, read my week 6 blog post here
Comment #40
serundeputy commentedgreat! thanks for the write up and all of your hard work!
Comment #42
banviktor commentedComment #43
joshi.rohit100Hi haven't looked through the complete module but here is one thing that I noticed :-
In your ChecklistController (may in other places as well), you are using static methods like '::csrfToken()', '::currentUser()'. I think it is better if you use DI instead of this.
Suggestion :-
You are making heavy use of SecurityReview class. So why don't you make it service ? I know most of its methods are static but still think in service way.
Comment #44
banviktor commentedHi @joshi.rohit100,
Thank you for your findings. It is also weird that I used ControllerBase for ToggleController but not for HelpController and ChecklistController. I will address these as soon as I can.
Comment #46
banviktor commentedThe lack of DI in controllers is already resolved on my GitHub. For services I was thinking Checklist, Security and SecurityReview as the Symfony Book says "As a rule, a PHP object is a service if it is used globally in your application.".
Comment #47
banviktor commentedChecklist, Security and SecurityReview are services on this branch on my GitHub. I don't feel like I gained much by this modification. Any feedback is welcome.
Comment #49
banviktor commentedServices and DI are part of the d.o code repository too.
Base URL check has been replaced by Trusted hosts which checks for $base_url and $settings['trusted_host_patterns']. See Issue #18 on GitHub.
Comment #50
banviktor commentedComment #51
banviktor commentedForgot to mention that some uninformative check results have been hidden, such as "Private files feature is not enabled". (@serundeputy)
Comment #52
serundeputy commentedJust tried it out. Works great! thanks.
~Geoff
Comment #55
francewhoaThanks all for your contributions :)
We are happy to contribute testing patch, quality assurance, documentation, and agile project management services if needed
Related pages
Comment #56
francewhoaUpdated title so it's easier to read. Using aggregator, drupal.org dashboard and search.
Comment #57
dsnopek@banviktor: How would you feel about using plugins for the checks? It seems like it'd be a good use of plugins - we'd be able to eliminate
hook_security_review_checks()and can move metadata about the checks (getNamespace(), getTitle(), getMachineTitle(), etc) into the plugin definition like other D8 plugins (ex. blocks, field formatters, etc).I'd be happy to write the code (I'll make a new issue) but I just wanted to see what you thought first?
Comment #58
banviktor commentedHi @dsnopek,
Using plugins came up as an idea during the last few weeks of GSoC, so the time was limited then. I forgot to mention there are a few issues related to the port I did on my github issues page.
So I'm more than happy if this gets implemented :) Thank you @dsnopek !
Comment #59
banviktor commentedComment #60
dsnopek@banviktor: Ah, cool! I didn't think to check the issues in the GitHub repo. Now that the module is fully working on D8 and the code is in the Drupal.org repo, how about closing this issue and moving the GitHub issues into this queue? Then we can continue collaborating on it in one place. I'd be happy to be the one to actually create the new issues here!
Comment #61
banviktor commentedYes, this issue doesn't really make sense now. Feel free to close this and create new ones :) Thank you!
Comment #62
dsnopekOk, closed! I made three issues on D.o for the four GitHub issues:
#2623148: Make security checks into plugins
#2623150: Remove SKIPPED and HIDE constants
#2623152: Merge Check::evaluate() and Check::evaluatePlain()
Comment #63
avpaderno