You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
AAP-47499 Use get_settings to get CSRF_TRUSTED_ORIGINS in ansible_base SessionAuthentication (#755)
## Description
- What is being changed? Modify
ansible_base.authentication.session.SessionAuthentication to temporarily
patch CSRF_TRUSTED_ORIGINS with the setting retrieved from
`ansible_base.lib.utils.settings.get_setting`
- Why is this change needed? To support dynamic definitions of the
CSRF_TRUSTED_ORIGIN setting, provided the correct
ANSIBLE_BASE_SETTINGS_FUNCTION
- How does this change address the issue? By having
SessionAuthentication temporarily patch CSRF_TRUSTED_ORIGINS for the
duration of csrf enforcement
## Type of Change
<!-- Mandatory: Check one or more boxes that apply -->
- [ ] Bug fix (non-breaking change which fixes an issue)
- [X] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] Documentation update
- [X] Test update
- [ ] Refactoring (no functional changes)
- [ ] Development environment change
- [ ] Configuration change
## Self-Review Checklist
<!-- These items help ensure quality - they complement our automated CI
checks -->
- [ ] I have performed a self-review of my code
- [ ] I have added relevant comments to complex code sections
- [ ] I have updated documentation where needed
- [ ] I have considered the security impact of these changes
- [ ] I have considered performance implications
- [ ] I have thought about error handling and edge cases
- [ ] I have tested the changes in my local environment
## Testing Instructions
### Prerequisites
Run your django app with one worker for simplicity (we cannot guarantee
this in testing situations, so this is only for manual verification)
### Steps to Test
1. Modify your ANSIBLE_BASE_SETTINGS_FUNCTION to return a different
CSRF_TRUSTED_ORIGINS
2. Make a curl POST request, changing your `Origin` header to match an
element of your alternate CSRF_TRUSTED_ORIGINS
### Expected Results
- CSRF_TRUSTED_ORIGINS django setting remains unchanged
- CSRF origin checking does not fail
---------
Co-authored-by: Hao Liu <[email protected]>
0 commit comments