Skip to content

Commit 7d1b6ac

Browse files
committed
fix(ticket): escape HTML in user-provided trac content
1 parent 16c8ad4 commit 7d1b6ac

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

eleventy.config.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,14 @@ module.exports = function (eleventyConfig) {
124124
const codes = []
125125
const pres = []
126126
return (
127-
// TODO: sanitize HTML content
128127
text
129128
// Newlines have extra escapes in the strings
130129
.replace(/\\\n/g, '\n')
130+
// Escape HTML
131+
.replace(/</g, '&lt;')
132+
.replace(/>/g, '&gt;')
131133
// Replace `` with <code> tags
132-
.replace(/`([^`]+?)`/g, (_match, code) => {
134+
.replace(/`([^\r\n`]+?)`/g, (_match, code) => {
133135
codes.push(code) // Save the code for later
134136
return `<code></code>`
135137
})

public/css/index.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ body {
7676
background-repeat: repeat-x;
7777
background-position: 50% 0;
7878
}
79+
th, tr {
80+
font-family: var(--font-family-alternate);
81+
}
7982
.container {
8083
width: 100%;
8184
max-width: 910px;

0 commit comments

Comments
 (0)