Skip to content

Commit 21c2d6d

Browse files
authored
Merge pull request #34 from dotnet/2.9.x
2.9.x
2 parents 6bd2f54 + 08290a9 commit 21c2d6d

23 files changed

Lines changed: 965 additions & 110 deletions

azure-pipelines.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
- script: eng\common\cibuild.cmd -configuration $(_configuration) -prepareMachine
2929
displayName: Build and Test
3030

31-
- task: PublishTestResults@1
31+
- task: PublishTestResults@2
3232
inputs:
3333
testRunner: XUnit
3434
testResultsFiles: '$(Build.SourcesDirectory)\artifacts\TestResults\$(_configuration)\*.xml'

src/Microsoft.CodeAnalysis.FxCopAnalyzers/Microsoft.CodeAnalysis.FxCopAnalyzers.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,15 +191,18 @@ Sr. No. | Rule ID | Title | Category | Enabled | CodeFix | Description |
191191
188 | CA5387 | Do Not Use Weak Key Derivation Function With Insufficient Iteration Count | Security | False | False | When deriving cryptographic keys from user-provided inputs such as password, use sufficient iteration count (at least 100k). |
192192
189 | CA5388 | Ensure Sufficient Iteration Count When Using Weak Key Derivation Function | Security | False | False | When deriving cryptographic keys from user-provided inputs such as password, use sufficient iteration count (at least 100k). |
193193
190 | [CA5389](https://docs.microsoft.com/visualstudio/code-quality/ca5389) | Do Not Add Archive Item's Path To The Target File System Path | Security | False | False | When extracting files from an archive and using the archive item's path, check if the path is safe. Archive path can be relative and can lead to file system access outside of the expected file system target path, leading to malicious config changes and remote code execution via lay-and-wait technique. |
194-
191 | CA5390 | Do Not Hard Code Encryption Key | Security | False | False | SymmetricAlgorithm's .Key property, or a method's rgbKey parameter, should never be a hardcoded value. |
194+
191 | CA5390 | Do not hard-code encryption key | Security | False | False | SymmetricAlgorithm's .Key property, or a method's rgbKey parameter, should never be a hard-coded value. |
195195
192 | CA5391 | Use antiforgery tokens in ASP.NET Core MVC controllers | Security | False | False | Handling a POST, PUT, PATCH, or DELETE request without validating an antiforgery token may be vulnerable to cross-site request forgery attacks. A cross-site request forgery attack can send malicious requests from an authenticated user to your ASP.NET Core MVC controller. |
196196
193 | CA5392 | Use DefaultDllImportSearchPaths attribute for P/Invokes | Security | False | False | By default, P/Invokes using DllImportAttribute probe a number of directories, including the current working directory for the library to load. This can be a security issue for certain applications, leading to DLL hijacking. |
197197
194 | CA5393 | Do not use unsafe DllImportSearchPath value | Security | False | False | There could be a malicious DLL in the default DLL search directories. Or, depending on where your application is run from, there could be a malicious DLL in the application's directory. Use a DllImportSearchPath value that specifies an explicit search path instead. The DllImportSearchPath flags that this rule looks for can be configured in .editorconfig. |
198-
195 | CA5394 | Do not use insecure randomness | Security | False | False | {0} is an insecure random number generator. Use cryptographically secure random number generators when randomness is required for security |
198+
195 | CA5394 | Do not use insecure randomness | Security | False | False | Using a cryptographically weak pseudo-random number generator may allow an attacker to predict what security-sensitive value will be generated. Use a cryptographically strong random number generator if an unpredictable value is required, or ensure that weak pseudo-random numbers aren't used in a security-sensitive manner. |
199199
196 | CA5395 | Miss HttpVerb attribute for action methods | Security | False | False | All the methods that create, edit, delete, or otherwise modify data do so in the [HttpPost] overload of the method, which needs to be protected with the anti forgery attribute from request forgery. Performing a GET operation should be a safe operation that has no side effects and doesn't modify your persisted data. |
200200
197 | CA5396 | Set HttpOnly to true for HttpCookie | Security | False | False | As a defense in depth measure, ensure security sensitive HTTP cookies are marked as HttpOnly. This indicates web browsers should disallow scripts from accessing the cookies. Injected malicious scripts are a common way of stealing cookies. |
201201
198 | [CA5397](https://docs.microsoft.com/visualstudio/code-quality/ca5397) | Do not use deprecated SslProtocols values | Security | True | False | Older protocol versions of Transport Layer Security (TLS) are less secure than TLS 1.2 and TLS 1.3, and are more likely to have new vulnerabilities. Avoid older protocol versions to minimize risk. |
202202
199 | [CA5398](https://docs.microsoft.com/visualstudio/code-quality/ca5398) | Avoid hardcoded SslProtocols values | Security | False | False | Current Transport Layer Security protocol versions may become deprecated if vulnerabilities are found. Avoid hardcoding SslProtocols values to keep your application secure. Use 'None' to let the Operating System choose a version. |
203-
200 | CA5399 | Definitely disable HttpClient certificate revocation list check | Security | False | False | Using HttpClient without providing a platform specific handler (WinHttpHandler or CurlHandler or HttpClientHandler) where the CheckCertificateRevocationList property is set to true, will allow revoked certificates to be accepted by the HttpClient as valid. |
203+
200 | CA5399 | HttpClients should enable certificate revocation list checks | Security | False | False | Using HttpClient without providing a platform specific handler (WinHttpHandler or CurlHandler or HttpClientHandler) where the CheckCertificateRevocationList property is set to true, will allow revoked certificates to be accepted by the HttpClient as valid. |
204204
201 | CA5400 | Ensure HttpClient certificate revocation list check is not disabled | Security | False | False | Using HttpClient without providing a platform specific handler (WinHttpHandler or CurlHandler or HttpClientHandler) where the CheckCertificateRevocationList property is set to true, will allow revoked certificates to be accepted by the HttpClient as valid. |
205-
202 | CA9999 | Analyzer version mismatch | Reliability | True | False | Analyzers in this package require a certain minimum version of Microsoft.CodeAnalysis to execute correctly. Refer to https://docs.microsoft.com/visualstudio/code-quality/install-fxcop-analyzers#fxcopanalyzers-package-versions to install the correct analyzer version. |
205+
202 | CA5401 | Do not use CreateEncryptor with non-default IV | Security | False | False | Symmetric encryption should always use a non-repeatable initialization vector to prevent dictionary attacks. |
206+
203 | CA5402 | Use CreateEncryptor with the default IV | Security | False | False | Symmetric encryption should always use a non-repeatable initialization vector to prevent dictionary attacks. |
207+
204 | CA5403 | Do not hard-code certificate | Security | False | False | Hard-coded certificates in source code are vulnerable to being exploited. |
208+
205 | CA9999 | Analyzer version mismatch | Reliability | True | False | Analyzers in this package require a certain minimum version of Microsoft.CodeAnalysis to execute correctly. Refer to https://docs.microsoft.com/visualstudio/code-quality/install-fxcop-analyzers#fxcopanalyzers-package-versions to install the correct analyzer version. |

src/Microsoft.CodeAnalysis.FxCopAnalyzers/Microsoft.CodeAnalysis.FxCopAnalyzers.sarif

Lines changed: 61 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3603,8 +3603,8 @@
36033603
},
36043604
"CA5390": {
36053605
"id": "CA5390",
3606-
"shortDescription": "Do Not Hard Code Encryption Key",
3607-
"fullDescription": "SymmetricAlgorithm's .Key property, or a method's rgbKey parameter, should never be a hardcoded value.",
3606+
"shortDescription": "Do not hard-code encryption key",
3607+
"fullDescription": "SymmetricAlgorithm's .Key property, or a method's rgbKey parameter, should never be a hard-coded value.",
36083608
"defaultLevel": "warning",
36093609
"properties": {
36103610
"category": "Security",
@@ -3677,7 +3677,7 @@
36773677
"CA5394": {
36783678
"id": "CA5394",
36793679
"shortDescription": "Do not use insecure randomness",
3680-
"fullDescription": "{0} is an insecure random number generator. Use cryptographically secure random number generators when randomness is required for security",
3680+
"fullDescription": "Using a cryptographically weak pseudo-random number generator may allow an attacker to predict what security-sensitive value will be generated. Use a cryptographically strong random number generator if an unpredictable value is required, or ensure that weak pseudo-random numbers aren't used in a security-sensitive manner.",
36813681
"defaultLevel": "warning",
36823682
"properties": {
36833683
"category": "Security",
@@ -3769,7 +3769,7 @@
37693769
},
37703770
"CA5399": {
37713771
"id": "CA5399",
3772-
"shortDescription": "Definitely disable HttpClient certificate revocation list check",
3772+
"shortDescription": "HttpClients should enable certificate revocation list checks",
37733773
"fullDescription": "Using HttpClient without providing a platform specific handler (WinHttpHandler or CurlHandler or HttpClientHandler) where the CheckCertificateRevocationList property is set to true, will allow revoked certificates to be accepted by the HttpClient as valid.",
37743774
"defaultLevel": "warning",
37753775
"properties": {
@@ -3804,6 +3804,63 @@
38043804
"Telemetry"
38053805
]
38063806
}
3807+
},
3808+
"CA5401": {
3809+
"id": "CA5401",
3810+
"shortDescription": "Do not use CreateEncryptor with non-default IV",
3811+
"fullDescription": "Symmetric encryption should always use a non-repeatable initialization vector to prevent dictionary attacks.",
3812+
"defaultLevel": "warning",
3813+
"properties": {
3814+
"category": "Security",
3815+
"isEnabledByDefault": false,
3816+
"typeName": "DoNotUseCreateEncryptorWithNonDefaultIV",
3817+
"languages": [
3818+
"C#",
3819+
"Visual Basic"
3820+
],
3821+
"tags": [
3822+
"Dataflow",
3823+
"Telemetry"
3824+
]
3825+
}
3826+
},
3827+
"CA5402": {
3828+
"id": "CA5402",
3829+
"shortDescription": "Use CreateEncryptor with the default IV ",
3830+
"fullDescription": "Symmetric encryption should always use a non-repeatable initialization vector to prevent dictionary attacks.",
3831+
"defaultLevel": "warning",
3832+
"properties": {
3833+
"category": "Security",
3834+
"isEnabledByDefault": false,
3835+
"typeName": "DoNotUseCreateEncryptorWithNonDefaultIV",
3836+
"languages": [
3837+
"C#",
3838+
"Visual Basic"
3839+
],
3840+
"tags": [
3841+
"Dataflow",
3842+
"Telemetry"
3843+
]
3844+
}
3845+
},
3846+
"CA5403": {
3847+
"id": "CA5403",
3848+
"shortDescription": "Do not hard-code certificate",
3849+
"fullDescription": "Hard-coded certificates in source code are vulnerable to being exploited.",
3850+
"defaultLevel": "warning",
3851+
"properties": {
3852+
"category": "Security",
3853+
"isEnabledByDefault": false,
3854+
"typeName": "DoNotHardCodeCertificate",
3855+
"languages": [
3856+
"C#",
3857+
"Visual Basic"
3858+
],
3859+
"tags": [
3860+
"Dataflow",
3861+
"Telemetry"
3862+
]
3863+
}
38073864
}
38083865
}
38093866
},

src/Microsoft.NetCore.Analyzers/Core/MicrosoftNetCoreAnalyzersResources.resx

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1119,11 +1119,11 @@
11191119
<data name="DoNotUseInsecureRandomness" xml:space="preserve">
11201120
<value>Do not use insecure randomness</value>
11211121
</data>
1122-
<data name="DoNotUseInsecureRandomnessDescription" xml:space="preserve">
1122+
<data name="DoNotUseInsecureRandomnessMessage" xml:space="preserve">
11231123
<value>{0} is an insecure random number generator. Use cryptographically secure random number generators when randomness is required for security</value>
11241124
</data>
1125-
<data name="DoNotUseInsecureRandomnessMessage" xml:space="preserve">
1126-
<value>Using a cryptographically weak pseudo-random number generator may allow an attacker to predict what security sensitive value will be generated. Use a cryptographically strong random number generator if an unpredictable value is required, or ensure that weak pseudo-random numbers aren't used in a security sensitive manner.</value>
1125+
<data name="DoNotUseInsecureRandomnessDescription" xml:space="preserve">
1126+
<value>Using a cryptographically weak pseudo-random number generator may allow an attacker to predict what security-sensitive value will be generated. Use a cryptographically strong random number generator if an unpredictable value is required, or ensure that weak pseudo-random numbers aren't used in a security-sensitive manner.</value>
11271127
</data>
11281128
<data name="DoNotUseCountAsyncWhenAnyAsyncCanBeUsedDescription" xml:space="preserve">
11291129
<value>For non-empty collections, CountAsync() and LongCountAsync() enumerate the entire sequence, while AnyAsync() stops at the first item or the first item that satisfies a condition.</value>
@@ -1174,7 +1174,7 @@
11741174
<value>All the methods that create, edit, delete, or otherwise modify data do so in the [HttpPost] overload of the method, which needs to be protected with the anti forgery attribute from request forgery. Performing a GET operation should be a safe operation that has no side effects and doesn't modify your persisted data.</value>
11751175
</data>
11761176
<data name="DefinitelyDisableHttpClientCRLCheck" xml:space="preserve">
1177-
<value>Definitely disable HttpClient certificate revocation list check</value>
1177+
<value>HttpClients should enable certificate revocation list checks</value>
11781178
</data>
11791179
<data name="DefinitelyDisableHttpClientCRLCheckMessage" xml:space="preserve">
11801180
<value>HttpClient is created without enabling CheckCertificateRevocationList</value>
@@ -1197,4 +1197,19 @@
11971197
<data name="DoNotHardCodeCertificateMessage" xml:space="preserve">
11981198
<value>Potential security vulnerability was found where '{0}' in method '{1}' may be tainted by hard-coded certificate from '{2}' in method '{3}'</value>
11991199
</data>
1200+
<data name="DefinitelyUseCreateEncryptorWithNonDefaultIV" xml:space="preserve">
1201+
<value>Do not use CreateEncryptor with non-default IV</value>
1202+
</data>
1203+
<data name="DefinitelyUseCreateEncryptorWithNonDefaultIVMessage" xml:space="preserve">
1204+
<value>Symmetric encryption uses non-default initialization vector, which could be potentially repeatable</value>
1205+
</data>
1206+
<data name="MaybeUseCreateEncryptorWithNonDefaultIV" xml:space="preserve">
1207+
<value>Use CreateEncryptor with the default IV </value>
1208+
</data>
1209+
<data name="MaybeUseCreateEncryptorWithNonDefaultIVMessage" xml:space="preserve">
1210+
<value>The non-default initialization vector, which can be potentially repeatable, is used in the encrypion. Ensure use the default one.</value>
1211+
</data>
1212+
<data name="DoNotUseCreateEncryptorWithNonDefaultIVDescription" xml:space="preserve">
1213+
<value>Symmetric encryption should always use a non-repeatable initialization vector to prevent dictionary attacks.</value>
1214+
</data>
12001215
</root>

0 commit comments

Comments
 (0)