Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HOLD for payment 2022-07-25] [$250] Statement does not load in NewDot Desktop App #9713

Closed
thienlnam opened this issue Jul 5, 2022 · 22 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Daily KSv2 External Added to denote the issue can be worked on by a contributor

Comments

@thienlnam
Copy link
Contributor

thienlnam commented Jul 5, 2022

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Action Performed:

Break down in numbered steps

  1. Click on the statement from Concierge on NewDot Desktop

Screen Shot 2022-07-05 at 12 09 00 PM

Expected Result:

Describe what you think should've happened
Should show the statement

Actual Result:

Describe what actually happened
Shows a blank screen
Screen Shot 2022-07-05 at 12 07 13 PM

Workaround:

Can the user still use Expensify without this being fixed? Have you informed them of the workaround?
Will have to view the statement on a non desktop application

Platform:

Where is this issue occurring?

  • Web
  • iOS
  • Android
  • Desktop App x
  • Mobile Web

Version Number:
Reproducible in staging?:
Reproducible in production?:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation
Upwork job link: https://www.upwork.com/jobs/~01993059e1414b86b4

View all open jobs on GitHub

@thienlnam thienlnam added Weekly KSv2 Internal Requires API changes or must be handled by Expensify staff labels Jul 5, 2022
@thienlnam
Copy link
Contributor Author

thienlnam commented Jul 5, 2022

cc @justinpersaud since you've helped us on previous configuration issues - do we just need to include https://www.expensify.com/ in the frame-ancestors list?

https://github.com/Expensify/Salt/blob/main/shared_pkgs/nginx/files/conf.d/www.conf.template#L50-L50

@thienlnam thienlnam self-assigned this Jul 5, 2022
@justinpersaud
Copy link
Contributor

www.expensify.com is in the list already. Is it not valid without the protocol? Maybe that was a typo?

@thienlnam
Copy link
Contributor Author

I assume it's not valid without the protocol, www.expensify.com is put there from the hostname here. We explicity imply it in these other configs https://github.com/Expensify/Salt/blob/3c6ac677d3a3e6d0dd7ee57b04fab523957525b6/shared_pkgs/nginx/files/conf.d/integrations.conf.template#L20-L20 so I'm guessing we can just start by adding it?

@justinpersaud
Copy link
Contributor

yeah let's try that and see? according to the spec it should work though: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/frame-ancestors

Warning: If no URL scheme is specified for a host-source and the iframe is loaded from an https URL, the URL for the page loading the iframe must also be https, per the Does URL match expression in origin with redirect count? section of the CSP spec.

@justinpersaud
Copy link
Contributor

wait, are you using the staging server on newdot? could it be because the request is coming from https://staging.new.expensify.com --> www.expensify.com

@thienlnam
Copy link
Contributor Author

Not on the staging server on newDot, unless it's something that's automatically added to my expensify account. Good point on the staging though, we'd also want this to work on staging so I will also add https://staging.expensify.com/ as well

@parasharrajat
Copy link
Member

parasharrajat commented Jul 5, 2022

@thienlnam This one needs to be done on front end. Doing this change will fix it.

  1. Add the following line after
    callback({responseHeaders: details.responseHeaders});
    .
if(details.responseHeaders['content-security-policy']){
                        details.responseHeaders['content-security-policy']  = details.responseHeaders['content-security-policy'].map(v => v.startsWith('frame-ancestors') ? v + ` app://*` : v);
                    }
  1. Add the following line after
    details.responseHeaders['access-control-allow-origin'] = [`http://localhost:${process.env.PORT}`];
    .
  if(details.responseHeaders['content-security-policy']){
                        details.responseHeaders['content-security-policy']  = details.responseHeaders['content-security-policy'].map(v => v.startsWith('frame-ancestors') ? v + ` http://localhost:${process.env.PORT}` : v);
                    }

Other solution could be to remove the CSP response headers all along. I am not sure of the security implications so I won't suggest it.

@thienlnam
Copy link
Contributor Author

thienlnam commented Jul 6, 2022

cc @parasharrajat

Add the following line after

What's the reasoning behind this, how come it isn't being recognized currently?

Other solution could be to remove the CSP response headers all along. I am not sure of the security implications so I won't suggest it.

Yeah this is unlikely what we'd want to do

@parasharrajat
Copy link
Member

parasharrajat commented Jul 6, 2022

On the desktop app, the app is loading with localhost URL on dev and with app:// on production. CSP policy will fail if URLs do not match what is specified in frame-ancestors.

Previously we never used frames anywhere AFAIK so frame-ancestors CSP was never applicable to any API calls.
As we are using electron, we can do anything with the API calls, either disable the policy completely before building the app(very bad) Or intercept the requests calls and manage the headers before that calls are received on the frontend.

@thienlnam
Copy link
Contributor Author

Interesting, thanks for the context. I agree this actually seems to be an issue we can fix on the front-end. Seems like we've already been running into this with access-control-allow-origin.

We could just update our config to allow app://expensify... but I think the solution you provided makes more sense. Do you want to take this issue?

@parasharrajat
Copy link
Member

Yup, I can do that.

@mvtglobally
Copy link

@thienlnam not sure if this is related #9670

@thienlnam
Copy link
Contributor Author

@mvtglobally Yup, good catch - this is the same issue so I'm closing the other one

@thienlnam thienlnam added External Added to denote the issue can be worked on by a contributor and removed Internal Requires API changes or must be handled by Expensify staff labels Jul 6, 2022
@melvin-bot
Copy link

melvin-bot bot commented Jul 6, 2022

Triggered auto assignment to @michaelhaxhiu (External), see https://stackoverflow.com/c/expensify/questions/8582 for more details.

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Jul 6, 2022
@thienlnam
Copy link
Contributor Author

cc @michaelhaxhiu

This is now an external job - please also hire @parasharrajat as the contributor completing the PR
I'll be reviewing the PR

@parasharrajat
Copy link
Member

parasharrajat commented Jul 7, 2022

@thienlnam I also found one issue #9712 (comment). Should I report it or you are aware of this?

I also suggested a solution to that.

@thienlnam
Copy link
Contributor Author

We've been aware of the blank page - we don't return anything in various scenarios and we've talked about adding some kind of error message so it doesn't look like a bug. The way you mentioned is one way we could handle it, we've also thought about just returning an error dialog but we haven't really fleshed out the design of what this would look like yet so it's something that we need to do first

@melvin-bot melvin-bot bot added Weekly KSv2 and removed Daily KSv2 Overdue labels Jul 11, 2022
@melvin-bot
Copy link

melvin-bot bot commented Jul 11, 2022

Current assignee @parasharrajat is eligible for the Exported assigner, not assigning anyone new.

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Jul 11, 2022
@melvin-bot
Copy link

melvin-bot bot commented Jul 11, 2022

Current assignee @thienlnam is eligible for the Exported assigner, not assigning anyone new.

@melvin-bot melvin-bot bot changed the title Statement does not load in NewDot Desktop App [$250] Statement does not load in NewDot Desktop App Jul 11, 2022
@michaelhaxhiu michaelhaxhiu removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Jul 11, 2022
@michaelhaxhiu
Copy link
Contributor

Job posted here - https://www.upwork.com/jobs/~01993059e1414b86b4, and invited Rajat :)

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Jul 18, 2022
@melvin-bot melvin-bot bot changed the title [$250] Statement does not load in NewDot Desktop App [HOLD for payment 2022-07-25] [$250] Statement does not load in NewDot Desktop App Jul 18, 2022
@melvin-bot
Copy link

melvin-bot bot commented Jul 18, 2022

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.1.84-13 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2022-07-25. 🎊

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Jul 25, 2022
@michaelhaxhiu
Copy link
Contributor

paid

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Daily KSv2 External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests

5 participants