Skip to content

Update App to support switching to QA environment and logging to Cloudflare Zero trust #91419

Open

Description

Activity

  1. iwiznia commented on May 26, 2026

    @iwiznia
    Author
  2. mateuuszzzzz commented on Jun 8, 2026

    @mateuuszzzzz
    Contributor

    I gave it a read. I'll be preparing implementation plan based on design doc. I'll post any updates in this issue

  3. sharabai commented on Jul 30, 2026

    @sharabai
    Contributor

    @iwiznia Hi! I'll be OOO starting tomorrow, so here's a quick update on the work I've been doing for the POC for web with CF Zero Trust on our fork.

    A quick note on expo-web-browser, the library that opens the Cloudflare login popup on web: I think we should stick with it. It already handles almost everything we need, mobile will use the same API, so we keep a single auth flow across platforms, and it's already been running in production on web for the final step of the SAML logout flow.

    That said, it did need a small workaround. Cloudflare's redirect chain breaks the mechanism the popup uses to report the result back to the main window, causing the auth flow to hang without any error. To work around this, I added a small web-only helper that lets the library complete the flow. It's not a second implementation: the library still owns the entire auth flow, and we simply receive the result through a different channel. It works reliably now across several local runs. The helper does lean on library internals that could change in a future version, so the unit tests reproduce the original hang, meaning a version bump that breaks this fails the suite instead of quietly hanging the flow.

    For anyone interested in the details: under normal circumstances, the popup sends the result back via postMessage using window.opener. Somewhere in Cloudflare's redirect chain, the popup loses its window.opener, so the message has nowhere to go. Fortunately, just before sending the postMessage, expo-web-browser also stores the callback URL in localStorage, which remains accessible regardless of what happens to window.opener. The main window now listens for that value instead, while an orphaned popup closes itself after writing it. The workaround is about 100 lines of code and depends on a couple of localStorage key names used by expo-web-browser@56.0.5.

  4. mateuuszzzzz commented on Jul 30, 2026

    @mateuuszzzzz
    Contributor

    Regarding this popup issue, I wonder if popup is preferred/required option here. If not, we could redirect to CF in current tab (full-page redirect) and this would probably allow us to overcome this expo-web-browser issue entirely. cc: @iwiznia

  5. mateuuszzzzz commented on Aug 6, 2026

    @mateuuszzzzz
    Contributor

    Update:

    I implemented full-page redirect today, it works and tests well, I pushed it to our fork: https://github.com/software-mansion-labs/expensify-app-fork/tree/poc/qa-env/web.

    I also discovered that we only perform SAML sign-outs via expo-web-browser. Sign-in uses full-page redirect as well so I would stick to this approach for CF ZeroTrust. I'll update design doc accordingly. From other things, we're starting "proper" implementation phase with @JakubKorytko. I'll be working on mobile side. He'll be working on web

  6. mateuuszzzzz commented on Aug 12, 2026

    @mateuuszzzzz
    Contributor

    Update:

    I created a draft PR today with QA auth utils that we need to build authentication flow on NewDot web and mobile

  7. 96 remaining items

  8. JakubKorytko commented on Oct 13, 2026

    @JakubKorytko
    Member

    Nothing from me, I think @sharabai would have one though!

  9. removed their assignment
    on Oct 14, 2026
  10. mallenexpensify commented on Oct 14, 2026

    @mallenexpensify
    Contributor

    Please comment and tag me if/when payment is due, thx

  11. sharabai commented on Oct 14, 2026

    @sharabai
    Contributor

    Quick QA update: I'm still working through these problems with QA's Cloudflare sign-in:

    • Log loop. Without a Cloudflare session, log requests are rejected. Each rejection writes an alert, which sends another log request, which is rejected too. It repeats about once a second for as long as the tab is open.
    • Refused renewals. When Cloudflare refuses to renew a session, the tab keeps trying the dead one, and every other tab shares that same stored copy.
    • Requests without a session. Cloudflare rejects them, and a rejected sign-in step is retried up to 10 times and never succeeds.
    • Signed-in testers. If the Cloudflare session ends while someone is signed in, their requests fail until a reload.
    • When the Cloudflare sign-in goes wrong:
      • Back or Deny on the Cloudflare page sends the tester straight back to it, every time.
      • A failed sign-in leaves a typed code loading for about 43 seconds, or shows "Couldn't retrieve account details" at the email step.
      • A magic link can be sent twice, so the tester is signed in but sees the "enter the code from the original device" screen.
      • The email field comes back empty after the Cloudflare page.

    Once I've figured these out I'll probably leave a few comments on the design doc, but I'm still working out how best to solve them.

  12. huult commented on Oct 15, 2026

    @huult
    Contributor

    Thanks for the update!

  13. melvin-bot commented on Oct 20, 2026

    @melvin-bot

    @huult Eep! 4 days overdue now. Issues have feelings too...

  14. huult commented on Oct 21, 2026

    @huult
    Contributor

    Not overdue. @sharabai, do we have any new updates?

  15. sharabai commented on Oct 21, 2026

    @sharabai
    Contributor

    Quick update! I've stopped working on the feature branch for now.

    While going through the problems from my last update, I kept running into cases the design doc doesn't cover. There were too many to just figure out as I go, and a lot of them need an actual decision. So I started my own design doc for them. It's still a draft and I'm adding to it.

    It builds on the feature branch, which follows the original design doc. The PRs that already merged were mostly prep work: refactoring, tooling, and checking that the connection to Cloudflare works. The branch doesn't handle a lot of edge cases yet, especially around errors. So far the draft covers:

    • Which requests can reach QA without a Cloudflare session
    • When the app sends you to the Cloudflare sign-in
    • Keeping the Cloudflare session when the app clears its own data
    • Handling errors when the Cloudflare sign-in goes wrong
    • Making sure QA behaves the same as production
  16. huult commented on Oct 22, 2026

    @huult
    Contributor

    Thanks for the update, and for taking the time to write the design doc for the edge cases.

  17. huult commented on Oct 22, 2026

    @huult
    Contributor

    I think this PR should have a weekly label since work is ongoing. If you disagree, we can switch it back to daily and update it accordingly, @iwiznia.

  18. added and removed on Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Skip PaymentSkips all the payment process steps for an issue. Use it for fixed-price projects.WeeklyKSv2

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions