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

PDF embedding #448

Closed
SuruPa00 opened this issue Dec 7, 2021 · 10 comments
Closed

PDF embedding #448

SuruPa00 opened this issue Dec 7, 2021 · 10 comments
Assignees
Labels
2day 2 days effort required bug Something isn't working cannot reproduce Cannot proceed because the bug was not reproducible frontend LAMP-dashboard, LAMP-activities, and LAMP-js

Comments

@SuruPa00
Copy link
Contributor

SuruPa00 commented Dec 7, 2021

There is an issue with embedding pdfs where even though the markdown code is correct, the pdf does not still show up in the LAMP account. See the "pdf tip" tip in the learn page of U1147188384 for an example.

@SuruPa00 SuruPa00 added bug Something isn't working frontend LAMP-dashboard, LAMP-activities, and LAMP-js priority MEDIUM Medium priority item labels Dec 7, 2021
@SuruPa00 SuruPa00 moved this to Frontend in mindLAMP 2 Dec 7, 2021
@SuruPa00
Copy link
Contributor Author

@ZCOEngineer let's have this looked at alongside priority 1 items now

@ZCOEngineer
Copy link

Ok Suraj

@sarithapillai8 sarithapillai8 added the 2day 2 days effort required label Dec 22, 2021
@sarithapillai8
Copy link
Contributor

sarithapillai8 commented Dec 22, 2021

@SuruPa00
The pdf is not rendering as we are trying to render it inside sandboxed iFrame. There are some restrictions for security reasons. I hope we cannot remove that attribute.
@avaidyam Please confirm.

@sarithapillai8 sarithapillai8 added the on hold Issue will not be worked on yet or is roadblocked label Dec 22, 2021
@sarithapillai8 sarithapillai8 self-assigned this Dec 22, 2021
@avaidyam
Copy link
Member

@sarithapillai8 It was working before and it's not working now. Can you provide explanation as to why the security policy is suddenly different? We have always been using a sandboxed iframe, correct?

@sarithapillai8
Copy link
Contributor

sarithapillai8 commented Dec 23, 2021

@avaidyam
Yes we are using the same sandboxed iFrame. If it was working, was it given in the same way as given now? Because I can see that the sandboxed iFrame restrict the rendering of pdf with embed, object tags. All these working when I remove sandbox attribute
Screenshot 2021-12-23 120944

@avaidyam
Copy link
Member

@sarithapillai8 Please add the sandbox exception attributes for plugins, external APIs, and automatically triggered content. That should fix the YouTube embed issue.

@sarithapillai8
Copy link
Contributor

@avaidyam We already have exception attributes in sandbox. I can check further. If you have any suggestion, please let me know. Our code is like :
'sandbox="allow-forms allow-same-origin allow-scripts allow-popups allow-top-navigation "'

image

@avaidyam
Copy link
Member

If that is the case, there should be no reason for PDF embedding to stop working. Can you investigate any code changes to React-Markdown in the Tips code?

@sarithapillai8
Copy link
Contributor

@avaidyam
No code changes affecting this pdf rendering found. I wonder if this is something related with browser update. PDF is rendering in Firefox and safari browser. The chrome browser has restrictions with sandboxed IFrame.
image

@avaidyam
Copy link
Member

avaidyam commented Jan 3, 2022

@sarithapillai8 Good call - I've investigated this and found that you are correct, it is indeed a new Chrome 88+ bug and a new security policy change made around Sept./Oct. 2021.1234

The Chrome PDF renderer now honors the global JavaScript policy (via chrome_pdf::features::kPdfHonorJsContentSettings). Chrome 88+ does not respect the Content-Security-Policy of the page for some reason as well and thus disables only PDF rendering inside an iframe.

Footnotes

  1. https://bugs.chromium.org/p/chromium/issues/detail?id=413851

  2. https://chromium.googlesource.com/chromium/src/+/48927999f8445cf01628dc3904a317e9d7a43964

  3. https://github.com/whatwg/html/issues/3958

  4. https://csplite.com/csp/test324/

Repository owner moved this from Frontend to Done in mindLAMP 2 Jan 10, 2022
@avaidyam avaidyam added cannot reproduce Cannot proceed because the bug was not reproducible and removed priority MEDIUM Medium priority item on hold Issue will not be worked on yet or is roadblocked labels Jan 10, 2022
@avaidyam avaidyam removed this from mindLAMP 2 Jan 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2day 2 days effort required bug Something isn't working cannot reproduce Cannot proceed because the bug was not reproducible frontend LAMP-dashboard, LAMP-activities, and LAMP-js
Projects
None yet
Development

No branches or pull requests

4 participants