-
Bug
-
Resolution: Unresolved
-
Low
-
Minor
Issue Summary
Rendering PDF files with base64 through Forge Custom UI app encounter a CSP error:
Refused to frame '' because it violates the following Content Security Policy directive
Steps to Reproduce
- Create an app using a Forge Custom UI.
- On the resolver, perform a REST API to get the pdf attachment content, e.g.:
resolver.define('download-attachment', async (req) => { const apiResponse = await api .asUser() .requestJira(route`/rest/api/3/attachment/content/ID`, { headers: { 'Accept': 'application/json' } }); const bufferResponse = await apiResponse.arrayBuffer(); const base64 = Buffer.from(bufferResponse).toString('base64') console.log(base64) return `data:application/pdf;base64,${base64}` });
- Invoke the resolver on the App.js file, and insert the base64 on the iframe and then, deploy and install the app.
return (
<div>
<span>Attachment pdf file:</span>
<div><iframe src={data}/></div>
</div>
);
Expected Results
PDF file rendered.
Actual Results
Refused to frame '' because it violates the following Content Security Policy directive
Workaround
Currently there is no known workaround for this behavior. A workaround will be added here when available