Skip to content

C++: Model secure_getenv and _wgetenv as local flow sources #11591

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

Merged
merged 3 commits into from
Dec 8, 2022

Conversation

jketema
Copy link
Contributor

@jketema jketema commented Dec 7, 2022

These are modelled as part of isUserInput, but not as LocalFlowSourceFunctions.

Does this need tests? If so, where to add them? I could not find an obvious location for them.

@jketema jketema requested a review from a team as a code owner December 7, 2022 12:40
@github-actions github-actions bot added the C++ label Dec 7, 2022
@MathiasVP
Copy link
Contributor

Does this need tests? If so, where to add them? I could not find an obvious location for them.

Good question. I think the answer is that we should have a way to test these. AFAIK, the cloest test we have is https://github.com/github/codeql/blob/main/cpp/ql/test/library-tests/dataflow/DefaultTaintTracking/annotate_sinks_only/remote-flow-sink.ql. I think we can take inspiration (and also slightly improve the current state) by:

  • Moving this file out of DefaultTaintTracking. This test isn't actually related to DefaultTaintTracking, but just placed there because it allowed us to reuse the existing source files, I guess?
  • Maybe split up the inline expectations test into local and remote versions
  • Add a similar inline expectation test file that tests sources in addition to sinks. After all, the sources is really the one we care about the most.

Copy link
Contributor

@MathiasVP MathiasVP left a comment

Choose a reason for hiding this comment

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

LGTM!

@jketema jketema merged commit a6bc9fd into github:main Dec 8, 2022
@jketema jketema deleted the getenv branch December 8, 2022 09:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants