Skip to content

Fix cwe tags to include leading zero #19429

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

owen-mc
Copy link
Contributor

@owen-mc owen-mc commented Apr 30, 2025

The query metadata style guide gives examples where the cwe number has leading zeros to make it three digits, like external/cwe/cwe-022. Most queries do this, but some are missing the leading zeros. This PR fixes that, and also one query that I noticed in passing had the wrong form for its CWE tags.

I hope this doesn't need a change note for each language. Let me know if I'm wrong.

@Copilot Copilot AI review requested due to automatic review settings April 30, 2025 15:48
@owen-mc owen-mc requested review from a team as code owners April 30, 2025 15:48
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates the CWE tag annotations in the QL queries to use three-digit CWE numbers with leading zeros, aligning them with the query metadata style guide.

  • Updates CWE-20, CWE-12, CWE-16, CWE-11, and CWE-14 tags to their three-digit formats (e.g. from cwe-20 to cwe-020).
  • Improves consistency of metadata across Go, C#, and C++ query files.

Reviewed Changes

Copilot reviewed 38 out of 38 changed files in this pull request and generated no comments.

Show a summary per file
File Description
go/ql/src/Security/CWE-020/UntrustedDataToUnknownExternalAPI.ql Updated tag from cwe-20 to cwe-020
go/ql/src/Security/CWE-020/UntrustedDataToExternalAPI.ql Updated tag from cwe-20 to cwe-020
go/ql/src/Security/CWE-020/SuspiciousCharacterInRegexp.ql Updated tag from cwe-20 to cwe-020
go/ql/src/Security/CWE-020/MissingRegexpAnchor.ql Updated tag from cwe-20 to cwe-020
go/ql/src/Security/CWE-020/IncompleteHostnameRegexp.ql Updated tag from cwe-20 to cwe-020
go/ql/src/Security/CWE-020/ExternalAPIsUsedWithUntrustedData.ql Updated tag from cwe-20 to cwe-020
csharp/ql/src/Security Features/CWE-248/MissingASPNETGlobalErrorHandler.ql Updated tag from cwe-12 to cwe-012
csharp/ql/src/Security Features/CWE-020/UntrustedDataToExternalAPI.ql Updated tag from cwe-20 to cwe-020
csharp/ql/src/Security Features/CWE-020/RuntimeChecksBypass.ql Updated tag from cwe-20 to cwe-020
csharp/ql/src/Security Features/CWE-020/ExternalAPIsUsedWithUntrustedData.ql Updated tag from cwe-20 to cwe-020
csharp/ql/src/Security Features/CWE-016/ASPNetPagesValidateRequest.ql Updated tag from cwe-16 to cwe-016
csharp/ql/src/Security Features/CWE-016/ASPNetMaxRequestLength.ql Updated tag from cwe-16 to cwe-016
csharp/ql/src/Security Features/CWE-011/ASPNetDebug.ql Updated tag from cwe-11 to cwe-011
csharp/ql/src/Configuration/PasswordInConfigurationFile.ql Updated tag from cwe-13 to cwe-013
cpp/ql/src/experimental/Security/CWE/CWE-020/LateCheckOfFunctionArgument.ql Updated tag from cwe-20 to cwe-020
cpp/ql/src/Security/CWE/CWE-020/UntrustedDataToExternalAPI.ql Updated tag from cwe-20 to cwe-020
cpp/ql/src/Security/CWE/CWE-020/IRUntrustedDataToExternalAPI.ql Updated tag from cwe-20 to cwe-020
cpp/ql/src/Security/CWE/CWE-020/IRCountUntrustedDataToExternalAPI.ql Updated tag from cwe-20 to cwe-020
cpp/ql/src/Security/CWE/CWE-020/CountUntrustedDataToExternalAPI.ql Updated tag from cwe-20 to cwe-020
cpp/ql/src/Security/CWE/CWE-014/MemsetMayBeDeleted.ql Updated tag from cwe-14 to cwe-014

Copy link
Contributor

@tausbn tausbn left a comment

Choose a reason for hiding this comment

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

Let's hope we never get more than a thousand CWEs.

@owen-mc owen-mc added the no-change-note-required This PR does not need a change note label Apr 30, 2025
@jketema
Copy link
Contributor

jketema commented Apr 30, 2025

There are more than 1000s CWEs. Example: https://cwe.mitre.org/data/definitions/1191.html. This also is not consistent with the numbering used by Mitre, which does not prefix the number with zeros. See, e.g., https://cwe.mitre.org/data/definitions/14.html. So I'm not sure if this is the way to go?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants