Skip to content

feat: add PDF buffer generation via Puppeteer#99

Merged
vinodpatidar-okta merged 4 commits intomainfrom
feat/generate-pdf-buffer
Apr 2, 2026
Merged

feat: add PDF buffer generation via Puppeteer#99
vinodpatidar-okta merged 4 commits intomainfrom
feat/generate-pdf-buffer

Conversation

@vinodpatidar-okta
Copy link
Copy Markdown
Contributor

By submitting a PR to this repository, you agree to the terms within the Auth0 Code of Conduct. Please see the contributing guidelines for how to create and submit a high-quality PR for this repo.

Description

Introduces a generatePdfBuffer function that compiles a Handlebars template and renders it to a PDF using Puppeteer, returning a Buffer for downstream use (e.g. HTTP responses, file writes).

Changes:

  • analyzer/report.js: Add generatePdfBuffer — launches headless Chromium, renders the pdf_cli_report.handlebars template, and returns a Buffer (explicit conversion handles Puppeteer v20+
    returning Uint8Array)
  • analyzer/report.js: Register Handlebars helpers (chooseFont, replace, and, inc) and load the template at module init
  • locales/en.json: Fix typo pending_verfification → pending_verification; remove trailing newline

Testing

Describe how this can be tested by reviewers. Be specific about anything not tested and reasons why. If this library has unit and/or integration testing, tests should be added for new functionality and existing tests should complete without errors.

Please include any manual steps for testing end-to-end or functionality not covered by unit/integration tests.

Also include details of the environment this PR was developed in (language/platform/browser version).

  • This change adds test coverage for new/changed/fixed functionality

Checklist

  • I have added documentation for new/changed functionality in this PR or in auth0.com/docs
  • All active GitHub checks for tests, formatting, and security are passing
  • The correct base branch is being used, if not the default branch

@vinodpatidar-okta vinodpatidar-okta requested a review from a team as a code owner March 30, 2026 06:17
const page = await browser.newPage();
// Load the compiled HTML content into Puppeteer

await page.setContent(`${htmlContent}`, { waitUntil: "networkidle2" });
Copy link
Copy Markdown

@semgrepcode-auth0 semgrepcode-auth0 bot Mar 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If unverified user data can reach the setContent method it can result in Server-Side Request Forgery vulnerabilities

🧁 Fixed in commit 99caf86 🧁

@vinodpatidar-okta vinodpatidar-okta merged commit 45ab44e into main Apr 2, 2026
4 checks passed
@vinodpatidar-okta vinodpatidar-okta deleted the feat/generate-pdf-buffer branch April 2, 2026 05:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants