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

Add tests for cross-function analysis #59

Merged
merged 2 commits into from
Aug 28, 2020

Conversation

mlevesquedion
Copy link
Contributor

@mlevesquedion mlevesquedion commented Aug 24, 2020

(This PR is intended as a precursor to #57 to reduce the diff.)

This PR adds tests for cross-function analysis. It covers the basic functionality of determining what a function does with its arguments, i.e. 1. do they reach a sink, 2. what return values do they reach. It also covers cycles in the call graph, as well as calls to functions from imported packages.

A want comment such as this:

SinkWrapper:"genericFunc{ sinks: <0>, taints: <<> <0>> }"

Means that we expect a Fact to be attached to the SinkWrapper function. The Fact says that this is a generic function whose first (0th) argument reaches a sink and does not reach any of its return values, while its second argument does not reach a sink, but it does reach the function's first (0th) return value.

The following are not covered:

  • Methods
  • Tainting of colocated arguments, e.g. fmt.Fprintf(w, Source{})

(I think for a first stab at cross-function analysis, handling those is out of scope.)

  • Tests pass
  • Appropriate changes to README are included in PR

@mlevesquedion mlevesquedion merged commit 1c5aa34 into google:master Aug 28, 2020
@mlevesquedion mlevesquedion deleted the cfa-tests branch August 28, 2020 17:19
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