grok

package module
v0.0.0-...-975e9b0 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2021 License: MIT Imports: 6 Imported by: 0

README

GROK

A partial implementation of Microsoft paper Bootstrapping Privacy Compliance in Big Data Systems, including:

  • lattice
    • definition
    • operations: meet, join
  • policy
    • definition, and parse
    • comply by reference rules
  • ...

Documentation

Index

Constants

View Source
const (
	Top    = "TOP"    // the least upper bound (supremum) of a lattice
	Bottom = "BOTTOM" // the greatest lower bound (infimum) of a lattice
)
View Source
const (
	ALLOW  = true
	DENY   = false
	Allow  = "ALLOW"
	Deny   = "DENY"
	Except = "EXCEPT"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Annotation

type Annotation Clause

Annotation is an alias of Clause, which is used as metadata of a program block

func (Annotation) ValuesOf

func (an Annotation) ValuesOf(attr string) []string

ValuesOf

type Clause

type Clause []pair

Clause is a slice of pairs. There may be duplicate attributes in a policy clause, e.g. DataType IPAddress DataType AccountID

func (Clause) ValuesOf

func (c Clause) ValuesOf(attr string) []string

ValuesOf returns the attribute values of a Clause when its attribute name is attr

type Edge

type Edge struct {
	From, To string
}

type Lattice

type Lattice struct {
	Name string
	// Edges are the edge collections in lattice structure
	Edges []Edge
	// contains filtered or unexported fields
}

func NewLattice

func NewLattice(str string) *Lattice

NewLattice returns a Lattice instance that is parsed from a string

func NewLattices

func NewLattices(str string) []*Lattice

NewLattices returns a slice of Lattice instances that are parsed from a string

func (*Lattice) Allow

func (l *Lattice) Allow(pattrs, aattrs []string) bool

Allow returns true when annotation attributes are allowed by policy clause T[c].

func (*Lattice) Deny

func (l *Lattice) Deny(pattrs, aattrs []string) bool

Deny returns true when annotation attributes are denied by policy clause T[c] (⊥ ∉ Tₓ from paper)

func (*Lattice) Join

func (l *Lattice) Join(a, b string) string

Join returns the least upper bound (supremum, a ∨ b) of two elements a and b

func (*Lattice) Meet

func (l *Lattice) Meet(a, b string) string

Meet returns greated lower bound (infimum, a ^ b) of two elements a and b

func (*Lattice) Precede

func (l *Lattice) Precede(a, b string) bool

Precede returns the a boolean comparing two elements in partial order which is defined in Lattice. The result will be true if a precede b, false for otherwise

func (*Lattice) Product

func (l *Lattice) Product(la *Lattice)

Product sets its state lattice for current lattice. And the lattice still keeps its behaviour as a single lattice

type Policy

type Policy struct {
	Mode bool
	Clause
	Excepts []Policy
	// contains filtered or unexported fields
}

Policy is composed of its mode, clause, and exceptions. It is based on some lattices.

func NewPolicy

func NewPolicy(ls []*Lattice) *Policy

NewPolicy creates a Policy instance based on some lattices.

func (*Policy) ApplyOn

func (p *Policy) ApplyOn(an Annotation) bool

ApplyOn decides whether a policy can apply on an annotation true means annotation is allowed by the policy false means annotation is denied by the policy Note: refer to inferences rules in page 7

func (*Policy) LatticeName

func (p *Policy) LatticeName(s string) (string, error)

LatticeName returns a valid lattice name, or returns error

func (*Policy) LatticeValue

func (p *Policy) LatticeValue(s string, name string) (string, error)

LatticeValue returns a valid lattice value from its a dependant lattice, or returns error

func (*Policy) ParseAnnotation

func (p *Policy) ParseAnnotation(str string) (Annotation, error)

ParseAnnotation returns an Annotation instance after parsing a string

func (*Policy) ParseClause

func (p *Policy) ParseClause(str string) (Clause, error)

ParseClause returns a Clause instance after parsing a string

func (*Policy) ParsePolicy

func (p *Policy) ParsePolicy(pstr string) error

ParsePolicy parses a policy string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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