-
Notifications
You must be signed in to change notification settings - Fork 17
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
Fix: Only traverse to reference args #185
Fix: Only traverse to reference args #185
Conversation
0cb7942
to
3a67a23
Compare
49b7f71
to
7ad0085
Compare
@@ -53,7 +53,9 @@ func TestMapRemainsTaintedWhenSourceIsDeleted(s core.Source) { | |||
core.Sink(m) // want "a source has reached a sink" | |||
} | |||
|
|||
func TestDeletingFromTaintedMapDoesNotTaintTheKey(key string, sources map[string]core.Source) { | |||
func TestDeletingFromTaintedMapDoesNotTaintKey(key *string, sources map[*string]core.Source) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The modifications in this PR caused this test to pass spuriously. The key now needs to be some kind of pointer in order to demonstrate the incorrect behavior.
7ad0085
to
d179003
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR feels like it's doing a bit too much.
- Like
reflect
, I don't think we have or should make any promise about tracking taint across use ofunsafe
. At best, that feels out of scope for this PR. - For what is pointer-like, I think
pointer
should be authoritative. Our use case includes also non-pointer wrappers of pointer-like types, so we have two extra cases to check. That delineation could be more clear.
internal/pkg/levee/testdata/src/example.com/tests/colocation/tests.go
Outdated
Show resolved
Hide resolved
Thank you for your review!
For |
internal/pkg/levee/testdata/src/example.com/tests/colocation/tests.go
Outdated
Show resolved
Hide resolved
internal/pkg/levee/testdata/src/example.com/tests/colocation/tests.go
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Only two minor question/comment items.
This PR modifies the propagation for
Call
s so that only reference arguments (as determined bypointer.CanPoint
) are tainted. It makes no sense to taint non-reference arguments, because the called function will receive a copy of them, so the original values in the caller can't be tainted.New tests are added to verify this behavior.