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

Honor the Lua tracer FF for database trace-command invocations for scanned languages. #1120

Merged
merged 3 commits into from Jun 28, 2022

Conversation

criemen
Copy link
Contributor

@criemen criemen commented Jun 24, 2022

In theory, a scanned language will not setup the build tracer, and so
shouldn't care about lua versus legacy tracing. However, go is a
special case where the autobuilder runs under the build tracer, that
then gets disabled immediately again, unless a special environment
variable is used.
Therefore, we need to thread through the feature flag to this
database trace-command invocation. For other scanned languages,
this should be a no-op, as no tracing is ever set up.

I couldn't find any tests for the existing functionality, so I couldn't extend them either. If anybody has some great ideas for how to test this change, I'm happy to write some tests for this, too.

Merge / deployment checklist

  • Confirm this change is backwards compatible with existing workflows.
  • Confirm the readme has been updated if necessary.
  • Confirm the changelog has been updated if necessary.

@criemen criemen requested a review from a team as a code owner June 24, 2022 10:32
Copy link
Contributor

@aeisenberg aeisenberg left a comment

Choose a reason for hiding this comment

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

Looks sensible. Though I think it shouldn't be too hard to create a unit test.

src/analyze.ts Outdated Show resolved Hide resolved
@aeisenberg
Copy link
Contributor

aeisenberg commented Jun 24, 2022

Another thing that I'm seeing is that these Test Python Package Installation tests are flaky. We should probably automatically retry them if they fail. (Unrelated to this PR.)

#1122

@aeisenberg
Copy link
Contributor

Oh...looks like this test is no longer flaky...it's just failing.

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Looks good. All tests passed.

…scanned languages.

In theory, a scanned language will not setup the build tracer, and so
shouldn't care about lua versus legacy tracing. However, `go` is a
special case where the autobuilder runs under the build tracer, that
then gets disabled immediately again, unless a special environment
variable is used.
Therefore, we need to thread through the feature flag to this
`database trace-command` invocation. For other scanned languages,
this should be a no-op, as no tracing is ever set up.
export async function getCodeQLForTesting(): Promise<CodeQL> {
return getCodeQLForCmd("codeql-for-testing", false);
export async function getCodeQLForTesting(
cmd = "codeql-for-testing"

Check failure

Code scanning / CodeQL

Exec call vulnerable to binary planting

This exec call might be vulnerable to Windows binary planting vulnerabilities. This exec call might be vulnerable to Windows binary planting vulnerabilities. This exec call might be vulnerable to Windows binary planting vulnerabilities.
injectedMlQueries: false,
};

test("createdDBForScannedLanguages() Lua feature flag enabled, but old CLI", async (t) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

There are 4 tests here that are almost the same, but with different parameters. Can you merge them? The easiest thing to do is something like this:

[{ name: "Lua feature flag enabled, but old CLI", version: "2.9.0", ... }, ...].forEach(options => {
  test(`createdDBForScannedLanguages() ${options.name}`, async (t) => {
    ...
    sinon.stub(codeqlObject, "getVersion").resolves(options.version);
    ...
  });
});

This will help emphasize the actual differences between the tests.

Copy link
Contributor

@aeisenberg aeisenberg left a comment

Choose a reason for hiding this comment

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

My suggestion is quite minor. Feel free to merge this now to get it into the 2.10.0 release and then tweak it later.

@criemen criemen merged commit b40cd03 into main Jun 28, 2022
@criemen criemen deleted the criemen/lua-tracer-ff-2 branch June 28, 2022 09:19
@criemen
Copy link
Contributor Author

criemen commented Jun 28, 2022

I'll do so, thanks!

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

Successfully merging this pull request may close these issues.

None yet

2 participants