security: disable JavaScript execution in Puppeteer for PDF generation
Some checks failed
Deploy to Production / Deploy to Server (push) Failing after 21s
Some checks failed
Deploy to Production / Deploy to Server (push) Failing after 21s
This commit is contained in:
parent
59d563841d
commit
b1135edcca
1 changed files with 2 additions and 0 deletions
|
|
@ -232,6 +232,7 @@ export async function renderPdf(
|
||||||
): Promise<Buffer> {
|
): Promise<Buffer> {
|
||||||
const { page, instance } = await acquirePage();
|
const { page, instance } = await acquirePage();
|
||||||
try {
|
try {
|
||||||
|
await page.setJavaScriptEnabled(false);
|
||||||
const result = await Promise.race([
|
const result = await Promise.race([
|
||||||
(async () => {
|
(async () => {
|
||||||
await page.setContent(html, { waitUntil: "domcontentloaded", timeout: 15_000 });
|
await page.setContent(html, { waitUntil: "domcontentloaded", timeout: 15_000 });
|
||||||
|
|
@ -269,6 +270,7 @@ export async function renderUrlPdf(
|
||||||
): Promise<Buffer> {
|
): Promise<Buffer> {
|
||||||
const { page, instance } = await acquirePage();
|
const { page, instance } = await acquirePage();
|
||||||
try {
|
try {
|
||||||
|
await page.setJavaScriptEnabled(false);
|
||||||
const result = await Promise.race([
|
const result = await Promise.race([
|
||||||
(async () => {
|
(async () => {
|
||||||
await page.goto(url, {
|
await page.goto(url, {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue