Details
-
Type:
Sub-task
-
Status:
Closed
-
Priority:
Blocker
-
Resolution: Fixed
-
Affects Version/s: 2.0
-
Fix Version/s: 2.0
-
Component/s: Portfolio API
-
Labels:None
-
Affected Branches:MOODLE_20_STABLE
-
Fixed Branches:MOODLE_20_STABLE
Description
Portfolio export needs to verify access control, the easiest way is to use require_login() with correct $cm parameter - replicating the logic from require_login() would be probably a major maintenance problem...
Sample exploit:
1/ go to forum in one browser and copy "Save..." link
2/ make module hidden in another browser as where you are logged in as admin
3/ paste the url in first browser - export will complete anyway
Interesting, each of the portfolio_caller subclasses needs to implement check_permissions function, which usually does a has_capability check. See mod/forum/lib.php, search for check_permissions function.
Maybe it's not being called properly when the exporter object is rewoken across requests. I'll check that.
I don't agree with your best fix though. Just doing require_login is not enough, we have to check the export capabilities on the context being exported as well.