Skip to content

Commit 9e97d27

Browse files
gibson042mgol
authored andcommitted
contribute.jquery.org: Sanitize input before rendering as HTML
Closes #393
1 parent bf98434 commit 9e97d27

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

themes/contribute.jquery.org/cla-check.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,12 +133,15 @@ function neglectedAuthors( $data ) {
133133
}
134134

135135
function commitLog( $data ) {
136-
$commitPrefix = "https://github.com/$data->owner/$data->repo/commit/";
136+
$commitPrefix = "https://github.com/" .
137+
htmlspecialchars( "$data->owner/$data->repo" ) .
138+
"/commit/";
137139

138140
$html = "<dl>\n";
139141
foreach ( $data->data->commits as $commit ) {
140-
$html .= "<dt><a href='$commitPrefix$commit->hash'>$commit->hash</a></dt>\n";
141-
$html .= "<dd>" . htmlspecialchars( "$commit->name <$commit->email>" ) . "</dd\n";
142+
$escapedHash = htmlspecialchars( $commit->hash );
143+
$html .= "<dt><a href=\"$commitPrefix$escapedHash\">$escapedHash</a></dt>\n";
144+
$html .= "<dd>" . htmlspecialchars( "$commit->name <$commit->email>" ) . "</dd>\n";
142145
}
143146
$html .= "</dl>\n";
144147
return $html;

0 commit comments

Comments
 (0)