infer

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 13, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package infer defines an analyzer that identifies Sources that either 1. are defined from a Source type, or 2. have a Source type as a field

Index

Constants

This section is empty.

Variables

View Source
var Analyzer = &analysis.Analyzer{
	Name: "sourceinfer",
	Doc: `This analyzer infers named source types from typedefs and fields.

Suppose Foo has been configured to be a source type.

Then, the following type definition would cause Bar to be identified
as a source, because its underlying type is Foo:
type Bar Foo
Indeed, if Foo contains sensitive data, then so does Bar, because they have
the same fields.

Similarly, the following type definition would cause Baz to be identified
as a source, because it holds a field of type Foo:
type Baz struct {
  f Foo
}
Indeed, if Foo contains sensitive data, and Bar contains Foo, Bar also
contains that data, via Foo.

Types identified as sources during analysis are used to evaluate
the sourceyness of types that depend on them. For example, in the
below type definitions, both Qux and Quux will be identified as sources:
type Qux Foo
type Quux Qux
`,
	Run: run,
	Requires: []*analysis.Analyzer{
		fieldtags.Analyzer,
		inspect.Analyzer,
	},
	ResultType: reflect.TypeOf(new(ResultType)).Elem(),
	FactTypes:  []analysis.Fact{new(inferredSourceFact)},
}

Functions

This section is empty.

Types

type ResultType

type ResultType map[types.Object]bool

ResultType is a set of types.Object that are inferred Sources.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL