-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
root/storages: fix punycode handling for s3 presigned generation #14706
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for authentik-docs canceled.
|
✅ Deploy Preview for authentik-storybook canceled.
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #14706 +/- ##
==========================================
- Coverage 92.80% 92.75% -0.05%
==========================================
Files 822 823 +1
Lines 42384 42588 +204
==========================================
+ Hits 39333 39503 +170
- Misses 3051 3085 +34
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
86f2bea
to
7de7e88
Compare
✅ Deploy Preview for authentik-integrations canceled.
|
try: | ||
# If custom domain is set, configure the endpoint URL | ||
if self.custom_domain: | ||
scheme = "https" if self.secure_urls else "http" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fails on this line with:
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/home/risson/goauthentik/authentik/main/.venv/lib/python3.13/site-packages/django/db/models/fields/files.py", line 70, in url
return self.storage.url(self.name)
~~~~~~~~~~~~~~~~^^^^^^^^^^^
File "/home/risson/goauthentik/authentik/main/authentik/root/storages.py", line 101, in url
scheme = "https" if self.secure_urls else "http"
^^^^^^^^^^^^^^^^
AttributeError: 'S3Storage' object has no attribute 'secure_urls'
I was doing application.meta_icon.url
What
This PR fixes an issue with S3 presigned URL generation when using custom domains that contain Unicode characters. The previous implementation was incorrectly handling punycode domains, resulting in "SignatureDoesNotMatch" errors when users attempted to access uploaded files.
Problem
When using S3 storage with a custom domain containing Unicode characters (e.g., "
ニャー
"), the signature calculation was broken because the old implementation used simple string replacement(url.replace(root_url, custom_url))
which didn't properly handle URL structures with punycode domains.Closes
Closes #13463
Acceptance Criteria
Details
REPLACE ME
Checklist
ak test authentik/
)make lint-fix
)If an API change has been made
make gen-build
)If changes to the frontend have been made
make web
)If applicable
make website
)