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

False positive: Cyclic import in Python #13866

Open
abadger opened this issue Aug 2, 2023 · 1 comment
Open

False positive: Cyclic import in Python #13866

abadger opened this issue Aug 2, 2023 · 1 comment

Comments

@abadger
Copy link

abadger commented Aug 2, 2023

Description of the false positive

CodeQL falsely detects a cyclic import in a Pull request.

  • There is an existing cyclic import in the code which is mitigated with an import inside of a function.

    toolopts imports global variables from systeminfo inside of _register_options()
    systeminfo imports toolopts

  • The pull request includes switching the python modules that the identifiers are being defined in and reversing the imports so that only one module has to import the other

    toolopts now implements the global variables
    toolopts no longer imports systeminfo at all
    systeminfo now imports the global variables from toolopts

Code samples or links to source code

URL to the alert on GitHub code scanning (optional)

@RasmusWL
Copy link
Member

RasmusWL commented Aug 7, 2023

Indeed, this sounds like a false positive. Thank you for reporting it!

Our current focus is on improving our security analysis. Because your report does not relate to a security query, we will put this on our backlog and prioritize it if we get enough reports of the same underlying issue in other projects. If you think that your report is related to our security analysis, please clarify that in a comment. Either way, we'll let you know here as soon as it's fixed!

I also want to point out that GitHub Code Scanning has facilities for suppressing individual alerts or disabling a query, just FYI.

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

No branches or pull requests

2 participants