Skip to content

Error when user without permissions accesses attachment link #681

Description

@svarlamov

For Bug Reports

  • BookStack Version (Found in settings, Please don't put 'latest'): master branch commit f4bfbf9
  • PHP Version: 7.1.10
  • MySQL Version: 5.7.20
Expected Behavior

User should see a 403 (or 404 if we wish to 'hide' it) page

Current Behavior

User gets a "An unknown error occurred" page. In the console log, we see:

production.ERROR: Type error: Argument 2 passed to BookStack\\Http\\Controllers\\Controller::checkOwnablePermission() must be an instance of BookStack\\Ownable, null given, called in /var/www/bookstack/app/Http/Controllers/AttachmentController.php on line 190 {"exception":"[object] (Symfony\\\\Component\\\\Debug\\\\Exception\\\\FatalThrowableError(code: 0): Type error: Argument 2 passed to BookStack\\\\Http\\\\Controllers\\\\Controller::checkOwnablePermission() must be an instance of BookStack\\\\Ownable, null given, called in /var/www/bookstack/app/Http/Controllers/AttachmentController.php on line 190 at /var/www/bookstack/app/Http/Controllers/Controller.php:101)"} []
Steps to Reproduce
  1. Create a page with an attachment.

  2. Set custom permissions for the page that prohibit your user in step 3 from viewing the page

  3. As a user that doesn't have view privileges to the page, navigate to the link for the attachment (ie., http://localhost:8080/attachments/1)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions