Secure and unsafe URLs do not work as expected
See original GitHub issue-
Secure URLs in version 3 are not secure.
- The new behaviour of v3 that changes the safe URLs from
/<hash>/<path>
to/<security_key>/<path>
is incorrect and completely defeats the purpose of the safe URL. The security key cannot appear in the public url to an image, only the hash can appear in a public url. - See https://github.com/awslabs/serverless-image-handler/issues/54#issuecomment-426752073
- See the official docs which support this: https://github.com/thumbor/thumbor/wiki/security
- The new behaviour of v3 that changes the safe URLs from
-
It is impossible to disable unsafe URLs using the ENV vars (in v2 or v3)
- Below are examples from my deployments for each version to demonstrate the problem.
- All urls were requested for the first time for these tests, so CloudFront cache was empty for each one.
- Screenshots of the Lambda config for the v2 and v3 deployments are shown below.
v2
-
With hash: loads (good):
https://d3f24ahusl0vhu.cloudfront.net/UpwsFH4gS8sPRTzw6Adc0sHKGwQ=/onfLoZx7d
-
With no hash or unsafe: error (good)
https://d3f24ahusl0vhu.cloudfront.net/onfLoZx7d
-
With unsafe: loads (bad)
https://d3f24ahusl0vhu.cloudfront.net/unsafe/onfLoZx7d
v3
-
With hash: error (bad)
https://d18aelkez1p3a0.cloudfront.net/5jel0cJtBXmMLI1Rupih8M6eiPc=/8GKv8lk32m
-
With no hash or unsafe: error (good)
https://d18aelkez1p3a0.cloudfront.net/8GKv8lk32m
-
With unsafe: loads (bad)
https://d18aelkez1p3a0.cloudfront.net/unsafe/8GKv8lk32m
-
With secret key in URL: loads (bad)
https://d18aelkez1p3a0.cloudfront.net/<redacted>/8GKv8lk32m
v2
v3
Issue Analytics
- State:
- Created 5 years ago
- Comments:10 (3 by maintainers)
Top Results From Across the Web
Seeing a “Not Secure” Warning in Chrome? Here's Why and ...
The reason you are seeing the “Not Secure” warning is because the web page or website you are visiting is not providing an...
Read more >Manage warnings about unsafe sites - Google Chrome Help
You'll see a warning if the content you're trying to see is dangerous or deceptive. These sites are often called "phishing" or "malware"...
Read more >URL rewrite not working for us - adding unsafe to the url? #54
In my setup I managed to get safe urls working while unsafe urls would not work (as expected since they should have been...
Read more >How To Fix the “HTTPS Not Secure” Message in Chrome
1. Purchase an SSL Certificate. To fix the 'not secure' message on your website, the first thing you need to do is purchase...
Read more >Safe Links in Microsoft Defender for Office 365
Safe Links does not work on mail-enabled public folders. Safe Links supports only HTTP(S) and FTP formats. Using another service to wrap links ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@timkelty I agree. If you wanted URLs with out
unsafe
or the HMAC I would expect having to handle it via rewrite rules.For anyone coming to this thread, I’ve summarized what I understand the expected behaviour should be below. Given the above examples however we know actual behaviour does not currently match (gsingh04 identified there may be a bug in Thumbor to account for some, but not all, of the issues).
ALLOW_UNSAFE_URL=Yes
a. Not load:https://example.cloudfront.net/<imagePath>/500x500.png
b. Load:https://example.cloudfront.net/unsafe/<imagePath>/500x500.png
c. Not load:https://example.cloudfront.net/<any-other-value>/<imagePath>/500x500.png
ALLOW_UNSAFE_URL=Yes
andSECURITY_KEY="top-secret"
a. Not load:https://example.cloudfront.net/<imagePath>/500x500.png
b. Load:https://example.cloudfront.net/unsafe/<imagePath>/500x500.png
c. Not load:https://example.cloudfront.net/top-secret/<imagePath>/500x500.png
d. Load:https://example.cloudfront.net/<correct-hmac>/<imagePath>/500x500.png
e. Not load:https://example.cloudfront.net/<any-other-value>/<imagePath>/500x500.png
ALLOW_UNSAFE_URL=No
andSECURITY_KEY="top-secret"
a. Not load:https://example.cloudfront.net/<imagePath>/500x500.png
b. Not Load:https://example.cloudfront.net/unsafe/<imagePath>/500x500.png
c. Not load:https://example.cloudfront.net/top-secret/<imagePath>/500x500.png
d. Load:https://example.cloudfront.net/<correct-hmac>/<imagePath>/500x500.png
e. Not load:https://example.cloudfront.net/<any-other-value>/<imagePath>/500x500.png
@gsingh04
Why both variable can not be passed as environment variables? If
ALLOW_UNSAFE_URL
is set to True, isn’tSECURITY_KEY
simply ignored by Thumbor?