fix(infra): route /login/* through CloudFront to the ALB for Entra login#351
Merged
Merged
Conversation
The Entra login path /login/entra is unreachable from the public CloudFront URL: the only login behavior is an exact /login, so /login/entra falls through to the S3 default origin and returns an S3 AccessDenied. The /login/entra* ALB rule from the dual-IdP work was added without the matching CloudFront behavior. Add a /login/* ordered_cache_behavior to the ztmf_api (ALB) origin, gated on entra_enabled to mirror the per-IdP ALB rules. Okta keeps using the exact /login behavior, unaffected. Refs #264
a-dipietro
approved these changes
Jun 18, 2026
a-dipietro
left a comment
Collaborator
There was a problem hiding this comment.
Verify listener rules are UTD, otherwise g2g!
danielbowne
added a commit
that referenced
this pull request
Jun 23, 2026
#351) (#361) ## Summary Routine refresh of the `impl` branch from `main` so the experimental environment does not drift from production code. Merge (not rebase), per the impl-sync policy, because `impl` is a shared, deployed branch. ## What main brought in The bulk of main's recent history (OpDiv-scoped RBAC, dual-IdP scaffolding, pgxpool, OpenAPI autogeneration, the N+1 users-list fix) was already present on impl from the previous sync, so the net new content here is small: - Scores diff endpoint to compare two data calls (#356) - Okta JWT `kid` validation and hardened key-fetch client (#354) - Route `/login/*` through CloudFront to the ALB for Entra login (#351) - The enrichment OpDiv gate as it landed on main (#359), reconciled with impl's own copy (#358) ## Conflict resolution - **Makefile** - kept impl's per-environment port scaffolding (`ZTMF_ENV` detection, parametrized `TEST_DB_PORT`). Reverting to main's hardcoded ports would break side-by-side worktree runs. - **fismasystems.go / scores.go / openapi.yaml** - took main's canonical versions (main's `FindFismaSystemByUUID` adds an explicit `LIMIT 1`; scores-diff is additive). OpenAPI regenerated from annotations afterward, no drift. ## Environment safety - Entra remains dormant on impl: there is no impl tfvars override, so `entra_enabled` stays at its default of false. Main's #350 only enabled it in dev. - No new migrations introduced by this sync beyond what is already merged on main. ## Testing Full local suite on the impl port set (unit, integration, E2E/Emberfall). --------- Co-authored-by: cameron testerman <11036339+voidspooks@users.noreply.github.com> Co-authored-by: MackOverflow <114018913+MackOverflow@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the Entra login path being unreachable from the public CloudFront URL.
Problem
CloudFront routes only the exact path
/loginto the ALB origin (cloudfront.tf); there is no/login/*behavior. So/login/entradoes not match, falls through to the S3 default origin, and S3 returns anAccessDeniedXML page. Entra login is unreachable for everyone, not specific to any user or email. Okta is unaffected because it lives at exactly/login.The dual-IdP work added the
/login/entra*rule on the ALB but never added the matching CloudFront behavior. The two layers are owned separately (the CloudFront login behavior was set up under #166 as an exact match), and the end-to-end "user lands at /login/entra" check was deferred to runtime, so the gap only surfaced once dev was flipped toentra_enabled = trueand Entra login was first exercised.Fix
Add a
/login/*ordered cache behavior pointing at theztmf_api(ALB) origin, mirroring the existing/loginbehavior (same forwarding, no caching). It is gated withdynamic ... for_each = var.entra_enabled ? [1] : []so it exists only when Entra is enabled, matching the per-IdP ALB listener rules that are created under the same flag. The exact/loginbehavior is left untouched, so Okta keeps working exactly as before.On dev (
entra_enabled = true) this creates the behavior and/login/entrareaches the ALB. On prod (entra_enabled = false) nothing changes.Validation
terraform fmtclean,terraform validatepasses,tflintclean./login/entraroutes to the ALB (Entra OIDC) instead of returning S3AccessDenied;/login(Okta) unchanged.Refs #264