fix(security): sanitize unescaped HTML interpolation in certificate download (#489) - #524
Closed
Ranjeet2063 wants to merge 1 commit into
Closed
Ranjeet2063 wants to merge 1 commit into
Ranjeet2063 wants to merge 1 commit into
Conversation
❌ Deploy Preview for chainlearn failed.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #489
Summary & Security Invariant Resolution
Resolves a potential Cross-Site Scripting (XSS) vulnerability during certificate export and download in
src/app/credentials/[credentialId]/page.tsx.Previously,
handleDownloadinterpolated dynamic certificate fields directly into an HTML template string without escaping, which allowed unescaped HTML/JavaScript in course titles or metadata to execute when the downloaded certificate was opened in a user browser.Changes Implemented
htmlEscape):htmlEscapehelper function converting special characters (&,<,>,",') into their corresponding HTML entities (&,<,>,",').null,undefined, and numeric values.credential.courseTitlein both<title>and<h2>elements.formatDate(credential.issuedAt).credential.id.truncateAddress(credential.tokenId, 8).credential.metadata.scorein the score badge display.src/app/credentials/[credentialId]/page.tsxwith zero unrelated diffs.