/
types.go
180 lines (156 loc) · 8.26 KB
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
// Code generated by cdpgen. DO NOT EDIT.
package security
import (
"github.com/mafredri/cdp/protocol/internal"
)
// CertificateID An internal certificate ID value.
type CertificateID int
// MixedContentType A description of mixed content (HTTP resources on HTTPS
// pages), as defined by https://www.w3.org/TR/mixed-content/#categories
type MixedContentType string
// MixedContentType as enums.
const (
MixedContentTypeNotSet MixedContentType = ""
MixedContentTypeBlockable MixedContentType = "blockable"
MixedContentTypeOptionallyBlockable MixedContentType = "optionally-blockable"
MixedContentTypeNone MixedContentType = "none"
)
func (e MixedContentType) Valid() bool {
switch e {
case "blockable", "optionally-blockable", "none":
return true
default:
return false
}
}
func (e MixedContentType) String() string {
return string(e)
}
// State The security level of a page or resource.
type State string
// State as enums.
const (
StateNotSet State = ""
StateUnknown State = "unknown"
StateNeutral State = "neutral"
StateInsecure State = "insecure"
StateSecure State = "secure"
StateInfo State = "info"
StateInsecureBroken State = "insecure-broken"
)
func (e State) Valid() bool {
switch e {
case "unknown", "neutral", "insecure", "secure", "info", "insecure-broken":
return true
default:
return false
}
}
func (e State) String() string {
return string(e)
}
// CertificateSecurityState Details about the security state of the page
// certificate.
//
// Note: This type is experimental.
type CertificateSecurityState struct {
Protocol string `json:"protocol"` // Protocol name (e.g. "TLS 1.2" or "QUIC").
KeyExchange string `json:"keyExchange"` // Key Exchange used by the connection, or the empty string if not applicable.
KeyExchangeGroup *string `json:"keyExchangeGroup,omitempty"` // (EC)DH group used by the connection, if applicable.
Cipher string `json:"cipher"` // Cipher name.
MAC *string `json:"mac,omitempty"` // TLS MAC. Note that AEAD ciphers do not have separate MACs.
Certificate []string `json:"certificate"` // Page certificate.
SubjectName string `json:"subjectName"` // Certificate subject name.
Issuer string `json:"issuer"` // Name of the issuing CA.
ValidFrom internal.NetworkTimeSinceEpoch `json:"validFrom"` // Certificate valid from date.
ValidTo internal.NetworkTimeSinceEpoch `json:"validTo"` // Certificate valid to (expiration) date
CertificateNetworkError *string `json:"certificateNetworkError,omitempty"` // The highest priority network error code, if the certificate has an error.
CertificateHasWeakSignature bool `json:"certificateHasWeakSignature"` // True if the certificate uses a weak signature aglorithm.
CertificateHasSha1Signature bool `json:"certificateHasSha1Signature"` // True if the certificate has a SHA1 signature in the chain.
ModernSSL bool `json:"modernSSL"` // True if modern SSL
ObsoleteSSLProtocol bool `json:"obsoleteSslProtocol"` // True if the connection is using an obsolete SSL protocol.
ObsoleteSSLKeyExchange bool `json:"obsoleteSslKeyExchange"` // True if the connection is using an obsolete SSL key exchange.
ObsoleteSSLCipher bool `json:"obsoleteSslCipher"` // True if the connection is using an obsolete SSL cipher.
ObsoleteSSLSignature bool `json:"obsoleteSslSignature"` // True if the connection is using an obsolete SSL signature.
}
// SafetyTipStatus
//
// Note: This type is experimental.
type SafetyTipStatus string
// SafetyTipStatus as enums.
const (
SafetyTipStatusNotSet SafetyTipStatus = ""
SafetyTipStatusBadReputation SafetyTipStatus = "badReputation"
SafetyTipStatusLookalike SafetyTipStatus = "lookalike"
)
func (e SafetyTipStatus) Valid() bool {
switch e {
case "badReputation", "lookalike":
return true
default:
return false
}
}
func (e SafetyTipStatus) String() string {
return string(e)
}
// SafetyTipInfo
//
// Note: This type is experimental.
type SafetyTipInfo struct {
SafetyTipStatus SafetyTipStatus `json:"safetyTipStatus"` // Describes whether the page triggers any safety tips or reputation warnings. Default is unknown.
SafeURL *string `json:"safeUrl,omitempty"` // The URL the safety tip suggested ("Did you mean?"). Only filled in for lookalike matches.
}
// VisibleSecurityState Security state information about the page.
//
// Note: This type is experimental.
type VisibleSecurityState struct {
SecurityState State `json:"securityState"` // The security level of the page.
CertificateSecurityState *CertificateSecurityState `json:"certificateSecurityState,omitempty"` // Security state details about the page certificate.
SafetyTipInfo *SafetyTipInfo `json:"safetyTipInfo,omitempty"` // The type of Safety Tip triggered on the page. Note that this field will be set even if the Safety Tip UI was not actually shown.
SecurityStateIssueIDs []string `json:"securityStateIssueIds"` // Array of security state issues ids.
}
// StateExplanation An explanation of an factor contributing to the security
// state.
type StateExplanation struct {
SecurityState State `json:"securityState"` // Security state representing the severity of the factor being explained.
Title string `json:"title"` // Title describing the type of factor.
Summary string `json:"summary"` // Short phrase describing the type of factor.
Description string `json:"description"` // Full text explanation of the factor.
MixedContentType MixedContentType `json:"mixedContentType"` // The type of mixed content described by the explanation.
Certificate []string `json:"certificate"` // Page certificate.
Recommendations []string `json:"recommendations,omitempty"` // Recommendations to fix any issues.
}
// InsecureContentStatus
//
// Deprecated: Information about insecure content on the page.
type InsecureContentStatus struct {
RanMixedContent bool `json:"ranMixedContent"` // Always false.
DisplayedMixedContent bool `json:"displayedMixedContent"` // Always false.
ContainedMixedForm bool `json:"containedMixedForm"` // Always false.
RanContentWithCertErrors bool `json:"ranContentWithCertErrors"` // Always false.
DisplayedContentWithCertErrors bool `json:"displayedContentWithCertErrors"` // Always false.
RanInsecureContentStyle State `json:"ranInsecureContentStyle"` // Always set to unknown.
DisplayedInsecureContentStyle State `json:"displayedInsecureContentStyle"` // Always set to unknown.
}
// CertificateErrorAction The action to take when a certificate error occurs.
// continue will continue processing the request and cancel will cancel the
// request.
type CertificateErrorAction string
// CertificateErrorAction as enums.
const (
CertificateErrorActionNotSet CertificateErrorAction = ""
CertificateErrorActionContinue CertificateErrorAction = "continue"
CertificateErrorActionCancel CertificateErrorAction = "cancel"
)
func (e CertificateErrorAction) Valid() bool {
switch e {
case "continue", "cancel":
return true
default:
return false
}
}
func (e CertificateErrorAction) String() string {
return string(e)
}