taralizer

package
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Copyright 2021 taralizer authors

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Package taralizer Threat and Risk Analyzer Copyright 2021 taralizer authors

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Package taralizer Threat and Risk Analyzer Copyright 2021 taralizer authors

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Package taralizer Threat and Risk Analyzer Copyright 2021 taralizer authors

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const PDF_REPORT_COVER_HTML = "pdf_report_cover.html"
View Source
const PDF_REPORT_HTML = "pdf_report.html"
View Source
const REPORT_FMT_STRING = "%s(%d)"
View Source
const RULE_REGO = "rego rule"
View Source
const RULSET_YAML = "ruleset.yaml"

Variables

This section is empty.

Functions

func GetMapIntValue

func GetMapIntValue(data map[string]interface{}, key string, location string) int64

func GetMapStringValue added in v0.1.7

func GetMapStringValue(data map[string]interface{}, key string, location string) string

Types

type Author

type Author struct {
	Name    string `yaml:"name"`
	Webpage string `yaml:"webpage"`
}
type CommunicationLink struct {
	Target             string   `yaml:"target"`
	Description        string   `yaml:"description,omitempty"`
	Protocol           string   `yaml:"protocol,omitempty"`
	Authenication      string   `yaml:"authenication,omitempty"`
	Authorization      string   `yaml:"authorization,omitempty"`
	DataAssetsSent     []string `yaml:"data_assets_sent,omitempty"`
	DataAssetsReceived []string `yaml:"data_assets_received,omitempty"`
}

type DataAsset

type DataAsset struct {
	Id              string `yaml:"id"`
	Name            string `yaml:"name"`
	Description     string `yaml:"description,omitempty"`
	Confidentiality string `yaml:"confidentiality,omitempty"`
	Integrity       string `yaml:"integrity,omitempty"`
	Availability    string `yaml:"availability,omitempty"`
}

type Measure added in v0.1.7

type Measure struct {
	Id                 string `yaml:"id"`
	Action             string `yaml:"action"`
	Justification      string `yaml:"justification"`
	Ticket             string `yaml:"ticket"`
	CheckedBy          string `yaml:"checked_by"`
	ResidualImpact     int64  `yaml:"residual_impact"`
	ResidualLikelihood int64  `yaml:"residual_likelihood"`
	ResidualSeverity   int64  `yaml:"residual_severity"`
	Status             string `yaml:"status"`
}

type ProfileSet added in v0.1.7

type ProfileSet struct {
	Name              string       `yaml:"name"`
	Description       string       `yaml:"description,omitempty"`
	TerraformProvider string       `yaml:"terraform_provider,omitempty"`
	Technologies      []Technology `yaml:"technologies,omitempty"`
}

ProfileSet represents a mapping profile to cloud technologies

func LoadProfileSet added in v0.1.7

func LoadProfileSet(fileName string) ProfileSet

LoadProfileSet opens a profile file and loads it into the ProfileSet model Please, node that the Risks property is empty.

type Report

type Report struct {
	ThreatAgents    []ThreatAgent    `yaml:"threat_agents,omitempty"`
	DataAssets      []DataAsset      `yaml:"data_assets,omitempty"`
	TechnicalAssets []TechnicalAsset `yaml:"technical_assets,omitempty"`
	TrustBoundaries []TrustBoundary  `yaml:"trust_boundaries,omitempty"`
	Risks           []Risk           `yaml:"risks,omitempty"`
	RiskTracking    []Measure        `yaml:"risk_tracking,omitempty"`
	Title           string           `yaml:"title,omitempty"`
	Version         string           `yaml:"version,omitempty"`
	Customer        string           `yaml:"customer,omitempty"`
	Date            string           `yaml:"date,omitempty"`
	Author          Author           `yaml:"author,omitempty"`
	RuleSet         RuleSet          `yaml:"ruleset,omitempty"`
}

Evaluation Report

func Load

func Load(fileName string) Report

Load opens the model file and loads it into the Report model Please, node that the Risks property is empty.

type ReportEngine

type ReportEngine struct {
	// contains filtered or unexported fields
}

Taralzer struct

func NewReportEngine

func NewReportEngine() ReportEngine

creates a new reporting engine

func (*ReportEngine) GenerateReport

func (svc *ReportEngine) GenerateReport(wr io.Writer, tplFile string, report Report)

GenerateReport uses the golang template file 'tplFile' to generate a text report. Several templates have been defined and stored in the 'templates'directory'

func (*ReportEngine) GenerateReportFile

func (svc *ReportEngine) GenerateReportFile(filename string, tplFile string, report Report)

GenerateReportFile creates a report to the file 'filename' on the local file system

func (*ReportEngine) GenerateReportFilePDF

func (svc *ReportEngine) GenerateReportFilePDF(filename string, tplFileReport string, tplFileCover string, report Report)

GenerateReportFilePDF creates a report to the file 'filename' on the local file system It uses the 'wkhtmltopdf' command line tool that should be available in the path

func (*ReportEngine) GetTemplateDir

func (svc *ReportEngine) GetTemplateDir() string

GetTemplateDir returns the directory of the template files

type Risk

type Risk struct {
	Id                 string `yaml:"id"`
	Cwe                int64  `yaml:"cwe"`
	Title              string `yaml:"title"`
	Description        string `yaml:"description"`
	Message            string `yaml:"message"`
	Url                string `yaml:"url"`
	Impact             int64  `yaml:"impact"`
	Likelihood         int64  `yaml:"likelihood"`
	Severity           int64  `yaml:"severity"`
	Action             string `yaml:"action"`
	Mitigation         string `yaml:"mitigation"`
	ResidualImpact     int64  `yaml:"residual_impact"`
	ResidualLikelihood int64  `yaml:"residual_likelihood"`
	ResidualSeverity   int64  `yaml:"residual_severity"`
	Status             string `yaml:"status"`
}

Defines a risk identifed in model

type Rule

type Rule struct {
	Id          string `yaml:"id"`
	Cwe         int64  `yaml:"cwe"`
	Title       string `yaml:"title"`
	Description string `yaml:"description"`
	Mitigation  string `yaml:"mitigation"`
	Url         string `yaml:"url"`
	Impact      int64  `yaml:"impact"`
	Likelihood  int64  `yaml:"likelihood"`
	Severity    int64  `yaml:"severity"`
}

rules

type RuleSet

type RuleSet struct {
	Name        string `yaml:"name"`
	Title       string `yaml:"title"`
	Description string `yaml:"description,omitempty"`
	Version     string `yaml:"version,omitempty"`
	Url         string `yaml:"url,omitempty"`
	Rules       []Rule `yaml:"rules,omitempty"`
}

RulSet repesents a ruleset

type StringWriter

type StringWriter struct {
	// contains filtered or unexported fields
}

func NewStringWriter

func NewStringWriter(buf *string) StringWriter

func (StringWriter) String

func (sw StringWriter) String() string

func (StringWriter) Write

func (sw StringWriter) Write(p []byte) (n int, err error)

type Taralizer

type Taralizer struct {
	// contains filtered or unexported fields
}

Taralzer struct

func NewTaralizer

func NewTaralizer(ruleset string) *Taralizer

New creates a new instance of the Taralizer engine.

func (*Taralizer) Evaluate

func (svc *Taralizer) Evaluate(fileName string) Report

Evaluate executes an Open Policy Agent (OPA) query against the rule sets and stores the resulting risks into the returned report.

func (*Taralizer) RuleSet

func (svc *Taralizer) RuleSet(rs string) RuleSet

RulesSet returns the rules of the given rulset

func (*Taralizer) Validate

func (svc *Taralizer) Validate(fileName string) []string

Validate executes an Open Policy Agent (OPA) query against the rule sets to perform a model validation/checking for inconsistencies.

type TechnicalAsset

type TechnicalAsset struct {
	Id                  string              `yaml:"id"`
	Name                string              `yaml:"name"`
	Description         string              `yaml:"description,omitempty"`
	Confidentiality     string              `yaml:"confidentiality,omitempty"`
	Integrity           string              `yaml:"integrity,omitempty"`
	Availability        string              `yaml:"availability,omitempty"`
	Technology          string              `yaml:"technology,omitempty"`
	Puml                string              `yaml:"puml,omitempty"`
	UsedAsClientByHuman bool                `yaml:"used_as_client_by_human,omitempty"`
	OutOfScope          bool                `yaml:"out_of_scope,omitempty"`
	Internet            bool                `yaml:"internet,omitempty"`
	DataAssetsStored    []string            `yaml:"data_assets_stored,omitempty"`
	DataAssetsProcessed []string            `yaml:"data_assets_processed,omitempty"`
	CommunicationLinks  []CommunicationLink `yaml:"communication_links,omitempty"`
}

type Technology added in v0.1.7

type Technology struct {
	Id        string `yaml:"id"`
	Name      string `yaml:"name"`
	Type      string `yaml:"type"`
	Terraform string `yaml:"terraform"`
}

Technology represents a mapping to cloud technology

type ThreatAgent

type ThreatAgent struct {
	Id          string `yaml:"id"`
	Name        string `yaml:"name"`
	Description string `yaml:"description"`
}

type TrustBoundary

type TrustBoundary struct {
	Id                    string   `yaml:"id"`
	Name                  string   `yaml:"name"`
	Description           string   `yaml:"description,omitempty"`
	Technology            string   `yaml:"technology,omitempty"`
	Puml                  string   `yaml:"puml,omitempty"`
	TrustBoundariesNested []string `yaml:"trust_boundaries_nested,omitempty"`
	TechnicalAssetsInside []string `yaml:"technical_assets_inside,omitempty"`
	ThreatAgentsInside    []string `yaml:"threat_agents_inside,omitempty"`
}

Jump to

Keyboard shortcuts

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