Skip to content

Commit 3405276

Browse files
authored
Address three CodeQL errors (#9260)
First, ignore moment.js issues by classifying it as a library. Second, resolve an escaping issue by using a built-in jQuery method. Third, surpress a usage of MD5 for backwards compatibility reasons.
1 parent 55adfe0 commit 3405276

3 files changed

Lines changed: 8 additions & 1 deletion

File tree

CodeQL.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
path_classifiers:
2+
library:
3+
# The default behavior is to tag library code as `library`. Results are hidden
4+
# for library code. You can tag further files as being library code by adding them
5+
# to the `library` section.
6+
- "src/NuGetGallery/Scripts/gallery/moment-*.js"

src/NuGetGallery/Scripts/gallery/autocomplete.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@
187187
}
188188

189189
function jquerySafeId(id) {
190-
return id.replace(/\./g, "\\.");
190+
return jQuery.escapeSelector(id);
191191
}
192192

193193
function safeId(id) {

src/NuGetGallery/Services/CertificateService.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ public async Task<Certificate> AddCertificateAsync(HttpPostedFileBase file)
6060
certificate = new Certificate()
6161
{
6262
#pragma warning disable CS0618 // Only set the SHA1 thumbprint, for backwards compatibility. Never read it.
63+
// CodeQL [SM02196] Only set the SHA1 thumbprint, for backwards compatibility. Never read it.
6364
Sha1Thumbprint = certificateFile.Sha1Thumbprint,
6465
#pragma warning restore CS0618
6566
Thumbprint = certificateFile.Sha256Thumbprint,

0 commit comments

Comments
 (0)