-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* framework for writing queries for apps that interact with drivers * remove extra print
- Loading branch information
1 parent
fa33730
commit a9ed412
Showing
11 changed files
with
574 additions
and
2 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
src/drivers/apps/queries/QueryTemplate/QueryTemplate.qhelp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<!DOCTYPE qhelp PUBLIC "-//Semmle//qhelp//EN" "qhelp.dtd"> | ||
<qhelp> | ||
<overview> | ||
<p> | ||
TODO overview | ||
</p> | ||
</overview> | ||
<recommendation> | ||
<p> | ||
TODO recommendation | ||
</p> | ||
</recommendation> | ||
<example> | ||
<p> | ||
TODO example | ||
</p> | ||
<sample language="c"> <![CDATA[ | ||
// Example code | ||
}]]> | ||
</sample> | ||
<p> | ||
TODO example 2 | ||
</p> | ||
<sample language="c"> <![CDATA[ | ||
// Example code | ||
}]]> | ||
</sample> | ||
</example> | ||
<semmleNotes> | ||
<p> | ||
TODO notes | ||
</p> | ||
</semmleNotes> | ||
<references> | ||
<li> | ||
<a href="example.com"> | ||
Example link | ||
</a> | ||
</li> | ||
</references> | ||
</qhelp> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
/** | ||
* @id cpp/drivers/TODO | ||
* @kind problem | ||
* @name TODO | ||
* @description TODO | ||
* @platform Desktop | ||
* @feature.area Multiple | ||
* @impact Insecure Coding Practice | ||
* @repro.text | ||
* @owner.email: [email protected] | ||
* @opaqueid CQLD-TODO | ||
* @problem.severity warning | ||
* @precision medium | ||
* @tags correctness | ||
* @scope domainspecific | ||
* @query-version v1 | ||
*/ | ||
|
||
|
||
import cpp | ||
|
||
from Function f | ||
where | ||
f.getName().matches("DriverEntry") | ||
select f, "TODO" |
199 changes: 199 additions & 0 deletions
199
src/drivers/apps/queries/QueryTemplate/QueryTemplate.sarif
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,199 @@ | ||
{ | ||
"$schema" : "https://json.schemastore.org/sarif-2.1.0.json", | ||
"version" : "2.1.0", | ||
"runs" : [ { | ||
"tool" : { | ||
"driver" : { | ||
"name" : "CodeQL", | ||
"organization" : "GitHub", | ||
"semanticVersion" : "2.15.4", | ||
"notifications" : [ { | ||
"id" : "cpp/baseline/expected-extracted-files", | ||
"name" : "cpp/baseline/expected-extracted-files", | ||
"shortDescription" : { | ||
"text" : "Expected extracted files" | ||
}, | ||
"fullDescription" : { | ||
"text" : "Files appearing in the source archive that are expected to be extracted." | ||
}, | ||
"defaultConfiguration" : { | ||
"enabled" : true | ||
}, | ||
"properties" : { | ||
"tags" : [ "expected-extracted-files", "telemetry" ] | ||
} | ||
} ], | ||
"rules" : [ { | ||
"id" : "cpp/drivers/TODO", | ||
"name" : "cpp/drivers/TODO", | ||
"shortDescription" : { | ||
"text" : "TODO" | ||
}, | ||
"fullDescription" : { | ||
"text" : "TODO" | ||
}, | ||
"defaultConfiguration" : { | ||
"enabled" : true, | ||
"level" : "warning" | ||
}, | ||
"properties" : { | ||
"tags" : [ "correctness" ], | ||
"description" : "TODO", | ||
"feature.area" : "Multiple", | ||
"id" : "cpp/drivers/TODO", | ||
"impact" : "Insecure Coding Practice", | ||
"kind" : "problem", | ||
"name" : "TODO", | ||
"opaqueid" : "CQLD-TODO", | ||
"owner.email:" : "[email protected]", | ||
"platform" : "Desktop", | ||
"precision" : "medium", | ||
"problem.severity" : "warning", | ||
"query-version" : "v1", | ||
"repro.text" : "", | ||
"scope" : "domainspecific" | ||
} | ||
} ] | ||
}, | ||
"extensions" : [ { | ||
"name" : "microsoft/windows-drivers", | ||
"semanticVersion" : "1.0.13+4cf80ade609037becb8999823de45e08bd818a20", | ||
"locations" : [ { | ||
"uri" : "file:///C:/codeql-home/WDDST/src/", | ||
"description" : { | ||
"text" : "The QL pack root directory." | ||
} | ||
}, { | ||
"uri" : "file:///C:/codeql-home/WDDST/src/qlpack.yml", | ||
"description" : { | ||
"text" : "The QL pack definition file." | ||
} | ||
} ] | ||
} ] | ||
}, | ||
"invocations" : [ { | ||
"toolExecutionNotifications" : [ { | ||
"locations" : [ { | ||
"physicalLocation" : { | ||
"artifactLocation" : { | ||
"uri" : "driver/driver_snippet.c", | ||
"uriBaseId" : "%SRCROOT%", | ||
"index" : 1 | ||
} | ||
} | ||
} ], | ||
"message" : { | ||
"text" : "" | ||
}, | ||
"level" : "none", | ||
"descriptor" : { | ||
"id" : "cpp/baseline/expected-extracted-files", | ||
"index" : 0 | ||
}, | ||
"properties" : { | ||
"formattedMessage" : { | ||
"text" : "" | ||
} | ||
} | ||
}, { | ||
"locations" : [ { | ||
"physicalLocation" : { | ||
"artifactLocation" : { | ||
"uri" : "driver/fail_driver1.c", | ||
"uriBaseId" : "%SRCROOT%", | ||
"index" : 0 | ||
} | ||
} | ||
} ], | ||
"message" : { | ||
"text" : "" | ||
}, | ||
"level" : "none", | ||
"descriptor" : { | ||
"id" : "cpp/baseline/expected-extracted-files", | ||
"index" : 0 | ||
}, | ||
"properties" : { | ||
"formattedMessage" : { | ||
"text" : "" | ||
} | ||
} | ||
}, { | ||
"locations" : [ { | ||
"physicalLocation" : { | ||
"artifactLocation" : { | ||
"uri" : "driver/fail_driver1.h", | ||
"uriBaseId" : "%SRCROOT%", | ||
"index" : 2 | ||
} | ||
} | ||
} ], | ||
"message" : { | ||
"text" : "" | ||
}, | ||
"level" : "none", | ||
"descriptor" : { | ||
"id" : "cpp/baseline/expected-extracted-files", | ||
"index" : 0 | ||
}, | ||
"properties" : { | ||
"formattedMessage" : { | ||
"text" : "" | ||
} | ||
} | ||
} ], | ||
"executionSuccessful" : true | ||
} ], | ||
"artifacts" : [ { | ||
"location" : { | ||
"uri" : "driver/fail_driver1.c", | ||
"uriBaseId" : "%SRCROOT%", | ||
"index" : 0 | ||
} | ||
}, { | ||
"location" : { | ||
"uri" : "driver/driver_snippet.c", | ||
"uriBaseId" : "%SRCROOT%", | ||
"index" : 1 | ||
} | ||
}, { | ||
"location" : { | ||
"uri" : "driver/fail_driver1.h", | ||
"uriBaseId" : "%SRCROOT%", | ||
"index" : 2 | ||
} | ||
} ], | ||
"results" : [ { | ||
"ruleId" : "cpp/drivers/TODO", | ||
"ruleIndex" : 0, | ||
"rule" : { | ||
"id" : "cpp/drivers/TODO", | ||
"index" : 0 | ||
}, | ||
"message" : { | ||
"text" : "TODO" | ||
}, | ||
"locations" : [ { | ||
"physicalLocation" : { | ||
"artifactLocation" : { | ||
"uri" : "driver/fail_driver1.c", | ||
"uriBaseId" : "%SRCROOT%", | ||
"index" : 0 | ||
}, | ||
"region" : { | ||
"startLine" : 56, | ||
"endColumn" : 12 | ||
} | ||
} | ||
} ], | ||
"partialFingerprints" : { | ||
"primaryLocationLineHash" : "60c6386a5ee58eb6:1", | ||
"primaryLocationStartColumnFingerprint" : "0" | ||
} | ||
} ], | ||
"columnKind" : "utf16CodeUnits", | ||
"properties" : { | ||
"semmle.formatSpecifier" : "sarifv2.1.0" | ||
} | ||
} ] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
|
||
// Macros to enable or disable a code section that may or may not conflict with this test. | ||
#define SET_DISPATCH 1 | ||
|
||
// Template function. Not used for this test. | ||
void top_level_call() | ||
{ | ||
} | ||
|
||
// TODO add tests for query |
40 changes: 40 additions & 0 deletions
40
src/drivers/test/ApplicationForDriversTestTemplate/ApplicationForDriversTestTemplate.sln
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.12.35707.178 d17.12 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ApplicationForDriversTestTemplate", "ApplicationForDriversTestTemplate.vcxproj", "{7EB8FC7A-AD1E-4560-8513-A986DDE4F05F}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|ARM = Debug|ARM | ||
Debug|ARM64 = Debug|ARM64 | ||
Debug|x64 = Debug|x64 | ||
Debug|x86 = Debug|x86 | ||
Release|ARM = Release|ARM | ||
Release|ARM64 = Release|ARM64 | ||
Release|x64 = Release|x64 | ||
Release|x86 = Release|x86 | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{7EB8FC7A-AD1E-4560-8513-A986DDE4F05F}.Debug|ARM.ActiveCfg = Debug|ARM | ||
{7EB8FC7A-AD1E-4560-8513-A986DDE4F05F}.Debug|ARM.Build.0 = Debug|ARM | ||
{7EB8FC7A-AD1E-4560-8513-A986DDE4F05F}.Debug|ARM64.ActiveCfg = Debug|ARM64 | ||
{7EB8FC7A-AD1E-4560-8513-A986DDE4F05F}.Debug|ARM64.Build.0 = Debug|ARM64 | ||
{7EB8FC7A-AD1E-4560-8513-A986DDE4F05F}.Debug|x64.ActiveCfg = Debug|x64 | ||
{7EB8FC7A-AD1E-4560-8513-A986DDE4F05F}.Debug|x64.Build.0 = Debug|x64 | ||
{7EB8FC7A-AD1E-4560-8513-A986DDE4F05F}.Debug|x86.ActiveCfg = Debug|Win32 | ||
{7EB8FC7A-AD1E-4560-8513-A986DDE4F05F}.Debug|x86.Build.0 = Debug|Win32 | ||
{7EB8FC7A-AD1E-4560-8513-A986DDE4F05F}.Release|ARM.ActiveCfg = Release|ARM | ||
{7EB8FC7A-AD1E-4560-8513-A986DDE4F05F}.Release|ARM.Build.0 = Release|ARM | ||
{7EB8FC7A-AD1E-4560-8513-A986DDE4F05F}.Release|ARM64.ActiveCfg = Release|ARM64 | ||
{7EB8FC7A-AD1E-4560-8513-A986DDE4F05F}.Release|ARM64.Build.0 = Release|ARM64 | ||
{7EB8FC7A-AD1E-4560-8513-A986DDE4F05F}.Release|x64.ActiveCfg = Release|x64 | ||
{7EB8FC7A-AD1E-4560-8513-A986DDE4F05F}.Release|x64.Build.0 = Release|x64 | ||
{7EB8FC7A-AD1E-4560-8513-A986DDE4F05F}.Release|x86.ActiveCfg = Release|Win32 | ||
{7EB8FC7A-AD1E-4560-8513-A986DDE4F05F}.Release|x86.Build.0 = Release|Win32 | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
EndGlobal |
Oops, something went wrong.