thumbor-community / aws

Thumbor AWS extensions
MIT License
155 stars 70 forks source link

Check allowed sources, fixes #94 #101

Closed Bladrak closed 6 years ago

Bladrak commented 6 years ago

Merging anyway, as the tests are broken waiting for https://github.com/nanvel/tornado-botocore/pull/12

kkopachev commented 6 years ago

Looks like it does not work. ImagingHandler tries to call validate on loader, if it exists there. validate called with 2 arguments, while one implemented in this PR has 3 parameters defined. Which results in

thumbor_1  | 2018-02-12 21:29:39 tornado.application:ERROR Future exception was never retrieved: Traceback (most recent call last):
thumbor_1  |   File "/usr/local/lib/python2.7/site-packages/tornado/gen.py", line 1069, in run
thumbor_1  |     yielded = self.gen.send(value)
thumbor_1  |   File "/usr/local/lib/python2.7/site-packages/thumbor/handlers/imaging.py", line 38, in check_image
thumbor_1  |     if not self.validate(kw['image']):
thumbor_1  |   File "/usr/local/lib/python2.7/site-packages/thumbor/handlers/__init__.py", line 535, in validate
thumbor_1  |     is_valid = self.context.modules.loader.validate(self.context, path)
thumbor_1  | TypeError: validate() takes exactly 3 arguments (2 given)
Bladrak commented 6 years ago

Thanks for the report @kkopachev ; I've re-opened the issue and will try to fix this.

Bladrak commented 6 years ago

@kkopachev I've pushed a fix on 6.0.6 on pypi, let me know if that's ok now

kkopachev commented 6 years ago

It is not in 6.0.6 https://github.com/thumbor-community/aws/blob/6.0/tc_aws/loaders/s3_loader.py#L16 but did go to master. Hard to tell what else is different between 6.0.6 and 6.1.x/6.2.x

Bladrak commented 6 years ago

Yes, sorry about that, I found out a bug afterwards that I fixed in the latest version (6.2.1). I mixed up the versions a bit, shouldn't try to maintain more than one branch anyways, as there are no BC Breaks.