Repository navigation
lib: avoid DNS resolution in fqdn_rand - #25728
Merged
BeryJu merged 1 commit intoSep 4, 2026
Merged
Conversation
✅ Deploy Preview for authentik-integrations ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for authentik-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
joaocfernandes
marked this pull request as ready for review
September 3, 2026 16:37
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #25728 +/- ##
==========================================
- Coverage 91.71% 91.68% -0.04%
==========================================
Files 1154 1154
Lines 73568 73585 +17
Branches 4054 4054
==========================================
- Hits 67474 67466 -8
- Misses 6052 6077 +25
Partials 42 42
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
BeryJu
approved these changes
Sep 3, 2026
Contributor
|
🍒 Cherry-pick to |
Contributor
|
🍒 Cherry-pick to |
Contributor
|
🍒 Cherry-pick to |
rissson
approved these changes
Sep 4, 2026
BeryJu
pushed a commit
that referenced
this pull request
Sep 4, 2026
…-2026.5) (#25760) lib: avoid DNS resolution in fqdn_rand (#25728) Co-authored-by: João C. Fernandes <[email protected]>
BeryJu
pushed a commit
that referenced
this pull request
Sep 4, 2026
…-2026.2) (#25759) lib: avoid DNS resolution in fqdn_rand (#25728) Co-authored-by: João C. Fernandes <[email protected]>
BeryJu
pushed a commit
that referenced
this pull request
Sep 4, 2026
…-2026.8) (#25758) lib: avoid DNS resolution in fqdn_rand (#25728) Co-authored-by: João C. Fernandes <[email protected]>
kensternberg-authentik
added a commit
that referenced
this pull request
Sep 8, 2026
* main: (45 commits) enterprise/providers/ws_federation: fix SAML Version casing (#25764) web/admin: oauth provider: explain what happens when no signing key is selected (#25756) lib/expression: fix PickleError due to resolver match when using ak_call_policy (#25763) website/docs: correct authenticator stage deletion behavior (#25070) ci: bump docker/setup-qemu-action from 4.2.0 to 4.3.0 (#25749) core: bump selenium from 4.47.0 to 4.48.0 (#25745) core: bump library/nginx from `db3099a` to `05b8cb6` in /website (#25747) admin/files: make file search case-insensitive (#25736) core: explicitly check is_active in auth backends (#25729) ci: bump helm/kind-action from 1.14.0 to 1.15.0 (#25750) core: bump aws-cdk-lib from 2.266.0 to 2.267.0 (#25748) lib: avoid DNS resolution in fqdn_rand (#25728) website/docs: add instructions on how to collect user attributes during enrollment (#25717) core: bump rust-toolchain from 1.98.0 to 1.98.1 (#25740) core: bump tower-http from 0.7.0 to 0.7.1 (#25753) core: bump cachetools from 7.1.7 to 7.1.8 (#25742) core: bump the types group with 2 updates (#25739) core: bump psycopg[c,pool] from 3.3.4 to 3.3.5 (#25741) website/docs: document ForceAuthn and typed AKQL JSON values (#25079) web: fix switches in table toolbars (#25730) ...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Details
What does this PR change?
Replaces socket.getfqdn() with non-resolving socket.gethostname() in fqdn_rand() and adds regression tests.
Why is this change needed?
DNS resolution could block during startup reconciliation while a database row lock was held, causing a cross-worker lock.
Detail
A DNS failure does not create the database lock; the lock has already been acquired. However, a DNS lookup that stalls or hangs prevents the transaction from completing and releasing that lock.
The synchronous call chain:
Therefore, fqdn_rand() runs while the row lock is held. If its DNS resolution hangs, update_or_create() cannot finish, the transaction remains open, and other workers attempting to update the same row block behind it.
How was this tested?
Added tests for deterministic output, range behavior, and ensuring DNS resolver functions are never called. Black, Ruff, and all six targeted tests pass.
Checklist
make all)make docs)AI was used to determine the issue.
AI wrote all tests.