Visitar URL original
C#: Use stubs in the Security feature related tests. by michaelnebel · Pull Request #13472 · github/codeql · GitHub
The Wayback Machine - https://web.archive.org/web/20260309112334/https://github.com/github/codeql/pull/13472
Skip to content

C#: Use stubs in the Security feature related tests.#13472

Merged
michaelnebel merged 33 commits intogithub:mainfrom
michaelnebel:csharp/usestubs2
Jun 19, 2023
Merged

C#: Use stubs in the Security feature related tests.#13472
michaelnebel merged 33 commits intogithub:mainfrom
michaelnebel:csharp/usestubs2

Conversation

@michaelnebel
Copy link
Contributor

@michaelnebel michaelnebel commented Jun 15, 2023 •

In this PR we convert almost all our existing security related query tests to be based on stubs instead of dll's.
The only tests that are not converted are

  • CWE-079 this was not easily doable for the Xss ASP inline test. I have split tests out into a separate directories to cover as many tests with stubs as possible.
  • CWE-611 as the output of the query is depending on the content of the framework dll's being used.

After the re-factor I think we for all practical purposes can claim that our security feature related tests are based on stubs and not compiled code.

@github-actions github-actions bot added the C# label Jun 15, 2023
@michaelnebel michaelnebel added the no-change-note-required This PR does not need a change note label Jun 16, 2023
@michaelnebel michaelnebel marked this pull request as ready for review June 16, 2023 08:37
@michaelnebel michaelnebel requested a review from a team as a code owner June 16, 2023 08:37
Copy link
Contributor

@hvitved hvitved left a comment

Choose a reason for hiding this comment

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

Thanks for doing this.

semmle-extractor-options: /r:${testdir}/../../../resources/assemblies/System.Web.dll /r:${testdir}/../../../resources/assemblies/System.Web.ApplicationServices.dll /r:${testdir}/../../../resources/assemblies/System.Data.dll /r:System.Text.RegularExpressions.dll /r:System.Collections.Specialized.dll /r:System.Data.Common.dll /r:System.Security.Cryptography.X509Certificates.dll /r:System.Runtime.InteropServices.dll
semmle-extractor-options: /nostdlib /noconfig
semmle-extractor-options: --load-sources-from-project:${testdir}/../../../resources/stubs/_frameworks/Microsoft.NETCore.App/Microsoft.NETCore.App.csproj
semmle-extractor-options: ${testdir}/../../../resources/stubs/System.Web.cs
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this file not belong to a properly generated stub from a nuget package? (We can take that follow-up).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The content of System.Web.cs?
I agree that the most ideal situation would be to only rely on generated stuff.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes; System.Web.cs appears to be handwritten; it would be nice if we could generate that using make_stubs_nuget.py.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, agreed, but I think that file contains stuff from multiple packages that has just piled up over time.

@michaelnebel michaelnebel merged commit 1338261 into github:main Jun 19, 2023
@michaelnebel michaelnebel deleted the csharp/usestubs2 branch June 19, 2023 07:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C# no-change-note-required This PR does not need a change note

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants