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-50130: Fallback authentication only on migrated users (#778)
## Description
<!-- Mandatory: Provide a clear, concise description of the changes and
their purpose -->
- What is being changed? Modifies the controller fallback authentication
so that it only is triggered if the gateway user has flag
`use_controller_password=true`. Once the controller fallback
authentication is completed, this flag is set to false to disallow users
from then signing in again with their controller password.
- Why is this change needed? This change is needed to ensure passwords
can only be set from their controller passwords once. This provides more
security benefits so that the controller password cannot always be used
as a "fallback" password, limiting exposure if this password had ever
been leaked after it has been changed.
- How does this change address the issue? This change addresses the
issue by adding another safeguard check in the fallback controller
authentication logic to validate that this flag is set on the user, and
if it is, it will update it to false, after the password has been
modified.
## Type of Change
<!-- Mandatory: Check one or more boxes that apply -->
- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] 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
- [ ] 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 -->
- [x] I have performed a self-review of my code
- [x] I have added relevant comments to complex code sections
- [x] I have updated documentation where needed
- [x] I have considered the security impact of these changes
- [x] I have considered performance implications
- [x] I have thought about error handling and edge cases
- [x] I have tested the changes in my local environment
## Testing Instructions
<!-- Optional for test-only changes. Mandatory for all other changes -->
<!-- Must be detailed enough for reviewers to reproduce -->
### Prerequisites
<!-- List any specific setup required -->
### Steps to Test
Testing instructions use aap-dev for validation
1. Deploy AAP Dev, with this branch, and also this [gateway
PR](ansible-automation-platform/aap-gateway#918)
2. Check `/gateway/v1/users/`, validate the administrator account has
`use_controller_password=false`
3. Attempt to sign in via gateway with administrator controller
password. This should fail. Only gateway password will work
4. Exec into controller-task container and run the following command to
create a user on controller only -
```bash
ANSIBLE_REVERSE_RESOURCE_SYNC=false awx-manage shell_plus --quiet-load -c "User.objects.create_user(username='dummy', email='[email protected]', password='test', first_name='dummy', last_name='user')"
```
5. Exec into gateway-api pod and run the migrate_service_data command -
```bash
aap-gateway-manage migrate_service_data --username=admin
```
6. Check `/gateway/v1/users`, validate dummy account exists, with
`use_controller_password=true`
7. Sign into gateway with the dummy user account, using the password
created in controller, sign in should succeed.
8. Check `/gateway/v1/users`, see that, with
`use_controller_password=false`
9. Change dummy user password in gateway
10. Attempt to sign in with dummy user again using original controller
password. Signin should fail. Only gateway password can be used now.
### Expected Results
Controller fallback authentication can only happen once for any account,
and only on those accounts which were migrated via migrate_service_data
## Additional Context
<!-- Optional but helpful information -->
### Required Actions
<!-- Check if changes require work in other areas -->
<!-- Remove section if no external actions needed -->
- [ ] Requires documentation updates
<!-- API docs, feature docs, deployment guides -->
- [ ] Requires downstream repository changes
<!-- Specify repos: django-ansible-base, eda-server, etc. -->
- [ ] Requires infrastructure/deployment changes
<!-- CI/CD, installer updates, new services -->
- [ ] Requires coordination with other teams
<!-- UI team, platform services, infrastructure -->
- [ ] Blocked by PR/MR: #XXX
<!-- Reference blocking PRs/MRs with brief context -->
### Screenshots/Logs
<!-- Add if relevant to demonstrate the changes -->
0 commit comments