Score:1

Permission denied on some private files, even though access is permitted

ng flag

Drupal 9.3

We have a site that allows private file uploads. We get intermittent files that cannot be viewed/downloaded, even with the "User 1" account.

There is no difference between a denied file and other files that can be viewed. The file exists in the Drupal Files Views and is used in 1 place as expected. The file exists on the server and has the same UNIX permissions.

Troubleshooting shows the Access Denied error coming from the download function in:

/web/core/modules/system/src/FileDownloadController.php

It appears that a header is getting set to -1 somewhere so I tried using hook_file_download() in a custom module with its weight set to 100 so it should fire last.

What's baffling me is that my hook is ran last by weight and the "-1" is not in the $headers but when FileDownloadController's download function checks it it is there.

The screenshot show dpm($headers) from my hook_download_file() that runs first and then the core download function. Where is the -1 being inserted and why is it intermittent?

enter image description here

cn flag
What kind of server? That may be relevant.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.