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

Struct fields should be taintable #228

Open
mlevesquedion opened this issue Dec 15, 2020 · 0 comments
Open

Struct fields should be taintable #228

mlevesquedion opened this issue Dec 15, 2020 · 0 comments
Labels
bug Something isn't working

Comments

@mlevesquedion
Copy link
Contributor

mlevesquedion commented Dec 15, 2020

The following test case was introduced by #195 and is currently failing:

func TestTaintFieldOnNonSourceStruct(s core.Source, i *core.Innocuous) {
	i.Data = s.Data
	core.Sink(i)      // TODO want "a source has reached a sink"
	core.Sink(i.Data) // TODO want "a source has reached a sink"
}

This behavior is inadequate: It should be possible to taint a field on a non-Source struct, and tainting this field should taint the struct.

The following test case is also failing:

func TestTaintNonSourceFieldOnSourceType(s core.Source, i *core.Innocuous) {
	s.ID, _ = strconv.Atoi(s.Data)
	core.Sink(s.ID) // TODO want "a source has reached a sink"
}

It should be possible to taint a non-source field on a source type.


This is related to this piece of propagation code:

		if !prop.config.IsSourceField(typPath, typName, fieldName) && !prop.taggedFields.IsSourceFieldAddr(t) {
			return
		}

Currently, we stop traversing when we reach a field unless the field is a Source.

See #195 for additional discussion.

@mlevesquedion mlevesquedion changed the title Structs should be taintable via their fields Struct fields should be taintable Dec 15, 2020
@mlevesquedion mlevesquedion added the bug Something isn't working label Dec 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant