compliance

package module
v0.0.0-...-0cc748a Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: MIT Imports: 10 Imported by: 0

README

Nimbusec Compliance API SDK

(BETA) Go SDK for the Nimbusec Compliance Monitoring API v1

Documentation

The link to the documentation can found at Open API Nimbusec. The format of the documentation is OpenAPI using the version 3.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultEndpoint = Endpoint{
	AuthURL:   "https://auth.nimbusec.com/oauth2/token",
	ServerURL: "https://compliance.nimbusec.com",
}

Functions

This section is empty.

Types

type ASN

type ASN int64

func (ASN) String

func (a ASN) String() string

type Asset

type Asset struct {
	ID        string    `json:"id"`
	IDfy      string    `json:"idfy"`
	Origin    string    `json:"origin"`
	CBundleID *string   `json:"cBundleID"`
	CreatedAt time.Time `json:"createdAt"`
	ContactID *string   `json:"contactID"`
}

type AssetComment

type AssetComment struct {
	ID        string     `json:"id"`
	Value     string     `json:"value"`
	CreatedBy string     `json:"createdBy"`
	CreatedAt time.Time  `json:"createdAt"`
	ChangedAt *time.Time `json:"changedAt"`
	AssetID   *string    `json:"assetID"`
}

type AssetCommentService

type AssetCommentService service

func (AssetCommentService) Create

func (srv AssetCommentService) Create(assetID string, create []AssetComment) ([]AssetComment, error)

func (AssetCommentService) Delete

func (srv AssetCommentService) Delete(assetID, commentID string) error

func (AssetCommentService) List

func (srv AssetCommentService) List(assetID string) ([]AssetComment, error)

type AssetDisabledService

type AssetDisabledService service

func (AssetDisabledService) Enable

func (srv AssetDisabledService) Enable(assetID string) (DisabledAsset, error)

func (AssetDisabledService) List

type AssetExternal

type AssetExternal struct {
	ID       string  `json:"id"`
	AssetID  string  `json:"assetID"`
	External string  `json:"external"`
	Comment  *string `json:"comment"`
}

type AssetExternalService

type AssetExternalService service

func (AssetExternalService) Create

func (srv AssetExternalService) Create(assetID string, create []AssetExternal) ([]AssetExternal, error)

func (AssetExternalService) Delete

func (srv AssetExternalService) Delete(assetID, externalID string) error

func (AssetExternalService) List

func (srv AssetExternalService) List(assetID string) ([]AssetExternal, error)

type AssetFilter

type AssetFilter struct {
	OnlySecurity   bool `json:"onlySecurity"`   // only security assets
	OnlyCompliance bool `json:"onlyCompliance"` // only compliance assets

	Name      []string `json:"name"` // idfy
	Origin    []string `json:"origin"`
	CreatedAt []string `json:"createdAt"`
	Contact   []string `json:"contact"` // contact mail
}

type AssetInfo

type AssetInfo struct {
	AssetID   string        `json:"assetID"`
	Type      AssetInfoType `json:"type"`
	Details   interface{}   `json:"details"`
	ChangedAt time.Time     `json:"changedAt"`
}

type AssetInfoASN

type AssetInfoASN struct {
	IPASs      []IPAS   `json:"ipASs"`
	Nameserver []string `json:"nameserver"`
	IsEU       *bool    `json:"isEU,omitempty"`
}

type AssetInfoApplication

type AssetInfoApplication struct {
	Name       string `json:"name"`
	Version    string `json:"version,omitempty"`
	Path       string `json:"path,omitempty"`
	Category   string `json:"category"`
	Source     string `json:"source"`
	Latest     bool   `json:"latest"`
	Vulnerable bool   `json:"vulnerable"`
	Consented  bool   `json:"consented"`
}

type AssetInfoApplications

type AssetInfoApplications []AssetInfoApplication

type AssetInfoDiscovery

type AssetInfoDiscovery struct {
	Sources   []DiscoveryInput `json:"sources"`
	Redirects []Redirect       `json:"redirects"`
}
type AssetInfoLinks struct {
	External       int      `json:"external"`
	Internal       int      `json:"internal"`
	BrokenExternal int      `json:"brokenExternal"`
	BrokenInternal int      `json:"brokenInternal"`
	Links          []string `json:"links"`
}

type AssetInfoType

type AssetInfoType string
const (
	AssetInfoTypeASN         AssetInfoType = "asn"
	AssetInfoTypeValidation  AssetInfoType = "validation"
	AssetInfoTypeDiscovery   AssetInfoType = "discovery"
	AssetInfoTypeApplication AssetInfoType = "application"
	AssetInfoTypeLinks       AssetInfoType = "links"
)

type AssetInfoValidation

type AssetInfoValidation struct {
	Redirects      []Redirect `json:"redirects"`
	HasBadRedirect bool       `json:"hasBadRedirect"`
	Scheme         string     `json:"scheme"`
	StatusCode     int        `json:"statusCode"`
	HasHTTP        bool       `json:"hasHTTP"`
	HasHTTPS       bool       `json:"hasHTTPS"`
	HostsDifferent bool       `json:"hostsDifferent"`
	ContentEqual   bool       `json:"contentEqual"`
	HTTPDowngrade  bool       `json:"httpDowngrade"`
}

type AssetPatch

type AssetPatch struct {
	IDfy      string  `json:"idfy"`
	CBundleID *string `json:"cBundleID"`
	Origin    string  `json:"origin"`
	ContactID *string `json:"contactID"`
}

type AssetPost

type AssetPost struct {
	AssetPatch
	ExternalID *string `json:"externalID"`
}

type AssetService

type AssetService service

func (AssetService) Create

func (srv AssetService) Create(create Asset) (Asset, error)

func (AssetService) Delete

func (srv AssetService) Delete(assetID string) error

func (AssetService) Disable

func (srv AssetService) Disable(assetID string, patch *DisablePatch) error

func (AssetService) Get

func (srv AssetService) Get(assetID string) (Asset, error)

func (AssetService) GetIssues

func (srv AssetService) GetIssues(assetID string) ([]Issue, error)

func (AssetService) List

func (srv AssetService) List(filter *AssetFilter) ([]Asset, error)

func (AssetService) Patch

func (srv AssetService) Patch(assetID string, patch AssetPatch) (Asset, error)

type AssetTag

type AssetTag struct {
	AssetID   string    `json:"assetID"`
	TagID     string    `json:"tagID"`
	CreatedAt time.Time `json:"createdAt"`
}

type AssetTagService

type AssetTagService service

func (AssetTagService) Create

func (srv AssetTagService) Create(assetID string, create []Tag) ([]Tag, error)
func (srv AssetTagService) Link(assetID, tagID string) error

func (AssetTagService) List

func (srv AssetTagService) List(assetID string) ([]AssetTag, error)
func (srv AssetTagService) Unlink(assetID, tagID string) error

type Bundle

type Bundle struct {
	ID                     string `json:"id"`
	Name                   string `json:"name"`
	ComplianceScanInterval int    `json:"scanInterval"`
	Disabled               bool   `json:"disabled"`
}

type BundleService

type BundleService service

func (BundleService) Get

func (srv BundleService) Get(bundleID string) (Bundle, error)

func (BundleService) List

func (srv BundleService) List() ([]Bundle, error)

type Client

type Client struct {
	Tags           *TagService
	Bundles        *BundleService
	Contacts       *ContactService
	Issues         *IssueService
	IssueExternals *IssueExternalService
	Metadata       *MetadataService
	Assets         *AssetService
	DisabledAssets *AssetDisabledService
	AssetTags      *AssetTagService
	AssetExternals *AssetExternalService
	AssetComments  *AssetCommentService
	// contains filtered or unexported fields
}

func NewClient

func NewClient(config ClientConfig) *Client

func (*Client) Do

func (client *Client) Do(method, path string, in, out interface{}) error

func (*Client) Ping

func (client *Client) Ping() error

type ClientConfig

type ClientConfig struct {
	ClientID     string
	ClientSecret string
	Endpoint     Endpoint
	Dry          bool
}

type Contact

type Contact struct {
	ID    string `json:"id"`
	Email string `json:"email"`
}

type ContactService

type ContactService service

func (ContactService) Create

func (srv ContactService) Create(create Contact) (Contact, error)

func (ContactService) Delete

func (srv ContactService) Delete(contactID string) error

func (ContactService) Get

func (srv ContactService) Get(contactID string) (Contact, error)

func (ContactService) List

func (srv ContactService) List() ([]Contact, error)

func (ContactService) Update

func (srv ContactService) Update(contactID string, update Contact) (Contact, error)

type ContentPolicyDetails

type ContentPolicyDetails struct {
	URL  string `json:"url"`
	Rule string `json:"rule"`
}

type CookieDetails

type CookieDetails struct {
	Name              string     `json:"name"`
	URLValues         []URLValue `json:"urlValues"` // URLValues[value]{url,url...}
	Domain            string     `json:"domain"`
	HTTPOnly          bool       `json:"httpOnly"`
	Lifetime          int64      `json:"lifetime"`
	SameSite          string     `json:"sameSite"`
	Secure            bool       `json:"secure"`
	ThirdParty        bool       `json:"thirdParty"`
	InGlobalWhitelist bool       `json:"inGlobalWhitelist"`
	InCustomWhitelist bool       `json:"inCustomWhitelist"`
	InServerResponse  bool       `json:"inServerResponse"`
	Consented         bool       `json:"consented"`
}

type CookiePolicyDetails

type CookiePolicyDetails struct {
	CookieDetails
}

type DanglingDNSDetails

type DanglingDNSDetails struct {
	Ports        string `json:"ports"`
	CloudService string `json:"cloudService"`
}

type DisablePatch

type DisablePatch struct {
	Reason string `json:"reason"`
}

type DisabledAsset

type DisabledAsset struct {
	ID             string    `json:"id"`
	IDfy           string    `json:"idfy"`
	Origin         string    `json:"origin"`
	CreatedAt      time.Time `json:"createdAt"`
	DisabledAt     time.Time `json:"disabledAt"`
	DisabledReason *string   `json:"disabledReason"`
}

type DisabledAssetFilter

type DisabledAssetFilter struct {
	Name           []string `json:"name,omitempty"` // idfy
	Origin         []string `json:"origin,omitempty"`
	CreatedAt      []string `json:"createdAt,omitempty"`
	DisabledAt     []string `json:"disabledAt,omitempty"`
	DisabledReason []string `json:"disabledReason,omitempty"`
}

type DiscoveryInput

type DiscoveryInput struct {
	Name  string `json:"name"`
	Src   string `json:"src"`
	Value string `json:"value"`
}

type Endpoint

type Endpoint struct {
	AuthURL   string
	ServerURL string
}

type Error

type Error struct {
	Message    string            `json:"message"`
	Validation map[string]string `json:"validation,omitempty"`
}

func (Error) Error

func (e Error) Error() string

type FormDetails

type FormDetails struct {
	URLs             []string       `json:"urls"`
	Name             string         `json:"name"`
	FormID           string         `json:"formID,omitempty"`
	Action           string         `json:"action"`
	Method           string         `json:"method"`
	InputFields      []InputDetails `json:"inputDetails"`
	HTTPTransmit     bool           `json:"httpTransmit"`
	ExternalTransmit bool           `json:"externalTransmit"`
	// if it contains input fields that violates either art 9 or 10 once
	Art9  bool `json:"art9"`
	Art10 bool `json:"art10"`
}

type IPAS

type IPAS struct {
	IP           string `json:"ip"`
	CIDR         string `json:"cidr"`
	ASN          ASN    `json:"asn"`
	Organization string `json:"organization"`
	CountryCode  string `json:"countryCode"`
	Country      string `json:"country"`
	IsEU         bool   `json:"isEU"`
}

type Initiator

type Initiator struct {
	InitType string `json:"type"`
	URL      string `json:"url"`
	Line     string `json:"line"`
	Column   string `json:"column"`
}

Initiator holds all information about the initiator of an request/malware issue

type InputDetails

type InputDetails struct {
	InputName         string `json:"inputName"`
	InputType         string `json:"inputType"`
	InputID           string `json:"inputID,omitempty"`
	InputAutocomplete string `json:"inputAutocomplete"`
	InputPlaceholder  string `json:"inputPlaceholder"`
	Category          string `json:"category"`
	Art9              bool   `json:"art9"`
	Art10             bool   `json:"art10"`
}

type Issue

type Issue struct {
	ID              string      `json:"id"`
	AssetID         string      `json:"assetID"`
	Type            IssueType   `json:"type"`
	Severity        Severity    `json:"severity"`
	Status          IssueStatus `json:"status"`
	StatusChangedAt time.Time   `json:"statusChangedAt"`
	CreatedAt       time.Time   `json:"createdAt"`
	LastSeenAt      time.Time   `json:"lastSeenAt"`
	Details         interface{} `json:"details"`
	CommentID       *string     `json:"commentID"`
}

type IssueExternal

type IssueExternal struct {
	IssueID    string  `json:"issueID"`
	ExternalID string  `json:"externalID"`
	Comment    *string `json:"comment"`
}

type IssueExternalService

type IssueExternalService service

func (IssueExternalService) Create

func (srv IssueExternalService) Create(issueID string, create []IssueExternal) ([]IssueExternal, error)

func (IssueExternalService) Delete

func (srv IssueExternalService) Delete(issueID string) error

func (IssueExternalService) List

func (srv IssueExternalService) List(issueID string) ([]IssueExternal, error)

type IssueFilter

type IssueFilter struct {
	Statuses  []IssueStatus `json:"statuses"`
	Externals []string      `json:"externals"`
}

type IssuePatch

type IssuePatch struct {
	IssueID string      `json:"issueID"`
	Status  IssueStatus `json:"status"`
	Comment *string     `json:"comment"`
}

type IssueService

type IssueService service

func (IssueService) Get

func (srv IssueService) Get(issueID string) (Issue, error)

func (IssueService) List

func (srv IssueService) List(filter *IssueFilter) ([]Issue, error)

func (IssueService) Patch

func (srv IssueService) Patch(issueID string, patch IssuePatch) (Issue, error)

func (IssueService) PatchList

func (srv IssueService) PatchList(patches []IssuePatch) ([]Issue, error)

type IssueStatus

type IssueStatus int
const (
	IssueStatusPending IssueStatus = 1
	IssueStatusOK      IssueStatus = 2 // acknowledged status
	IssueStatusIgnored IssueStatus = 3
)

type IssueType

type IssueType string
const (
	IssueTypeComplianceContentPolicy IssueType = "compliance_content_policy"
	IssueTypeComplianceCookieOptIn   IssueType = "compliance_cookie_opt_in"
	IssueTypeComplianceCookiePolicy  IssueType = "compliance_cookie_policy"
	IssueTypeComplianceFormHTTP      IssueType = "compliance_form_http"
	IssueTypeComplianceFormExternal  IssueType = "compliance_form_external"
	IssueTypeComplianceFormSensitive IssueType = "compliance_form_sensitive"
	IssueTypeComplianceStatusCode    IssueType = "compliance_status_code"
	IssueTypeComplianceTrackerOptIn  IssueType = "compliance_tracker_opt_in"
	IssueTypeComplianceTrackerPolicy IssueType = "compliance_tracker_policy"
	IssueTypeDanglingDNS             IssueType = "dangling-dns"
)

type Metadata

type Metadata struct {
	AssetID string                      `json:"assetID"`
	Infos   map[AssetInfoType]AssetInfo `json:"infos"`
}

type MetadataFilter

type MetadataFilter struct {
	Types []string `url:"type,omitempty"`
}

type MetadataService

type MetadataService service

func (MetadataService) Get

func (srv MetadataService) Get(assetID string) (Metadata, error)

func (MetadataService) List

func (srv MetadataService) List(filter *MetadataFilter) ([]Metadata, error)

type Redirect

type Redirect struct {
	URL        string `json:"url"`
	Address    string `json:"address"`
	StatusCode int    `json:"statusCode"`
}

type Severity

type Severity int

type StatusCodeDetails

type StatusCodeDetails struct {
	URL          string `json:"url"`
	StatusCode   int    `json:"statusCode"`
	ExpectedCode int    `json:"expected"`
}

type Tag

type Tag struct {
	ID          string  `json:"id"`
	Name        string  `json:"name"`
	Description *string `json:"description"`
	Type        TagType `json:"type"`
}

type TagService

type TagService service

func (TagService) Create

func (srv TagService) Create(create Tag) (Tag, error)

func (TagService) Delete

func (srv TagService) Delete(tagID string) error

func (TagService) Get

func (srv TagService) Get(tagID string) (Tag, error)

func (TagService) List

func (srv TagService) List() ([]Tag, error)

func (TagService) Update

func (srv TagService) Update(tagID string, update Tag) (Tag, error)

type TagType

type TagType string

type TrackerCategory

type TrackerCategory string

type TrackerDetails

type TrackerDetails struct {
	Name       string          `json:"name"`
	Category   TrackerCategory `json:"category"`
	Hostname   string          `json:"hostname"`
	Initiators [][]Initiator   `json:"initiators"`
	Visited    bool            `json:"visited"`
	Consented  bool            `json:"consented"`
}

type TrackerPolicyDetails

type TrackerPolicyDetails struct {
	TrackerDetails
	Rule string `json:"rule"`
}

type URLValue

type URLValue struct {
	URL   string `json:"url"`
	Value string `json:"value"`
}

Jump to

Keyboard shortcuts

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