Skip to content

Conversation

@dominic-r
Copy link
Member

Overview:

When using path-style addressing with a custom domain that includes the bucket name, the generated presigned URLs contained the bucket name twice, which is obviously not intended.

The fix strips the bucket name from the presigned URL path when path-style addressing is detected (path starts with /{bucket}/), since custom_domain must include the bucket name per configuration docs.i

A more detailed overview of the bug can be found at: #19521 (comment)

Do note that commit b5d0968 is present in this PR until #19536 is merged, so I can use the dev server and run tests locally without encountering any issues.

Motivation:

Closes: #19521

Adds test replicating the user's issue and is added now to confirm wether this is indeed an issue and wether my fix actually works.

Good, it fails.

```
FAILED authentik/admin/files/backends/tests/test_s3_backend.py::TestS3Backend::test_file_url_custom_domain_with_bucket_no_duplicate - AssertionError: 2 != 1 : Bucket name 'authentik-test-270gxfe1t2' appears 2 times in URL, expected 1. URL: https://localhost:8020/authentik-test-270gxfe1t2/authentik-test-270gxfe1t2/media/public/application-icons/test.svg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=accessKey1%2F20260117%2Fca-central-1%2Fs3%2Faws4_request&X-Amz-Date=20260117T010127Z&X-Amz-Expires=900&X-Amz-SignedHeaders=host&X-Amz-Signature=b24c140b41232df1d0c7d51197d6a94d59b09bcc8fbe31de54be92e34b61f65b
```
…domain

When using path-style addressing with a custom domain that includes the bucket name, the generated presigned URLs contained the bucket name twice, which is obviously not intended.

The fix strips the bucket name from the presigned URL path when path-style addressing is detected (path starts with `/{bucket}/`), since `custom_domain` must include the bucket name per configuration docs.i

A more detailed overview of the bug can be found at: #19521 (comment)
@dominic-r dominic-r requested review from a team as code owners January 17, 2026 01:16
@dominic-r dominic-r self-assigned this Jan 17, 2026
@dominic-r dominic-r added this to the Release 2025.12.2 milestone Jan 17, 2026
@netlify
Copy link

netlify bot commented Jan 17, 2026

Deploy Preview for authentik-docs ready!

Name Link
🔨 Latest commit 14789b4
🔍 Latest deploy log https://app.netlify.com/projects/authentik-docs/deploys/696bf0c566049f0008d63ff3
😎 Deploy Preview https://deploy-preview-19537--authentik-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@codecov
Copy link

codecov bot commented Jan 17, 2026

Codecov Report

❌ Patch coverage is 93.75000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 93.27%. Comparing base (8fce7b9) to head (14789b4).
⚠️ Report is 2 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
authentik/admin/files/backends/s3.py 85.71% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #19537      +/-   ##
==========================================
+ Coverage   92.50%   93.27%   +0.76%     
==========================================
  Files         949      949              
  Lines       52052    52067      +15     
==========================================
+ Hits        48151    48564     +413     
+ Misses       3901     3503     -398     
Flag Coverage Δ
conformance 38.25% <0.00%> (-0.01%) ⬇️
e2e 44.19% <0.00%> (-0.02%) ⬇️
integration 23.20% <0.00%> (?)
unit 91.49% <93.75%> (-0.02%) ⬇️
unit-migrate 91.50% <93.75%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 17, 2026

authentik PR Installation instructions

Instructions for docker-compose

Add the following block to your .env file:

AUTHENTIK_IMAGE=ghcr.io/goauthentik/dev-server
AUTHENTIK_TAG=gh-14789b498f0fde1a0648af4b11e9efc951dee6a8
AUTHENTIK_OUTPOSTS__CONTAINER_IMAGE_BASE=ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s

Afterwards, run the upgrade commands from the latest release notes.

Instructions for Kubernetes

Add the following block to your values.yml file:

authentik:
    outposts:
        container_image_base: ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s
global:
    image:
        repository: ghcr.io/goauthentik/dev-server
        tag: gh-14789b498f0fde1a0648af4b11e9efc951dee6a8

Afterwards, run the upgrade commands from the latest release notes.

@dominic-r dominic-r added the backport/version-2025.12 Add this label to PRs to backport changes to version-2025.12 label Jan 17, 2026
@netlify
Copy link

netlify bot commented Jan 17, 2026

Deploy Preview for authentik-integrations ready!

Name Link
🔨 Latest commit 14789b4
🔍 Latest deploy log https://app.netlify.com/projects/authentik-integrations/deploys/696bf0c436773f0008cb646a
😎 Deploy Preview https://deploy-preview-19537--authentik-integrations.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@dominic-r dominic-r removed the request for review from a team January 18, 2026 15:17
@github-project-automation github-project-automation bot moved this from Todo to In Progress in authentik Core Jan 19, 2026
@rissson rissson merged commit 1837bec into main Jan 19, 2026
101 checks passed
@rissson rissson deleted the sdko/s3-dupe-bucket-fix branch January 19, 2026 12:05
@github-project-automation github-project-automation bot moved this from In Progress to Done in authentik Core Jan 19, 2026
authentik-automation bot pushed a commit that referenced this pull request Jan 19, 2026
…domain (#19537)

Co-authored-by: Marcelo Elizeche Landó <marcelo@goauthentik.io>
@authentik-automation
Copy link
Contributor

🍒 Cherry-pick to version-2025.12 created: #19575

dominic-r added a commit that referenced this pull request Jan 19, 2026
…domain (#19537)

Co-authored-by: Marcelo Elizeche Landó <marcelo@goauthentik.io>
rissson pushed a commit that referenced this pull request Jan 19, 2026
…domain (cherry-pick #19537 to version-2025.12) (#19575)

Co-authored-by: Dominic R <dominic@sdko.org>
Co-authored-by: Marcelo Elizeche Landó <marcelo@goauthentik.io>
fix duplicate bucket name in presigned URLs with custom domain (#19537)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:backend backport/version-2025.12 Add this label to PRs to backport changes to version-2025.12

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Duplicated bucket-name in S3 file path

4 participants