Documentation
¶
Overview ¶
Package ctis defines CTIS 2.0, the CTEM Interchange Schema: the JSON document format security tools and platforms use to exchange assets, findings, software components, relationships and web endpoints for continuous threat exposure management. A document carries natural keys (canonical forms) and the producer's own references, never a receiver's database keys.
The Go types in this package, the JSON Schema in schemas/v2 and the field reference in docs/spec.md describe the same format; tests keep them equal. Decode reads a document under the compatibility rule: strictly for this module's minor or an older one (a member it does not know is an error), ignoring unknown members and mapping unknown enum values to their fallback for a newer minor, and refusing another major. The Canonical* functions and AssetKey give the canonical value and key receivers deduplicate assets on.
Producing a report:
r := ctis.NewReport() // stamps SchemaVersion, SchemaURL, a UUIDv7 id and the time
r.Tool = &ctis.Tool{Name: "my-scanner"}
r.Assets = append(r.Assets, ctis.Asset{ID: "h1", Type: ctis.AssetTypeHost, Value: "web01.example.com"})
r.Findings = append(r.Findings, ctis.Finding{
Type: ctis.FindingTypeExposure, Title: "...", Severity: ctis.SeverityHigh, AssetRef: "h1",
})
if err := r.Validate(); err != nil { ... }
Converting tool output: ConvertReconToCTIS and MergeReconReports for reconnaissance results; package importer for exported files of scanners and products. The standard formats (SARIF, CycloneDX, SPDX, CSAF, OpenVEX, OCSF) are read and written by the interoperability adapters, one Go module each: github.com/openctemio/ctis/v2/interop/<format> (docs/interop.md).
Versioning: a report's Version is the specification version MAJOR.MINOR. Receivers read every minor of their major (newer minors with unknown members ignored, see Decode) and refuse every other major: a 1.x document is rejected and its producer must be upgraded. See docs/spec.md.
Index ¶
- Constants
- Variables
- func AssetKey(t AssetType, canonicalValue string) string
- func Bool(b bool) *bool
- func CVEs(v *VulnerabilityDetails) []string
- func CVSSVersionOfVector(vector string) string
- func CanonicalARN(s string) (string, error)
- func CanonicalAssetValue(t AssetType, value string) (string, error)
- func CanonicalAzureResourceID(s string) (string, error)
- func CanonicalCIDR(s string) (string, error)
- func CanonicalCPE(s string) (string, error)
- func CanonicalCertificateFingerprint(s string) (string, error)
- func CanonicalDomain(s string) (string, error)
- func CanonicalGCPResourceName(s string) (string, error)
- func CanonicalIP(s string) (string, error)
- func CanonicalImage(s string) (string, error)
- func CanonicalOrigin(s string) (string, error)
- func CanonicalPurl(s string) (identity, version string, err error)
- func CanonicalRepository(s string) (string, error)
- func CanonicalService(host string, port int, transport string) (string, error)
- func CanonicalURL(s string) (string, error)
- func ContainsSecret(s string, raw ...string) bool
- func CorrelationKey(assetKey string, f *Finding) string
- func CorrelationKeyForTool(assetKey, tool string, f *Finding) string
- func Decode(r io.Reader) (Report, Unknown, error)
- func EnumFallback(v any) (string, bool)
- func FitEvidenceItem(it *EvidenceItem)
- func FlowPath(p string) (string, bool)
- func HasThreatSignal(v *VulnerabilityDetails, types ...ThreatSignalType) bool
- func IsAttackTechniqueID(s string) bool
- func IsCompatibleVersion(v string) bool
- func IsDocumentRef(s string) bool
- func IsExtensionNamespace(s string) bool
- func IsKnownEvidenceKind(kind string) bool
- func IsOpenToken(s string) bool
- func IsReportID(s string) bool
- func IsSensitiveHeader(name string) bool
- func IsSensitiveParam(name string) bool
- func IsSupportedVersion(v string) bool
- func IsUUIDShaped(s string) bool
- func IsWebURL(s string) bool
- func KnownEvidenceKinds() []string
- func LocationKey(f *Finding) string
- func MarkSensitive(items ...*EvidenceItem) (incomplete []int)
- func MaskSecretMatch(s string) string
- func NewReportID() string
- func NormalizeAssetName(t AssetType, name string) string
- func NormalizeNativeStatus(scheme NativeScheme, native string) (status FindingStatus, state SourceState, ok bool)
- func ParseVersion(v string) (major, minor int, ok bool)
- func RedactCodeSecrets(s string) string
- func RedactSecretFinding(f *Finding, known ...string)
- func RedactSecretFindingWith(f *Finding, isSecret bool, snippetMasked func(string) bool, known ...string)
- func SetSourceExtra(f *Finding, key, value string) bool
- func SupportedSchemaVersions() []string
- type ASNInput
- type AccessControlIssue
- type Advisory
- type ArtifactLocation
- type Asset
- type AssetCompliance
- type AssetIdentifiers
- type AssetOwner
- type AssetState
- type AssetStateReason
- type AssetTechnical
- type AssetType
- type Attachment
- type AuditReport
- type BranchInfo
- type CertificateTechnical
- type Channel
- type CloudTechnical
- type CommitInfo
- type ComplianceDetails
- type ComplianceFramework
- type ContainerLayer
- type ContractLibrary
- type CookieFlags
- type CookieFlagsInput
- type CoreContract
- type CoverageType
- type Criticality
- type DNSRecord
- type DNSRecordInput
- type DataClassification
- type DataFlow
- func (df *DataFlow) AddIntermediate(loc DataFlowLocation)
- func (df *DataFlow) AddSanitizer(loc DataFlowLocation)
- func (df *DataFlow) BuildSummary() string
- func (df *DataFlow) GetFullPath() []DataFlowLocation
- func (df *DataFlow) GetPathLength() int
- func (df *DataFlow) IsCrossFunction() bool
- func (df *DataFlow) MarkAsSanitized()
- type DataFlowLocation
- func (loc DataFlowLocation) AsSanitizer() DataFlowLocation
- func (loc DataFlowLocation) AsSink() DataFlowLocation
- func (loc DataFlowLocation) AsSource() DataFlowLocation
- func (loc DataFlowLocation) WithFunction(fn string) DataFlowLocation
- func (loc DataFlowLocation) WithLabel(label string) DataFlowLocation
- func (loc DataFlowLocation) WithOperation(op string) DataFlowLocation
- type DataFlowLocationType
- type DeFiDetails
- type Dependency
- type DependencyLocation
- type DependencyRelationship
- type DependencyType
- type DetectionType
- type DiscoveredURLInput
- type DomainTechnical
- type Effort
- type Endpoint
- type EndpointAuth
- type EndpointKind
- type EndpointParam
- type EndpointSource
- type Environment
- type EvidenceArtifact
- type EvidenceFile
- type EvidenceHTTP
- type EvidenceHeader
- type EvidenceItem
- type EvidenceMatch
- type EvidenceRequest
- type EvidenceResponse
- type ExposureVector
- type Extensions
- type Finding
- type FindingExposure
- type FindingLocation
- type FindingStatus
- type FindingType
- type FindingValidation
- type FixRegex
- type FlashLoanIssue
- type GasIssue
- type Geolocation
- type HTTPMessageParts
- type HTTPTechnical
- type IPAddressTechnical
- type IdentityHints
- type IdentityKind
- type IdentityTechnical
- type LiveHostInput
- type LogicalLocation
- type MisconfigurationDetails
- type NFTCollectionDetails
- type NativeIdentity
- type NativeScheme
- type NetworkDeviceKind
- type NetworkDeviceTechnical
- type NetworkLocation
- type OpenPortInput
- type OracleManipulationIssue
- type OwnerKind
- type OwnerRole
- type ParamLocation
- type PortState
- type Profile
- type Properties
- type ReconConverterOptions
- type ReconToCTISInput
- type ReentrancyIssue
- type Relationship
- type RelationshipType
- type Remediation
- type Report
- type ReportMetadata
- type RepositoryTechnical
- type ResponseHeadersInput
- type Rule
- type Score
- type ScoreSystem
- type SecretDetails
- type SecurityHeaders
- type Segment
- type SensitiveSpan
- type ServiceTechnical
- type Severity
- type SmartContractDetails
- type SolutionType
- type SourceLifecycle
- type SourceRef
- type SourceState
- type StackFrame
- type StackTrace
- type SubdomainInput
- type Suppression
- type TLSLeafInput
- type TLSVersion
- type TargetCause
- type TargetClass
- type TargetOutcome
- type TargetState
- type Technique
- type Technology
- type TechnologyInput
- type ThreatSignal
- type ThreatSignalType
- type TokenBalance
- type TokenDetails
- type Tool
- type ToolContent
- type TradingPair
- type Transport
- type Unknown
- type UnknownEntry
- type UnknownKind
- type VEX
- type VEXJustification
- type VEXStatus
- type ValidationMethod
- type ValidationStatus
- type VerificationHold
- type VulnDataSource
- type VulnerabilityDetails
- type VulnerabilityID
- type VulnerabilityIDType
- type WalletDetails
- type Web3POC
- type Web3Technical
- type Web3VulnerabilityClass
- type Web3VulnerabilityDetails
- type WebCaptureInput
- type WebFormInput
- type WebLocation
- type WebParameter
Constants ¶
const ( MaxTechnologies = 100 MaxTechnologyNameLen = 128 MaxTechnologyVerLen = 64 MaxTechnologyCPELen = 255 MaxTechnologyCategory = 10 MaxTechnologyCatLen = 64 MaxFindingTechniques = 20 MaxRelationships = 10000 MaxRelationshipRefLen = 255 MaxFindingEvidenceSize = 64 * 1024 )
Limits of these members. The schema states them too; Validate refuses a report that exceeds them.
const ( MaxExtensionNamespaces = 32 MaxExtensionNamespaceLen = 128 MaxExtensionsBytes = 64 * 1024 MaxAssetOwners = 20 MaxOwnerRefLen = 256 MaxValidatorLen = 256 MaxValidationNotes = 4096 MaxEvidenceRefs = 20 MaxEvidenceRefLen = 128 MaxCAPECIDs = 32 MaxThreatSignals = 16 MaxSignalSourceLen = 64 MaxSignalRefLen = 2048 MaxTargets = 100000 MaxTargetLen = 2048 MaxSegmentCount = 10000 MaxDependencyRefLen = 255 )
Limits of the 2.0 additive members.
const ( // MaxDataFlowSteps is the most locations a data flow keeps, over its // sources, intermediates, sanitizers and sinks together. MaxDataFlowSteps = 100 // MaxDataFlowContentLen is the longest snippet of a step, in characters. MaxDataFlowContentLen = 2048 // MaxDataFlowContextLen is the longest surrounding code of a step, in // characters; a longer one is cut after its last whole line. MaxDataFlowContextLen = 8192 // MaxDataFlowPathLen is the longest file path of a step, in characters. // A longer path is dropped, not cut, so no path is invented. MaxDataFlowPathLen = 1024 // MaxDataFlowLabelLen is the longest label, function, class, module or // note of a step, in characters. MaxDataFlowLabelLen = 255 )
Bounds on one data flow.
const ( EvidenceKindHTTPExchange = "http_exchange" EvidenceKindRawText = "raw_text" EvidenceKindScreenshot = "screenshot" EvidenceKindFileExcerpt = "file_excerpt" EvidenceKindCommandOutput = "command_output" EvidenceKindCurl = "curl" )
Evidence kinds this module knows.
const ( MaxEvidenceItems = 20 MaxEvidenceItemBytes = 256 << 10 MaxEvidenceBodyBytes = 64 << 10 MaxEvidenceTextBytes = 64 << 10 MaxEvidenceHeaders = 100 MaxEvidenceHeaderBytes = 8 << 10 MaxEvidenceExtracted = 20 MaxEvidenceExtractLen = 1 << 10 MaxEvidenceLabelLen = 200 MaxEvidenceMatches = 50 MaxEvidenceSpans = 200 MaxEvidenceURLBytes = 8 << 10 MaxEvidenceCommandLen = 8 << 10 MaxEvidenceDataBytes = 64 << 10 )
Limits of evidence.
const ( BodyEncodingText = "text" BodyEncodingBase64 = "base64" )
Body encodings.
const ( MatchLocationRequest = "request" MatchLocationResponse = "response" MatchPartStatus = "status" MatchPartHeader = "header" MatchPartBody = "body" MatchPartURL = "url" )
Match locations and parts.
const ( MaxDocumentRefLen = 255 MaxSourceRefs = 16 MaxSourceRefIDLen = 256 MaxSourceSystemLen = 64 )
Limits of the identifier members.
const ( MaxScores = 32 MaxScoreVectorLen = 512 MaxScoreSourceLen = 64 MaxScoreLabelLen = 32 MaxVulnerabilityIDs = 64 MaxVulnerabilityIDLen = 128 MaxAdvisories = 50 MaxAdvisoryURLLen = 2048 MaxNativeValueLen = 64 // native severity, status, justification MaxNativeIDLen = 256 // native vuln id, instance id, family MaxRawRefLen = 1024 MaxVEXStatementLen = 4096 MaxVEXSourceLen = 512 MaxSourceExtraEntries = 64 MaxSourceExtraKeyLen = 128 MaxSourceExtraValueLen = 4096 MaxSourceExtraBytes = 32 * 1024 // keys plus values, in bytes MaxIdentityHintLen = 255 MaxIdentityHintMACs = 32 MaxTimesFound = 1_000_000_000 )
Size limits of the interoperability members. They are part of the contract (the schema states them and Validate enforces them), so a hostile or broken producer cannot make a receiver store unbounded data through them.
const ( MaxPostureValueLen = 4096 MaxPostureCookies = 20 )
Bounds on posture values.
const ( // MaxWebContentBody is the longest body kept, in bytes. MaxWebContentBody = 512 << 10 // MaxWebCaptures is the most captures one live host carries. MaxWebCaptures = 200 )
Bounds of a web content capture. A scanned server chooses every value, so the converter applies them again whatever the producer claims.
const ( MaxRules = 10000 MaxRuleIDLen = 1024 MaxRuleNameLen = 1024 MaxRuleShortDescLen = 1024 MaxRuleTextLen = 32768 MaxRuleTags = 64 MaxRuleTagLen = 256 MaxRuleCWEIDs = MaxCWEIDs MaxContentPathLen = 512 // Bounds on tool.content. MaxToolContent = 16 MaxToolContentFieldLen = 128 )
Bounds on the rule catalog.
const ( MaxReferences = 100 MaxURLLen = 2048 MaxDependencyLocation = 100 MaxDependsOn = 1000 MaxLicenses = 32 MaxCWEIDs = 32 MaxFixedVersions = 64 MaxAuthMethods = 16 MaxServiceDetails = 32 MaxDetailValueLen = 1024 MaxHeaderValueLen = 2048 MaxSecretScopes = 64 )
Limits of the core members (the schema states them too).
const ( // HoldEdgeBlockPage: the matched response is a challenge, block or // rate-limit page. HoldEdgeBlockPage = "edge_block_page" // HoldThrottledResponse: the matched response was 429 or 503, or carried // a Retry-After. HoldThrottledResponse = "throttled_response" // HoldSoft404: the matched response resembles the origin's not-found // answer. HoldSoft404 = "soft_404" // HoldTargetThrottled: the target throttled or blocked the scan around // the match. HoldTargetThrottled = "target_throttled" // HoldTimingBased: the check decides on response time. HoldTimingBased = "timing_based" // HoldOOBWeak: the out-of-band interaction is weak evidence (DNS only, // late, or from a resolver). HoldOOBWeak = "oob_weak" )
Hold reasons of a VerificationHold.
const ( HoldEdgeChallenged = "challenged" HoldEdgeBlocked = "blocked" )
Edge answers of a VerificationHold.
const ( SchemaVersion = "2.0" SchemaMajor = 2 // SchemaBaseURL is the base of the published schema $ids. The $ids are // immutable and versioned; they are identifiers on the project's domain // and receivers never fetch them. SchemaBaseURL = "https://schemas.openctem.io/ctis/" + SchemaVersion + "/" // SchemaURL is the $id of the report schema, for Report.Schema. SchemaURL = SchemaBaseURL + "report.json" // MediaType is the media type of a CTIS document. MediaTypeVersioned // carries the version parameter producers send. MediaType = "application/vnd.ctis+json" MediaTypeVersioned = MediaType + "; version=" + SchemaVersion // FileSuffix is the file name suffix of a CTIS document. FileSuffix = ".ctis.json" )
Specification version, schema location and media type.
SchemaVersion is the MAJOR.MINOR of the CTIS specification this module implements and the value producers put in Report.Version. It moves with the module's minor version: module v2.0.x implements CTIS 2.0. A parity test keeps it equal to the "default" of report.json#/properties/version.
Compatibility rule (docs/spec.md, "Versioning"): a receiver decodes a document of its own minor or an older one strictly, ignores unknown members (and maps unknown enum values to their fallback) only in a document of a newer minor of the same major, and rejects every other major. There is no conversion between majors: a 1.x document is rejected and its producer must be upgraded.
const ( MaxEndpoints = 200000 MaxEndpointParams = 100 MaxParamNameLen = 128 MaxEndpointPathLen = 2048 MaxContentTypeLen = 255 MaxParamTypeHintLen = 32 MaxEndpointIDLen = 128 MaxWebRequestRefLen = 128 )
Limits of the web members.
const AssetKeyNamespace = "9678743b-b91d-59fa-b168-ed192fe9eed3"
AssetKeyNamespace is the published UUID namespace of CTIS asset keys: uuidv5(NAMESPACE_URL, "urn:ctis:asset-key").
const CorrelationKeyPrefix = "ctis-ck/1:"
CorrelationKeyPrefix starts every correlation key.
const DocumentRefPattern = `^[A-Za-z0-9][A-Za-z0-9._:/@+=~%-]{0,254}$`
DocumentRefPattern is the form of a document-local reference: visible ASCII starting with a letter or digit, at most 255 characters.
const ExtensionNamespacePattern = `^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?(\.[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)+$`
ExtensionNamespacePattern is the form of an extensions key: a reverse-DNS name of at least two labels ("io.openctem", "com.example.scanner").
const MaxAssetValueLen = 2048
MaxAssetValueLen bounds asset.value.
const MaxDNSRecords = 500
MaxDNSRecords bounds the DNS records of one domain_name asset.
const MaxDNSValueLen = 1024
MaxDNSValueLen bounds a DNS record value.
const MaxHTTPXLineBytes = 1 << 20
MaxHTTPXLineBytes is the longest line ParseHTTPXLine reads.
const MaxUnknownEntries = 1000
MaxUnknownEntries bounds the entries Decode lists in Unknown; the rest are counted in Unknown.Omitted.
const OpenCTEMNamespace = "io.openctem"
OpenCTEMNamespace is the extensions namespace of the OpenCTEM receiver profile (schemas/extensions/io.openctem/2.json).
const OpenTokenPattern = `^[a-z0-9][a-z0-9_.-]{0,63}$`
OpenTokenPattern is the form of an open vocabulary value (2.0): a member whose known values are listed in the documentation but whose set is not closed, such as technical.cloud.provider and native.scheme.
const RedactedSecret = "REDACTED"
RedactedSecret replaces a secret, or a code line holding one, that is too short to show any of it.
const ReportIDPattern = `^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$`
ReportIDPattern is the form of metadata.id: a lowercase UUID of version 7.
const TypeHintPassword = "password"
TypeHintPassword is the type hint of a form field that holds a password. A form endpoint with such a parameter is a login form: a receiver labels the endpoint auth:login from it.
const UUIDShapePattern = `^(urn:uuid:|\{)?[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}\}?$`
UUIDShapePattern matches a UUID in its canonical, braced or URN form. A document-local reference MUST NOT match it.
const VerificationHoldKey = "verification_hold"
VerificationHoldKey is the key under extensions["io.openctem"] of a finding whose matched response the producer screened as possibly the target's throttling or block answer (schemas/extensions/io.openctem/2.json, docs/profiles/openctem.md). The receiver keeps the finding and holds it until it is checked; a receiver that does not know the namespace ignores it.
const WebContentKey = "web_content"
WebContentKey is the key under extensions["io.openctem"] of a web_origin asset that carries the captures of a web content fetch: a list of objects with the keys url, final_url, status_code, content_type, size, sha256, truncated, body, body_truncated and fetched_at. A receiver that does not know the namespace ignores it.
It is an explicit input (LiveHostInput.WebContent), not part of the httpx line allow-list: ParseHTTPXLine never keeps a response body.
Variables ¶
var ErrHTTPXLine = errors.New("not a usable httpx result line")
ErrHTTPXLine is the error of a line that is not a usable httpx result.
var ErrInvalidVerificationHold = errors.New("ctis: invalid verification hold")
ErrInvalidVerificationHold is returned for a hold outside the schema.
var ErrNotCanonicalizable = errors.New("ctis: value has no canonical form")
ErrNotCanonicalizable is wrapped by every error of the Canonical* functions.
var HoldReasons = []string{HoldEdgeBlockPage, HoldThrottledResponse, HoldSoft404, HoldTargetThrottled, HoldTimingBased, HoldOOBWeak}
HoldReasons are the hold reasons, in order.
Functions ¶
func AssetKey ¶
AssetKey returns the deterministic key of an asset: uuidv5(AssetKeyNamespace, type + 0x1F + canonicalValue), lowercase. The value MUST already be canonical for the type; AssetKey does not canonicalize it.
func CVEs ¶
func CVEs(v *VulnerabilityDetails) []string
CVEs returns the CVE ids of a vulnerability, canonical, in order.
func CVSSVersionOfVector ¶
CVSSVersionOfVector returns the CVSS version a vector string declares ("3.0", "3.1", "4.0"), "2.0" for a prefix-less v2 vector (AV:N/AC:L/...), or "" when it is not a CVSS vector.
func CanonicalARN ¶
CanonicalARN returns an Amazon Resource Name as issued, with partition, service and region lowercase ("arn:aws:s3:::bucket").
func CanonicalAssetValue ¶
CanonicalAssetValue returns value in the canonical form of asset type t (spec section "Canonical forms"), or an error when value has no canonical form for t. The asset key is AssetKey(t, canonical value). Types without a structured form (a web application name, an identity) are trimmed and must not contain control characters.
func CanonicalAzureResourceID ¶
CanonicalAzureResourceID returns an Azure Resource Manager id lowercase (ARM ids are case-insensitive), without a trailing slash.
func CanonicalCIDR ¶
CanonicalCIDR returns an IP range as a CIDR with its network address ("10.0.0.0/8"), IPv6 per RFC 5952; an IPv4-mapped range of /96 or longer becomes the IPv4 range.
func CanonicalCPE ¶
CanonicalCPE returns a CPE 2.3 formatted string binding, lowercase, with 13 colon-separated parts ("cpe:2.3:a:vendor:product:..."). A CPE 2.2 URI ("cpe:/a:vendor:product:version") without percent-encoding is bound to the 2.3 form, missing components as "*".
func CanonicalCertificateFingerprint ¶
CanonicalCertificateFingerprint returns a certificate SHA-256 fingerprint (of the DER) as 64 lowercase hex digits; colons and spaces are removed.
func CanonicalDomain ¶
CanonicalDomain returns a domain name trimmed, lowercase, with no trailing dot, each non-ASCII label as an A-label ("xn--..."). A wildcard label, an empty label, a label over 63 bytes, a name over 253 bytes, and characters other than letters, digits, hyphen and underscore are refused.
func CanonicalGCPResourceName ¶
CanonicalGCPResourceName returns a Google Cloud full resource name "//<service>.googleapis.com/<path>", the service host lowercase, the path as given, without a trailing slash.
func CanonicalIP ¶
CanonicalIP returns an IP address in canonical form: IPv4 dotted quad without leading zeros, IPv6 per RFC 5952, an IPv4-mapped IPv6 address as IPv4, and no zone.
func CanonicalImage ¶
CanonicalImage returns a container image reference as "<registry>/<repository>@sha256:<digest>": Docker Hub names expanded to docker.io (and docker.io/library for an official image), the registry lowercase, the digest lowercase hex. The tag is an attribute, not identity: a reference without a digest returns "<registry>/<repository>", which names the repository, not one image.
func CanonicalOrigin ¶
CanonicalOrigin returns the origin of an http or https URL: "scheme://host[:port]", scheme and host lowercase, the host canonical, the default port dropped.
func CanonicalPurl ¶
CanonicalPurl splits a package URL into its identity, the versionless purl "pkg:<type>/<namespace>/<name>" in canonical form, and its version. The type is lowercase; namespace and name are lowercase for the types whose names are case-insensitive (bitbucket, github, npm, pypi, composer, hex), and a pypi name has "_" replaced by "-". Segments are percent-encoded minimally (everything but unreserved characters). Qualifiers and subpath are not part of the identity.
func CanonicalRepository ¶
CanonicalRepository returns a repository as "<host>/<owner path>/<name>": no scheme, user info, port-less host lowercase, no ".git", no trailing slash. scp-style "git@host:owner/name" is accepted. The owner path and name are lowercase on hosts known to be case-insensitive and kept as given elsewhere.
func CanonicalService ¶
CanonicalService returns "<host>:<port>/<transport>" with the host canonical (an IPv6 address in brackets) and the transport tcp, udp or sctp.
func CanonicalURL ¶
CanonicalURL returns an http or https URL in canonical form: the origin (CanonicalOrigin), the path with its case kept, percent-encoding uppercased and unreserved characters decoded, dot segments removed, and the query parameter names only, sorted and without duplicates. User info, fragment and query values are dropped.
func ContainsSecret ¶
ContainsSecret reports whether s holds one of the raw values, the check a test or a receiver uses to prove a value never reached storage.
func CorrelationKey ¶
CorrelationKey is the normative key that says two findings, possibly from different tools, describe the same issue at the same place on the same asset. It is "ctis-ck/1:" and the hex SHA-256 of the length-prefixed parts (fingerprint.EncodeParts, as recipe v2 uses) in this order:
- assetKey: the asset's key, computed by the receiver, never taken from a producer;
- the finding's preferred vulnerability id (PreferredVulnerabilityID), or "rule:" + tool + "/" + rule_id when it has none;
- LocationKey(f).
Receivers compute it; a producer's value is never trusted. The tool is the finding's own tool when the finding carries one; CorrelationKeyForTool takes it explicitly (the report's tool when the finding has none).
It returns "" when f is nil or assetKey is empty: no asset, no key.
func CorrelationKeyForTool ¶
CorrelationKeyForTool is CorrelationKey with the tool name given by the caller. The tool only matters for a finding that has no vulnerability id.
func Decode ¶
Decode reads one CTIS document from r under the compatibility rule of spec section 2.2:
- version missing or malformed: an error;
- another major: an error. There is no conversion between majors;
- this module's major, the same or an older minor than SchemaVersion: strict decoding, an unknown member is an error, and Unknown is empty;
- this module's major, a newer minor: unknown members are ignored, and an enum value this module does not know is mapped to the enum's fallback (EnumFallback). An enum with no fallback loses the value: the member is removed when it is optional, else the nearest enclosing optional member or array item is removed (a finding of an unknown type is dropped). Each of these is listed in Unknown.
Decode checks shape only; run Report.Validate on the result. It reads the whole of r: bound the input first (io.LimitReader). Trailing data after the document is an error.
func EnumFallback ¶
EnumFallback returns the documented fallback of an enum type for a value a receiver does not know ("unknown", "unclassified", "other"), and false when the enum has none. v is any value of the enum type.
func FitEvidenceItem ¶
func FitEvidenceItem(it *EvidenceItem)
FitEvidenceItem shrinks an http_exchange item until it serializes under MaxEvidenceItemBytes (JSON escaping can make a body up to six times longer), halving the larger body first and marking it truncated.
func FlowPath ¶
FlowPath cleans a path or file URI to a POSIX path and says whether it is absolute, the way NormalizeDataFlow reads the paths of a trace. It returns "" for a value that is no file path: another URI scheme, an empty value, a path with control characters. Converters use it to read the base directories a producer names for its relative paths.
func HasThreatSignal ¶
func HasThreatSignal(v *VulnerabilityDetails, types ...ThreatSignalType) bool
HasThreatSignal reports whether v carries a threat signal of one of the types.
func IsAttackTechniqueID ¶
IsAttackTechniqueID reports whether s is a well-formed MITRE ATT&CK technique id ("T1190") or sub-technique id ("T1595.002").
func IsCompatibleVersion ¶
IsCompatibleVersion reports whether a report declaring version v can be read by this module: same major, any minor. See the package compatibility rule on SchemaVersion for what a newer minor implies.
func IsDocumentRef ¶
IsDocumentRef reports whether s is a valid document-local reference: it follows DocumentRefPattern and is not UUID-shaped.
func IsExtensionNamespace ¶
IsExtensionNamespace reports whether s is a valid extensions key.
func IsKnownEvidenceKind ¶
IsKnownEvidenceKind reports whether this module validates the kind's body.
func IsOpenToken ¶
IsOpenToken reports whether s is a value of an open vocabulary.
func IsReportID ¶
IsReportID reports whether s is a valid metadata.id (lowercase UUIDv7).
func IsSensitiveHeader ¶
IsSensitiveHeader reports whether a header carries credentials or a session: Authorization, Proxy-Authorization, Cookie, Set-Cookie, X-Api-Key, or a name with token, secret, session or auth in it.
func IsSensitiveParam ¶
IsSensitiveParam reports whether a query, form or JSON member name names a credential, a session or a token.
func IsSupportedVersion ¶
IsSupportedVersion reports whether v is one of SupportedSchemaVersions.
func IsUUIDShaped ¶
IsUUIDShaped reports whether s looks like a UUID (canonical, braced or URN form).
func IsWebURL ¶
IsWebURL reports whether s is an absolute http or https URL with a host, the only schemes CTIS URL members accept.
func KnownEvidenceKinds ¶
func KnownEvidenceKinds() []string
KnownEvidenceKinds returns the kinds whose body this module validates.
func LocationKey ¶
LocationKey returns the normalized location of a finding on its asset, the location part of a cross-source deduplication key (asset, vulnerability, location). The asset is not part of it. In order of precedence:
- "pkg:<type>/<namespace>/<name>": the package URL without version, qualifiers or subpath;
- "url:<scheme>://<host>[:port]/<path>": a web location, lower-case scheme and host, default port, user info, query and fragment removed;
- "file:<path>": a repository-relative POSIX path (line numbers are not part of it: they move when unrelated code changes);
- "net:<port>/<transport>" or "net:host" for a host-level network finding;
- "resource:<type>/<name>" for a misconfigured resource;
- "" when the finding names no location.
It is derived, never sent: a receiver computes it so a producer cannot choose the key another producer's finding is merged under.
func MarkSensitive ¶
func MarkSensitive(items ...*EvidenceItem) (incomplete []int)
MarkSensitive adds sensitive spans to the items for the values of sensitive headers, of sensitive query, form and JSON members of request URLs and bodies, and for every other place in the items that repeats one of those values (a curl command repeating the Cookie header). Values are marked, never masked; spans already present are kept. When an item would need more than MaxEvidenceSpans spans, its spans are widened to whole strings. It returns the indexes of the items it could still not mark completely (more strings to mark than MaxEvidenceSpans): callers MUST drop those items, never send them unmarked.
func MaskSecretMatch ¶
MaskSecretMatch masks a secret scanner's raw match: the first 4 characters of a secret of 16 characters or more followed by asterisks, else "REDACTED". The masked form does not reveal the length. Every converter of a secret scanner's output uses it, so every report masks a match the same way.
func NewReportID ¶
func NewReportID() string
NewReportID returns a new UUIDv7 (RFC 9562) for metadata.id: 48 bits of Unix milliseconds, a 12-bit counter that keeps ids from one process monotonic within a millisecond, and 62 random bits.
func NormalizeAssetName ¶
NormalizeAssetName returns the canonical value of name for type t, or the trimmed name when it has no canonical form (a receiver then refuses the asset in Validate).
func NormalizeNativeStatus ¶
func NormalizeNativeStatus(scheme NativeScheme, native string) (status FindingStatus, state SourceState, ok bool)
NormalizeNativeStatus maps a native status of the given scheme to a CTIS finding status and a source state. state is empty when the native value is a disposition rather than a lifecycle state. Unknown schemes and values return ok=false.
A receiver that keeps its own lifecycle should treat status as the source's claim: "resolved" means the source no longer sees it, not that it is fixed.
func ParseVersion ¶
ParseVersion splits a CTIS version of the form MAJOR.MINOR. It accepts only non-negative decimal numbers without leading zeros, so "1.3" parses and "1", "v1.3", "1.03" and "1.3.0" do not.
func RedactCodeSecrets ¶
RedactCodeSecrets masks the credentials in a line or a block of source code: a quoted value assigned to a credential name (password, secret, token, api key, access key, private key, client secret, credentials), the password of a URL's user info, tokens of a recognisable form (cloud access keys, repository and chat tokens, payment keys, JSON web tokens) and private key blocks. Masks use MaskSecretMatch. Values already masked (asterisks, REDACTED) and placeholders are kept. Everything else in the code is left as it is: a taint step's code is what the reader needs.
func RedactSecretFinding ¶
RedactSecretFinding masks raw secret values everywhere in f: the title, description, message, snippet, evidence, remediation, fingerprints, tags, properties and every other plain string field.
The values masked are the known raw values passed in and, for a secret finding (type secret), the location snippet and secret.masked_value when they are not already masked. A value is masked as a whole, and so is each secret-looking word in it: a snippet holding a whole code line (key = "AKIA...") still has the bare secret masked where the title repeats it alone. Values already masked (asterisks, REDACTED) are left as they are, so the call is idempotent and a producer's masking is kept.
Receivers call it on every finding they store, as defence in depth; the converters of this module call it on every secret finding they emit.
func RedactSecretFindingWith ¶
func RedactSecretFindingWith(f *Finding, isSecret bool, snippetMasked func(string) bool, known ...string)
RedactSecretFindingWith is RedactSecretFinding with two decisions made by the caller: isSecret says whether the snippet and secret.masked_value hold the secret (a converter may decide by the tool that wrote the finding, not only by its type), and snippetMasked says whether a snippet is already masked (a converter may keep only a fully redacted snippet where a receiver keeps any masked one). A nil snippetMasked uses the receiver's test.
func SetSourceExtra ¶
SetSourceExtra stores one unmapped source field on f within the source_extra limits. The key is trimmed; a value longer than MaxSourceExtraValueLen characters is cut at that length. It returns false and stores nothing when the key is empty, too long or holds control characters, or when the entry would exceed MaxSourceExtraEntries or MaxSourceExtraBytes. Replacing an existing key is allowed within the limits.
func SupportedSchemaVersions ¶
func SupportedSchemaVersions() []string
SupportedSchemaVersions returns every CTIS version this module reads with full knowledge of its members, oldest first: 2.0 up to SchemaVersion. A report declaring any of them decodes strictly into the Go types and passes Validate. Code that compared a version against a literal such as "1.3" should check membership here instead (or IsCompatibleVersion, which also accepts newer minors of the same major).
Types ¶
type ASNInput ¶
type ASNInput struct {
Number string // "AS13335" or "13335"
Org string
Country string // ISO 3166-1 alpha-2
}
ASNInput is an autonomous system.
type AccessControlIssue ¶
type AccessControlIssue struct {
// Missing modifier
MissingModifier string `json:"missing_modifier,omitempty"`
// Unprotected function
UnprotectedFunction string `json:"unprotected_function,omitempty"`
// Can be called by
CallableBy string `json:"callable_by,omitempty"` // anyone, owner_only, etc.
// Privilege escalation path
EscalationPath string `json:"escalation_path,omitempty"`
// Missing role check
MissingRoleCheck string `json:"missing_role_check,omitempty"`
}
AccessControlIssue contains details about access control vulnerabilities.
type Advisory ¶
type Advisory struct {
// Advisory id (MS24-001, RHSA-2024:1234, DSA-5600-1).
ID string `json:"id,omitempty"`
// Advisory URL.
URL string `json:"url,omitempty"`
// Issuer (microsoft, redhat, debian, ...).
Source string `json:"source,omitempty"`
}
Advisory is a vendor advisory that addresses a finding.
type ArtifactLocation ¶
type ArtifactLocation struct {
URI string `json:"uri,omitempty"`
URIBaseID string `json:"uri_base_id,omitempty"`
Index int `json:"index,omitempty"`
}
ArtifactLocation represents the location of an artifact.
type Asset ¶
type Asset struct {
// Document-local reference (required): findings, relationships,
// dependencies and endpoints name the asset by it. Never UUID-shaped,
// never a receiver's key.
ID string `json:"id"`
// Asset type (required).
Type AssetType `json:"type"`
// The asset's value in the canonical form of its type (required):
// "www.example.com", "192.0.2.10", "192.0.2.10:443/tcp",
// "https://www.example.com", "github.com/org/repo".
Value string `json:"value"`
// Human-readable name.
Name string `json:"name,omitempty"`
// Description (plain text).
Description string `json:"description,omitempty"`
// Tags for categorization.
Tags []string `json:"tags,omitempty"`
// Business criticality: critical, high, medium, low.
Criticality Criticality `json:"criticality,omitempty"`
// How sure the producer is about the asset, 0-100.
Confidence int `json:"confidence,omitempty"`
// When the producer first and last observed the asset.
FirstSeenAt *time.Time `json:"first_seen_at,omitempty"`
LastSeenAt *time.Time `json:"last_seen_at,omitempty"`
// Type-specific technical details.
Technical *AssetTechnical `json:"technical,omitempty"`
// Compliance context.
Compliance *AssetCompliance `json:"compliance,omitempty"`
// Whether the asset is reachable from the internet. Absent means
// unknown; false means verified not reachable.
IsInternetAccessible *bool `json:"is_internet_accessible,omitempty"`
// Stable identifiers read from the asset itself.
Identifiers *AssetIdentifiers `json:"identifiers,omitempty"`
// Remote observations that help match the asset across tools.
IdentityHints *IdentityHints `json:"identity_hints,omitempty"`
// Technologies the asset runs.
Technologies []Technology `json:"technologies,omitempty"`
// Deployment environment.
Environment Environment `json:"environment,omitempty"`
// Who owns the asset. The refs are personal data.
Owners []AssetOwner `json:"owners,omitempty"`
// State of the asset. gone only on an authoritative signal, named by
// StateReason.
State AssetState `json:"state,omitempty"`
StateReason AssetStateReason `json:"state_reason,omitempty"`
// The producer's own identifiers of the asset in its own systems.
SourceRefs []SourceRef `json:"source_refs,omitempty"`
// Opaque bag; no meaning.
Properties Properties `json:"properties,omitempty"`
// Namespaced producer data.
Extensions Extensions `json:"extensions,omitempty"`
}
Asset is an observed asset. Its identity is AssetKey(type, canonical value); receivers compute the key and never trust a producer's.
type AssetCompliance ¶
type AssetCompliance struct {
// Compliance frameworks the asset is in scope for, from the framework
// registry (ComplianceFramework).
Frameworks []ComplianceFramework `json:"frameworks,omitempty"`
// Data classification: public, internal, confidential, restricted.
DataClassification DataClassification `json:"data_classification,omitempty"`
// The asset holds personally identifiable information.
HasPII bool `json:"has_pii,omitempty"`
// The asset holds protected health information.
HasPHI bool `json:"has_phi,omitempty"`
}
AssetCompliance contains compliance context for an asset.
type AssetIdentifiers ¶
type AssetIdentifiers struct {
// Host ID read on the host: /etc/machine-id, MachineGuid,
// IOPlatformUUID.
MachineID string `json:"machine_id,omitempty"`
// Cloud instance ID, VM ID or resource ARN.
CloudResourceID string `json:"cloud_resource_id,omitempty"`
// SMBIOS system UUID.
BIOSUUID string `json:"bios_uuid,omitempty"`
// Hardware serial number.
SerialNumber string `json:"serial_number,omitempty"`
// MAC addresses of the host's interfaces.
MACAddresses []string `json:"mac_addresses,omitempty"`
// Repository ID assigned by the source-code host. It survives renames.
SCMRepoID string `json:"scm_repo_id,omitempty"`
}
AssetIdentifiers holds identifiers that stay the same when an asset is renamed or readdressed, read from the asset itself. In order of trust: MachineID, CloudResourceID, BIOSUUID then SerialNumber, MACAddresses. SCMRepoID identifies a repository. They are the asset's own identifiers, never a receiver's keys.
type AssetOwner ¶
type AssetOwner struct {
Kind OwnerKind `json:"kind"`
Ref string `json:"ref"`
Role OwnerRole `json:"role,omitempty"`
}
AssetOwner is one owner of an asset. Ref is personal data when Kind is person (an e-mail address, a user name): receivers must be able to erase it.
type AssetState ¶
type AssetState string
AssetState is the state of an asset as the producer observed it.
const ( AssetStateActive AssetState = "active" AssetStateGone AssetState = "gone" )
Asset states. gone needs an authoritative signal (StateReason); every other absence of an asset is "not seen" (spec section 4.17).
func (AssetState) IsValid ¶
func (s AssetState) IsValid() bool
IsValid reports whether s is a known asset state.
type AssetStateReason ¶
type AssetStateReason string
AssetStateReason is the authoritative signal behind AssetStateGone.
const ( // StateReasonNameGone: an authoritative NXDOMAIN or NODATA answer. StateReasonNameGone AssetStateReason = "name_gone" // StateReasonResourceDeleted: the provider's API reports the resource // deleted. StateReasonResourceDeleted AssetStateReason = "resource_deleted" // StateReasonInventoryRemoved: the authoritative inventory the producer // reads (a CMDB, an identity provider) no longer lists the asset. StateReasonInventoryRemoved AssetStateReason = "inventory_removed" )
Asset state reasons.
func AllAssetStateReasons ¶
func AllAssetStateReasons() []AssetStateReason
AllAssetStateReasons returns every asset state reason.
func (AssetStateReason) IsValid ¶
func (r AssetStateReason) IsValid() bool
IsValid reports whether r is a known asset state reason.
type AssetTechnical ¶
type AssetTechnical struct {
// For domain_name assets.
Domain *DomainTechnical `json:"domain,omitempty"`
// For ip_address assets.
IPAddress *IPAddressTechnical `json:"ip_address,omitempty"`
// For repository assets.
Repository *RepositoryTechnical `json:"repository,omitempty"`
// For certificate assets.
Certificate *CertificateTechnical `json:"certificate,omitempty"`
// For cloud assets.
Cloud *CloudTechnical `json:"cloud,omitempty"`
// For service assets.
Service *ServiceTechnical `json:"service,omitempty"`
// For web_origin assets.
HTTP *HTTPTechnical `json:"http,omitempty"`
// For identity assets.
Identity *IdentityTechnical `json:"identity,omitempty"`
// For network_device assets.
NetworkDevice *NetworkDeviceTechnical `json:"network_device,omitempty"`
// For web3 assets (web3 profile).
Web3 *Web3Technical `json:"web3,omitempty"`
}
AssetTechnical contains type-specific technical details. Set the member that matches the asset type.
type AssetType ¶
type AssetType string
AssetType is the type of an asset. Each type has one canonical value form (spec section "Assets").
const ( // Discovery / external attack surface. AssetTypeDomainName AssetType = "domain_name" // DNS name; the apex is derived AssetTypeIPAddress AssetType = "ip_address" // IPv4 or IPv6 address AssetTypeIPRange AssetType = "ip_range" // CIDR block AssetTypeCertificate AssetType = "certificate" // X.509 certificate (SHA-256 of DER) AssetTypeAutonomousSystem AssetType = "autonomous_system" // BGP autonomous system ("AS64500") // Applications and services. AssetTypeWebOrigin AssetType = "web_origin" // scheme://host[:port] AssetTypeWebApplication AssetType = "web_application" // a web application behind one or more origins AssetTypeAPI AssetType = "api" // an API (REST, GraphQL, gRPC) AssetTypeMobileApp AssetType = "mobile_app" // mobile application (bundle id) AssetTypeSaaSApplication AssetType = "saas_application" // SaaS application tenant AssetTypeService AssetType = "service" // host:port/transport // Code and artifacts. AssetTypeRepository AssetType = "repository" // host/owner/name AssetTypePackage AssetType = "package" // versionless purl AssetTypeContainerImage AssetType = "container_image" // registry/repository@sha256:digest AssetTypeAIModel AssetType = "ai_model" // machine learning model // Cloud. AssetTypeCloudAccount AssetType = "cloud_account" // account, subscription, project AssetTypeCloudResource AssetType = "cloud_resource" // resource by provider id AssetTypeStorage AssetType = "storage" // object storage bucket or container AssetTypeDatabase AssetType = "database" // managed database AssetTypeServerless AssetType = "serverless" // function AssetTypeContainerRegistry AssetType = "container_registry" // registry // Infrastructure and devices. AssetTypeHost AssetType = "host" // physical or virtual machine AssetTypeContainer AssetType = "container" // running container AssetTypeKubernetesCluster AssetType = "kubernetes_cluster" // cluster AssetTypeKubernetesNamespace AssetType = "kubernetes_namespace" // namespace AssetTypeKubernetesWorkload AssetType = "kubernetes_workload" // Deployment, StatefulSet, Job, Pod AssetTypeEndpointDevice AssetType = "endpoint_device" // laptop, desktop, phone AssetTypeIoTDevice AssetType = "iot_device" // IoT device AssetTypeOTDevice AssetType = "ot_device" // operational technology device AssetTypeNetworkDevice AssetType = "network_device" // router, switch, access point // Network. AssetTypeVPC AssetType = "vpc" AssetTypeSubnet AssetType = "subnet" AssetTypeLoadBalancer AssetType = "load_balancer" AssetTypeFirewall AssetType = "firewall" // Identity. AssetTypeIdentity AssetType = "identity" // with technical.identity.kind // Web3 profile. AssetTypeSmartContract AssetType = "smart_contract" AssetTypeWallet AssetType = "wallet" AssetTypeNFTCollection AssetType = "nft_collection" AssetTypeDeFiProtocol AssetType = "defi_protocol" AssetTypeToken AssetType = "token" AssetTypeBlockchain AssetType = "blockchain" // Not yet classified. AssetTypeUnclassified AssetType = "unclassified" )
Asset types.
type Attachment ¶
type Attachment struct {
Description string `json:"description,omitempty"`
ArtifactLocation *ArtifactLocation `json:"artifact_location,omitempty"`
Regions []*FindingLocation `json:"regions,omitempty"`
}
Attachment represents an artifact or evidence attachment (SARIF attachment).
type AuditReport ¶
type AuditReport struct {
Auditor string `json:"auditor"`
ReportURL string `json:"report_url,omitempty"`
PublishedAt *time.Time `json:"published_at,omitempty"`
Scope string `json:"scope,omitempty"`
CriticalCount int `json:"critical_count,omitempty"`
HighCount int `json:"high_count,omitempty"`
MediumCount int `json:"medium_count,omitempty"`
LowCount int `json:"low_count,omitempty"`
}
AuditReport represents a security audit report.
type BranchInfo ¶
type BranchInfo struct {
// Branch name ("main", "feature/xyz").
Name string `json:"name"`
// Whether this is the repository's default branch. Auto-resolve applies
// only to default branch scans.
IsDefaultBranch bool `json:"is_default_branch"`
// Commit SHA being scanned.
CommitSHA string `json:"commit_sha,omitempty"`
// Base branch for pull request scans.
BaseBranch string `json:"base_branch,omitempty"`
// Pull request number.
PullRequestNumber int `json:"pull_request_number,omitempty"`
// Pull request URL (http or https).
PullRequestURL string `json:"pull_request_url,omitempty"`
// Repository URL (http or https).
RepositoryURL string `json:"repository_url,omitempty"`
}
BranchInfo contains git branch context for CI/CD scans.
type CertificateTechnical ¶
type CertificateTechnical struct {
SerialNumber string `json:"serial_number,omitempty"`
SubjectCN string `json:"subject_cn,omitempty"`
SubjectAltNames []string `json:"subject_alt_names,omitempty"`
IssuerCN string `json:"issuer_cn,omitempty"`
IssuerOrg string `json:"issuer_org,omitempty"`
NotBefore *time.Time `json:"not_before,omitempty"`
NotAfter *time.Time `json:"not_after,omitempty"`
SignatureAlgorithm string `json:"signature_algorithm,omitempty"`
KeyAlgorithm string `json:"key_algorithm,omitempty"`
KeySize int `json:"key_size,omitempty"` // bits
// SHA-256 of the DER, lowercase hex.
SHA256Fingerprint string `json:"sha256_fingerprint,omitempty"`
IsSelfSigned bool `json:"is_self_signed,omitempty"`
IsWildcard bool `json:"is_wildcard,omitempty"`
}
CertificateTechnical contains certificate details. The asset value is the SHA-256 fingerprint of the DER.
type Channel ¶
type Channel string
Channel is how the data of a report reached the document.
type CloudTechnical ¶
type CloudTechnical struct {
// Provider: an open token (aws, azure, gcp, oci, alibaba).
Provider string `json:"provider,omitempty"`
// Account, subscription or project.
AccountID string `json:"account_id,omitempty"`
Region string `json:"region,omitempty"`
Zone string `json:"zone,omitempty"`
ResourceType string `json:"resource_type,omitempty"`
ResourceID string `json:"resource_id,omitempty"`
ARN string `json:"arn,omitempty"`
// Resource tags.
Tags map[string]string `json:"tags,omitempty"`
}
CloudTechnical contains cloud resource details.
type CommitInfo ¶
type CommitInfo struct {
SHA string `json:"sha,omitempty"`
Author string `json:"author,omitempty"`
AuthorEmail string `json:"author_email,omitempty"`
CommittedAt *time.Time `json:"committed_at,omitempty"`
}
CommitInfo is a commit of a repository. Author and AuthorEmail are personal data; producers SHOULD omit AuthorEmail unless asked to send it.
type ComplianceDetails ¶
type ComplianceDetails struct {
// Framework from the registry (ComplianceFramework).
Framework ComplianceFramework `json:"framework,omitempty"`
FrameworkVersion string `json:"framework_version,omitempty"`
ControlID string `json:"control_id,omitempty"`
ControlName string `json:"control_name,omitempty"`
ControlDescription string `json:"control_description,omitempty"`
}
ComplianceDetails names the control a compliance finding evaluates. The result is the finding's kind (pass, fail, review, not_applicable).
type ComplianceFramework ¶
type ComplianceFramework string
ComplianceFramework is a compliance framework, an open token with a registry of known values (the constants).
const ( FrameworkPCIDSS ComplianceFramework = "pci_dss" FrameworkHIPAA ComplianceFramework = "hipaa" FrameworkSOC2 ComplianceFramework = "soc2" FrameworkISO27001 ComplianceFramework = "iso27001" FrameworkNISTCSF ComplianceFramework = "nist_csf" FrameworkNIST80053 ComplianceFramework = "nist_800_53" FrameworkCIS ComplianceFramework = "cis" FrameworkGDPR ComplianceFramework = "gdpr" FrameworkFedRAMP ComplianceFramework = "fedramp" FrameworkOWASPASVS ComplianceFramework = "owasp_asvs" )
Registered compliance frameworks.
func AllComplianceFrameworks ¶
func AllComplianceFrameworks() []ComplianceFramework
AllComplianceFrameworks returns the registered frameworks.
func (ComplianceFramework) IsValid ¶
func (f ComplianceFramework) IsValid() bool
IsValid reports whether f is a registered framework. Validate accepts any open token.
type ContainerLayer ¶
type ContainerLayer struct {
Digest string `json:"digest,omitempty"`
DiffID string `json:"diff_id,omitempty"`
}
ContainerLayer identifies a container image layer.
type ContractLibrary ¶
ContractLibrary represents an external library linked to a contract.
type CookieFlags ¶
type CookieFlags struct {
Name string `json:"name"`
IsSecure bool `json:"is_secure,omitempty"`
IsHTTPOnly bool `json:"is_http_only,omitempty"`
IsPersistent bool `json:"is_persistent,omitempty"`
// SameSite: strict, lax, none.
SameSite string `json:"same_site,omitempty"`
}
CookieFlags is what a Set-Cookie header says about a cookie, without its value.
type CookieFlagsInput ¶
type CookieFlagsInput struct {
Name string
Secure bool
HTTPOnly bool
SameSite string
Persistent bool
}
CookieFlagsInput is what a Set-Cookie header says about a cookie, without its value.
type CoreContract ¶
type CoreContract struct {
Name string `json:"name"`
Address string `json:"address"`
Role string `json:"role,omitempty"` // router, factory, vault, etc.
}
CoreContract represents a core contract of a DeFi protocol.
type CoverageType ¶
type CoverageType string
CoverageType says how much of the scope the work covered.
const ( CoverageFull CoverageType = "full" CoverageIncremental CoverageType = "incremental" CoveragePartial CoverageType = "partial" )
Coverage types.
func AllCoverageTypes ¶
func AllCoverageTypes() []CoverageType
AllCoverageTypes returns every coverage type.
func (CoverageType) IsValid ¶
func (c CoverageType) IsValid() bool
IsValid reports whether c is a known coverage type.
type Criticality ¶
type Criticality string
Criticality is the business criticality of an asset.
const ( CriticalityCritical Criticality = "critical" CriticalityHigh Criticality = "high" CriticalityMedium Criticality = "medium" CriticalityLow Criticality = "low" )
Criticalities.
func AllCriticalities ¶
func AllCriticalities() []Criticality
AllCriticalities returns all valid criticalities.
func (Criticality) IsValid ¶
func (c Criticality) IsValid() bool
IsValid checks if the criticality is valid. Empty is valid (not stated).
func (Criticality) String ¶
func (c Criticality) String() string
String returns the string representation.
type DNSRecord ¶
type DNSRecord struct {
Type string `json:"type"`
Name string `json:"name"`
Value string `json:"value"`
TTL int `json:"ttl,omitempty"`
}
DNSRecord represents a DNS record. Type is the RR type verbatim (A, AAAA, CNAME, MX, TXT ...); TTL is in seconds.
type DNSRecordInput ¶
type DNSRecordInput struct {
Host string
RecordType string
Values []string
TTL int
Resolver string
StatusCode string
}
DNSRecordInput represents a DNS record.
type DataClassification ¶
type DataClassification string
DataClassification is a data classification level.
const ( DataPublic DataClassification = "public" DataInternal DataClassification = "internal" DataConfidential DataClassification = "confidential" DataRestricted DataClassification = "restricted" )
Data classification levels.
func AllDataClassifications ¶
func AllDataClassifications() []DataClassification
AllDataClassifications returns every data classification level.
func (DataClassification) IsValid ¶
func (d DataClassification) IsValid() bool
IsValid reports whether d is a known data classification.
type DataFlow ¶
type DataFlow struct {
// Taint source locations (where untrusted data enters)
Sources []DataFlowLocation `json:"sources,omitempty"`
// Intermediate variable locations (propagation path)
Intermediates []DataFlowLocation `json:"intermediates,omitempty"`
// Taint sink location (where data reaches dangerous function)
Sinks []DataFlowLocation `json:"sinks,omitempty"`
// Sanitizers applied (functions that clean/escape data)
Sanitizers []DataFlowLocation `json:"sanitizers,omitempty"`
// Whether the data is still tainted at the sink
// (false if properly sanitized before reaching sink)
IsTainted bool `json:"is_tainted"`
// Type of taint: user_input, file_read, env_var, network, database
TaintType string `json:"taint_type,omitempty"`
// Flow confidence score (0-100)
Confidence int `json:"confidence,omitempty"`
// Is interprocedural (crosses function boundaries)
IsInterprocedural bool `json:"is_interprocedural,omitempty"`
// Is cross-file (data flows across multiple files)
IsCrossFile bool `json:"is_cross_file,omitempty"`
// Call graph path (function names in order)
CallPath []string `json:"call_path,omitempty"`
// Summary of the flow for human readability
Summary string `json:"summary,omitempty"`
}
DataFlow represents taint analysis data flow trace. This structure captures the complete path from source to sink, including all intermediate steps and transformations.
func NewDataFlow ¶
func NewDataFlow(source, sink DataFlowLocation) *DataFlow
NewDataFlow creates a new DataFlow with the given source and sink.
func NormalizeDataFlow ¶
NormalizeDataFlow bounds, cleans and redacts df in place and returns it, or nil when no location is left.
- At most MaxDataFlowSteps locations are kept, in step order; the step indexes are renumbered 0..n-1 in that order.
- Text is cut at the limits above; control characters other than tab, newline and carriage return are removed.
- Paths become repository-relative POSIX paths: a file URI or an absolute path is made relative to the first of roots it lies under, else to the root a relative path elsewhere in the flow reveals (an absolute path ending in that relative path), else it is dropped. A path that leaves the repository ("../"), a non-file URI or an over-long path is dropped. The location itself is kept: its line and snippet still say what the step is.
- Snippets, labels and notes have credentials masked (RedactCodeSecrets).
- Tainted is true when the flow has both a source and a sink.
func (*DataFlow) AddIntermediate ¶
func (df *DataFlow) AddIntermediate(loc DataFlowLocation)
AddIntermediate adds an intermediate step to the dataflow path.
func (*DataFlow) AddSanitizer ¶
func (df *DataFlow) AddSanitizer(loc DataFlowLocation)
AddSanitizer adds a sanitizer location that cleans the tainted data.
func (*DataFlow) BuildSummary ¶
BuildSummary generates a human-readable summary of the dataflow.
func (*DataFlow) GetFullPath ¶
func (df *DataFlow) GetFullPath() []DataFlowLocation
GetFullPath returns all locations in order from source to sink.
func (*DataFlow) GetPathLength ¶
GetPathLength returns the number of steps in the dataflow.
func (*DataFlow) IsCrossFunction ¶
IsCrossFunction checks if the dataflow crosses function boundaries.
func (*DataFlow) MarkAsSanitized ¶
func (df *DataFlow) MarkAsSanitized()
MarkAsSanitized marks the dataflow as no longer tainted.
type DataFlowLocation ¶
type DataFlowLocation struct {
// File path
Path string `json:"path,omitempty"`
// Line number (1-indexed)
Line int `json:"line,omitempty"`
// End line (for multi-line spans)
EndLine int `json:"end_line,omitempty"`
// Column number (1-indexed)
Column int `json:"column,omitempty"`
// End column
EndColumn int `json:"end_column,omitempty"`
// Code content at this location
Content string `json:"content,omitempty"`
// Surrounding code and the line it starts at: a few lines before and
// after the step, read by a producer that has the source (codesnippet).
ContextSnippet string `json:"context_snippet,omitempty"`
ContextStartLine int `json:"context_start_line,omitempty"`
// Variable or expression name
Label string `json:"label,omitempty"`
// Step index in the flow (for ordering, 0-indexed)
Index int `json:"index,omitempty"`
// Location type: source, sink, propagator, sanitizer, transform
Type DataFlowLocationType `json:"type,omitempty"`
// Function/method name containing this location
Function string `json:"function,omitempty"`
// Class/struct name (if applicable)
ClassName string `json:"class_name,omitempty"`
// Module/namespace
Module string `json:"module,omitempty"`
// The operation performed: assignment, call, return, parameter, concat, etc.
Operation string `json:"operation,omitempty"`
// For function calls: the function being called
CalledFunction string `json:"called_function,omitempty"`
// For parameters: the parameter index (0-indexed)
ParameterIndex int `json:"parameter_index,omitempty"`
// Taint state at this location: tainted, sanitized, unknown
TaintState string `json:"taint_state,omitempty"`
// Transformation applied: encode, decode, escape, hash, encrypt, etc.
Transformation string `json:"transformation,omitempty"`
// Notes for human understanding
Notes string `json:"notes,omitempty"`
}
DataFlowLocation represents a location in a data flow trace.
func NewDataFlowLocation ¶
func NewDataFlowLocation(path string, line, column int, content string) DataFlowLocation
NewDataFlowLocation creates a new DataFlowLocation.
func (DataFlowLocation) AsSanitizer ¶
func (loc DataFlowLocation) AsSanitizer() DataFlowLocation
AsSanitizer marks this location as a sanitizer.
func (DataFlowLocation) AsSink ¶
func (loc DataFlowLocation) AsSink() DataFlowLocation
AsSink marks this location as a taint sink.
func (DataFlowLocation) AsSource ¶
func (loc DataFlowLocation) AsSource() DataFlowLocation
AsSource marks this location as a taint source.
func (DataFlowLocation) WithFunction ¶
func (loc DataFlowLocation) WithFunction(fn string) DataFlowLocation
WithFunction sets the function context for the location.
func (DataFlowLocation) WithLabel ¶
func (loc DataFlowLocation) WithLabel(label string) DataFlowLocation
WithLabel sets the label for the location.
func (DataFlowLocation) WithOperation ¶
func (loc DataFlowLocation) WithOperation(op string) DataFlowLocation
WithOperation sets the operation type for the location.
type DataFlowLocationType ¶
type DataFlowLocationType string
DataFlowLocationType represents the type of a location in dataflow.
const ( // DataFlowLocationSource is where untrusted data enters the system DataFlowLocationSource DataFlowLocationType = "source" // DataFlowLocationSink is where data reaches a dangerous function DataFlowLocationSink DataFlowLocationType = "sink" // DataFlowLocationPropagator is where data is passed/assigned DataFlowLocationPropagator DataFlowLocationType = "propagator" // DataFlowLocationSanitizer is where data is cleaned/escaped DataFlowLocationSanitizer DataFlowLocationType = "sanitizer" // DataFlowLocationTransform is where data is transformed (not sanitized) DataFlowLocationTransform DataFlowLocationType = "transform" )
func AllDataFlowLocationTypes ¶
func AllDataFlowLocationTypes() []DataFlowLocationType
AllDataFlowLocationTypes returns every valid data flow location type.
type DeFiDetails ¶
type DeFiDetails struct {
// Protocol name: uniswap, aave, compound, etc.
ProtocolName string `json:"protocol_name,omitempty"`
// Protocol type: dex, lending, yield, bridge, derivatives, etc.
ProtocolType string `json:"protocol_type,omitempty"`
// Protocol version
Version string `json:"version,omitempty"`
// Total Value Locked (TVL) in USD
TVLUSD float64 `json:"tvl_usd,omitempty"`
// Supported chains
SupportedChains []string `json:"supported_chains,omitempty"`
// Core contracts
CoreContracts []CoreContract `json:"core_contracts,omitempty"`
// Governance token address
GovernanceToken string `json:"governance_token,omitempty"`
// Is audited
IsAudited bool `json:"is_audited,omitempty"`
// Audit reports
AuditReports []AuditReport `json:"audit_reports,omitempty"`
// Has bug bounty
HasBugBounty bool `json:"has_bug_bounty,omitempty"`
// Bug bounty platform: immunefi, hackerone, etc.
BugBountyPlatform string `json:"bug_bounty_platform,omitempty"`
// Max bug bounty payout
MaxBountyUSD float64 `json:"max_bounty_usd,omitempty"`
// Timelock duration (for governance)
TimelockSeconds int `json:"timelock_seconds,omitempty"`
// Is paused
IsPaused bool `json:"is_paused,omitempty"`
}
DeFiDetails contains DeFi protocol-specific details.
type Dependency ¶
type Dependency struct {
// Document-local reference. Never UUID-shaped.
ID string `json:"id,omitempty"`
// Component name (required) and version.
Name string `json:"name"`
Version string `json:"version,omitempty"`
// Component type (CycloneDX component types, verbatim).
Type DependencyType `json:"type,omitempty"`
// Package URL.
PURL string `json:"purl,omitempty"`
// The producer's own id of the component (a CycloneDX bom-ref, an SPDX
// element id).
SourceID string `json:"source_id,omitempty"`
// SPDX license ids or expressions.
Licenses []string `json:"licenses,omitempty"`
// Place in the dependency graph: root, direct, transitive.
Relationship DependencyRelationship `json:"relationship,omitempty"`
// Ids of the dependencies of this report this one depends on.
DependsOn []string `json:"depends_on,omitempty"`
// Where the component is declared (manifest, lock file).
Locations []DependencyLocation `json:"locations,omitempty"`
// The asset of this report the component was found in.
AssetRef string `json:"asset_ref,omitempty"`
// Opaque bag; no meaning.
Properties Properties `json:"properties,omitempty"`
// Namespaced producer data.
Extensions Extensions `json:"extensions,omitempty"`
}
Dependency is a software component (SBOM). Its identity is the versionless purl; the ecosystem is the purl type.
type DependencyLocation ¶
type DependencyLocation struct {
Path string `json:"path,omitempty"`
StartLine int `json:"start_line,omitempty"`
EndLine int `json:"end_line,omitempty"`
StartColumn int `json:"start_column,omitempty"`
EndColumn int `json:"end_column,omitempty"`
}
DependencyLocation is a place in a file where a component is declared.
type DependencyRelationship ¶
type DependencyRelationship string
DependencyRelationship is the place of a component in the graph.
const ( DependencyRoot DependencyRelationship = "root" DependencyDirect DependencyRelationship = "direct" DependencyTransitive DependencyRelationship = "transitive" )
Dependency relationships.
func AllDependencyRelationships ¶
func AllDependencyRelationships() []DependencyRelationship
AllDependencyRelationships returns every dependency relationship.
func (DependencyRelationship) IsValid ¶
func (r DependencyRelationship) IsValid() bool
IsValid reports whether r is a known relationship.
type DependencyType ¶
type DependencyType string
DependencyType is a CycloneDX component type, verbatim.
const ( DependencyTypeApplication DependencyType = "application" DependencyTypeFramework DependencyType = "framework" DependencyTypeLibrary DependencyType = "library" DependencyTypeContainer DependencyType = "container" DependencyTypePlatform DependencyType = "platform" DependencyTypeOperatingSystem DependencyType = "operating-system" DependencyTypeDevice DependencyType = "device" DependencyTypeDeviceDriver DependencyType = "device-driver" DependencyTypeFirmware DependencyType = "firmware" DependencyTypeFile DependencyType = "file" DependencyTypeMachineLearning DependencyType = "machine-learning-model" DependencyTypeData DependencyType = "data" DependencyTypeCryptographicAst DependencyType = "cryptographic-asset" )
Dependency types.
func AllDependencyTypes ¶
func AllDependencyTypes() []DependencyType
AllDependencyTypes returns every dependency type.
func (DependencyType) IsValid ¶
func (t DependencyType) IsValid() bool
IsValid reports whether t is a known dependency type.
type DetectionType ¶
type DetectionType string
DetectionType says how sure the source is that the issue is present.
const ( // The source verified the issue (a Qualys Confirmed detection). DetectionTypeConfirmed DetectionType = "confirmed" // The source could not verify it (a Qualys Potential detection, a // version-only match). DetectionTypePotential DetectionType = "potential" // Information gathered, not a vulnerability. DetectionTypeInfo DetectionType = "info" )
func AllDetectionTypes ¶
func AllDetectionTypes() []DetectionType
AllDetectionTypes returns every valid detection type.
func NormalizeDetectionType ¶
func NormalizeDetectionType(native string) (DetectionType, bool)
NormalizeDetectionType maps a native detection type (Qualys TYPE Confirmed / Potential / Info, "vuln", "ig", ...) to a DetectionType.
func (DetectionType) IsValid ¶
func (d DetectionType) IsValid() bool
IsValid reports whether d is a recognized detection type.
type DiscoveredURLInput ¶
type DiscoveredURLInput struct {
URL string
Method string
Source string
StatusCode int
Depth int
Parent string
Type string
Extension string
// ContentType of the response (1.6 endpoints).
ContentType string
// Params are parameters seen besides the query: form fields, JSON
// members, headers. Names only.
Params []EndpointParam
// Forms are the HTML forms of the page. Each becomes a form endpoint
// with its field names; values are not carried.
Forms []WebFormInput
}
DiscoveredURLInput represents a discovered URL/endpoint.
type DomainTechnical ¶
type DomainTechnical struct {
// Registrar.
Registrar string `json:"registrar,omitempty"`
// Registration and expiry times.
RegisteredAt *time.Time `json:"registered_at,omitempty"`
ExpiresAt *time.Time `json:"expires_at,omitempty"`
// Nameservers (canonical domain names).
Nameservers []string `json:"nameservers,omitempty"`
// DNS records.
DNSRecords []DNSRecord `json:"dns_records,omitempty"`
// WHOIS data, as key/value strings.
WHOIS map[string]string `json:"whois,omitempty"`
}
DomainTechnical contains domain-specific technical details.
type Effort ¶
type Effort string
Effort is the effort of a fix.
type Endpoint ¶
type Endpoint struct {
// ID names the endpoint within the report (finding.web.endpoint_ref).
ID string `json:"id,omitempty"`
// Origin is the normalised origin, "https://api.example.com".
Origin string `json:"origin"`
// OriginRef names the web_origin asset of the origin in this report.
OriginRef string `json:"origin_ref,omitempty"`
// Method is an HTTP method, or ANY when unknown.
Method string `json:"method,omitempty"`
// Path is the concrete path, without query or fragment.
Path string `json:"path"`
// Template is the producer's path template; a receiver recomputes it.
Template string `json:"template,omitempty"`
Kind EndpointKind `json:"kind,omitempty"`
Source EndpointSource `json:"source,omitempty"`
// ParentURL is the page the endpoint was found on, redacted (no query
// values, user info or fragment).
ParentURL string `json:"parent_url,omitempty"`
StatusCode int `json:"status_code,omitempty"`
ContentType string `json:"content_type,omitempty"`
Auth EndpointAuth `json:"auth,omitempty"`
Technologies []Technology `json:"technologies,omitempty"`
// Params are the parameters the endpoint takes: names and hints,
// never values.
Params []EndpointParam `json:"params,omitempty"`
// Namespaced producer data.
Extensions Extensions `json:"extensions,omitempty"`
}
Endpoint is one method and path a web origin serves, as a tool saw it.
func ConvertEndpoints ¶
func ConvertEndpoints(urls []DiscoveredURLInput) []Endpoint
ConvertEndpoints converts discovered URLs to endpoints only, without the web_origin assets ConvertReconToCTIS also adds. It is for callers that read a large URL list (an import) and need the endpoints alone. URLs that do not parse are left out; at most MaxEndpoints are returned.
type EndpointAuth ¶
type EndpointAuth string
EndpointAuth is whether an endpoint asked for authentication.
const ( EndpointAuthNone EndpointAuth = "none" EndpointAuthRequired EndpointAuth = "required" EndpointAuthRedirectLogin EndpointAuth = "redirect_login" EndpointAuthUnknown EndpointAuth = "unknown" )
Endpoint authentication states.
func AllEndpointAuths ¶
func AllEndpointAuths() []EndpointAuth
AllEndpointAuths returns every endpoint authentication state.
type EndpointKind ¶
type EndpointKind string
EndpointKind is what an endpoint serves.
const ( EndpointKindPage EndpointKind = "page" EndpointKindAPI EndpointKind = "api" EndpointKindScript EndpointKind = "script" EndpointKindForm EndpointKind = "form" EndpointKindGraphQL EndpointKind = "graphql" EndpointKindWebSocket EndpointKind = "websocket" EndpointKindStatic EndpointKind = "static" EndpointKindOther EndpointKind = "other" )
Endpoint kinds.
func AllEndpointKinds ¶
func AllEndpointKinds() []EndpointKind
AllEndpointKinds returns every endpoint kind.
type EndpointParam ¶
type EndpointParam struct {
Location ParamLocation `json:"location"`
Name string `json:"name"`
TypeHint string `json:"type_hint,omitempty"`
IsRequired bool `json:"is_required,omitempty"`
}
EndpointParam is one parameter of an endpoint. It has no value member: a value is refused by every strict receiver.
type EndpointSource ¶
type EndpointSource string
EndpointSource is how an endpoint was found.
const ( EndpointSourceCrawl EndpointSource = "crawl" EndpointSourceJS EndpointSource = "js" EndpointSourceSitemap EndpointSource = "sitemap" EndpointSourceRobots EndpointSource = "robots" EndpointSourceSpec EndpointSource = "spec" EndpointSourceHAR EndpointSource = "har" EndpointSourceArchive EndpointSource = "archive" EndpointSourceDAST EndpointSource = "dast" EndpointSourceProbe EndpointSource = "probe" // EndpointSourceImport: read from a results file a person or another // tool exported (a recon directory), not seen by a probe of ours. EndpointSourceImport EndpointSource = "import" )
Endpoint sources.
func AllEndpointSources ¶
func AllEndpointSources() []EndpointSource
AllEndpointSources returns every endpoint source.
type Environment ¶
type Environment string
Environment is the deployment environment of an asset.
const ( EnvironmentProduction Environment = "production" EnvironmentStaging Environment = "staging" EnvironmentDevelopment Environment = "development" EnvironmentTest Environment = "test" EnvironmentUnknown Environment = "unknown" )
Environments. unknown is the fallback for a value a receiver does not know.
func AllEnvironments ¶
func AllEnvironments() []Environment
AllEnvironments returns every environment.
func (Environment) IsValid ¶
func (e Environment) IsValid() bool
IsValid reports whether e is a known environment.
type EvidenceArtifact ¶
type EvidenceArtifact struct {
MediaType string `json:"media_type"`
SHA256 string `json:"sha256"`
Size int64 `json:"size,omitempty"`
Ref string `json:"ref,omitempty"`
}
EvidenceArtifact names binary evidence stored apart from the report.
type EvidenceFile ¶
type EvidenceFile struct {
Path string `json:"path"`
StartLine int `json:"start_line,omitempty"`
EndLine int `json:"end_line,omitempty"`
Snippet string `json:"snippet,omitempty"`
}
EvidenceFile is an excerpt of a file.
type EvidenceHTTP ¶
type EvidenceHTTP struct {
Request *EvidenceRequest `json:"request,omitempty"`
Response *EvidenceResponse `json:"response,omitempty"`
}
EvidenceHTTP is one HTTP request and its response.
type EvidenceHeader ¶
EvidenceHeader is one header, in captured order.
type EvidenceItem ¶
type EvidenceItem struct {
// Kind is a known kind or another ^[a-z0-9][a-z0-9_.-]{0,63}$ name.
Kind string `json:"kind"`
// Version of the kind's body format (1).
Version int `json:"version,omitempty"`
Label string `json:"label,omitempty"`
CapturedAt *time.Time `json:"captured_at,omitempty"`
// ContentSHA256 is "sha256:<hex>" over the item as captured, before any
// masking or truncation.
ContentSHA256 string `json:"content_sha256,omitempty"`
// http_exchange
HTTP *EvidenceHTTP `json:"http,omitempty"`
// Match locates what matched in the request or the response.
Match []EvidenceMatch `json:"match,omitempty"`
// Extracted are values the tool extracted (versions, banners).
Extracted []string `json:"extracted,omitempty"`
// Text is the content of raw_text, command_output and curl items.
Text string `json:"text,omitempty"`
// Protocol of raw_text ("dns", "tls", "ssh", "banner", "smtp", ...).
Protocol string `json:"protocol,omitempty"`
// command_output
Command string `json:"command,omitempty"`
ExitCode *int `json:"exit_code,omitempty"`
// file_excerpt
File *EvidenceFile `json:"file,omitempty"`
// screenshot (and any binary evidence)
Artifact *EvidenceArtifact `json:"artifact,omitempty"`
// Data holds the fields of a kind this module does not know; empty for
// known kinds.
Data map[string]any `json:"data,omitempty"`
// Sensitive marks the spans that hold secrets or personal data.
Sensitive []SensitiveSpan `json:"sensitive,omitempty"`
}
EvidenceItem is one piece of evidence.
func CurlEvidence ¶
func CurlEvidence(command string) (EvidenceItem, bool)
CurlEvidence is a curl item holding the command, capped. Call MarkSensitive with the exchange it reproduces to mark the values the command repeats.
func HTTPExchange ¶
func HTTPExchange(req, resp *HTTPMessageParts) (EvidenceItem, bool)
HTTPExchange builds an http_exchange evidence item from the two sides of an exchange, capped (FitEvidenceItem) and with sensitive values marked (MarkSensitive). A request needs a method or a target; a response needs a status, a header or a body. It returns false when neither side qualifies, and when a sensitive value could not be marked (the item is refused rather than written with a value unmarked).
func HTTPExchangeFromHAR ¶
func HTTPExchangeFromHAR(entry []byte) (EvidenceItem, error)
HTTPExchangeFromHAR builds an http_exchange item from one HAR 1.2 entry (log.entries[i]). The item is capped and its sensitive values are marked.
func HTTPExchangeFromRaw ¶
func HTTPExchangeFromRaw(request, response, baseURL string) (EvidenceItem, bool)
HTTPExchangeFromRaw builds an http_exchange item from a raw HTTP/1.x request and response as a tool printed them. A relative request target is resolved against baseURL. It reports false when neither part holds an HTTP message. The item is capped and its sensitive values are marked.
type EvidenceMatch ¶
type EvidenceMatch struct {
Location string `json:"location"`
Part string `json:"part"`
Start *int `json:"start,omitempty"`
End *int `json:"end,omitempty"`
Matcher string `json:"matcher,omitempty"`
}
EvidenceMatch locates what a matcher matched. Start and End are byte offsets into the part as sent.
type EvidenceRequest ¶
type EvidenceRequest struct {
Method string `json:"method,omitempty"`
URL string `json:"url,omitempty"`
HTTPVersion string `json:"http_version,omitempty"`
Headers []EvidenceHeader `json:"headers,omitempty"`
Body string `json:"body,omitempty"`
BodyEncoding string `json:"body_encoding,omitempty"`
BodyTruncated bool `json:"body_truncated,omitempty"`
BodySize int64 `json:"body_size,omitempty"`
}
EvidenceRequest is a captured HTTP request.
type EvidenceResponse ¶
type EvidenceResponse struct {
Status int `json:"status,omitempty"`
Reason string `json:"reason,omitempty"`
HTTPVersion string `json:"http_version,omitempty"`
Headers []EvidenceHeader `json:"headers,omitempty"`
Body string `json:"body,omitempty"`
BodyEncoding string `json:"body_encoding,omitempty"`
BodyTruncated bool `json:"body_truncated,omitempty"`
BodySize int64 `json:"body_size,omitempty"`
TimeMs int64 `json:"time_ms,omitempty"`
}
EvidenceResponse is a captured HTTP response.
type ExposureVector ¶
type ExposureVector string
ExposureVector is an attack vector in the CVSS AV vocabulary.
const ( VectorNetwork ExposureVector = "network" VectorAdjacent ExposureVector = "adjacent" VectorLocal ExposureVector = "local" VectorPhysical ExposureVector = "physical" )
Exposure vectors.
func AllExposureVectors ¶
func AllExposureVectors() []ExposureVector
AllExposureVectors returns every exposure vector.
func (ExposureVector) IsValid ¶
func (v ExposureVector) IsValid() bool
IsValid reports whether v is a known exposure vector.
type Extensions ¶
Extensions holds namespaced producer data: each key is a reverse-DNS namespace and each value an object whose members that namespace defines. A receiver validates a namespace it knows and ignores one it does not.
func (Extensions) Get ¶
func (e Extensions) Get(ns, key string) (any, bool)
Get returns the value under key in namespace ns.
func (*Extensions) Set ¶
func (e *Extensions) Set(ns, key string, value any)
Set stores value under key in namespace ns, creating the maps it needs.
type Finding ¶
type Finding struct {
// Document-local reference. Never UUID-shaped, never a receiver's key.
ID string `json:"id,omitempty"`
// Finding type (required).
Type FindingType `json:"type"`
// Short title (required, plain text).
Title string `json:"title"`
// Detailed description (plain text).
Description string `json:"description,omitempty"`
// Primary message (plain text), distinct from title and description.
Message string `json:"message,omitempty"`
// Severity (required).
Severity Severity `json:"severity"`
// How sure the producer is, 0-100.
Confidence int `json:"confidence,omitempty"`
// Finding category.
Category string `json:"category,omitempty"`
// Vulnerability classes ("SQL Injection", "XSS").
VulnerabilityClasses []string `json:"vulnerability_classes,omitempty"`
// Subcategories ("audit", "vuln", "secure default").
Subcategories []string `json:"subcategories,omitempty"`
// Rule or check that detected the finding.
RuleID string `json:"rule_id,omitempty"`
RuleName string `json:"rule_name,omitempty"`
// The rule of this report's rules[] that detected the finding. When
// set, rule_id is required and equals the rule's rule_id.
RuleRef string `json:"rule_ref,omitempty"`
// The asset of this report the finding is on (required).
AssetRef string `json:"asset_ref"`
// Code location.
Location *FindingLocation `json:"location,omitempty"`
// Network location: the host, port and protocol the finding was
// observed on.
Network *NetworkLocation `json:"network,omitempty"`
// Where on a web origin the finding was observed.
Web *WebLocation `json:"web,omitempty"`
// Type-specific details.
Vulnerability *VulnerabilityDetails `json:"vulnerability,omitempty"`
Secret *SecretDetails `json:"secret,omitempty"`
Misconfiguration *MisconfigurationDetails `json:"misconfiguration,omitempty"`
Compliance *ComplianceDetails `json:"compliance,omitempty"`
// Web3 details (web3 profile) on a vulnerability or weakness finding.
Web3 *Web3VulnerabilityDetails `json:"web3,omitempty"`
// Remediation guidance.
Remediation *Remediation `json:"remediation,omitempty"`
// References (http or https URLs). Receivers never fetch them.
References []string `json:"references,omitempty"`
// Tags.
Tags []string `json:"tags,omitempty"`
// The producer's fingerprint (recipe ctis-fp/2). Receivers recompute
// it and never trust it as a key.
Fingerprint string `json:"fingerprint,omitempty"`
// Contributing identity components (SARIF partialFingerprints).
PartialFingerprints map[string]string `json:"partial_fingerprints,omitempty"`
// Groups logically identical results across runs (SARIF
// correlationGuid), the producer's own.
CorrelationID string `json:"correlation_id,omitempty"`
// Status relative to the producer's previous run (SARIF baselineState):
// new, unchanged, updated, absent.
BaselineState string `json:"baseline_state,omitempty"`
// Evaluation state (SARIF kind): not_applicable, pass, fail, review,
// open, informational. A compliance result is a kind.
Kind string `json:"kind,omitempty"`
// Priority 0-100 (SARIF rank).
Rank float64 `json:"rank,omitempty"`
// How often the result was observed (SARIF occurrenceCount).
OccurrenceCount int `json:"occurrence_count,omitempty"`
// SARIF relatedLocations, stacks, attachments, workItemUris,
// hostedViewerUri.
RelatedLocations []*FindingLocation `json:"related_locations,omitempty"`
Stacks []*StackTrace `json:"stacks,omitempty"`
Attachments []*Attachment `json:"attachments,omitempty"`
WorkItemURIs []string `json:"work_item_uris,omitempty"`
HostedViewerURI string `json:"hosted_viewer_uri,omitempty"`
// When the producer first and last observed the finding.
FirstSeenAt *time.Time `json:"first_seen_at,omitempty"`
LastSeenAt *time.Time `json:"last_seen_at,omitempty"`
// Status hint from the producer.
Status FindingStatus `json:"status,omitempty"`
// Taint trace (source to sink).
DataFlow *DataFlow `json:"data_flow,omitempty"`
// Suppression (SARIF suppressions).
Suppression *Suppression `json:"suppression,omitempty"`
// Exposure of the finding.
Exposure *FindingExposure `json:"exposure,omitempty"`
// The finding as the source tool names it.
Native *NativeIdentity `json:"native,omitempty"`
// Every score of the finding with its source and date: CVSS (each
// version), EPSS, SSVC, vendor ratings.
Scores []Score `json:"scores,omitempty"`
// Exploitability statement (VEX).
VEX *VEX `json:"vex,omitempty"`
// The finding's history as the source tracks it.
SourceLifecycle *SourceLifecycle `json:"source_lifecycle,omitempty"`
// Source fields no CTIS member holds, as strings. Bounded: at most 64
// entries, keys of 128 and values of 4096 bytes, 32 KiB in all. Use
// SetSourceExtra.
SourceExtra map[string]string `json:"source_extra,omitempty"`
// MITRE ATT&CK technique ids the finding enables ("T1190"), at most 20.
AttackTechniqueIDs []string `json:"attack_technique_ids,omitempty"`
// CAPEC attack pattern ids ("CAPEC-66").
CAPECIDs []string `json:"capec_ids,omitempty"`
// Typed evidence (at most 20): HTTP exchanges, raw text, command
// output, file excerpts, artifacts. Sensitive values only inside spans
// marked in their sensitive list.
EvidenceItems []EvidenceItem `json:"evidence_items,omitempty"`
// Overrides the report's tool for this finding.
Tool *Tool `json:"tool,omitempty"`
// Overrides the tool's techniques for this finding.
Technique Technique `json:"technique,omitempty"`
// Whether and how the finding was shown to be exploitable.
Validation *FindingValidation `json:"validation,omitempty"`
// The dependency of this report the finding affects.
DependencyRef string `json:"dependency_ref,omitempty"`
// The producer's own identifiers of the finding in its own systems.
SourceRefs []SourceRef `json:"source_refs,omitempty"`
// Opaque bag; no meaning.
Properties Properties `json:"properties,omitempty"`
// Namespaced producer data.
Extensions Extensions `json:"extensions,omitempty"`
}
Finding is a security finding on one asset of the report.
func (*Finding) SetVerificationHold ¶ added in v2.0.5
func (f *Finding) SetVerificationHold(h VerificationHold) error
SetVerificationHold stores h under extensions["io.openctem"] of the finding, after checking it.
func (*Finding) VerificationHold ¶ added in v2.0.5
func (f *Finding) VerificationHold() (h VerificationHold, ok bool, err error)
VerificationHold returns the finding's hold: ok is false when it has none. A value that is not a valid hold (a decoded document is producer input) is an error, never a silent "not held".
type FindingExposure ¶
type FindingExposure struct {
// Attack vector (CVSS AV vocabulary): network, adjacent, local,
// physical.
Vector ExposureVector `json:"vector,omitempty"`
// Reachability. Absent means unknown; false means verified not
// reachable.
IsNetworkAccessible *bool `json:"is_network_accessible,omitempty"`
IsInternetAccessible *bool `json:"is_internet_accessible,omitempty"`
// Prerequisites for exploitation (plain text).
AttackPrerequisites string `json:"attack_prerequisites,omitempty"`
}
FindingExposure contains exposure information for a finding.
type FindingLocation ¶
type FindingLocation struct {
// File path, case kept.
Path string `json:"path,omitempty"`
StartLine int `json:"start_line,omitempty"`
EndLine int `json:"end_line,omitempty"`
StartColumn int `json:"start_column,omitempty"`
EndColumn int `json:"end_column,omitempty"`
// Code snippet.
Snippet string `json:"snippet,omitempty"`
// Branch name.
Branch string `json:"branch,omitempty"`
// The commit that introduced the finding. Author fields are personal
// data.
Commit *CommitInfo `json:"commit,omitempty"`
// Logical location (function, class, method).
LogicalLocation *LogicalLocation `json:"logical_location,omitempty"`
// Surrounding code and the line it starts at.
ContextSnippet string `json:"context_snippet,omitempty"`
ContextStartLine int `json:"context_start_line,omitempty"`
}
FindingLocation contains location information for code-based findings.
type FindingStatus ¶
type FindingStatus string
FindingStatus represents the status of a finding.
const ( FindingStatusOpen FindingStatus = "open" FindingStatusResolved FindingStatus = "resolved" FindingStatusSuppressed FindingStatus = "suppressed" FindingStatusFalsePositive FindingStatus = "false_positive" FindingStatusAcceptedRisk FindingStatus = "accepted_risk" FindingStatusInProgress FindingStatus = "in_progress" )
Finding statuses.
func AllFindingStatuses ¶
func AllFindingStatuses() []FindingStatus
AllFindingStatuses returns every valid finding status.
func (FindingStatus) IsValid ¶
func (s FindingStatus) IsValid() bool
IsValid reports whether s is a recognized finding status.
type FindingType ¶
type FindingType string
FindingType represents the type of a finding.
const ( FindingTypeVulnerability FindingType = "vulnerability" // a known vulnerability (advisory id) FindingTypeWeakness FindingType = "weakness" // a code or design weakness without an advisory id FindingTypeSecret FindingType = "secret" // an exposed credential FindingTypeMisconfiguration FindingType = "misconfiguration" // a setting that weakens security FindingTypeCompliance FindingType = "compliance" // a control evaluation FindingTypeExposure FindingType = "exposure" // something reachable that should not be FindingTypeMalware FindingType = "malware" // malicious code or package FindingTypeLicense FindingType = "license" // license policy violation )
Finding types.
func AllFindingTypes ¶
func AllFindingTypes() []FindingType
AllFindingTypes returns all valid finding types.
func (FindingType) IsValid ¶
func (t FindingType) IsValid() bool
IsValid checks if the finding type is valid.
func (FindingType) String ¶
func (t FindingType) String() string
String returns the string representation.
type FindingValidation ¶
type FindingValidation struct {
Status ValidationStatus `json:"status"`
Method ValidationMethod `json:"method,omitempty"`
ValidatedAt *time.Time `json:"validated_at,omitempty"`
Validator string `json:"validator,omitempty"`
EvidenceRefs []string `json:"evidence_refs,omitempty"`
Notes string `json:"notes,omitempty"`
}
FindingValidation says whether and how a finding was shown to be exploitable. Validator is personal data.
type FixRegex ¶
type FixRegex struct {
Regex string `json:"regex,omitempty"`
Replacement string `json:"replacement,omitempty"`
// Number of replacements (0: all).
Count int `json:"count,omitempty"`
}
FixRegex contains regex-based auto-fix information.
type FlashLoanIssue ¶
type FlashLoanIssue struct {
// Flash loan provider: aave, dydx, uniswap, balancer
Provider string `json:"provider,omitempty"`
// Attack type: price_manipulation, governance_attack, collateral_theft
AttackType string `json:"attack_type,omitempty"`
// Required capital for attack
RequiredCapitalUSD float64 `json:"required_capital_usd,omitempty"`
// Potential profit
PotentialProfitUSD float64 `json:"potential_profit_usd,omitempty"`
// Attack steps
AttackSteps []string `json:"attack_steps,omitempty"`
}
FlashLoanIssue contains details about flash loan attack vulnerabilities.
type GasIssue ¶
type GasIssue struct {
// Current gas cost
CurrentGas int64 `json:"current_gas,omitempty"`
// Optimized gas cost
OptimizedGas int64 `json:"optimized_gas,omitempty"`
// Gas savings percentage
SavingsPercent float64 `json:"savings_percent,omitempty"`
// Optimization suggestion
Suggestion string `json:"suggestion,omitempty"`
}
GasIssue contains details about gas optimization issues.
type Geolocation ¶
type Geolocation struct {
Latitude float64 `json:"latitude"`
Longitude float64 `json:"longitude"`
Accuracy float64 `json:"accuracy,omitempty"`
}
Geolocation contains geographic coordinates; accuracy is in meters.
type HTTPMessageParts ¶
type HTTPMessageParts struct {
// Request only.
Method string
Target string
// Response only. Reason is the reason phrase.
Status int
Reason string
// HTTPVersion as "HTTP/1.1"; empty when unknown.
HTTPVersion string
Headers map[string]string
// Body is the decoded body. A non-nil Body that is empty states a body
// member without content.
Body *string
}
HTTPMessageParts is one side of an HTTP exchange as a converter read it from another format: the members it found, still raw. HTTPExchange cleans, caps and marks them.
type HTTPTechnical ¶
type HTTPTechnical struct {
// Status code of the probe's response.
StatusCode int `json:"status_code,omitempty"`
// Page title and server header (plain text).
Title string `json:"title,omitempty"`
WebServer string `json:"web_server,omitempty"`
// Content type of the response.
ContentType string `json:"content_type,omitempty"`
// TLS version the origin negotiated (https origins).
TLSVersion TLSVersion `json:"tls_version,omitempty"`
// Where the origin redirects to (http or https URL).
RedirectURL string `json:"redirect_url,omitempty"`
// Content delivery network and web application firewall in front of
// the origin, as open tokens (cloudflare, akamai).
CDN string `json:"cdn,omitempty"`
WAF string `json:"waf,omitempty"`
// TLS server fingerprints (JARM) and the favicon hash (MurmurHash3 of
// the base64 body), as the probe computed them.
JARM string `json:"jarm,omitempty"`
FaviconMMH3 string `json:"favicon_mmh3,omitempty"`
// Security response headers the origin sets.
SecurityHeaders *SecurityHeaders `json:"security_headers,omitempty"`
}
HTTPTechnical is what a probe saw on a web origin.
type IPAddressTechnical ¶
type IPAddressTechnical struct {
// IP version: 4 or 6.
Version int `json:"version,omitempty"`
// Hostname (if resolved).
Hostname string `json:"hostname,omitempty"`
// Autonomous system number and organization.
ASN int `json:"asn,omitempty"`
ASNOrg string `json:"asn_org,omitempty"`
// ISO 3166-1 alpha-2 country code.
Country string `json:"country,omitempty"`
// City.
City string `json:"city,omitempty"`
// Geolocation.
Geolocation *Geolocation `json:"geolocation,omitempty"`
}
IPAddressTechnical contains IP address-specific technical details. Open ports are service assets linked by exposes.
type IdentityHints ¶
type IdentityHints struct {
// Fully qualified DNS name the scanner resolved.
FQDN string `json:"fqdn,omitempty"`
// NetBIOS name.
NetBIOSName string `json:"netbios_name,omitempty"`
// MAC addresses observed.
MACAddresses []string `json:"mac_addresses,omitempty"`
// CPE of the detected operating system (cpe:/o:... or cpe:2.3:o:...).
OSCPE string `json:"os_cpe,omitempty"`
// Cloud resource id the scanner reported (instance id, ARN).
CloudResourceID string `json:"cloud_resource_id,omitempty"`
// Id of the scanner's own agent installed on the host (a Nessus or
// Qualys agent UUID). Unique per scanner, not across scanners. The Go
// name says whose agent it is, so it is not read as a receiver's own
// endpoint software.
ScannerAgentID string `json:"agent_id,omitempty"`
}
IdentityHints are what a scanner observed about a host that helps match it to the same host seen by another tool. Unlike AssetIdentifiers, which are read from the asset itself and trusted as identity, hints are remote observations (a NetBIOS name from a probe, a MAC from an ARP table) and a receiver weighs them accordingly.
type IdentityKind ¶
type IdentityKind string
IdentityKind is the kind of an identity.
const ( IdentityUser IdentityKind = "user" IdentityServiceAccount IdentityKind = "service_account" IdentityRole IdentityKind = "role" IdentityGroup IdentityKind = "group" IdentityWorkload IdentityKind = "workload" )
Identity kinds.
func AllIdentityKinds ¶
func AllIdentityKinds() []IdentityKind
AllIdentityKinds returns every identity kind.
func (IdentityKind) IsValid ¶
func (k IdentityKind) IsValid() bool
IsValid reports whether k is a known identity kind.
type IdentityTechnical ¶
type IdentityTechnical struct {
// Kind (required): user, service_account, role, group, workload.
Kind IdentityKind `json:"kind"`
// Identity provider: an open token (aws, azure, gcp, okta, ldap).
Provider string `json:"provider,omitempty"`
}
IdentityTechnical describes an identity asset.
type LiveHostInput ¶
type LiveHostInput struct {
URL string
Host string
IP string
Port int
Scheme string
StatusCode int
ContentLength int64
Title string
WebServer string
ContentType string
Technologies []string
CDN string
TLSVersion string
Redirect string
ResponseTime int64
// CDNType is what CDN names: "cdn", "waf" or "cloud" (httpx cdn_type).
CDNType string
// TLS is the leaf certificate seen in the TLS handshake (httpx
// -tls-grab); nil when the probe did not grab one.
TLS *TLSLeafInput
// FaviconMMH3 is the mmh3 hash of the favicon (httpx -favicon), as
// Shodan prints it: a signed 32-bit decimal.
FaviconMMH3 string
// JARM is the JARM TLS server fingerprint (62 hex characters).
JARM string
// ASN is the autonomous system of the host's address (httpx -asn).
ASN *ASNInput
// ResponseHeaders is the posture subset of the response headers. The
// converter applies the allow-list again (recon_posture.go).
ResponseHeaders *ResponseHeadersInput
// CNAMEs is the DNS alias chain of the host.
CNAMEs []string
// WebContent is the result of a web content fetch of this host's URLs
// (see WebContentKey). It is an explicit input: ParseHTTPXLine
// never fills it.
WebContent []WebCaptureInput
}
LiveHostInput represents an HTTP/HTTPS live host.
func ParseHTTPXLine ¶
func ParseHTTPXLine(line []byte, observe func(path string)) (LiveHostInput, error)
ParseHTTPXLine maps one line of httpx -json output to a LiveHostInput.
observe, when set, receives the path of every member the line holds ("/url", "/tls/subject_cn", ...), mapped or not, so a caller can report the members it did not read. The returned error wraps ErrHTTPXLine.
type LogicalLocation ¶
type LogicalLocation struct {
FullyQualifiedName string `json:"fully_qualified_name,omitempty"`
Name string `json:"name,omitempty"`
// Kind: function, method, class, module, namespace.
Kind string `json:"kind,omitempty"`
ParentIndex int `json:"parent_index,omitempty"`
}
LogicalLocation represents a logical code location.
type MisconfigurationDetails ¶
type MisconfigurationDetails struct {
PolicyID string `json:"policy_id,omitempty"`
PolicyName string `json:"policy_name,omitempty"`
ResourceType string `json:"resource_type,omitempty"`
ResourceName string `json:"resource_name,omitempty"`
// Provider: an open token (aws, azure, gcp, kubernetes).
Provider string `json:"provider,omitempty"`
Service string `json:"service,omitempty"`
Namespace string `json:"namespace,omitempty"`
Query string `json:"query,omitempty"`
Expected string `json:"expected,omitempty"`
Actual string `json:"actual,omitempty"`
Cause string `json:"cause,omitempty"`
}
MisconfigurationDetails contains misconfiguration-specific details.
type NFTCollectionDetails ¶
type NFTCollectionDetails struct {
// Collection name
Name string `json:"name,omitempty"`
// Collection symbol
Symbol string `json:"symbol,omitempty"`
// Token standard: erc721, erc1155
Standard string `json:"standard,omitempty"`
// Total supply
TotalSupply int64 `json:"total_supply,omitempty"`
// Max supply
MaxSupply int64 `json:"max_supply,omitempty"`
// Unique holders
HolderCount int64 `json:"holder_count,omitempty"`
// Floor price (in native token)
FloorPrice string `json:"floor_price,omitempty"`
// Floor price USD
FloorPriceUSD float64 `json:"floor_price_usd,omitempty"`
// Total volume (in native token)
TotalVolume string `json:"total_volume,omitempty"`
// Total volume USD
TotalVolumeUSD float64 `json:"total_volume_usd,omitempty"`
// Royalty percentage
RoyaltyPercent float64 `json:"royalty_percent,omitempty"`
// Royalty recipient
RoyaltyRecipient string `json:"royalty_recipient,omitempty"`
// Marketplace URLs
Marketplaces []string `json:"marketplaces,omitempty"`
// Is revealed
IsRevealed bool `json:"is_revealed,omitempty"`
// Base URI
BaseURI string `json:"base_uri,omitempty"`
// Metadata storage: ipfs, arweave, centralized
MetadataStorage string `json:"metadata_storage,omitempty"`
// Creator address
Creator string `json:"creator,omitempty"`
}
NFTCollectionDetails contains NFT collection-specific details.
type NativeIdentity ¶
type NativeIdentity struct {
// Vocabulary of the native values below. Selects the mapping tables of
// NormalizeNativeSeverity, NormalizeNativeStatus and
// NormalizeDetectionType.
Scheme NativeScheme `json:"scheme,omitempty"`
// The tool's id of the vulnerability or check: a Nessus plugin ID, a
// Qualys QID, a DefectDojo vuln_id_from_tool, a SARIF rule id.
VulnID string `json:"vuln_id,omitempty"`
// The tool's id of this occurrence (DefectDojo unique_id_from_tool, a
// Tenable or Qualys detection id), when it has one.
InstanceID string `json:"instance_id,omitempty"`
// The tool's family or category of the check (Nessus plugin family,
// Qualys vulnerability category).
Family string `json:"family,omitempty"`
// The tool's severity exactly as reported ("4", "5", "High", "error").
// finding.severity holds the normalized level.
Severity string `json:"severity,omitempty"`
// The tool's status exactly as reported ("Re-Opened", "fixed",
// "risk_accepted"). finding.status and source_lifecycle.state hold the
// normalized values.
Status string `json:"status,omitempty"`
// Whether the tool confirmed the issue or only suspects it.
DetectionType DetectionType `json:"detection_type,omitempty"`
// Whether the scan that found it was authenticated on the target. Absent
// means unknown; false means the scan ran without credentials.
IsCredentialed *bool `json:"is_credentialed,omitempty"`
// Where the raw record can be found again: a URL into the source, or a
// locator inside the imported file. Informational; receivers never fetch
// it.
RawRef string `json:"raw_ref,omitempty"`
}
NativeIdentity is the finding as the source tool names it.
type NativeScheme ¶
type NativeScheme string
NativeScheme names the vocabulary of a finding's native values. since 2.0 it is an open vocabulary: any value matching OpenTokenPattern is valid, and the constants below are the known values the Normalize* tables map.
const ( NativeSchemeNessus NativeScheme = "nessus" NativeSchemeQualys NativeScheme = "qualys" NativeSchemeDefectDojo NativeScheme = "defectdojo" NativeSchemeSARIF NativeScheme = "sarif" NativeSchemeOther NativeScheme = "other" )
func AllNativeSchemes ¶
func AllNativeSchemes() []NativeScheme
AllNativeSchemes returns the known native schemes.
func (NativeScheme) IsValid ¶
func (s NativeScheme) IsValid() bool
IsValid reports whether s is a known native scheme. Validate accepts any open token (IsOpenToken); IsValid says whether this module has mapping tables for it.
type NetworkDeviceKind ¶
type NetworkDeviceKind string
NetworkDeviceKind is the kind of a network device.
const ( NetworkDeviceRouter NetworkDeviceKind = "router" NetworkDeviceSwitch NetworkDeviceKind = "switch" NetworkDeviceFirewall NetworkDeviceKind = "firewall" NetworkDeviceLoadBalancer NetworkDeviceKind = "load_balancer" NetworkDeviceWirelessAccessPoint NetworkDeviceKind = "wireless_access_point" NetworkDeviceVPNGateway NetworkDeviceKind = "vpn_gateway" NetworkDeviceOther NetworkDeviceKind = "other" )
Network device kinds.
func AllNetworkDeviceKinds ¶
func AllNetworkDeviceKinds() []NetworkDeviceKind
AllNetworkDeviceKinds returns every network device kind.
func (NetworkDeviceKind) IsValid ¶
func (k NetworkDeviceKind) IsValid() bool
IsValid reports whether k is a known network device kind.
type NetworkDeviceTechnical ¶
type NetworkDeviceTechnical struct {
// Kind (required): router, switch, firewall, load_balancer,
// wireless_access_point, vpn_gateway, other.
Kind NetworkDeviceKind `json:"kind"`
}
NetworkDeviceTechnical holds the technical details of a network_device asset.
type NetworkLocation ¶
type NetworkLocation struct {
// Host (canonical IP or domain name). Optional when the finding's
// asset already is the host.
Host string `json:"host,omitempty"`
// Port (0: not port-specific).
Port int `json:"port,omitempty"`
// Transport: tcp, udp, sctp.
Transport Transport `json:"transport,omitempty"`
// Application protocol, an IANA service name.
AppProtocol string `json:"app_protocol,omitempty"`
}
NetworkLocation describes where a network finding was observed.
type OpenPortInput ¶
type OpenPortInput struct {
Host string
IP string
Port int
Protocol string
Service string
Version string
Banner string
}
OpenPortInput represents an open port.
type OracleManipulationIssue ¶
type OracleManipulationIssue struct {
// Oracle type: chainlink, uniswap_twap, custom
OracleType string `json:"oracle_type,omitempty"`
// Oracle address
OracleAddress string `json:"oracle_address,omitempty"`
// Manipulation method: flash_loan, sandwich, time_manipulation
ManipulationMethod string `json:"manipulation_method,omitempty"`
// Price impact possible
PriceImpactPercent float64 `json:"price_impact_percent,omitempty"`
// Missing checks
MissingChecks []string `json:"missing_checks,omitempty"`
}
OracleManipulationIssue contains details about oracle manipulation vulnerabilities.
type OwnerKind ¶
type OwnerKind string
OwnerKind is what an asset owner reference names.
type OwnerRole ¶
type OwnerRole string
OwnerRole is the responsibility an owner has for an asset.
type ParamLocation ¶
type ParamLocation string
ParamLocation is where a request parameter goes.
const ( ParamLocationQuery ParamLocation = "query" ParamLocationPath ParamLocation = "path" ParamLocationHeader ParamLocation = "header" ParamLocationCookie ParamLocation = "cookie" ParamLocationForm ParamLocation = "form" ParamLocationJSON ParamLocation = "json" ParamLocationMultipart ParamLocation = "multipart" ParamLocationGraphQLArg ParamLocation = "graphql_arg" )
Parameter locations.
func AllParamLocations ¶
func AllParamLocations() []ParamLocation
AllParamLocations returns every parameter location.
type PortState ¶
type PortState string
PortState is the state of a port.
type Profile ¶
type Profile string
Profile is a conformance profile a producer claims for a document.
type Properties ¶
Properties is an opaque bag. Receivers MUST NOT give meaning to its keys.
type ReconConverterOptions ¶
type ReconConverterOptions struct {
// Source tracking
DiscoverySource string // "agent", "integration", "manual"
DiscoveryTool string // Scanner name
// Default values. DefaultCriticality is business context that a scanner
// does not know (spec section 4.1); leave it empty unless the caller
// really has it.
DefaultCriticality Criticality
DefaultConfidence int // 0-100
// Filtering
MinConfidence int // Minimum confidence to include
}
ReconConverterOptions configures the conversion from ReconResult to CTIS Report.
func DefaultReconConverterOptions ¶
func DefaultReconConverterOptions() *ReconConverterOptions
DefaultReconConverterOptions returns sensible default options.
type ReconToCTISInput ¶
type ReconToCTISInput struct {
// Scanner info
ScannerName string
ScannerVersion string
ReconType string // subdomain, dns, port, http_probe, url_crawl
// Target
Target string
// Timing
StartedAt int64
FinishedAt int64
DurationMs int64
// Results
Subdomains []SubdomainInput
DNSRecords []DNSRecordInput
OpenPorts []OpenPortInput
LiveHosts []LiveHostInput
URLs []DiscoveredURLInput
Technologies []TechnologyInput
}
ReconToCTISInput holds the data from a reconnaissance scan result. This is a simplified version of core.ReconResult to avoid import cycles.
type ReentrancyIssue ¶
type ReentrancyIssue struct {
// Reentrancy type: cross_function, cross_contract, read_only
Type string `json:"type,omitempty"`
// Vulnerable external call
ExternalCall string `json:"external_call,omitempty"`
// State variable modified after call
StateModifiedAfterCall string `json:"state_modified_after_call,omitempty"`
// Entry point function
EntryPoint string `json:"entry_point,omitempty"`
// Callback function
Callback string `json:"callback,omitempty"`
// Max reentrancy depth possible
MaxDepth int `json:"max_depth,omitempty"`
}
ReentrancyIssue contains details about reentrancy vulnerabilities.
type Relationship ¶
type Relationship struct {
Type RelationshipType `json:"type"`
FromRef string `json:"from_ref"`
ToRef string `json:"to_ref"`
// When the producer first and last observed the edge, and how sure it
// is, 0-100 (2.0).
FirstSeenAt *time.Time `json:"first_seen_at,omitempty"`
LastSeenAt *time.Time `json:"last_seen_at,omitempty"`
Confidence int `json:"confidence,omitempty"`
// Namespaced producer data (2.0).
Extensions Extensions `json:"extensions,omitempty"`
}
Relationship is a typed edge between two assets of the same report, named by their ids.
type RelationshipType ¶
type RelationshipType string
RelationshipType is the type of a relationship between two assets of a report. The set is closed.
const ( // RelSubdomainOf: from (a subdomain) is a name below to (a domain). RelSubdomainOf RelationshipType = "subdomain_of" // RelResolvesTo: from (a name) resolves to to (an address). RelResolvesTo RelationshipType = "resolves_to" // RelCnameOf: from (a name) is an alias of to (a name). RelCnameOf RelationshipType = "cname_of" // RelExposes: from (a host or address) exposes to (a service or port). RelExposes RelationshipType = "exposes" // RelServesCertificate: from (a service) serves to (a certificate). RelServesCertificate RelationshipType = "serves_certificate" // RelHostedBy: from (a service or address) is hosted by to (a provider // or a host). RelHostedBy RelationshipType = "hosted_by" // RelContains: from (a cluster, account, network, image) contains to. RelContains RelationshipType = "contains" // RelRunsOn: from (a workload, container, service) runs on to (a host, // cluster, cloud resource). RelRunsOn RelationshipType = "runs_on" // RelDependsOn: from (an application, package) depends on to (a // package, service). RelDependsOn RelationshipType = "depends_on" // RelDeployedFrom: from (a workload, image) is deployed from to (a // repository, image). RelDeployedFrom RelationshipType = "deployed_from" // RelMemberOf: from (an identity, host) is a member of to (a group, // network, account). RelMemberOf RelationshipType = "member_of" // RelRoutesTo: from (a load balancer, gateway, origin) routes traffic // to to. RelRoutesTo RelationshipType = "routes_to" // RelHasAccessTo: from (an identity) has access to to (a resource). RelHasAccessTo RelationshipType = "has_access_to" // RelHasAddress: from (a host, network device, endpoint device or other // machine) is assigned to (an ip_address asset): an interface or // management address, not DNS. A name's DNS answers stay resolves_to. RelHasAddress RelationshipType = "has_address" )
Relationship types.
func AllRelationshipTypes ¶
func AllRelationshipTypes() []RelationshipType
AllRelationshipTypes returns every relationship type.
func (RelationshipType) IsValid ¶
func (t RelationshipType) IsValid() bool
IsValid reports whether t is a known relationship type.
type Remediation ¶
type Remediation struct {
// Short recommendation (plain text).
Recommendation string `json:"recommendation,omitempty"`
// Fix steps.
Steps []string `json:"steps,omitempty"`
// Kind of fix (CSAF remediation categories plus config_change and
// upgrade).
SolutionType SolutionType `json:"solution_type,omitempty"`
// Effort: trivial, low, medium, high.
Effort Effort `json:"effort,omitempty"`
// Estimated time to fix in minutes.
EstimatedMinutes int `json:"estimated_minutes,omitempty"`
// A fix exists. Absent means unknown; false means verified no fix.
IsFixAvailable *bool `json:"is_fix_available,omitempty"`
// The tool can apply the fix itself.
IsAutoFixable bool `json:"is_auto_fixable,omitempty"`
// Replacement code, and a regex fix.
FixCode string `json:"fix_code,omitempty"`
FixRegex *FixRegex `json:"fix_regex,omitempty"`
// When the vendor published the patch.
PatchPublishedAt *time.Time `json:"patch_published_at,omitempty"`
// Vendor advisories that address the finding.
Advisories []Advisory `json:"advisories,omitempty"`
}
Remediation is the one remediation object of a finding.
type Report ¶
type Report struct {
// Specification version, MAJOR.MINOR (required).
Version string `json:"version"`
// Schema URL for validation (optional). An identifier: receivers never
// fetch it.
Schema string `json:"$schema,omitempty"`
// Report metadata (required).
Metadata ReportMetadata `json:"metadata"`
// The tool that produced the report.
Tool *Tool `json:"tool,omitempty"`
// Assets observed.
Assets []Asset `json:"assets,omitempty"`
// Rules and checks the findings name by rule_ref, described once.
Rules []Rule `json:"rules,omitempty"`
// Findings observed. Each names its asset by asset_ref.
Findings []Finding `json:"findings,omitempty"`
// Software components (SBOM).
Dependencies []Dependency `json:"dependencies,omitempty"`
// Typed relationships between assets of this report.
Relationships []Relationship `json:"relationships,omitempty"`
// Endpoints are the methods and paths web origins serve, as a tool saw
// them. Names of parameters only, never values.
Endpoints []Endpoint `json:"endpoints,omitempty"`
// An opaque bag. Receivers MUST NOT give meaning to its keys; namespaced
// data goes in Extensions.
Properties Properties `json:"properties,omitempty"`
// Namespaced producer data, keyed by a reverse-DNS namespace.
Extensions Extensions `json:"extensions,omitempty"`
}
Report is the root CTIS document: one producer's observations of assets and findings at metadata.generated_at. A document carries natural keys (canonical forms) and the producer's own references, never a receiver's database keys.
func ConvertReconToCTIS ¶
func ConvertReconToCTIS(input *ReconToCTISInput, opts *ReconConverterOptions) (*Report, error)
ConvertReconToCTIS converts reconnaissance results to a CTIS report.
The output follows the CTIS 2.0 asset model:
- names are domain_name assets (canonical form), with their DNS records in technical.domain; a name that has no canonical form is skipped;
- a port-scan target is an ip_address asset when it is an address and a host asset otherwise; each open port is a service asset ("host:port/transport") linked from it by an exposes relationship;
- every HTTP probe result is a web_origin asset (its canonical origin) with technical.http (status, title, server, TLS version, CDN, WAF, JARM, favicon hash, security headers) and typed technologies; the leaf certificate is a certificate asset linked by serves_certificate; the address the origin answered on is an ip_address asset that the origin's name resolves_to;
- crawled URLs are endpoints of their web_origin asset.
Asset ids are unique within the report and assets keep the input order.
func MergeReconReports ¶
MergeReconReports merges the CTIS reports of a recon pipeline (subfinder -> dnsx -> naabu -> httpx) into one new report.
Assets with the same type and value are merged into one: tags, DNS records, nameservers and technologies are combined, and the first report's other members win. Assets keep first-seen order and get report-unique ids; relationships, findings and endpoints are re-pointed at the merged ids, and relationships are de-duplicated. The merged tool's techniques are the union of the inputs'. The inputs are never modified.
func NewReport ¶
func NewReport() *Report
NewReport creates a new empty CTIS report stamped with the specification version, the schema URL, a fresh UUIDv7 metadata.id and the current time.
func (*Report) Validate ¶
Validate checks a report's semantic invariants using only the standard library. Producers call it before sending and receivers at their ingest boundary, so a malformed report is refused rather than stored.
Beyond what decoding into the Go types enforces, it checks:
- version is MAJOR.MINOR of this module's major;
- metadata: id is a UUIDv7, generated_at is set, channel, coverage_type, profiles, source_refs, targets and segment are valid;
- tool: name set, techniques known, info_url http(s);
- assets: id a document reference (never UUID-shaped) and unique, type known, value in the canonical form of its type, criticality, confidence, technical details, compliance, context and extensions;
- findings: title, type, severity, status, confidence, rank, an asset_ref naming an asset of the report, document references, URL members http(s), and the type-specific blocks;
- dependencies, endpoints and relationships: references resolve within the report, enums and limits.
Validate reports all problems it finds (up to 100) in one error, joined with "; ". It does not modify the report and does no I/O.
type ReportMetadata ¶
type ReportMetadata struct {
// Producer-generated UUIDv7 that identifies this document (required). A
// retry re-sends the same id; receivers deduplicate on (credential, id).
// Every segment of a split result shares it. It is never a receiver's
// key.
ID string `json:"id"`
// When the producer generated the report (required).
GeneratedAt time.Time `json:"generated_at"`
// Duration of the work in milliseconds.
DurationMs int `json:"duration_ms,omitempty"`
// How the data reached the document: scanner, collector, integration,
// manual.
Channel Channel `json:"channel,omitempty"`
// The producer's own references for the work (a job id in the
// producer's scheduler, a scan id in the source product).
SourceRefs []SourceRef `json:"source_refs,omitempty"`
// Coverage type: full, incremental, partial. Only full lets a receiver
// call an absent item gone (with targets).
CoverageType CoverageType `json:"coverage_type,omitempty"`
// Branch information for git-based scans.
Branch *BranchInfo `json:"branch,omitempty"`
// Conformance profiles the producer claims for this document.
Profiles []Profile `json:"profiles,omitempty"`
// When the work that produced the report started and ended.
StartedAt *time.Time `json:"started_at,omitempty"`
EndedAt *time.Time `json:"ended_at,omitempty"`
// How each target of the work ended. With coverage_type full, a target
// in state done is what lets a receiver call an item gone.
Targets []TargetOutcome `json:"targets,omitempty"`
// Segment places this document in a result split over several
// documents that share one metadata.id.
Segment *Segment `json:"segment,omitempty"`
// Opaque bag; no meaning.
Properties Properties `json:"properties,omitempty"`
// Namespaced producer data.
Extensions Extensions `json:"extensions,omitempty"`
}
ReportMetadata contains metadata about the report.
type RepositoryTechnical ¶
type RepositoryTechnical struct {
// Source-code host: an open token (github, gitlab, bitbucket).
Platform string `json:"platform,omitempty"`
// Organization or owner path.
Owner string `json:"owner,omitempty"`
// Repository name.
Name string `json:"name,omitempty"`
// Default branch.
DefaultBranch string `json:"default_branch,omitempty"`
// Visibility: public, private, internal.
Visibility string `json:"visibility,omitempty"`
// Repository web URL (http or https).
URL string `json:"url,omitempty"`
// Bytes per language.
Languages map[string]int `json:"languages,omitempty"`
// Stars and forks.
Stars int `json:"stars,omitempty"`
Forks int `json:"forks,omitempty"`
// Last commit.
LastCommitSHA string `json:"last_commit_sha,omitempty"`
LastCommitAt *time.Time `json:"last_commit_at,omitempty"`
}
RepositoryTechnical contains repository-specific technical details.
type ResponseHeadersInput ¶
type ResponseHeadersInput struct {
// Values maps a header name to its value; names outside the allow-list
// are ignored.
Values map[string]string
Cookies []CookieFlagsInput
}
ResponseHeadersInput is the posture subset of a response's headers, as a producer reports it.
type Rule ¶
type Rule struct {
// Document-local reference (required). Findings name the rule by it.
ID string `json:"id"`
// The tool's identifier of the rule (required).
RuleID string `json:"rule_id"`
// Human-readable rule name.
Name string `json:"name,omitempty"`
// One-sentence description (plain text).
ShortDescription string `json:"short_description,omitempty"`
// Full description (plain text).
FullDescription string `json:"full_description,omitempty"`
// How to fix what the rule finds (plain text).
Help string `json:"help,omitempty"`
// Page that documents the rule (http or https). Receivers never fetch it.
HelpURI string `json:"help_uri,omitempty"`
// Severity the tool gives the rule when a finding does not override it.
DefaultSeverity Severity `json:"default_severity,omitempty"`
// The tool's tags for the rule.
Tags []string `json:"tags,omitempty"`
// CWE identifiers the rule checks for.
CWEIDs []string `json:"cwe_ids,omitempty"`
// SHA-256 of the rule's content as the tool ran it (a template or rule
// file), lowercase hex: which revision of the rule matched.
ContentSHA256 string `json:"content_sha256,omitempty"`
// Path of the rule within the tool's content (plain text; receivers
// never open it).
ContentPath string `json:"content_path,omitempty"`
// Namespaced producer data.
Extensions Extensions `json:"extensions,omitempty"`
}
Rule describes a rule or check once. Findings it detected name it with finding.rule_ref instead of repeating its text, and keep their own rule_id, which MUST equal the rule's rule_id (identity never depends on the catalog).
type Score ¶
type Score struct {
// Scoring system (required).
System ScoreSystem `json:"system"`
// System version: "2.0", "3.0", "3.1" or "4.0" for CVSS (required
// there), the model version for EPSS, "2" for SSVC.
Version string `json:"version,omitempty"`
// Vector string ("CVSS:3.1/AV:N/...", an SSVC vector).
Vector string `json:"vector,omitempty"`
// Numeric value: 0-10 for cvss and vpr, 0-1 for epss and
// epss_percentile (FIRST's fractions), absent for ssvc.
Value *float64 `json:"value,omitempty"`
// Qualitative rating as the source states it ("high", "Act").
Label string `json:"label,omitempty"`
// Who assigned it: nvd, ghsa, vendor, tenable, qualys, first, cisa, ...
Source string `json:"source,omitempty"`
// When the source assigned or last updated it.
AsOf *time.Time `json:"as_of,omitempty"`
}
Score is one score of a finding, with where it came from and when. A finding may carry several: CVSS v3.1 and v4.0 together, a vendor's rating, EPSS and an SSVC decision.
func PrimaryCVSS ¶
PrimaryCVSS returns the CVSS score of a finding receivers show first: the one of the highest version that has a value, else the first CVSS score.
type ScoreSystem ¶
type ScoreSystem string
ScoreSystem names a scoring system.
const ( ScoreSystemCVSS ScoreSystem = "cvss" ScoreSystemEPSS ScoreSystem = "epss" ScoreSystemEPSSPercentile ScoreSystem = "epss_percentile" ScoreSystemSSVC ScoreSystem = "ssvc" // A vendor's own score or rating (a priority rating, a detection // score); source names the vendor as an open token. ScoreSystemVendor ScoreSystem = "vendor" )
func AllScoreSystems ¶
func AllScoreSystems() []ScoreSystem
AllScoreSystems returns every valid score system.
func (ScoreSystem) IsValid ¶
func (s ScoreSystem) IsValid() bool
IsValid reports whether s is a recognized score system.
type SecretDetails ¶
type SecretDetails struct {
// Secret type: api_key, password, token, certificate, private_key ...
Type string `json:"type,omitempty"`
// Service the secret belongs to: an open token (aws, github, stripe).
Service string `json:"service,omitempty"`
// Masked value (first and last few characters at most).
MaskedValue string `json:"masked_value,omitempty"`
// Length and entropy of the secret.
Length int `json:"length,omitempty"`
Entropy float64 `json:"entropy,omitempty"`
// Verification result. Absent means not verified.
IsValid *bool `json:"is_valid,omitempty"`
VerifiedAt *time.Time `json:"verified_at,omitempty"`
IsRevoked bool `json:"is_revoked,omitempty"`
RevokedAt *time.Time `json:"revoked_at,omitempty"`
// Scopes or permissions of the secret.
Scopes []string `json:"scopes,omitempty"`
ExpiresAt *time.Time `json:"expires_at,omitempty"`
AgeDays int `json:"age_days,omitempty"`
RotationDueAt *time.Time `json:"rotation_due_at,omitempty"`
// The secret is only in history, not at HEAD, and the number of commits
// it appears in.
IsHistoryOnly bool `json:"is_history_only,omitempty"`
CommitCount int `json:"commit_count,omitempty"`
}
SecretDetails contains secret-specific details. No usable secret value is ever carried: masked_value only.
type SecurityHeaders ¶
type SecurityHeaders struct {
StrictTransportSecurity string `json:"strict_transport_security,omitempty"`
ContentSecurityPolicy string `json:"content_security_policy,omitempty"`
XFrameOptions string `json:"x_frame_options,omitempty"`
XContentTypeOptions string `json:"x_content_type_options,omitempty"`
ReferrerPolicy string `json:"referrer_policy,omitempty"`
PermissionsPolicy string `json:"permissions_policy,omitempty"`
// CORS response headers.
AccessControlAllowOrigin string `json:"access_control_allow_origin,omitempty"`
AccessControlAllowCredentials string `json:"access_control_allow_credentials,omitempty"`
// The cookies the origin sets: names and flags, never values.
Cookies []CookieFlags `json:"cookies,omitempty"`
}
SecurityHeaders is the security posture of a web origin's response headers. Each value is the header as received (bounded), absent when the origin does not send it.
type Segment ¶
Segment places a document in a result split over Count documents that share one metadata.id. Index is zero-based.
type SensitiveSpan ¶
type SensitiveSpan struct {
Pointer string `json:"pointer"`
Start *int `json:"start,omitempty"`
End *int `json:"end,omitempty"`
Kind string `json:"kind,omitempty"`
}
SensitiveSpan marks a secret or personal value inside the item: the string at Pointer (a JSON pointer into the item), whole or the byte range [Start, End).
type ServiceTechnical ¶
type ServiceTechnical struct {
// Port number (required).
Port int `json:"port"`
// Transport (required): tcp, udp, sctp.
Transport Transport `json:"transport"`
// Application protocol, an IANA service name (http, https, ssh, smtp,
// domain, ldap, microsoft-ds, mysql ...).
AppProtocol string `json:"app_protocol,omitempty"`
// Port state: open, closed, filtered.
State PortState `json:"state,omitempty"`
// Product and version ("OpenSSH" "9.6").
Product string `json:"product,omitempty"`
Version string `json:"version,omitempty"`
// CPE 2.3 name.
CPE string `json:"cpe,omitempty"`
// Banner and extra information as the probe saw them (plain text).
Banner string `json:"banner,omitempty"`
ExtraInfo string `json:"extra_info,omitempty"`
// TLS.
IsTLS bool `json:"is_tls,omitempty"`
TLSVersion TLSVersion `json:"tls_version,omitempty"`
// Authentication.
IsAuthRequired bool `json:"is_auth_required,omitempty"`
AuthMethods []string `json:"auth_methods,omitempty"`
HasDefaultCredentials bool `json:"has_default_credentials,omitempty"`
HasAnonymousAccess bool `json:"has_anonymous_access,omitempty"`
// Response time in milliseconds.
ResponseTimeMs int `json:"response_time_ms,omitempty"`
// Protocol-dependent details, as strings (SSH algorithms, SMTP
// extensions).
Details map[string]string `json:"details,omitempty"`
}
ServiceTechnical is the one shape of a network service: the technical details of a service asset (value host:port/transport), linked from its host or address by an exposes relationship.
type Severity ¶
type Severity string
Severity represents the severity level.
const ( SeverityCritical Severity = "critical" SeverityHigh Severity = "high" SeverityMedium Severity = "medium" SeverityLow Severity = "low" SeverityInfo Severity = "info" // SeverityUnknown: the source gave no severity, or one that maps to none // of the others. Also the fallback for a severity a receiver does not // know in a newer-minor document. SeverityUnknown Severity = "unknown" )
Severities.
func NormalizeNativeSeverity ¶
func NormalizeNativeSeverity(scheme NativeScheme, native string) (Severity, bool)
NormalizeNativeSeverity maps a native severity of the given scheme to a CTIS severity. Unknown schemes and values return ok=false.
func (Severity) Score ¶
Score returns a numeric score for the severity (0-10).
An unrecognized, empty or unknown severity intentionally scores 5.0 (Medium), not 0: a finding whose severity the producer got wrong must still surface in score-based triage rather than sink and be missed. Callers that want to reject unknown severities use Validate.
type SmartContractDetails ¶
type SmartContractDetails struct {
// Contract name
Name string `json:"name,omitempty"`
// Contract address
Address string `json:"address,omitempty"`
// Deployer address
DeployerAddress string `json:"deployer_address,omitempty"`
// Deployment transaction hash
DeploymentTxHash string `json:"deployment_tx_hash,omitempty"`
// Deployment block number
DeploymentBlock int64 `json:"deployment_block,omitempty"`
// Deployment timestamp
DeployedAt *time.Time `json:"deployed_at,omitempty"`
// Is verified on explorer (etherscan, etc.)
IsVerified bool `json:"is_verified,omitempty"`
// Compiler version
CompilerVersion string `json:"compiler_version,omitempty"`
// EVM version
EVMVersion string `json:"evm_version,omitempty"`
// Optimization enabled
IsOptimizationEnabled bool `json:"is_optimization_enabled,omitempty"`
// Optimization runs
OptimizationRuns int `json:"optimization_runs,omitempty"`
// Contract type: erc20, erc721, erc1155, proxy, multisig, defi, custom
ContractType string `json:"contract_type,omitempty"`
// Is proxy contract
IsProxy bool `json:"is_proxy,omitempty"`
// Implementation address (for proxy contracts)
ImplementationAddress string `json:"implementation_address,omitempty"`
// Proxy type: transparent, uups, beacon, diamond
ProxyType string `json:"proxy_type,omitempty"`
// Is upgradeable
IsUpgradeable bool `json:"is_upgradeable,omitempty"`
// Owner/admin address
OwnerAddress string `json:"owner_address,omitempty"`
// Has renounced ownership
IsOwnershipRenounced bool `json:"is_ownership_renounced,omitempty"`
// Source code URL (GitHub, etc.)
SourceCodeURL string `json:"source_code_url,omitempty"`
// ABI (JSON string or base64 encoded)
ABI string `json:"abi,omitempty"`
// Bytecode hash (keccak256)
BytecodeHash string `json:"bytecode_hash,omitempty"`
// Source code hash
SourceCodeHash string `json:"source_code_hash,omitempty"`
// License type: MIT, GPL, UNLICENSED, etc.
License string `json:"license,omitempty"`
// External libraries used
Libraries []ContractLibrary `json:"libraries,omitempty"`
// Implemented interfaces: ERC20, ERC721, etc.
Interfaces []string `json:"interfaces,omitempty"`
// Contract balance (in wei)
Balance string `json:"balance,omitempty"`
// Total transactions
TxCount int64 `json:"tx_count,omitempty"`
}
SmartContractDetails contains smart contract-specific details.
type SolutionType ¶
type SolutionType string
SolutionType is the kind of fix a remediation is.
const ( SolutionTypeVendorFix SolutionType = "vendor_fix" SolutionTypeWorkaround SolutionType = "workaround" SolutionTypeMitigation SolutionType = "mitigation" SolutionTypeNoFixPlanned SolutionType = "no_fix_planned" SolutionTypeNoneAvailable SolutionType = "none_available" SolutionTypeConfigChange SolutionType = "config_change" SolutionTypeUpgrade SolutionType = "upgrade" )
The first five are the CSAF 2.0 remediation categories; config_change and upgrade are CTIS refinements a CSAF export writes as mitigation and vendor_fix.
func AllSolutionTypes ¶
func AllSolutionTypes() []SolutionType
AllSolutionTypes returns every valid solution type.
func (SolutionType) IsValid ¶
func (s SolutionType) IsValid() bool
IsValid reports whether s is a recognized solution type.
type SourceLifecycle ¶
type SourceLifecycle struct {
// When the source first found it.
FirstFoundAt *time.Time `json:"first_found_at,omitempty"`
// When the source last found it.
LastFoundAt *time.Time `json:"last_found_at,omitempty"`
// When the source last saw it fixed.
LastFixedAt *time.Time `json:"last_fixed_at,omitempty"`
// How many times the source has found it.
TimesFound int `json:"times_found,omitempty"`
// The source state, normalized (native.status keeps the source's word).
State SourceState `json:"state,omitempty"`
}
SourceLifecycle is the finding's history as the source tracks it. It is the source's view and stays separate from the receiver's own lifecycle: a scanner may call a finding fixed that a receiver keeps open until verified.
type SourceRef ¶
SourceRef is a producer's own identifier of an item in its own system: a plugin id, a scan id, an issue key in the source product. System is an open token naming the system; ID is opaque. It is never a receiver's key, and receivers never use it as one.
type SourceState ¶
type SourceState string
SourceState is the normalized state of a finding in its source.
const ( SourceStateNew SourceState = "new" SourceStateActive SourceState = "active" SourceStateReopened SourceState = "reopened" SourceStateFixed SourceState = "fixed" )
func AllSourceStates ¶
func AllSourceStates() []SourceState
AllSourceStates returns every valid source state.
func (SourceState) IsValid ¶
func (s SourceState) IsValid() bool
IsValid reports whether s is a recognized source state.
type StackFrame ¶
type StackFrame struct {
Location *FindingLocation `json:"location,omitempty"`
Module string `json:"module,omitempty"`
ThreadID int `json:"thread_id,omitempty"`
Parameters []string `json:"parameters,omitempty"`
}
StackFrame represents a single frame in a call stack.
type StackTrace ¶
type StackTrace struct {
Message string `json:"message,omitempty"`
Frames []*StackFrame `json:"frames,omitempty"`
}
StackTrace represents a call stack trace (SARIF stack).
type SubdomainInput ¶
SubdomainInput represents a discovered subdomain.
type Suppression ¶
type Suppression struct {
// Suppression kind: in_source, external.
Kind string `json:"kind,omitempty"`
// Suppression status: accepted, under_review, rejected.
Status string `json:"status,omitempty"`
// Short reason code ("false_positive", "test_code", "risk_accepted").
Reason string `json:"reason,omitempty"`
// Justification (plain text).
Justification string `json:"justification,omitempty"`
// Who suppressed the finding (personal data).
SuppressedBy string `json:"suppressed_by,omitempty"`
SuppressedAt *time.Time `json:"suppressed_at,omitempty"`
ExpiresAt *time.Time `json:"expires_at,omitempty"`
}
Suppression contains information about finding suppression (SARIF).
type TLSLeafInput ¶
type TLSLeafInput struct {
SubjectCN string
SANs []string
IssuerCN string
IssuerOrg string
SerialNumber string
NotBefore time.Time
NotAfter time.Time
// FingerprintSHA256 is the SHA-256 of the DER certificate, hex, with or
// without colons. It is the certificate's identity: a leaf without a
// valid one is not converted.
FingerprintSHA256 string
SelfSigned bool
Expired bool
Wildcard bool
Mismatched bool
}
TLSLeafInput is the leaf certificate an HTTP probe saw in a TLS handshake. Every value comes from the scanned server and is bounded by the converter.
type TLSVersion ¶
type TLSVersion string
TLSVersion is a TLS or SSL protocol version.
const ( TLSVersionSSL3 TLSVersion = "ssl3" TLSVersionTLS10 TLSVersion = "tls1.0" TLSVersionTLS11 TLSVersion = "tls1.1" TLSVersionTLS12 TLSVersion = "tls1.2" TLSVersionTLS13 TLSVersion = "tls1.3" )
TLS versions.
func (TLSVersion) IsValid ¶
func (v TLSVersion) IsValid() bool
IsValid reports whether v is a known TLS version.
type TargetCause ¶
type TargetCause string
TargetCause says whose side a not-covered target is on.
const ( TargetCauseTarget TargetCause = "target" TargetCauseSensor TargetCause = "sensor" TargetCausePlatform TargetCause = "platform" )
Target causes.
func AllTargetCauses ¶
func AllTargetCauses() []TargetCause
AllTargetCauses returns every target cause.
func (TargetCause) IsValid ¶
func (c TargetCause) IsValid() bool
IsValid reports whether c is a known target cause.
type TargetClass ¶
type TargetClass string
TargetClass says why a target failed or was skipped.
const ( TargetClassUnreachable TargetClass = "unreachable" TargetClassTimeout TargetClass = "timeout" TargetClassToolError TargetClass = "tool_error" TargetClassEgressRefused TargetClass = "egress_refused" TargetClassNameGone TargetClass = "name_gone" TargetClassResolverFailed TargetClass = "resolver_failed" TargetClassSensorNetworkFault TargetClass = "sensor_network_fault" TargetClassRateLimited TargetClass = "rate_limited" TargetClassEdgeChallenged TargetClass = "edge_challenged" TargetClassEdgeBlocked TargetClass = "edge_blocked" TargetClassRefused TargetClass = "refused" TargetClassExcluded TargetClass = "excluded" )
Target classes.
func AllTargetClasses ¶
func AllTargetClasses() []TargetClass
AllTargetClasses returns every target class.
func (TargetClass) IsValid ¶
func (c TargetClass) IsValid() bool
IsValid reports whether c is a known target class.
type TargetOutcome ¶
type TargetOutcome struct {
Target string `json:"target"`
Kind AssetType `json:"kind,omitempty"`
State TargetState `json:"state"`
Class TargetClass `json:"class,omitempty"`
Cause TargetCause `json:"cause,omitempty"`
}
TargetOutcome is how one target of the work ended. Done and unfinished take no class or cause; failed and skipped need a class of their own.
type TargetState ¶
type TargetState string
TargetState is how one target of the work ended. The vocabulary is the one of the platform-sensor outcome vocabulary (revision 2); CTIS owns its own copy.
const ( TargetDone TargetState = "done" TargetFailed TargetState = "failed" TargetSkipped TargetState = "skipped" TargetUnfinished TargetState = "unfinished" )
Target states.
func AllTargetStates ¶
func AllTargetStates() []TargetState
AllTargetStates returns every target state.
func (TargetState) IsValid ¶
func (s TargetState) IsValid() bool
IsValid reports whether s is a known target state.
type Technique ¶
type Technique string
Technique is a detection technique: how a finding was found. It is a separate axis from the channel (how the data reached the document).
const ( TechniqueSAST Technique = "sast" TechniqueSCA Technique = "sca" TechniqueSecret Technique = "secret" TechniqueIaC Technique = "iac" TechniqueContainer Technique = "container" TechniqueDAST Technique = "dast" TechniqueVA Technique = "va" TechniqueEASM Technique = "easm" TechniqueCSPM Technique = "cspm" TechniqueBAS Technique = "bas" TechniquePentest Technique = "pentest" TechniqueManual Technique = "manual" )
Techniques (closed set).
type Technology ¶
type Technology struct {
// Name of the product or framework ("nginx", "WordPress").
Name string `json:"name"`
// Version when the tool could tell.
Version string `json:"version,omitempty"`
// CPE 2.3 name when the tool could tell.
CPE string `json:"cpe,omitempty"`
// Categories the tool puts the technology in ("web-server", "cms").
Categories []string `json:"categories,omitempty"`
// How sure the tool is, 0-100.
Confidence int `json:"confidence,omitempty"`
}
Technology is a technology an asset runs, as a fingerprinting tool identified it.
type TechnologyInput ¶
type TechnologyInput struct {
Name string
Version string
Categories []string
Confidence int
Website string
}
TechnologyInput represents a detected technology.
type ThreatSignal ¶
type ThreatSignal struct {
Type ThreatSignalType `json:"type"`
Source string `json:"source"`
AsOf *time.Time `json:"as_of,omitempty"`
Ref string `json:"ref,omitempty"`
DueOn string `json:"due_on,omitempty"`
}
ThreatSignal is a threat assertion made by a named source at a date. Ref is an external reference (a catalog id or a URL); receivers never fetch it. DueOn is a date-only remediation due date (a KEV due date).
type ThreatSignalType ¶
type ThreatSignalType string
ThreatSignalType is the kind of a threat assertion about a vulnerability.
const ( ThreatSignalKEV ThreatSignalType = "kev" ThreatSignalExploitedInWild ThreatSignalType = "exploited_in_wild" ThreatSignalPublicExploit ThreatSignalType = "public_exploit" ThreatSignalRansomwareUse ThreatSignalType = "ransomware_use" ThreatSignalWeaponized ThreatSignalType = "weaponized" )
Threat signal types.
func AllThreatSignalTypes ¶
func AllThreatSignalTypes() []ThreatSignalType
AllThreatSignalTypes returns every threat signal type.
func (ThreatSignalType) IsValid ¶
func (t ThreatSignalType) IsValid() bool
IsValid reports whether t is a known threat signal type.
type TokenBalance ¶
type TokenBalance struct {
// Token contract address
ContractAddress string `json:"contract_address"`
// Token symbol
Symbol string `json:"symbol,omitempty"`
// Token name
Name string `json:"name,omitempty"`
// Token decimals
Decimals int `json:"decimals,omitempty"`
// Balance (raw value)
Balance string `json:"balance"`
// Balance formatted (human readable)
BalanceFormatted string `json:"balance_formatted,omitempty"`
// USD value
USDValue float64 `json:"usd_value,omitempty"`
}
TokenBalance represents a token balance for a wallet.
type TokenDetails ¶
type TokenDetails struct {
// Token standard: erc20, erc721, erc1155, bep20, spl
Standard string `json:"standard,omitempty"`
// Token symbol
Symbol string `json:"symbol,omitempty"`
// Token name
Name string `json:"name,omitempty"`
// Token decimals
Decimals int `json:"decimals,omitempty"`
// Total supply (raw value)
TotalSupply string `json:"total_supply,omitempty"`
// Max supply (if applicable)
MaxSupply string `json:"max_supply,omitempty"`
// Is mintable
IsMintable bool `json:"is_mintable,omitempty"`
// Is burnable
IsBurnable bool `json:"is_burnable,omitempty"`
// Is pausable
IsPausable bool `json:"is_pausable,omitempty"`
// Has blacklist/whitelist
HasBlacklist bool `json:"has_blacklist,omitempty"`
// Has transfer fee/tax
HasTransferFee bool `json:"has_transfer_fee,omitempty"`
// Transfer fee percentage
TransferFeePercent float64 `json:"transfer_fee_percent,omitempty"`
// Holder count
HolderCount int64 `json:"holder_count,omitempty"`
// Market cap USD
MarketCapUSD float64 `json:"market_cap_usd,omitempty"`
// Price USD
PriceUSD float64 `json:"price_usd,omitempty"`
// Liquidity USD
LiquidityUSD float64 `json:"liquidity_usd,omitempty"`
// Trading pairs
TradingPairs []TradingPair `json:"trading_pairs,omitempty"`
// Is honeypot
IsHoneypot bool `json:"is_honeypot,omitempty"`
// Honeypot reason
HoneypotReason string `json:"honeypot_reason,omitempty"`
}
TokenDetails contains token-specific details (ERC-20, etc.).
type Tool ¶
type Tool struct {
// Tool name (required).
Name string `json:"name"`
// Tool version.
Version string `json:"version,omitempty"`
// Tool vendor or organization.
Vendor string `json:"vendor,omitempty"`
// Tool information URL (http or https).
InfoURL string `json:"info_url,omitempty"`
// Detection techniques the tool applies. A finding may override with
// its own technique.
Techniques []Technique `json:"techniques,omitempty"`
// Content releases the tool ran with: template and rule packs,
// vulnerability databases.
Content []ToolContent `json:"content,omitempty"`
}
Tool describes the tool that generated the report, or one finding.
type ToolContent ¶
type ToolContent struct {
// Content name (required), for example a template pack or a
// vulnerability database.
Name string `json:"name"`
// Release version.
Version string `json:"version,omitempty"`
// SHA-256 of the release, lowercase hex.
SHA256 string `json:"sha256,omitempty"`
}
ToolContent is one content release a tool ran with.
type TradingPair ¶
type TradingPair struct {
// DEX name: uniswap, sushiswap, pancakeswap, etc.
DEX string `json:"dex"`
// Pair address
PairAddress string `json:"pair_address"`
// Quote token symbol (WETH, USDT, etc.)
QuoteToken string `json:"quote_token"`
// Liquidity USD
LiquidityUSD float64 `json:"liquidity_usd,omitempty"`
}
TradingPair represents a trading pair for a token.
type Transport ¶
type Transport string
Transport is a transport protocol.
type Unknown ¶
type Unknown struct {
Entries []UnknownEntry `json:"entries,omitempty"`
// Omitted counts entries beyond MaxUnknownEntries.
Omitted int `json:"omitted,omitempty"`
}
Unknown lists what Decode did not know in a newer-minor document. It is empty for a document of this module's minor or an older one.
type UnknownEntry ¶
type UnknownEntry struct {
Path string `json:"path"`
Kind UnknownKind `json:"kind"`
Value string `json:"value,omitempty"`
Fallback string `json:"fallback,omitempty"`
}
UnknownEntry is one thing Decode ignored, mapped or removed. Path is a JSON Pointer (RFC 6901) into the document as received; Value is the offending enum value, cut to 64 characters.
type UnknownKind ¶
type UnknownKind string
UnknownKind says what Decode did with something it did not know.
const ( // UnknownMember: a member the receiver does not know, ignored. UnknownMember UnknownKind = "member" // UnknownEnumValue: an enum value the receiver does not know. Fallback // is the value it was mapped to; empty when the enum has none, and then // a UnknownRemoved or UnknownDropped entry follows. UnknownEnumValue UnknownKind = "enum_value" // UnknownRemoved: an optional member removed because its value could // not be kept. UnknownRemoved UnknownKind = "removed" // UnknownDropped: an array item removed because a required value of it // could not be kept (a finding of a type the receiver does not know). UnknownDropped UnknownKind = "dropped" )
Unknown kinds.
type VEX ¶
type VEX struct {
// Status (required).
Status VEXStatus `json:"status"`
// Why the product is not affected. Only with status not_affected, which
// needs a justification or a statement.
Justification VEXJustification `json:"justification,omitempty"`
// The justification as the source document states it (a CycloneDX
// analysis.justification such as code_not_reachable).
NativeJustification string `json:"native_justification,omitempty"`
// Impact or action statement, plain text.
Statement string `json:"statement,omitempty"`
// Who made the statement: a document id or URL, a vendor, a team.
Source string `json:"source,omitempty"`
// When the statement was made.
AsOf *time.Time `json:"as_of,omitempty"`
}
VEX is an exploitability statement about the vulnerability of a finding, in the CSAF / OpenVEX vocabulary.
type VEXJustification ¶
type VEXJustification string
VEXJustification is why a product is not affected (CSAF flags, OpenVEX justifications).
const ( VEXJustificationComponentNotPresent VEXJustification = "component_not_present" VEXJustificationVulnerableCodeNotPresent VEXJustification = "vulnerable_code_not_present" VEXJustificationVulnerableCodeNotInExecutePath VEXJustification = "vulnerable_code_not_in_execute_path" VEXJustificationVulnerableCodeCannotBeControlledByAdversary VEXJustification = "vulnerable_code_cannot_be_controlled_by_adversary" VEXJustificationInlineMitigationsAlreadyExist VEXJustification = "inline_mitigations_already_exist" )
func AllVEXJustifications ¶
func AllVEXJustifications() []VEXJustification
AllVEXJustifications returns every valid VEX justification.
func NormalizeVEXJustification ¶
func NormalizeVEXJustification(native string) (VEXJustification, bool)
NormalizeVEXJustification maps a not-affected justification from CSAF flags, OpenVEX or CycloneDX (analysis.justification) to a VEXJustification. The CycloneDX values map to the nearest CSAF/OpenVEX value; keep the source word in VEX.NativeJustification.
func (VEXJustification) IsValid ¶
func (j VEXJustification) IsValid() bool
IsValid reports whether j is a recognized VEX justification.
type VEXStatus ¶
type VEXStatus string
VEXStatus is the exploitability status of a VEX statement.
func AllVEXStatuses ¶
func AllVEXStatuses() []VEXStatus
AllVEXStatuses returns every valid VEX status.
func NormalizeVEXStatus ¶
NormalizeVEXStatus maps a VEX status from CSAF (product_status groups), OpenVEX or CycloneDX (analysis.state) to a VEXStatus. A CycloneDX false_positive is a disposition of the finding, not an exploitability statement, and is not mapped.
type ValidationMethod ¶
type ValidationMethod string
ValidationMethod is how a finding was validated.
const ( ValidationMethodPentest ValidationMethod = "pentest" ValidationMethodBAS ValidationMethod = "bas" ValidationMethodAutomatedExploit ValidationMethod = "automated_exploit" ValidationMethodRetest ValidationMethod = "retest" ValidationMethodManualReview ValidationMethod = "manual_review" )
Validation methods.
func AllValidationMethods ¶
func AllValidationMethods() []ValidationMethod
AllValidationMethods returns every validation method.
func (ValidationMethod) IsValid ¶
func (m ValidationMethod) IsValid() bool
IsValid reports whether m is a known validation method.
type ValidationStatus ¶
type ValidationStatus string
ValidationStatus is the result of validating a finding.
const ( ValidationExploited ValidationStatus = "exploited" ValidationNotExploited ValidationStatus = "not_exploited" ValidationBlocked ValidationStatus = "blocked" ValidationDetected ValidationStatus = "detected" ValidationNotReproducible ValidationStatus = "not_reproducible" ValidationNotTested ValidationStatus = "not_tested" )
Validation statuses.
func AllValidationStatuses ¶
func AllValidationStatuses() []ValidationStatus
AllValidationStatuses returns every validation status.
func (ValidationStatus) IsValid ¶
func (s ValidationStatus) IsValid() bool
IsValid reports whether s is a known validation status.
type VerificationHold ¶ added in v2.0.5
type VerificationHold struct {
// Reasons are hold reason codes (HoldReasons), at least one.
Reasons []string `json:"reasons"`
// Status is the HTTP status of the matched response (0: not known).
Status int `json:"status,omitempty"`
// Edge is how an edge protection answered in the origin's place
// (HoldEdgeChallenged, HoldEdgeBlocked; "": none seen).
Edge string `json:"edge,omitempty"`
// EdgeVendor names the edge protection (an open token, text only).
EdgeVendor string `json:"edge_vendor,omitempty"`
// Similarity of the matched response to the origin's not-found answer,
// from 0 to 1 (nil: not measured).
Similarity *float64 `json:"similarity,omitempty"`
}
VerificationHold is the producer's screen of a finding's matched response: why the match may be the target's answer, not the application, and the screen's inputs. It never carries the response body.
func (VerificationHold) Validate ¶ added in v2.0.5
func (h VerificationHold) Validate() error
Validate checks h against the namespace schema.
type VulnDataSource ¶
type VulnDataSource struct {
// Open token ("nvd", "ghsa", "osv").
ID string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
// http or https URL.
URL string `json:"url,omitempty"`
}
VulnDataSource contains information about the vulnerability data source.
type VulnerabilityDetails ¶
type VulnerabilityDetails struct {
// Every id of the vulnerability with its namespace: CVE, GHSA, OSV,
// vendor (with source).
IDs []VulnerabilityID `json:"ids,omitempty"`
// CWE ids ("CWE-79").
CWEIDs []string `json:"cwe_ids,omitempty"`
// OWASP Top 10 ids ("A01:2021").
OWASPIDs []string `json:"owasp_ids,omitempty"`
// Affected package name, its purl and the installed version.
PackageName string `json:"package_name,omitempty"`
PURL string `json:"purl,omitempty"`
InstalledVersion string `json:"installed_version,omitempty"`
// Affected version range as the source states it.
AffectedVersionRange string `json:"affected_version_range,omitempty"`
// Versions that fix the vulnerability.
FixedVersions []string `json:"fixed_versions,omitempty"`
// Advisory publication and last modification.
PublishedAt *time.Time `json:"published_at,omitempty"`
ModifiedAt *time.Time `json:"modified_at,omitempty"`
// Affected CPE.
CPE string `json:"cpe,omitempty"`
// Direct dependency (not transitive), and the path for a transitive
// one.
IsDirect bool `json:"is_direct,omitempty"`
DependencyPath []string `json:"dependency_path,omitempty"`
// Vulnerability database the producer matched against.
DataSource *VulnDataSource `json:"data_source,omitempty"`
// Container layer where the package was found.
Layer *ContainerLayer `json:"layer,omitempty"`
// Threat assertions made by a named source at a date: KEV listing,
// exploitation in the wild, public exploit. Receivers SHOULD prefer
// their own intelligence.
ThreatSignals []ThreatSignal `json:"threat_signals,omitempty"`
}
VulnerabilityDetails contains vulnerability-specific details.
func (*VulnerabilityDetails) AddID ¶
func (v *VulnerabilityDetails) AddID(raw, source string) bool
AddID adds a vulnerability id to v.IDs: raw is recognized (CVE, GHSA, OSV-style ids) by NormalizeVulnerabilityID, else kept as a vendor id of the given source when source is set. It skips duplicates and reports whether v.IDs holds the id afterwards.
type VulnerabilityID ¶
type VulnerabilityID struct {
// Namespace (required).
Type VulnerabilityIDType `json:"type"`
// The identifier (required): CVE-2024-3094, GHSA-xxxx-xxxx-xxxx,
// PYSEC-2021-1, RHSA-2024:1234.
ID string `json:"id"`
// Issuer of a vendor id (redhat, microsoft, ubuntu, ...).
Source string `json:"source,omitempty"`
}
VulnerabilityID is one identifier of a vulnerability, with its namespace. One vulnerability often has several (a CVE, a GHSA and an OSV id); receivers deduplicate on any shared id.
func NormalizeVulnerabilityID ¶
func NormalizeVulnerabilityID(raw string) (VulnerabilityID, bool)
NormalizeVulnerabilityID recognizes a vulnerability id and returns it in canonical form with its type: CVE ids upper-case, GHSA ids as "GHSA-" plus the lower-case body, OSV database ids with an upper-case prefix, anything else as a vendor id. Empty, over-long and malformed ids (whitespace, control characters) return ok=false.
func PreferredVulnerabilityID ¶
func PreferredVulnerabilityID(v *VulnerabilityDetails) (VulnerabilityID, bool)
PreferredVulnerabilityID picks the one id receivers key on, so two tools that name the same vulnerability differently agree: the numerically smallest CVE (by year, then sequence number, so CVE-2021-9999 comes before CVE-2021-10000), else the first GHSA, else the first OSV id, else the first vendor id. A CVE id that does not parse sorts after every well-formed one, by text.
func VulnerabilityIDs ¶
func VulnerabilityIDs(v *VulnerabilityDetails) []VulnerabilityID
VulnerabilityIDs returns every id of a vulnerability, canonical and without duplicates, in the order of vulnerability.ids, at most MaxVulnerabilityIDs. Invalid entries are skipped.
type VulnerabilityIDType ¶
type VulnerabilityIDType string
VulnerabilityIDType is the namespace of a vulnerability id.
const ( VulnerabilityIDCVE VulnerabilityIDType = "cve" VulnerabilityIDGHSA VulnerabilityIDType = "ghsa" VulnerabilityIDOSV VulnerabilityIDType = "osv" VulnerabilityIDVendor VulnerabilityIDType = "vendor" )
func AllVulnerabilityIDTypes ¶
func AllVulnerabilityIDTypes() []VulnerabilityIDType
AllVulnerabilityIDTypes returns every valid vulnerability id type.
func (VulnerabilityIDType) IsValid ¶
func (t VulnerabilityIDType) IsValid() bool
IsValid reports whether t is a recognized vulnerability id type.
type WalletDetails ¶
type WalletDetails struct {
// Wallet type: eoa, multisig, smart_wallet, mpc
WalletType string `json:"wallet_type,omitempty"`
// For multisig: required signatures
RequiredSignatures int `json:"required_signatures,omitempty"`
// For multisig: total owners
TotalOwners int `json:"total_owners,omitempty"`
// Owner addresses (for multisig)
Owners []string `json:"owners,omitempty"`
// Wallet provider: metamask, ledger, safe, argent, etc.
Provider string `json:"provider,omitempty"`
// Balance (native token, in wei)
Balance string `json:"balance,omitempty"`
// Token balances
TokenBalances []TokenBalance `json:"token_balances,omitempty"`
// NFT count
NFTCount int `json:"nft_count,omitempty"`
// First transaction timestamp
FirstTxAt *time.Time `json:"first_tx_at,omitempty"`
// Last transaction timestamp
LastTxAt *time.Time `json:"last_tx_at,omitempty"`
// Total transactions
TxCount int64 `json:"tx_count,omitempty"`
// ENS name (if applicable)
ENSName string `json:"ens_name,omitempty"`
// Labels (exchange, whale, hacker, etc.)
Labels []string `json:"labels,omitempty"`
}
WalletDetails contains wallet-specific details.
type Web3POC ¶
type Web3POC struct {
// POC type: transaction, script, foundry_test, hardhat_test
Type string `json:"type,omitempty"`
// POC code or script
Code string `json:"code,omitempty"`
// POC transaction data
TxData string `json:"tx_data,omitempty"`
// Expected outcome
ExpectedOutcome string `json:"expected_outcome,omitempty"`
// Tested on: mainnet_fork, testnet, local
TestedOn string `json:"tested_on,omitempty"`
// Fork block number (for mainnet fork tests)
ForkBlockNumber int64 `json:"fork_block_number,omitempty"`
}
Web3POC contains proof of concept details for Web3 vulnerabilities.
type Web3Technical ¶
type Web3Technical struct {
// Blockchain network: ethereum, polygon, bsc, arbitrum, optimism, avalanche, solana, etc.
Chain string `json:"chain,omitempty"`
// Chain ID (EVM chains): 1 (mainnet), 137 (polygon), 56 (bsc), etc.
ChainID int64 `json:"chain_id,omitempty"`
// Network type: mainnet, testnet, devnet
NetworkType string `json:"network_type,omitempty"`
// Contract/wallet address
Address string `json:"address,omitempty"`
// For smart contracts
Contract *SmartContractDetails `json:"contract,omitempty"`
// For wallets
Wallet *WalletDetails `json:"wallet,omitempty"`
// For tokens (ERC-20, ERC-721, etc.)
Token *TokenDetails `json:"token,omitempty"`
// For DeFi protocols
DeFi *DeFiDetails `json:"defi,omitempty"`
// For NFT collections
NFT *NFTCollectionDetails `json:"nft,omitempty"`
}
Web3Technical contains Web3-specific technical details for smart contracts, wallets, tokens, and other blockchain assets.
type Web3VulnerabilityClass ¶
type Web3VulnerabilityClass string
Web3VulnerabilityClass represents common Web3 vulnerability classes.
const ( // SWC-100 series - Basic Web3VulnReentrancy Web3VulnerabilityClass = "reentrancy" // SWC-107 Web3VulnIntegerOverflow Web3VulnerabilityClass = "integer_overflow" // SWC-101 Web3VulnIntegerUnderflow Web3VulnerabilityClass = "integer_underflow" // SWC-101 Web3VulnAccessControl Web3VulnerabilityClass = "access_control" // SWC-105 Web3VulnUncheckedCall Web3VulnerabilityClass = "unchecked_call" // SWC-104 Web3VulnDelegateCall Web3VulnerabilityClass = "delegate_call" // SWC-112 Web3VulnSelfDestruct Web3VulnerabilityClass = "self_destruct" // SWC-106 Web3VulnTxOrigin Web3VulnerabilityClass = "tx_origin" // SWC-115 Web3VulnTimestampDependence Web3VulnerabilityClass = "timestamp_dependence" // SWC-116 Web3VulnBlockHashDependence Web3VulnerabilityClass = "blockhash_dependence" // SWC-120 // DeFi-specific Web3VulnFlashLoan Web3VulnerabilityClass = "flash_loan_attack" Web3VulnOracleManipulation Web3VulnerabilityClass = "oracle_manipulation" Web3VulnFrontRunning Web3VulnerabilityClass = "front_running" Web3VulnSandwichAttack Web3VulnerabilityClass = "sandwich_attack" Web3VulnSlippage Web3VulnerabilityClass = "slippage_attack" Web3VulnPriceManipulation Web3VulnerabilityClass = "price_manipulation" Web3VulnGovernanceAttack Web3VulnerabilityClass = "governance_attack" Web3VulnLiquidityDrain Web3VulnerabilityClass = "liquidity_drain" Web3VulnMEV Web3VulnerabilityClass = "mev_vulnerability" // Token-specific Web3VulnHoneypot Web3VulnerabilityClass = "honeypot" Web3VulnHiddenMint Web3VulnerabilityClass = "hidden_mint" Web3VulnHiddenFee Web3VulnerabilityClass = "hidden_fee" Web3VulnBlacklistAbuse Web3VulnerabilityClass = "blacklist_abuse" Web3VulnRenounceOwnership Web3VulnerabilityClass = "fake_renounce" // Proxy & Upgrade Web3VulnStorageCollision Web3VulnerabilityClass = "storage_collision" Web3VulnUninitializedProxy Web3VulnerabilityClass = "uninitialized_proxy" Web3VulnUpgradeVuln Web3VulnerabilityClass = "upgrade_vulnerability" // Cryptographic Web3VulnWeakRandomness Web3VulnerabilityClass = "weak_randomness" // SWC-120 Web3VulnSignatureMalleability Web3VulnerabilityClass = "signature_malleability" Web3VulnReplayAttack Web3VulnerabilityClass = "replay_attack" // Gas & DoS Web3VulnDosGasLimit Web3VulnerabilityClass = "dos_gas_limit" Web3VulnUnboundedLoop Web3VulnerabilityClass = "unbounded_loop" Web3VulnDosBlockStuffing Web3VulnerabilityClass = "dos_block_stuffing" // Logic Web3VulnBusinessLogic Web3VulnerabilityClass = "business_logic" Web3VulnInvariantViolation Web3VulnerabilityClass = "invariant_violation" )
func AllWeb3VulnerabilityClasses ¶
func AllWeb3VulnerabilityClasses() []Web3VulnerabilityClass
AllWeb3VulnerabilityClasses returns all Web3 vulnerability classes.
type Web3VulnerabilityDetails ¶
type Web3VulnerabilityDetails struct {
// Vulnerability class/category (SWC ID or custom)
// Common: reentrancy, overflow, access_control, front_running, etc.
VulnerabilityClass string `json:"vulnerability_class,omitempty"`
// SWC Registry ID (e.g., SWC-107 for reentrancy)
SWCID string `json:"swc_id,omitempty"`
// Contract address affected
ContractAddress string `json:"contract_address,omitempty"`
// Chain ID
ChainID int64 `json:"chain_id,omitempty"`
// Chain name
Chain string `json:"chain,omitempty"`
// Affected function signature
FunctionSignature string `json:"function_signature,omitempty"`
// Affected function selector (4 bytes)
FunctionSelector string `json:"function_selector,omitempty"`
// Vulnerable code pattern
VulnerablePattern string `json:"vulnerable_pattern,omitempty"`
// Bytecode offset (if found in bytecode analysis)
BytecodeOffset int `json:"bytecode_offset,omitempty"`
// Is exploitable on mainnet
IsExploitableOnMainnet bool `json:"is_exploitable_on_mainnet,omitempty"`
// Estimated impact in USD (if quantifiable)
EstimatedImpactUSD float64 `json:"estimated_impact_usd,omitempty"`
// Affected assets value in USD
AffectedValueUSD float64 `json:"affected_value_usd,omitempty"`
// Attack vector description
AttackVector string `json:"attack_vector,omitempty"`
// Proof of concept (if available)
POC *Web3POC `json:"poc,omitempty"`
// Related transaction hashes (if exploit occurred)
RelatedTxHashes []string `json:"related_tx_hashes,omitempty"`
// Attacker addresses (if known)
AttackerAddresses []string `json:"attacker_addresses,omitempty"`
// Tool that found this: slither, mythril, securify, manticore, etc.
DetectionTool string `json:"detection_tool,omitempty"`
// Detection confidence: high, medium, low
DetectionConfidence string `json:"detection_confidence,omitempty"`
// Is false positive
IsFalsePositive bool `json:"is_false_positive,omitempty"`
// Gas optimization issues (for gas-related findings)
GasIssue *GasIssue `json:"gas_issue,omitempty"`
// Access control details
AccessControl *AccessControlIssue `json:"access_control,omitempty"`
// Reentrancy details
Reentrancy *ReentrancyIssue `json:"reentrancy,omitempty"`
// Oracle manipulation details
OracleManipulation *OracleManipulationIssue `json:"oracle_manipulation,omitempty"`
// Flash loan attack details
FlashLoan *FlashLoanIssue `json:"flash_loan,omitempty"`
}
Web3VulnerabilityDetails contains Web3/smart contract vulnerability-specific details.
type WebCaptureInput ¶
type WebCaptureInput struct {
// URL is the URL that was asked for. FinalURL is where redirects ended.
URL string
FinalURL string
// StatusCode is the HTTP status of the final response.
StatusCode int
ContentType string
// Size is the number of body bytes the producer read.
Size int64
// SHA256 is the lowercase hex SHA-256 of those bytes.
SHA256 string
// Truncated reports that the producer stopped reading at its limit.
Truncated bool
// Body is the response body as text; empty when the content type is not
// text, or the producer chose not to send it. BodyTruncated reports that
// the producer already cut it.
Body string
BodyTruncated bool
// FetchedAt is when the response was read; zero means now.
FetchedAt time.Time
}
WebCaptureInput is one fetched URL: what the server answered, never what a page would execute.
type WebFormInput ¶
type WebFormInput struct {
// Method is GET or POST; anything else is GET.
Method string
// Action is the absolute form target; empty means the page itself.
Action string
// Params are the field names (location form). A producer that knows
// the input type sets TypeHint to TypeHintPassword; the converter also
// marks fields whose name says password.
Params []EndpointParam
}
WebFormInput is one HTML form of a crawled page.
type WebLocation ¶
type WebLocation struct {
// URL is the redacted URL: no query values, user info or fragment.
URL string `json:"url"`
Method string `json:"method,omitempty"`
// EndpointRef names an endpoint of this report.
EndpointRef string `json:"endpoint_ref,omitempty"`
// Parameter is the parameter the finding is about.
Parameter *WebParameter `json:"parameter,omitempty"`
// RequestRef names the evidence of the request ("sha256:<hex>" or an
// attachment id).
RequestRef string `json:"request_ref,omitempty"`
StatusCode int `json:"status_code,omitempty"`
}
WebLocation is where on a web origin a finding was observed.
type WebParameter ¶
type WebParameter struct {
Location ParamLocation `json:"location"`
Name string `json:"name"`
}
WebParameter is one parameter of a request.
Source Files
¶
- canonical.go
- contract_members.go
- correlation.go
- coverage_members.go
- dataflow_normalize.go
- dataflow_types.go
- decode.go
- dependency_types.go
- doc.go
- evidence.go
- evidence_http.go
- evidence_redact.go
- httpx.go
- identifiers.go
- interop.go
- interop_normalize.go
- interop_validate.go
- normalize.go
- recon_converter.go
- recon_posture.go
- recon_web.go
- recon_webcontent.go
- rules.go
- secret_redact.go
- types.go
- validate.go
- validate_details.go
- verification_hold.go
- version.go
- web3_types.go
- web_members.go
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
ctis
module
|
|
|
Package codesnippet fills the code of a report's locations from the scanned source, for a producer that has the source in front of it (a CI job, a sensor).
|
Package codesnippet fills the code of a report's locations from the scanned source, for a producer that has the source in front of it (a CI job, a sensor). |
|
Package fingerprint provides unified fingerprint generation algorithms for deduplication of security findings across SDK and Backend.
|
Package fingerprint provides unified fingerprint generation algorithms for deduplication of security findings across SDK and Backend. |
|
Package importer converts the files other security tools export into CTIS 1.4 reports: Nessus v2 XML, Qualys host detection XML (joined with the Qualys KnowledgeBase), CycloneDX and SPDX SBOMs, OSV records, CSAF 2.0 and OpenVEX documents, DefectDojo Generic Findings JSON, SARIF 2.1.0, and the native JSON of trivy, nuclei, semgrep, betterleaks and vuls, nmap XML, testssl.sh JSON, ffuf JSON, S3Scanner JSON lines, arjun JSON, line lists (FormatLines) and CTIS reports (FormatCTIS, passed through without the receiver profile's extensions).
|
Package importer converts the files other security tools export into CTIS 1.4 reports: Nessus v2 XML, Qualys host detection XML (joined with the Qualys KnowledgeBase), CycloneDX and SPDX SBOMs, OSV records, CSAF 2.0 and OpenVEX documents, DefectDojo Generic Findings JSON, SARIF 2.1.0, and the native JSON of trivy, nuclei, semgrep, betterleaks and vuls, nmap XML, testssl.sh JSON, ffuf JSON, S3Scanner JSON lines, arjun JSON, line lists (FormatLines) and CTIS reports (FormatCTIS, passed through without the receiver profile's extensions). |
|
mapping
Package mapping turns the JSON, JSON Lines, CSV or XML output of any tool into a CTIS report through a declarative mapping file, so a tool or an export needs no parser code.
|
Package mapping turns the JSON, JSON Lines, CSV or XML output of any tool into a CTIS report through a declarative mapping file, so a tool or an export needs no parser code. |
|
internal
|
|
|
conformance
Package conformance runs the CTIS conformance vectors (conformance/v2) against this implementation.
|
Package conformance runs the CTIS conformance vectors (conformance/v2) against this implementation. |
|
exportkit
Package exportkit holds the rules every exporter of the interoperability adapters (v2/interop/<format>, nested modules of this repository) follows.
|
Package exportkit holds the rules every exporter of the interoperability adapters (v2/interop/<format>, nested modules of this repository) follows. |
|
goldencheck
Package goldencheck holds checks on golden report files that package importer and the adapters share (it must not import importer).
|
Package goldencheck holds checks on golden report files that package importer and the adapters share (it must not import importer). |
|
importkit
Package importkit holds the text, reference and package helpers shared by the importers of package importer and the interoperability adapters (v2/interop/<format>, nested modules of this repository).
|
Package importkit holds the text, reference and package helpers shared by the importers of package importer and the interoperability adapters (v2/interop/<format>, nested modules of this repository). |
|
interoptest
Package interoptest holds the test helpers the interoperability adapters (v2/interop/<format>, nested modules of this repository) share: golden files, round-trip comparison with declared losses, field coverage of mapping files.
|
Package interoptest holds the test helpers the interoperability adapters (v2/interop/<format>, nested modules of this repository) share: golden files, round-trip comparison with declared losses, field coverage of mapping files. |
|
validatedoc
Package validatedoc checks one CTIS document the way a strict receiver does: it decodes with unknown members refused, requires a version this module implements, and runs Report.Validate.
|
Package validatedoc checks one CTIS document the way a strict receiver does: it decodes with unknown members refused, requires a version this module implements, and runs Report.Validate. |
|
interop
|
|
|
engine
Package engine runs the declarative mapping files of the CTIS interoperability adapters (github.com/openctemio/ctis/v2/interop/<format>).
|
Package engine runs the declarative mapping files of the CTIS interoperability adapters (github.com/openctemio/ctis/v2/interop/<format>). |
|
csaf
module
|
|
|
cyclonedx
module
|
|
|
ocsf
module
|
|
|
openvex
module
|
|
|
sarif
module
|
|
|
spdx
module
|
|
|
Package severity provides unified severity level definitions and mappings for security findings across SDK and Backend.
|
Package severity provides unified severity level definitions and mappings for security findings across SDK and Backend. |
|
Package weburl is the one URL library of the web attack surface: the sensor, the SDK and the platform parse, normalise and template web URLs the same way, so an endpoint found by one tool and one found by another land on the same row.
|
Package weburl is the one URL library of the web attack surface: the sensor, the SDK and the platform parse, normalise and template web URLs the same way, so an endpoint found by one tool and one found by another land on the same row. |