Skip to content

NEEDS TESTING - Support multiple Cognito user groups per node ID - #385

Draft
jordanpadams wants to merge 2 commits into
mainfrom
bugfix/384-multi-group-cognito-auth
Draft

NEEDS TESTING - Support multiple Cognito user groups per node ID#385
jordanpadams wants to merge 2 commits into
mainfrom
bugfix/384-multi-group-cognito-auth

Conversation

@jordanpadams

Copy link
Copy Markdown
Member

🗒️ Summary

Fixes a 401 Unauthorized error for SBN users whose Cognito account is in PDS_SBNUMD_USERS rather than PDS_SBN_USERS. The authorizer previously checked the user's groups against a single expected group name, so any node with more than one Cognito group (e.g. SBN with separate UMD and PSI orgs) would silently reject valid users.

Changes:

  • node_util.py: Replaces the auto-generated single group name pattern with an explicit node_id_to_cognito_groups map. sbn maps to ["PDS_SBN_USERS", "PDS_SBNUMD_USERS"]; all other nodes map to their single group. The node_id_to_group_names() method returns the full list.
  • pds_ingress_client.py, pds_status_client.py, log_util.py: All UserGroup header callsites updated to send a comma-separated string of all permitted groups for the node.
  • authorizer/index.js: Splits the UserGroup header on commas and authorizes if the user belongs to any group in the list (permitted_groups.some(g => groups.includes(g))).
  • test_log_util.py: Updated assertion to match the new comma-joined header format.

🤖 Generated with Claude Code


AI assistance: ~90% of the code changes were written with Claude Code assistance.

⚙️ Test Data and/or Report

All 44 existing unit tests pass (pytest tests/ -x -q). The authorizer change is JavaScript and covered by manual review; the behavior change is minimal (single-group nodes are unaffected since a one-element comma-split is identical to the previous exact match).

Integration test against LocalStack with an SBN user in PDS_SBNUMD_USERS is recommended before merging to production.

♻️ Related Issues

Fixes #384

🤓 Reviewer Checklist

  • Are there new or updated tests?
  • If applicable, does the documentation need to be updated?
  • Are all security concerns addressed?
  • Is the code maintainable and readable?

jordanpadams and others added 2 commits August 27, 2026 09:15
Replaces auto-generated single group names with an explicit
node_id_to_cognito_groups map in NodeUtil. SBN now maps to both
PDS_SBN_USERS and PDS_SBNUMD_USERS. All client callsites send a
comma-separated UserGroup header; the Lambda authorizer authorizes
if the user belongs to any group in the list.

Fixes #384

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@jordanpadams
jordanpadams requested a review from a team as a code owner August 28, 2026 15:12
@jordanpadams jordanpadams added the bug Something isn't working label Aug 28, 2026
@jordanpadams jordanpadams self-assigned this Aug 28, 2026
@jordanpadams
jordanpadams marked this pull request as draft August 28, 2026 15:21
@jordanpadams jordanpadams changed the title Support multiple Cognito user groups per node ID UNTESTED - Support multiple Cognito user groups per node ID Aug 28, 2026
@jordanpadams jordanpadams changed the title UNTESTED - Support multiple Cognito user groups per node ID NEEDS TESTING - Support multiple Cognito user groups per node ID Aug 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Authorizer does not support multiple Cognito user groups per node ID

1 participant