AAP-49133: Only consider first entry in comma-separated remote host headers for provisioning callback#16284
AAP-49133: Only consider first entry in comma-separated remote host headers for provisioning callback#16284chrismeyersfsu wants to merge 1 commit intoansible:develfrom
Conversation
📝 WalkthroughWalkthroughReplaced host extraction in callback matching to use a new utility that returns only the first comma-separated entry from configured headers; added that utility and updated views to call it. Added unit and functional tests covering first-entry semantics and proxy header variations. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
* When the remote host header values contains a comma separated list, only consider the first entry. Previously we considered every item in the list.
beeb5c9 to
a5138f1
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. 🚀 New features to boost your workflow:
|
|
SUMMARY
Changes the provisioning callback host matching logic to only consider the first entry in comma-separated header values (e.g.,
X-Forwarded-For: client, proxy1, proxy2), rather than all entries.Previously,
get_remote_hostsfromdjango-ansible-basewould return every value in comma-separated headers, meaning intermediate proxy addresses could incorrectly match inventory hosts. This replaces that with a newget_first_remote_host_from_headersutility inawx.main.utils.proxythat only extracts the first (original client) entry from each header.ISSUE TYPE
COMPONENT NAME
ADDITIONAL INFORMATION
Adds unit tests for the new
get_first_remote_host_from_headersandis_proxy_in_headersutility functions, and functional tests validating that only the first entry in comma-separated callback headers is matched against inventory hosts.