Skip to content

Initial crack at Service/M2M authentication.#8

Open
mikedarcy wants to merge 12 commits intomainfrom
m2m_support
Open

Initial crack at Service/M2M authentication.#8
mikedarcy wants to merge 12 commits intomainfrom
m2m_support

Conversation

@mikedarcy
Copy link
Contributor

Refactored some existing package structure to better organize things.
Updated unit tests and documentation.

@mikedarcy mikedarcy self-assigned this Jan 15, 2026
@mikedarcy mikedarcy requested a review from karlcz January 16, 2026 22:58
STS GetCallerIdentity returns an assumed-role ARN that omits IAM role paths, so direct role_arn string equality can fail (e.g., role/foo-path/...). Update the aws_presigned adapter to derive (account_id, role_name) from the STS ARN and match bindings by account + role name while preserving the configured IAM role_arn as the canonical principal for subject/proof.
Add some additional unit tests for error handling in aws_presigned.
… ‘audiences’ -> ‘resources’) to prepare for multi-resource opaque token binding and uniform enforcement via `/session?resource=` across all flows.

Hardening and refinements to session_store.py.
Rewrite of `is_browser_client` to not use auth cookie (which may not be set yet) and user-agent inspection to detect browser.
Use a hash of the principal/realm/adapter as the key for rate limiting on service principal.
Update unit tests.
UX:
- Styled HTML success page for device authorization

Security improvements:
- Use secrets.token_hex() for device codes instead of UUID for explicit entropy (128-bit device_code, 32-bit user_code)
- Fix race condition in verify_device(): validate flow exists before consuming user_code mapping; return 410 Gone for expired flows
- Sanitize error messages in device_flow.py and login_flow.py to not leak exception details to clients; log full errors server-side

Code cleanup:
- Remove redundant session_data.metadata assignments (dict passed by ref)
- Add defensive check with warning log for unlikely flow/user_code TTL race
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant