Skip to content

core: preserve encoded avatar URLs - #23225

Merged
dominic-r merged 1 commit into
mainfrom
sdko/avatar-url-encoding
Jun 25, 2026
Merged

dominic-r merged 1 commit into
mainfrom
sdko/avatar-url-encoding

Conversation

@dominic-r

@dominic-r dominic-r commented Jun 21, 2026 •

Copy link
Copy Markdown
Member

Custom avatar URLs currently go through Python % formatting, so normal URL escapes like %2F can be interpreted as format tokens and raise while the user avatar is serialized.

This changes avatar URL formatting to replace only the supported placeholders:

%(username)s
%(mail_hash)s
%(upn)s

Everything else is left as-is, so encoded URLs stay valid.

Repro:

  1. Set System → Settings → Avatars to:

    https://example.com/avatar%2Ffoo.png?next=https%3A%2F%2Fcdn.example.com%2Favatar.png
    
  2. Load /api/v3/core/users/me/.

Before this change, that can 500 while formatting the avatar URL. With this change it returns the encoded URL normally.

Validation:

uv run coverage run manage.py test --keepdb authentik/core/tests/test_users_avatars.py

Avoid Python percent-formatting for custom avatar URLs so URL-encoded sequences such as %2F are treated as URL text instead of format directives.
Agent-thread: https://koala.sdko.net/th?h=co&d=a7k&t=019ee851-2fd9-7d01-863f-ba4eef342dbe
Signed-off-by: Dominic Roy <[email protected]>
Co-authored-by: Agent <[email protected]>
@netlify

netlify Bot commented Jun 21, 2026

Copy link
Copy Markdown

✅ Deploy Preview for authentik-integrations ready!

Name Link
🔨 Latest commit 4546d8a
🔍 Latest deploy log https://app.netlify.com/projects/authentik-integrations/deploys/6a37630af07e32000893024b
😎 Deploy Preview https://deploy-preview-23225--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 self-assigned this Jun 21, 2026
@dominic-r dominic-r added backport/version-2026.2 Add this label to PRs to backport changes to version-2026.2 backport/version-2026.5 Add this label to PRs to backport changes to version-2026.5 labels Jun 21, 2026
@dominic-r
dominic-r marked this pull request as ready for review June 21, 2026 04:07
@dominic-r
dominic-r requested a review from a team as a code owner June 21, 2026 04:07
@netlify

netlify Bot commented Jun 21, 2026

Copy link
Copy Markdown

✅ Deploy Preview for authentik-docs ready!

Name Link
🔨 Latest commit 4546d8a
🔍 Latest deploy log https://app.netlify.com/projects/authentik-docs/deploys/6a37630a4b289b000854d67c
😎 Deploy Preview https://deploy-preview-23225--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

codecov Bot commented Jun 21, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.22%. Comparing base (f0bff6a) to head (4546d8a).
⚠️ Report is 4 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #23225      +/-   ##
==========================================
- Coverage   93.27%   93.22%   -0.06%     
==========================================
  Files        1035     1035              
  Lines       60354    60372      +18     
  Branches      400      400              
==========================================
- Hits        56295    56281      -14     
- Misses       4059     4091      +32     
Flag Coverage Δ
conformance 36.46% <42.10%> (+<0.01%) ⬆️
e2e 41.70% <42.10%> (+<0.01%) ⬆️
integration 32.41% <5.26%> (-0.50%) ⬇️
rust 0.00% <ø> (ø)
unit 92.21% <100.00%> (+<0.01%) ⬆️
unit-migrate 92.24% <100.00%> (-0.01%) ⬇️

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

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

@github-actions

Copy link
Copy Markdown
Contributor

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-4546d8ad1f15a453d00e9257f8e78c6ac19dbfe7
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-4546d8ad1f15a453d00e9257f8e78c6ac19dbfe7

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

@github-project-automation github-project-automation Bot moved this from Todo to In Progress in authentik Core Jun 25, 2026
@dominic-r
dominic-r merged commit 41e7b0a into main Jun 25, 2026
113 checks passed
@dominic-r
dominic-r deleted the sdko/avatar-url-encoding branch June 25, 2026 10:04
@github-project-automation github-project-automation Bot moved this from In Progress to Done in authentik Core Jun 25, 2026
@authentik-automation

Copy link
Copy Markdown
Contributor

🍒 Cherry-pick to version-2026.2 created: #23393

@authentik-automation

Copy link
Copy Markdown
Contributor

🍒 Cherry-pick to version-2026.5 created: #23394

kensternberg-authentik added a commit that referenced this pull request Jun 25, 2026
* main: (27 commits)
  website/integrations: Planka: cleanup (#23332)
  website/integrations: SharePoint Server SE: cleanup (#23335)
  core: run debugpy within worker process so it's DAP-attachable again (#23401)
  core, web: update translations (#23373)
  core: bump library/golang from `bbf22dd` to `76a2924` in /lifecycle/container (#23380)
  core: bump library/node from `191ef87` to `f9b8bd6` in /lifecycle/container (#23378)
  core: bump library/nginx from `42f2d24` to `ec4ed8b` in /website (#23382)
  core: bump library/node from `3c05c2c` to `15797fb` in /website (#23383)
  core: bump goauthentik/fips-python from `c54ab1b` to `fe20a68` in /lifecycle/container (#23379)
  website/docs: fix 2026.5 release notes mentioning docker-compose.yml (#23385)
  website/docs: fix 2026.2 release notes docker compose mention take 2 (#23388)
  website/docs: clean up source docs (#23374)
  website/api: debug build issues (#23392)
  core: preserve encoded avatar URLs (#23225)
  website/integrations: add ExcaliDash integration (#23375)
  website/docs: sources: remove support_level labels from docs (#23389)
  website/integrations: Zabbix: cleanup (#23271)
  fix release notes docker compose mention (#23386)
  core: bump goauthentik/fips-debian and fips-python in /lifecycle/container (#23362)
  root: Fix SECURITY.md versions (#23370)
  ...
kensternberg-authentik added a commit that referenced this pull request Jun 25, 2026
* web/css/enabling-layers: (27 commits)
  website/integrations: Planka: cleanup (#23332)
  website/integrations: SharePoint Server SE: cleanup (#23335)
  core: run debugpy within worker process so it's DAP-attachable again (#23401)
  core, web: update translations (#23373)
  core: bump library/golang from `bbf22dd` to `76a2924` in /lifecycle/container (#23380)
  core: bump library/node from `191ef87` to `f9b8bd6` in /lifecycle/container (#23378)
  core: bump library/nginx from `42f2d24` to `ec4ed8b` in /website (#23382)
  core: bump library/node from `3c05c2c` to `15797fb` in /website (#23383)
  core: bump goauthentik/fips-python from `c54ab1b` to `fe20a68` in /lifecycle/container (#23379)
  website/docs: fix 2026.5 release notes mentioning docker-compose.yml (#23385)
  website/docs: fix 2026.2 release notes docker compose mention take 2 (#23388)
  website/docs: clean up source docs (#23374)
  website/api: debug build issues (#23392)
  core: preserve encoded avatar URLs (#23225)
  website/integrations: add ExcaliDash integration (#23375)
  website/docs: sources: remove support_level labels from docs (#23389)
  website/integrations: Zabbix: cleanup (#23271)
  fix release notes docker compose mention (#23386)
  core: bump goauthentik/fips-debian and fips-python in /lifecycle/container (#23362)
  root: Fix SECURITY.md versions (#23370)
  ...
dominic-r added a commit that referenced this pull request Jun 30, 2026
…6.5) (#23394)

core: preserve encoded avatar URLs (#23225)

Avoid Python percent-formatting for custom avatar URLs so URL-encoded sequences such as %2F are treated as URL text instead of format directives.
Agent-thread: https://koala.sdko.net/th?h=co&d=a7k&t=019ee851-2fd9-7d01-863f-ba4eef342dbe

Signed-off-by: Dominic Roy <[email protected]>
Co-authored-by: Dominic Roy <[email protected]>
Co-authored-by: Agent <[email protected]>
BeryJu pushed a commit that referenced this pull request Jul 1, 2026
…6.2) (#23393)

core: preserve encoded avatar URLs (#23225)

Avoid Python percent-formatting for custom avatar URLs so URL-encoded sequences such as %2F are treated as URL text instead of format directives.
Agent-thread: https://koala.sdko.net/th?h=co&d=a7k&t=019ee851-2fd9-7d01-863f-ba4eef342dbe

Signed-off-by: Dominic Roy <[email protected]>
Co-authored-by: Dominic Roy <[email protected]>
Co-authored-by: Agent <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants