over at #1507988: SA-CORE-2012-002 - Access bypass - private images it was noted that we check access on the original image if the derivative doesn't exist, but check access on the derivative if the derivative does exist.
this patch does the most naive thing, and always passes in the derivative path for access checks.
| Comment | File | Size | Author |
|---|---|---|---|
| image-style-access.patch | 587 bytes | Anonymous (not verified) |
Comments
Comment #2
berdirTests failed, I guess the reason is that we check access before the file exists, so we can't return the proper headers and stuff. To be able to support this, I guess we need to move the access check below actually creating the file. I don't think that is a performance problem because having to create the derivate is a one-time special case anyway and is slow already.
Note: This looks a bit confusing, but what happens is that image.module translates the derivate url to the original url and calls hook_file_download() again and allows access if access to the original image is allowed.
What this change actually consistently allows is applying different access rules for different derivates (and different than the original). I think. Would be a good idea to add tests for that.
Comment #3
claudiu.cristeaAnd more:
public://) while still having originals as private (private://). And this is not only for access reasons but for performance. For every small thumbnail on the same "poster store" the request is traversing Varnish, hitting Apache, hitting PHP and then hitting in the heart of Drupal. Why? This is too expensive.My proposal:
private://is enabled)Comment #4
claudiu.cristeaComment #5
claudiu.cristeaAfter converting the image system to OOP I feel that this is a non-issue.
I'm closing it. Feel free to reopen if I was wrong.
Comment #5.0
claudiu.cristeaenglish please.