Closed (fixed)
Project:
Link checker
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Reporter:
Created:
14 Aug 2018 at 16:25 UTC
Updated:
14 Jul 2019 at 10:44 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
pnagornyak commentedAdded a view.
Comment #3
pnagornyak commentedRemove some controllers and code for old report pages. I suppose, we no longer need them, but I added it as another patch to easily revert it.
Comment #4
hass commentedYes, need to be migrated to views. Where are you checking if the user has permission to view a link?
Comment #5
pnagornyak commentedPermission check added here #2780873: Add a new entity type linkchecker
Comment #6
pnagornyak commentedComment #7
pnagornyak commentedComment #8
hass commentedI guess this needs a rerole after the many other commits?
Comment #9
waverate commentedRe-roll of patch at #7 against linkchecker-8.x-1.x-dev (29 May 2019).
Comment #10
waverate commentedForgot to add the view.
Comment #11
waverate commentedSigh.
Comment #12
waverate commentedMoved /config/optional/views.view.broken_links_report.yml to /config/install/views.view.broken_links_report.ymlComment #13
waverate commentedUse patch at #11.
From CR:
Comment #14
waverate commented1. Re-roll patch at #11 against linkchecker-8.x-1.x-dev (29 May 2019) - 5fcf109d
2. Fixed views broken/missing handler for Entity Field.
3. Enabled contextual link in view.
Now that the report is available in views, I think the rest of the customizations can be done by the end user to fit their needs.
Comment #15
waverate commentedComment #16
hass commentedOnce the reports are migrated to views - linkchecker depends on views.
We cannot commit this view as it adds a security bug. perm: 'access broken links report' Is not correct. The user that views the view may not allowed to see a content type field a link is extracted from. Such links may contain passwords what will cause security bypass to users with ‚access broken links report' permission.
Since we know now from what entity the link comes from, we could check the field permission of the current user has access too and exclude these links from the report.
Comment #17
waverate commentedRe: #16. Is adding text to the permission acceptable for now or maybe calling the permission View Any Broken links report?
Warning: Give to trusted roles only; this permission has security implications.
This may allow you to commit this patch and keep the D8 release moving forward.
We can then open a new issue to create View Own Broken links report; or something similar.
Comment #18
pnagornyak commented@waverate have you checked on your local env that it is bypassing entity access?
we have an Access Handler for LinkCheckerLink and it should work, so there is no need to add restricted permission warning.
Please check it.
Comment #19
waverate commentedRe: #18. Sorry. I didn’t realise you already implemented the permissions in linkchecker.permissions.yml:
1. I think @hass is correct. The ‘Access broken links report’ permission should have restrict access: true.
2. With respect to linkchecker.routing.yml, are the report permissions taken care of here or are they part of the view:
3. I don’t see the the view display for /user/{user}/linkchecker. Should I build that?
Comment #20
waverate commentedComment #21
hass commented@pnagornyak: Can we prove the entity permission works properly with a test, please?
Yes, but we should handle this in an extra case so that this case here does not get blocked by it.
Comment #22
waverate commentedRe: #18. I can confirm in my local env, that I have given a user without any nodes/entities, only permission ‘Access broken links report’.
The user has access to all links in the Broken links report.
How is the access handler supposed to be used in the view?
Comment #23
waverate commentedComment #24
pnagornyak commentedI checked how Views checks access to entity - there is no entity access check :(
But Views checks field access, so I adjusted fieldAccess for LinkcheckerLink URL field, if user does not have access to entity that stores a Link then he will see empty URL in table, here is example:
https://i.imgur.com/Cnqnbpr.png
NOTE: if we will add access check on view prerender hook, then user will see broken list of links, means - on some pages he will see 20 links, on some pages 6 or even 0 (in a case if view pager is exist).
I also add some adjustments access handler and tests, for cases when parent entity was removed but Link still exists in database.
Comment #25
pnagornyak commentedComment #26
waverate commentedPatch at #24 looks good. I also think @pnagornyak's interpretation of @hass' requirement at #4 is a good one.
Instead of:
Check if users have view access to field containing a link.
If a user does not have view access to the field containing a link, he will not see the URL in the Report as shown in @pnagornyak's attached image.
Are we able to filter the View if URL is empty, so a user will not see these rows at all? If that could be done, I'd call this perfect.
Comment #27
hass commentedCan we add a text like "Permission restrictions deny you access to this broken link." (as in D7) as replacement to no URL?
Comment #29
hass commentedI committed this as-is in hope it is done correctly. Lets fix the remaining stuff in follow ups.