Skip to content

s3 custom_url makes signature verification fail #13463

@benaryorg

Description

@benaryorg

Describe the bug
When I upload a file to S3 and I have custom_domain set, I get an error.
I do not get the error with the custom_domain setting removed, even retroactively for existing files.

To Reproduce
Steps to reproduce the behavior:

  1. use s3 backend with custom_url
  2. upload flow background image
  3. open flow
  4. background image not loaded

Expected behavior
URL both with and without custom_url works.

Screenshots
not applicable

Logs
not applicable (signature calculates properly, it's just somehow wrong)

Version and Deployment (please complete the following information):

  • authentik version: 2024.12.1 (the code around the signature doesn't seem like it has changed recently, and I don't have a good way to quickly upgrade for testing)
  • Deployment: manual (issue is not deployment-related)

Additional context

This occurs with a radosgw running with Ceph squid (v19.2.0).

When the custom_url setting is off I get this URL:

https://s3.ovh.xn--idk5byd.net/benaryorg-authentik/media/public/application-icons/Grafana_logo.svg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ISXPUYU60051HVZ8LXX0%2F20250314%2Fdefault%2Fs3%2Faws4_request&X-Amz-Date=20250314T181538Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&X-Amz-Signature=253b6e3e445dff3b553b228a01f5ed685d30f5f6d6ef93db3c350c813e53c531

When it is on I get this one:

https://benaryorg-authentik.s3.ovh.ニャー.net/media/public/application-icons/Grafana_logo.svg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ISXPUYU60051HVZ8LXX0%2F20250314%2Fdefault%2Fs3%2Faws4_request&X-Amz-Date=20250314T181657Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&X-Amz-Signature=56a737db3aa170b5909fec7a6639cb9b96ccd48513db8666d30d56203001c5e1

Since it works with one but not the other (and the signature differs) we can probably assume that the following line is okay and works, despite the punycode domain:

url = url.replace(root_url, custom_url)

The error I get is this:

<?xml version="1.0" encoding="UTF-8"?><Error><Code>SignatureDoesNotMatch</Code><Message></Message><RequestId>tx00000d09c7361dc47e6cc-0067d0711a-2194166-default</RequestId><HostId>2194166-default-default</HostId></Error>

As to everything else, I wouldn't know to be honest.
If you need any further information (or a test bucket) I'm happy to help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingbug/confirmedConfirmed bugs

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions