Closed samarth-aws closed 12 months ago
Good catch! However I don't think this is the solution: for function calls, we need to track the return value of the function call. This solution changes how the sources are identified to match function values. I would prefer a solution were function calls are accurately resolved so that matching sources doesn't miss calls to source functions because they have a different name when they're called.
Agreed, that would be the better approach. For example, this PR doesn't handle the case when a source function is not an argument:
func example3() {
handler := sink
str := "hello"
s := func() func() string {
str += " world"
return source
}
process(s(), handler)
process(func() string { return "ok" }, handler)
handler(str)
}
I think we need to bump go versions to 1.20.12 and 1.21.5
Description of changes:
This PR fixes a soundness issue where a source function supplied as an actual parameter did not get tracked as an analysis entrypoint.
Before the fix:
Notice that there are only 4 entrypoints: the source function in
example2
was undetected leading to a soundness issue.After the fix:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.