|
110 | 110 | } |
111 | 111 |
|
112 | 112 | function prLink(repo, pr, text) { |
113 | | - return `<a href="https://github.com/${metadata.org}/${repo}/pull/${pr}">${text}</a>`; |
| 113 | + const org = encodeURIComponent(metadata.org); |
| 114 | + const repoSeg = encodeURIComponent(repo); |
| 115 | + const prSeg = encodeURIComponent(String(pr)); |
| 116 | + const safeText = DataTable.util.escapeHtml(String(text)); |
| 117 | + return `<a href="https://github.com/${org}/${repoSeg}/pull/${prSeg}">${safeText}</a>`; |
114 | 118 | } |
115 | 119 |
|
116 | 120 | function userLink(user, internal = true) { |
|
124 | 128 | user = user.substring(1); |
125 | 129 | } |
126 | 130 |
|
127 | | - const href = internal ? `?username=${user}` : `https://github.com/${user}`; |
128 | | - return `<a class="${linkClass}" href="${href}">${user}</a>`; |
| 131 | + const href = internal |
| 132 | + ? `?username=${encodeURIComponent(user)}` |
| 133 | + : `https://github.com/${encodeURIComponent(user)}`; |
| 134 | + const safeUser = DataTable.util.escapeHtml(user); |
| 135 | + return `<a class="${linkClass}" href="${href}">${safeUser}</a>`; |
129 | 136 | } |
130 | 137 | function sortUsernames(a, b) { |
131 | 138 | const getPriority = (str) => (str.startsWith("-") ? -2 : str.startsWith("+") ? -1 : 0); |
|
144 | 151 | render: (data, type, row) => { |
145 | 152 | if (type == "display") { |
146 | 153 | let docHref = metadata.doc_url.replaceAll('\${pr}', row[0]); |
147 | | - docLink = `<a href="${docHref}" target="_blank" title="CI-built documentation"> |
| 154 | + const safeDocHref = DataTable.util.escapeHtml(docHref); |
| 155 | + docLink = `<a href="${safeDocHref}" target="_blank" title="CI-built documentation"> |
148 | 156 | <i class="bi bi-file-earmark-text"></i> |
149 | 157 | </a>`; |
150 | 158 | return docLink + " " + prLink(row[13], data, data); |
|
210 | 218 | className: "ellipsis narrow", |
211 | 219 | responsivePriority: 5, |
212 | 220 | }, |
213 | | - { title: "Base", responsivePriority: 200 }, |
| 221 | + { title: "Base", responsivePriority: 200, render: DataTable.render.text() }, |
214 | 222 | { |
215 | 223 | title: "Updated", |
216 | 224 | render: (data, type, row) => (type == "display" ? timeSince(data) : data), |
|
0 commit comments