-
Notifications
You must be signed in to change notification settings - Fork 160
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
Adding compiler data to AppInsights #404
Adding compiler data to AppInsights #404
Conversation
Adding improvements
3af6b99
to
d7d01f9
Compare
…ttps://github.com/microsoft/binskim into users/ednakamu/application-insights-compiler-data
This pull request fixes 2 alerts when merging fd254b4 into cbae8ad - view on LGTM.com fixed alerts:
|
This pull request fixes 2 alerts when merging b0f5106 into ad9e840 - view on LGTM.com fixed alerts:
|
This pull request fixes 2 alerts when merging aedb1eb into 350fcf6 - view on LGTM.com fixed alerts:
|
these strings are neither alphabetized nor are they sorted by line length. can we sort by line length? makes things more readable. In reply to: 881621666 In reply to: 881621666 In reply to: 881621666 Refers to: src/BinaryParsers/MachOBinary/SingleMachOBinary.cs:16 in aedb1eb. [](commit_id = aedb1eb, deletion_comment = False) |
src/BinSkim.Driver/AnalyzeOptions.cs
Outdated
|
||
[Option( | ||
"repository-uri", | ||
HelpText = "RepositoryUri is required to rule BA4001 and BA4002.")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whenever you show an opaque rule id to the user, you should add the readable name. Not everyone can remember what BA4001 is. Also, you've described a fact here 'this data is required to run rule BA4001.ReportPECompilerData' but you haven't described what that data is.
What is this data? Does it make sense that we require a single repo URL for a scan run??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed the helptext. Let me know what do you think.
About your question...I thought about it, and I could not find anything better based on this:
https://docs.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=azure-devops&tabs=yaml
my idea was to find one pre-defined variable that any pipeline would be able to get.
src/BinSkim.Driver/AnalyzeOptions.cs
Outdated
|
||
[Option( | ||
"pipeline-name", | ||
HelpText = "PipelineName is required to rule BA4001 and BA4002.")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated the helptext, pls, review :)
Console.Write($"{file},"); | ||
Console.Write($"{context?.Hashes?.Sha256},"); | ||
Console.WriteLine(); | ||
context.CompilerDataLogger.Write(compiler.Compiler.ToString(), compiler.Version.ToString(), language, file); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where I create the CompilerDataLogger, i pass the context. from it I retrieve information such as hash. With that, i can remove from here and just pass the data that i dont have during construction of compilerDataLogger
Console.Write(context.TargetUri.LocalPath + ","); | ||
Console.WriteLine($",,,,,,{context?.Hashes?.Sha256},{target.PdbParseException.Message}"); | ||
string errorMessage = target.PdbParseException.Message; | ||
context.CompilerDataLogger.WriteException(errorMessage); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the hash is constructed with the CompilerDataLogger, so we don't need to worry here.
|
||
s_telemetryClient.TrackEvent(CompilerEventName, properties: new Dictionary<string, string> | ||
{ | ||
{ "repositoryUri", repositoryUri ?? string.Empty }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed the relevant code to throw an argumentNullException in case repositoryUri or pipelineName is null/empty.
With that, i cleaned the code
{ | ||
{ "repositoryUri", repositoryUri ?? string.Empty }, | ||
{ "pipelineName", pipelineName ?? string.Empty }, | ||
{ "target", this.localPath }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
made a change to transform the localPath to a relativeFilePath base on the targetFileSpecifiers
{ "pipelineName", pipelineName ?? string.Empty }, | ||
{ "target", this.localPath }, | ||
{ "compilerName", compilerDataParts[0] }, | ||
{ "compilerBackEndVersion", compilerDataParts[1] }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed!
} | ||
else | ||
{ | ||
Console.Write($"{repositoryUri},"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🕐
…ttps://github.com/microsoft/binskim into users/ednakamu/application-insights-compiler-data
This pull request fixes 2 alerts when merging 9d21968 into be2289a - view on LGTM.com fixed alerts:
|
This pull request fixes 2 alerts when merging 7ce6027 into be2289a - view on LGTM.com fixed alerts:
|
This pull request fixes 2 alerts when merging 5112e4a into be2289a - view on LGTM.com fixed alerts:
|
This pull request fixes 2 alerts when merging 4fb5fbc into be2289a - view on LGTM.com fixed alerts:
|
This pull request fixes 2 alerts when merging a6a3632 into be2289a - view on LGTM.com fixed alerts:
|
…ttps://github.com/microsoft/binskim into users/ednakamu/application-insights-compiler-data
This pull request fixes 2 alerts when merging 843eeed into be2289a - view on LGTM.com fixed alerts:
|
This pull request fixes 2 alerts when merging 2ddf392 into be2289a - view on LGTM.com fixed alerts:
|
This pull request fixes 2 alerts when merging 0c7b53b into be2289a - view on LGTM.com fixed alerts:
|
This pull request fixes 2 alerts when merging ed8cb64 into be2289a - view on LGTM.com fixed alerts:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No description provided.