google / go-flow-levee

Apache License 2.0
193 stars 20 forks source link

Infer as a source type any type that contains a source type as a field #97

Open PurelyApplied opened 4 years ago

PurelyApplied commented 4 years ago

Consider the following:


type Source struct {
  secret string // `levee:"source"`
}

type Container struct {
  ID int
  content *Source  // This field should implicitly be marked similarly as a source
}

While explicit instantiation c := Container{ID: 10, content: Source{secret: "my-token"}} should be currently detected by taint propagation to the struct's field, this context may be lost outside the instantiation of the wrapper.

mlevesquedion commented 4 years ago

I assume this includes embedding? E.g. if a struct embeds another struct, implicitly it has the embedded struct as a field.

PurelyApplied commented 4 years ago

I would say yes. The distinction in embedding is just a method-set delegation, and we're generally not concerning ourselves with the interface layer. The embedded field is still a field and should covered by this issue as well.