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

C# POC: Add binary log based extraction #16581

Closed
wants to merge 3 commits into from

Conversation

tamasvajk
Copy link
Contributor

No description provided.

@github-actions github-actions bot added the C# label May 23, 2024
Comment on lines +119 to +123
catch (Exception ex) // lgtm[cs/catch-of-all-exceptions]
{
logger.Log(Severity.Error, " Unhandled exception: {0}", ex);
return ExitCode.Errors;
}

Check notice

Code scanning / CodeQL

Generic catch clause Note

Generic catch clause.
public BinaryLogExtractor(string cwd, string[] args, string outputPath, ILogger logger, PathTransformer pathTransformer, CommonOptions options)
: base(cwd, args, outputPath, [], logger, pathTransformer)
{
Mode = ExtractorMode.BinaryLog;

Check warning

Code scanning / CodeQL

Virtual call in constructor or destructor Warning

Avoid virtual calls in a constructor or destructor.
Mode = ExtractorMode.BinaryLog;
if (options.QlTest)
{
Mode |= ExtractorMode.QlTest;

Check warning

Code scanning / CodeQL

Virtual call in constructor or destructor Warning

Avoid virtual calls in a constructor or destructor.
@@ -115,29 +185,28 @@ function RegisterExtractorPack(id)
end
end
if match then
local injections = { '-p:UseSharedCompilation=false', '-p:EmitCompilerGeneratedFiles=true' }
-- TODO: Add real temporary file name
local injections = { '-bl:codeql_' .. RandomString(15) .. '.binlog' }
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Passing -bl to dotnet run doesn't seem to do anything, but it makes the extractor fail due to the non existent binlog file.

@tamasvajk
Copy link
Contributor Author

DCA test results don't look good. We're losing a lot of alerts.

@@ -1,10 +1,28 @@
function RegisterExtractorPack(id)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Another approach would be running the database creation without any command, so running the autobuilder, but with a new extractor option specifying the binlog path. And then the autobuilder could start the extractor with the given path.

Comment on lines +13 to +20
if (builder.Options.Binlog is string binlog)
{
return BuildScript.Create(_ => Semmle.Extraction.CSharp.Driver.Main(["--binlog", binlog]));
}
else
{
return BuildScript.Create(_ => Semmle.Extraction.CSharp.Standalone.Program.Main([]));
}

Check notice

Code scanning / CodeQL

Missed ternary opportunity Note

Both branches of this 'if' statement return - consider using '?' to express intent better.
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 this pull request may close these issues.

1 participant