Guarantee IAM ID on every authenticated effective-user principal
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- typescript
- Domain
- authentication, backend
Research direction
Start by tracing UserProfileOrchestrator.EnsureUserProfileAsync and AuthenticationHelper.OnTokenValidated, then inspect SystemController.Emulate, the local login flow in AccountController, cookie validation, and WalterTargetingContextAccessor. Run the existing authentication and targeting tests to map coverage before making changes. Done means every authenticated path has one canonical effective-user IAM claim, cookies are repaired or authentication fails when it cannot be resolved, and targeting uses the claim without a database lookup; add the behavioral tests listed in the issue.
Written by the indexing model from the issue text.
Description
Walter should guarantee that every authenticated application principal contains exactly one nonblank ucdPersonIAMID claim identifying the effective user. During emulation, that must be the emulated user's IAM ID.
Normal profile initialization already requires a resolvable IAM ID, but the resolved value is not consistently copied into the authentication cookie. Emulation and local development login also construct principals without this claim. This leaves consumers with inconsistent identity information and makes feature targeting perform a separate user lookup.
Follow-up to #465. Schedule this separately from the current feature-flag PR.
Current impact
UserProfileOrchestrator.EnsureUserProfileAsyncresolves and persists IAM ID, whileAuthenticationHelper.OnTokenValidateddiscards the returned profile instead of adding the resolved claim.SystemController.Emulateand the local login flow inAccountControlleromit IAM ID when constructing their cookie principals./api/user/mereads IAM ID from the database, so the frontend and browser telemetry can still identify the user. Project access commonly uses the object ID to retrieve the stored Employee ID.- Backend request logging and tracing read IAM ID directly from the principal, so these sessions lose IAM attribution.
WalterTargetingContextAccessorcompensates with a database lookup for missing claims and emulation.
Proposed change
- After normal profile initialization, stamp its resolved IAM ID onto the application's authenticated principal before issuing the cookie. Normalize the value and replace duplicate or conflicting IAM claims.
- Include the selected user's IAM ID when issuing emulation and local development cookies. Preserve the operator's separate audit identity during emulation.
- Extend existing cookie validation to repair missing or inconsistent IAM claims from the effective user's stored profile and renew the cookie, including when roles have not changed. Retrieve IAM alongside the existing user/role lookup rather than adding another database round trip.
- Simplify
WalterTargetingContextAccessorto read the canonical claim. Remove its user-service dependency, database fallback, and special emulation branch. Retain a defensive missing-claim warning/off result for callers outside the authenticated application pipeline. - Update authentication, telemetry, and feature-flag documentation to describe the guarantee.
Authentication behavior
A session whose IAM ID cannot be resolved must not continue as an authenticated Walter session. Return a clear authentication failure. Repair existing cookies when their stored user profile supplies the ID; a missing claim alone should not force users to sign in again.
This intentionally changes the feature-flag migration's behavior for an authenticated session without IAM: authentication will reject an unresolvable identity instead of permitting that session to use global flags. Normal profile initialization already rejects unresolved IAM IDs. Keep object IDs, Employee IDs, role-based access checks, and operator audit information distinct from IAM ID. Do not substitute another identifier or accept browser-supplied targeting identity.
Acceptance criteria
- Normal sign-in produces one correct IAM claim whether it arrived in the validated token or was resolved through the existing profile fallback.
- Emulation and local development login produce the effective user's IAM claim; the operator's IAM ID cannot leak into the emulated principal.
- Existing cookies with missing, duplicate, or inconsistent IAM claims are corrected and renewed, including when roles are unchanged.
- An unresolvable IAM ID fails authentication with a clear error; anonymous endpoints retain their existing behavior.
- Backend logs and traces receive the effective user's IAM ID for normal, fallback, and emulated sessions, while retaining separate operator attribution.
- Feature targeting reads only the principal and performs no identity lookup. Role and project authorization behavior remains intact.
- Behavioral tests cover all sign-in paths, cookie migration, unresolved IAM, telemetry attribution, and IAM allowlist/exclusion evaluation after the accessor is simplified.
- Dominant language
- TypeScript
- Stars
- 0
- Forks
- 1
- Avg merge
- 19h 34m
- Merged PRs (30d)
- 22
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ucdavis/Walter
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 25/100
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 20/100
Maintainers usually reply within 1 day
-
Capital Project CleanupPossibly taken @rmartinsen-ucd claimed this 4 days ago. Open
ucdavis/Walter#483 · 1 assignee ·
Maintainers usually reply within 1 day
-
CAYUSEOpen
Difficulty 5/5 Over a week Newbie friendliness 1/100
Maintainers usually reply within 1 day
-
Redesign Personnel TablePossibly taken @cydoval claimed this 4 days ago. Open
ucdavis/Walter#480 · 1 assignee ·
Maintainers usually reply within 1 day
Similar issues
-
CLI OAuth login fails behind an authenticating proxy: GET /api/v1/user omits Proxy-AuthorizationOpen
Difficulty 1/5 Under an hour Newbie friendliness 85/100
lightdash/lightdash#33086 · 1 comment ·
Maintainers usually reply within 1 day
-
[功能请求] 设置选项语言调整Open功能请求
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
antithesishq/bombadil#473 ·
Maintainers usually reply within 2 days
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
ardia-browser/ardia#3291 ·
Maintainers usually reply within 1 day
-
The structured output reference promises null results for refusals that carry validation detailsOpenbug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day