Skip to content
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

DevSkim CLI is case-sensitive where the VSCode extension is not #283

Closed
tomwatson1024 opened this issue May 17, 2021 · 3 comments · Fixed by #284
Closed

DevSkim CLI is case-sensitive where the VSCode extension is not #283

tomwatson1024 opened this issue May 17, 2021 · 3 comments · Fixed by #284
Labels

Comments

@tomwatson1024
Copy link

The Devskim CLI reports an issue that has been explicitly excluded using a Devskim: ignore comment. The VSCode extension works as expected, that is, not reporting the suppressed issue.

$ cat main.c
#include <stdio.h>
#include <string.h>

int main()
{
  char src[40];
  char dest[100];
  char dest2[100];

  gets(src);  // Devskim: ignore DS181021
}
$ devskim analyze main.c
main.c:10:3:10:12 [Important] DS181021 Banned C function detected (gets)
$ devskim --version
Microsoft DevSkim Command Line Interface
0.4.221+17272b4af9

VSCode shows no squiggles. Removing the exclusion comment causes VSCode to show the expected squiggle.

Possibly related to #70 - I've tested the snippet there with the same results as detailed in that issue.

It's also possible I'm missing something obvious here, in which case my apologies in advance.

@tomwatson1024
Copy link
Author

Ah, the issue is suppressed on the CLI if the suppression comment reads // DevSkim: ignore DS181021, note the capitalization of Skim (The issue continues to be suppressed in VSCode). This is the documented capitalization at https://marketplace.visualstudio.com/items?itemName=MS-CST-E.MicrosoftDevSkim.

It seems that the VSCode extension is more permissive?

@tomwatson1024
Copy link
Author

Got it - the regex here in the C# CLI tool is case-sensitive, whereas the regex here in the TS plugin is case-insensitive (note the trailing i flag).

I expect the fix is to make the C# regex case-insensitive also - I don't have an environment set up to build C# so I can't make this fix myself.

@tomwatson1024 tomwatson1024 changed the title DevSkim CLI not suppressing ignored finding DevSkim CLI is case-sensitive where the VSCode extension is not May 18, 2021
gfs added a commit that referenced this issue May 18, 2021
@gfs gfs mentioned this issue May 18, 2021
@gfs
Copy link
Contributor

gfs commented May 18, 2021

Thanks for identifying where the discrepancy was! I'll merge a fix for this today along with a dependency bump.

@gfs gfs closed this as completed in #284 May 18, 2021
gfs added a commit that referenced this issue May 18, 2021
* Fix #283

* Bump dependencies

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

Successfully merging a pull request may close this issue.

2 participants