Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/actions/find/src/findForUrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ export async function findForUrl(url: string, authContext?: AuthContext): Promis
findings = rawFindings.violations.map(violation => ({
scannerType: 'axe',
url,
html: violation.nodes[0].html,
problemShort: violation.help.toLowerCase().replace(/[']/g, '’'),
problemUrl: violation.helpUrl.replace(/[']/g, '’'),
html: violation.nodes[0].html.replace(/'/g, "'"),
Copy link

Copilot AI Oct 21, 2025

Choose a reason for hiding this comment

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

The html field should use HTML entity encoding for all special characters, not just single quotes. Consider using a proper HTML escaping function to handle <, >, &, \", and ' to prevent potential XSS vulnerabilities or data corruption when the HTML is processed downstream.

Copilot uses AI. Check for mistakes.
Copy link
Collaborator Author

@smockle smockle Oct 21, 2025

Choose a reason for hiding this comment

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

I'm open to this, but each of these specific examples is safe in a single-quoted shell string (where they are treated as string literals, not as shell operators, etc.)

problemShort: violation.help.toLowerCase().replace(/'/g, "&apos;"),
problemUrl: violation.helpUrl.replace(/'/g, "&apos;"),
ruleId: violation.id,
solutionShort: violation.description.toLowerCase().replace(/[']/g, '’'),
solutionLong: violation.nodes[0].failureSummary?.replace(/[']/g, '’')
solutionShort: violation.description.toLowerCase().replace(/'/g, "&apos;"),
solutionLong: violation.nodes[0].failureSummary?.replace(/'/g, "&apos;")
}));
} catch (e) {
// do something with the error
Expand Down