checkly 8.16.0 → 8.17.1-prerelease-14d5b2d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai-context/context.js +4 -4
- package/dist/ai-context/skills-command/references/configure-ssl-monitors.md +4 -4
- package/dist/constructs/grpc-assertion-codegen.js +60 -4
- package/dist/constructs/grpc-assertion-codegen.js.map +1 -1
- package/dist/constructs/grpc-assertion-validation.js +16 -0
- package/dist/constructs/grpc-assertion-validation.js.map +1 -1
- package/dist/constructs/grpc-assertion.d.ts +37 -2
- package/dist/constructs/grpc-assertion.js +42 -3
- package/dist/constructs/grpc-assertion.js.map +1 -1
- package/dist/constructs/grpc-request-codegen.js +0 -3
- package/dist/constructs/grpc-request-codegen.js.map +1 -1
- package/dist/constructs/grpc-request.d.ts +0 -6
- package/dist/constructs/internal/assertion-codegen.d.ts +11 -2
- package/dist/constructs/internal/assertion-codegen.js +14 -17
- package/dist/constructs/internal/assertion-codegen.js.map +1 -1
- package/dist/constructs/internal/assertion-grammar.d.ts +35 -0
- package/dist/constructs/internal/assertion-grammar.js +75 -0
- package/dist/constructs/internal/assertion-grammar.js.map +1 -0
- package/dist/constructs/internal/assertion.js +2 -2
- package/dist/constructs/internal/assertion.js.map +1 -1
- package/dist/constructs/ssl-assertion-codegen.d.ts +2 -0
- package/dist/constructs/ssl-assertion-codegen.js +65 -27
- package/dist/constructs/ssl-assertion-codegen.js.map +1 -1
- package/dist/constructs/ssl-assertion-grammar.d.ts +123 -0
- package/dist/constructs/ssl-assertion-grammar.js +90 -0
- package/dist/constructs/ssl-assertion-grammar.js.map +1 -0
- package/dist/constructs/ssl-assertion-validation.d.ts +6 -6
- package/dist/constructs/ssl-assertion-validation.js +97 -28
- package/dist/constructs/ssl-assertion-validation.js.map +1 -1
- package/dist/constructs/ssl-assertion.d.ts +59 -114
- package/dist/constructs/ssl-assertion.js +59 -176
- package/dist/constructs/ssl-assertion.js.map +1 -1
- package/dist/constructs/traceroute-assertion-grammar.d.ts +33 -0
- package/dist/constructs/traceroute-assertion-grammar.js +33 -0
- package/dist/constructs/traceroute-assertion-grammar.js.map +1 -0
- package/dist/constructs/traceroute-assertion-validation.js +21 -27
- package/dist/constructs/traceroute-assertion-validation.js.map +1 -1
- package/dist/constructs/traceroute-assertion.d.ts +6 -25
- package/dist/constructs/traceroute-assertion.js +5 -51
- package/dist/constructs/traceroute-assertion.js.map +1 -1
- package/dist/reporters/abstract-list.d.ts +2 -0
- package/dist/reporters/abstract-list.js +29 -11
- package/dist/reporters/abstract-list.js.map +1 -1
- package/oclif.manifest.json +206 -206
- package/package.json +7 -7
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import { Assertion as CoreAssertion } from './internal/assertion.js';
|
|
1
|
+
import { Assertion as CoreAssertion, GeneralAssertionBuilder, NumericAssertionBuilder } from './internal/assertion.js';
|
|
2
|
+
import { PropertyOperators } from './internal/assertion-grammar.js';
|
|
3
|
+
import { certificateGrammar, connectionGrammar } from './ssl-assertion-grammar.js';
|
|
2
4
|
/**
|
|
3
|
-
* Known TLS protocol versions for use
|
|
5
|
+
* Known TLS protocol versions for use as a target of the `tlsVersion` property on
|
|
6
|
+
* the {@link SslAssertionBuilder.connection} builder.
|
|
4
7
|
*
|
|
5
8
|
* @example
|
|
6
9
|
* ```typescript
|
|
7
|
-
* SslAssertionBuilder.tlsVersion
|
|
10
|
+
* SslAssertionBuilder.connection('tlsVersion').equals(TlsVersion.TLS1_3)
|
|
8
11
|
* ```
|
|
9
12
|
*/
|
|
10
13
|
export declare const TlsVersion: {
|
|
@@ -17,11 +20,12 @@ export type TlsVersionValue = (typeof TlsVersion)[keyof typeof TlsVersion];
|
|
|
17
20
|
/**
|
|
18
21
|
* Signature algorithms as reported by Go's `x509.Certificate.SignatureAlgorithm.String()`.
|
|
19
22
|
* These are the exact values the SSL runner evaluates assertions against — use these
|
|
20
|
-
* constants (or the string literals they represent)
|
|
23
|
+
* constants (or the string literals they represent) as a target of the
|
|
24
|
+
* `signatureAlgorithm` property on the {@link SslAssertionBuilder.certificate} builder.
|
|
21
25
|
*
|
|
22
26
|
* @example
|
|
23
27
|
* ```typescript
|
|
24
|
-
* SslAssertionBuilder.signatureAlgorithm
|
|
28
|
+
* SslAssertionBuilder.certificate('signatureAlgorithm').equals(SignatureAlgorithm.SHA256_RSA)
|
|
25
29
|
* ```
|
|
26
30
|
*/
|
|
27
31
|
export declare const SignatureAlgorithm: {
|
|
@@ -44,14 +48,14 @@ export declare const SignatureAlgorithm: {
|
|
|
44
48
|
};
|
|
45
49
|
export type SignatureAlgorithmValue = (typeof SignatureAlgorithm)[keyof typeof SignatureAlgorithm];
|
|
46
50
|
/**
|
|
47
|
-
* Commonly-used IANA cipher suite names for use
|
|
48
|
-
* {@link SslAssertionBuilder.
|
|
49
|
-
* widely-deployed TLS 1.2 suites.
|
|
51
|
+
* Commonly-used IANA cipher suite names for use as a target of the `cipherSuite`
|
|
52
|
+
* property on the {@link SslAssertionBuilder.connection} builder. Includes TLS 1.3
|
|
53
|
+
* suites and widely-deployed TLS 1.2 suites.
|
|
50
54
|
*
|
|
51
55
|
* @example
|
|
52
56
|
* ```typescript
|
|
53
|
-
* SslAssertionBuilder.cipherSuite
|
|
54
|
-
* SslAssertionBuilder.cipherSuite
|
|
57
|
+
* SslAssertionBuilder.connection('cipherSuite').equals(CipherSuite.TLS_AES_256_GCM_SHA384)
|
|
58
|
+
* SslAssertionBuilder.connection('cipherSuite').equals(CipherSuite.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256)
|
|
55
59
|
* ```
|
|
56
60
|
*/
|
|
57
61
|
export declare const CipherSuite: {
|
|
@@ -72,126 +76,67 @@ export declare const CipherSuite: {
|
|
|
72
76
|
readonly TLS_RSA_WITH_AES_256_CBC_SHA: "TLS_RSA_WITH_AES_256_CBC_SHA";
|
|
73
77
|
};
|
|
74
78
|
export type CipherSuiteValue = (typeof CipherSuite)[keyof typeof CipherSuite];
|
|
75
|
-
type SslAssertionSource = '
|
|
79
|
+
type SslAssertionSource = 'CERTIFICATE' | 'CONNECTION' | 'RESPONSE_TIME' | 'JSON_RESPONSE' | 'TEXT_RESPONSE';
|
|
76
80
|
export type SslAssertion = CoreAssertion<SslAssertionSource>;
|
|
77
|
-
/**
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
lessThan(target: number): SslAssertion;
|
|
82
|
-
greaterThan(target: number): SslAssertion;
|
|
83
|
-
}
|
|
84
|
-
/** Certificate key size in bits (numeric, exact match only). */
|
|
85
|
-
declare class KeySizeBitsAssertionBuilder {
|
|
86
|
-
equals(target: number): SslAssertion;
|
|
87
|
-
}
|
|
88
|
-
/** Whether the certificate is not expired (boolean). */
|
|
89
|
-
declare class CertNotExpiredAssertionBuilder {
|
|
90
|
-
equals(target: boolean): SslAssertion;
|
|
91
|
-
}
|
|
92
|
-
/** Whether the hostname is verified (boolean). */
|
|
93
|
-
declare class HostnameVerifiedAssertionBuilder {
|
|
94
|
-
equals(target: boolean): SslAssertion;
|
|
95
|
-
}
|
|
96
|
-
/** Whether the certificate chain is trusted (boolean). */
|
|
97
|
-
declare class ChainTrustedAssertionBuilder {
|
|
98
|
-
equals(target: boolean): SslAssertion;
|
|
99
|
-
}
|
|
100
|
-
/** Whether a stapled OCSP response was provided during the handshake (boolean). */
|
|
101
|
-
declare class OcspStapledAssertionBuilder {
|
|
102
|
-
equals(target: boolean): SslAssertion;
|
|
103
|
-
}
|
|
104
|
-
/** Negotiated TLS version — `.equals()` accepts only known TLS version strings. */
|
|
105
|
-
declare class TlsVersionAssertionBuilder {
|
|
106
|
-
equals(target: TlsVersionValue): SslAssertion;
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Certificate signature algorithm. `.equals()` takes a Go
|
|
110
|
-
* `x509.Certificate.SignatureAlgorithm.String()` value; `.matches()` takes a regex.
|
|
111
|
-
*/
|
|
112
|
-
declare class SignatureAlgorithmAssertionBuilder {
|
|
113
|
-
equals(target: SignatureAlgorithmValue): SslAssertion;
|
|
114
|
-
matches(target: string): SslAssertion;
|
|
115
|
-
}
|
|
116
|
-
/** Negotiated cipher suite (string) — exact, not-equal, or regex match. */
|
|
117
|
-
declare class CipherSuiteAssertionBuilder {
|
|
118
|
-
equals(target: string): SslAssertion;
|
|
119
|
-
notEquals(target: string): SslAssertion;
|
|
120
|
-
matches(target: string): SslAssertion;
|
|
121
|
-
}
|
|
122
|
-
/** Certificate issuer common name (string) — exact, not-equal, or regex match. */
|
|
123
|
-
declare class IssuerCnAssertionBuilder {
|
|
124
|
-
equals(target: string): SslAssertion;
|
|
125
|
-
notEquals(target: string): SslAssertion;
|
|
126
|
-
matches(target: string): SslAssertion;
|
|
127
|
-
}
|
|
128
|
-
/** Certificate SHA-256 fingerprint (string, exact match only). */
|
|
129
|
-
declare class CertFingerprintSha256AssertionBuilder {
|
|
130
|
-
equals(target: string): SslAssertion;
|
|
131
|
-
}
|
|
132
|
-
/** Issuer SHA-256 fingerprint (string, exact match only). */
|
|
133
|
-
declare class IssuerFingerprintSha256AssertionBuilder {
|
|
134
|
-
equals(target: string): SslAssertion;
|
|
135
|
-
}
|
|
81
|
+
/** The certificate properties an assertion can be made against. */
|
|
82
|
+
export type SslCertificateProperty = keyof typeof certificateGrammar;
|
|
83
|
+
/** The connection properties an assertion can be made against. */
|
|
84
|
+
export type SslConnectionProperty = keyof typeof connectionGrammar;
|
|
136
85
|
/**
|
|
137
86
|
* Builder class for creating SSL monitor assertions.
|
|
138
|
-
*
|
|
87
|
+
*
|
|
88
|
+
* Assertions are property-scoped: {@link certificate} and {@link connection} take the
|
|
89
|
+
* name of a certificate/connection property, {@link jsonResponse} takes a JSONPath and
|
|
90
|
+
* {@link textResponse} an optional regex. The comparison operators the backend accepts
|
|
91
|
+
* depend on the property's value type and are validated at deploy time.
|
|
139
92
|
*
|
|
140
93
|
* @example
|
|
141
94
|
* ```typescript
|
|
142
|
-
* //
|
|
143
|
-
* SslAssertionBuilder.
|
|
95
|
+
* // Certificate facts, addressed by property name
|
|
96
|
+
* SslAssertionBuilder.certificate('daysUntilExpiry').greaterThan(30)
|
|
97
|
+
* SslAssertionBuilder.certificate('issuerCN').contains("Let's Encrypt")
|
|
98
|
+
* SslAssertionBuilder.certificate('signatureAlgorithm').equals(SignatureAlgorithm.SHA256_RSA)
|
|
99
|
+
* SslAssertionBuilder.certificate('selfSigned').equals(false)
|
|
144
100
|
*
|
|
145
|
-
* //
|
|
146
|
-
* SslAssertionBuilder.
|
|
147
|
-
* SslAssertionBuilder.
|
|
101
|
+
* // Connection / handshake facts
|
|
102
|
+
* SslAssertionBuilder.connection('tlsVersion').equals(TlsVersion.TLS1_3)
|
|
103
|
+
* SslAssertionBuilder.connection('cipherSuite').equals(CipherSuite.TLS_AES_256_GCM_SHA384)
|
|
104
|
+
* SslAssertionBuilder.connection('chainTrusted').equals(true)
|
|
148
105
|
*
|
|
149
|
-
* //
|
|
150
|
-
* SslAssertionBuilder.
|
|
151
|
-
* SslAssertionBuilder.
|
|
152
|
-
*
|
|
153
|
-
* // Match the issuer or cipher suite against a regex
|
|
154
|
-
* SslAssertionBuilder.issuerCn().matches("^Let's Encrypt")
|
|
155
|
-
* SslAssertionBuilder.cipherSuite().matches('TLS_(AES|CHACHA)')
|
|
106
|
+
* // Response time, JSON and text responses
|
|
107
|
+
* SslAssertionBuilder.responseTime().lessThan(1000)
|
|
108
|
+
* SslAssertionBuilder.jsonResponse('$.status').equals('ok')
|
|
109
|
+
* SslAssertionBuilder.textResponse().contains('healthy')
|
|
156
110
|
* ```
|
|
157
111
|
*/
|
|
158
112
|
export declare class SslAssertionBuilder {
|
|
159
|
-
/** Assertion builder for the number of days until the certificate expires. */
|
|
160
|
-
static certExpiresInDays(): CertExpiresInDaysAssertionBuilder;
|
|
161
|
-
/** Assertion builder for the certificate key size in bits. */
|
|
162
|
-
static keySizeBits(): KeySizeBitsAssertionBuilder;
|
|
163
|
-
/** Assertion builder for whether the certificate is not expired. */
|
|
164
|
-
static certNotExpired(): CertNotExpiredAssertionBuilder;
|
|
165
|
-
/** Assertion builder for whether the hostname is verified. */
|
|
166
|
-
static hostnameVerified(): HostnameVerifiedAssertionBuilder;
|
|
167
|
-
/** Assertion builder for whether the certificate chain is trusted. */
|
|
168
|
-
static chainTrusted(): ChainTrustedAssertionBuilder;
|
|
169
113
|
/**
|
|
170
|
-
*
|
|
171
|
-
*
|
|
172
|
-
*
|
|
114
|
+
* Creates an assertion builder for a certificate property.
|
|
115
|
+
* @param property The certificate property to assert on (e.g. `'daysUntilExpiry'`,
|
|
116
|
+
* `'issuerCN'`, `'signatureAlgorithm'`, `'sans'`, `'selfSigned'`).
|
|
117
|
+
*/
|
|
118
|
+
static certificate<Property extends SslCertificateProperty>(property: Property): PropertyOperators<'CERTIFICATE', typeof certificateGrammar[Property]>;
|
|
119
|
+
/**
|
|
120
|
+
* Creates an assertion builder for a connection property.
|
|
121
|
+
* @param property The connection property to assert on (e.g. `'tlsVersion'`,
|
|
122
|
+
* `'cipherSuite'`, `'hostnameVerified'`, `'ocspStatus'`, `'resolvedIp'`).
|
|
123
|
+
*/
|
|
124
|
+
static connection<Property extends SslConnectionProperty>(property: Property): PropertyOperators<'CONNECTION', typeof connectionGrammar[Property]>;
|
|
125
|
+
/**
|
|
126
|
+
* Creates an assertion builder for the TLS handshake response time in milliseconds.
|
|
173
127
|
*/
|
|
174
|
-
static
|
|
128
|
+
static responseTime(): NumericAssertionBuilder<SslAssertionSource, string>;
|
|
175
129
|
/**
|
|
176
|
-
*
|
|
177
|
-
*
|
|
178
|
-
* unconstrained; use the {@link CipherSuite} constants for common suites, or
|
|
179
|
-
* `.matches()` with a regex pattern.
|
|
130
|
+
* Creates an assertion builder for a JSON response body.
|
|
131
|
+
* @param property Optional JSONPath to a specific value (e.g. `'$.status'`).
|
|
180
132
|
*/
|
|
181
|
-
static
|
|
182
|
-
/** Assertion builder for the certificate issuer common name. */
|
|
183
|
-
static issuerCn(): IssuerCnAssertionBuilder;
|
|
184
|
-
/** Assertion builder for the certificate SHA-256 fingerprint. */
|
|
185
|
-
static certFingerprintSha256(): CertFingerprintSha256AssertionBuilder;
|
|
186
|
-
/** Assertion builder for the issuer SHA-256 fingerprint. */
|
|
187
|
-
static issuerFingerprintSha256(): IssuerFingerprintSha256AssertionBuilder;
|
|
133
|
+
static jsonResponse(property?: string): GeneralAssertionBuilder<SslAssertionSource, string | number | boolean>;
|
|
188
134
|
/**
|
|
189
|
-
*
|
|
190
|
-
*
|
|
191
|
-
*
|
|
135
|
+
* Creates an assertion builder for a text response body.
|
|
136
|
+
* @param regex Optional regex pattern (with a capture group) used to extract the value
|
|
137
|
+
* to compare from the serialized response document. Carried in the assertion's
|
|
138
|
+
* `property` field — the slot the backend and runner read the pattern from.
|
|
192
139
|
*/
|
|
193
|
-
static
|
|
194
|
-
/** Assertion builder for whether a stapled OCSP response was provided. */
|
|
195
|
-
static ocspStapled(): OcspStapledAssertionBuilder;
|
|
140
|
+
static textResponse(regex?: string): GeneralAssertionBuilder<SslAssertionSource, string | number | boolean>;
|
|
196
141
|
}
|
|
197
142
|
export {};
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { GeneralAssertionBuilder, NumericAssertionBuilder, } from './internal/assertion.js';
|
|
2
|
+
import { operatorsForProperty } from './internal/assertion-grammar.js';
|
|
3
|
+
import { certificateGrammar, connectionGrammar } from './ssl-assertion-grammar.js';
|
|
2
4
|
/**
|
|
3
|
-
* Known TLS protocol versions for use
|
|
5
|
+
* Known TLS protocol versions for use as a target of the `tlsVersion` property on
|
|
6
|
+
* the {@link SslAssertionBuilder.connection} builder.
|
|
4
7
|
*
|
|
5
8
|
* @example
|
|
6
9
|
* ```typescript
|
|
7
|
-
* SslAssertionBuilder.tlsVersion
|
|
10
|
+
* SslAssertionBuilder.connection('tlsVersion').equals(TlsVersion.TLS1_3)
|
|
8
11
|
* ```
|
|
9
12
|
*/
|
|
10
13
|
export const TlsVersion = {
|
|
@@ -16,11 +19,12 @@ export const TlsVersion = {
|
|
|
16
19
|
/**
|
|
17
20
|
* Signature algorithms as reported by Go's `x509.Certificate.SignatureAlgorithm.String()`.
|
|
18
21
|
* These are the exact values the SSL runner evaluates assertions against — use these
|
|
19
|
-
* constants (or the string literals they represent)
|
|
22
|
+
* constants (or the string literals they represent) as a target of the
|
|
23
|
+
* `signatureAlgorithm` property on the {@link SslAssertionBuilder.certificate} builder.
|
|
20
24
|
*
|
|
21
25
|
* @example
|
|
22
26
|
* ```typescript
|
|
23
|
-
* SslAssertionBuilder.signatureAlgorithm
|
|
27
|
+
* SslAssertionBuilder.certificate('signatureAlgorithm').equals(SignatureAlgorithm.SHA256_RSA)
|
|
24
28
|
* ```
|
|
25
29
|
*/
|
|
26
30
|
export const SignatureAlgorithm = {
|
|
@@ -46,14 +50,14 @@ export const SignatureAlgorithm = {
|
|
|
46
50
|
ED25519: 'Ed25519',
|
|
47
51
|
};
|
|
48
52
|
/**
|
|
49
|
-
* Commonly-used IANA cipher suite names for use
|
|
50
|
-
* {@link SslAssertionBuilder.
|
|
51
|
-
* widely-deployed TLS 1.2 suites.
|
|
53
|
+
* Commonly-used IANA cipher suite names for use as a target of the `cipherSuite`
|
|
54
|
+
* property on the {@link SslAssertionBuilder.connection} builder. Includes TLS 1.3
|
|
55
|
+
* suites and widely-deployed TLS 1.2 suites.
|
|
52
56
|
*
|
|
53
57
|
* @example
|
|
54
58
|
* ```typescript
|
|
55
|
-
* SslAssertionBuilder.cipherSuite
|
|
56
|
-
* SslAssertionBuilder.cipherSuite
|
|
59
|
+
* SslAssertionBuilder.connection('cipherSuite').equals(CipherSuite.TLS_AES_256_GCM_SHA384)
|
|
60
|
+
* SslAssertionBuilder.connection('cipherSuite').equals(CipherSuite.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256)
|
|
57
61
|
* ```
|
|
58
62
|
*/
|
|
59
63
|
export const CipherSuite = {
|
|
@@ -76,192 +80,71 @@ export const CipherSuite = {
|
|
|
76
80
|
TLS_RSA_WITH_AES_128_CBC_SHA: 'TLS_RSA_WITH_AES_128_CBC_SHA',
|
|
77
81
|
TLS_RSA_WITH_AES_256_CBC_SHA: 'TLS_RSA_WITH_AES_256_CBC_SHA',
|
|
78
82
|
};
|
|
79
|
-
// One builder class per SSL source, each exposing only the operators (and value
|
|
80
|
-
// type) the backend accepts for that source. The classes are stateless — the source
|
|
81
|
-
// is baked into each `toAssertion` call — and are not exported: they are reachable
|
|
82
|
-
// only through `SslAssertionBuilder`, so they stay out of the package's public API.
|
|
83
|
-
/** Days until the certificate expires (numeric). */
|
|
84
|
-
class CertExpiresInDaysAssertionBuilder {
|
|
85
|
-
equals(target) {
|
|
86
|
-
return toAssertion('CERT_EXPIRES_IN_DAYS', 'EQUALS', target);
|
|
87
|
-
}
|
|
88
|
-
notEquals(target) {
|
|
89
|
-
return toAssertion('CERT_EXPIRES_IN_DAYS', 'NOT_EQUALS', target);
|
|
90
|
-
}
|
|
91
|
-
lessThan(target) {
|
|
92
|
-
return toAssertion('CERT_EXPIRES_IN_DAYS', 'LESS_THAN', target);
|
|
93
|
-
}
|
|
94
|
-
greaterThan(target) {
|
|
95
|
-
return toAssertion('CERT_EXPIRES_IN_DAYS', 'GREATER_THAN', target);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
/** Certificate key size in bits (numeric, exact match only). */
|
|
99
|
-
class KeySizeBitsAssertionBuilder {
|
|
100
|
-
equals(target) {
|
|
101
|
-
return toAssertion('KEY_SIZE_BITS', 'EQUALS', target);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
/** Whether the certificate is not expired (boolean). */
|
|
105
|
-
class CertNotExpiredAssertionBuilder {
|
|
106
|
-
equals(target) {
|
|
107
|
-
return toAssertion('CERT_NOT_EXPIRED', 'EQUALS', target);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
/** Whether the hostname is verified (boolean). */
|
|
111
|
-
class HostnameVerifiedAssertionBuilder {
|
|
112
|
-
equals(target) {
|
|
113
|
-
return toAssertion('HOSTNAME_VERIFIED', 'EQUALS', target);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
/** Whether the certificate chain is trusted (boolean). */
|
|
117
|
-
class ChainTrustedAssertionBuilder {
|
|
118
|
-
equals(target) {
|
|
119
|
-
return toAssertion('CHAIN_TRUSTED', 'EQUALS', target);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
/** Whether a stapled OCSP response was provided during the handshake (boolean). */
|
|
123
|
-
class OcspStapledAssertionBuilder {
|
|
124
|
-
equals(target) {
|
|
125
|
-
return toAssertion('OCSP_STAPLED', 'EQUALS', target);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
/** Negotiated TLS version — `.equals()` accepts only known TLS version strings. */
|
|
129
|
-
class TlsVersionAssertionBuilder {
|
|
130
|
-
equals(target) {
|
|
131
|
-
return toAssertion('TLS_VERSION', 'EQUALS', target);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* Certificate signature algorithm. `.equals()` takes a Go
|
|
136
|
-
* `x509.Certificate.SignatureAlgorithm.String()` value; `.matches()` takes a regex.
|
|
137
|
-
*/
|
|
138
|
-
class SignatureAlgorithmAssertionBuilder {
|
|
139
|
-
equals(target) {
|
|
140
|
-
return toAssertion('SIGNATURE_ALGORITHM', 'EQUALS', target);
|
|
141
|
-
}
|
|
142
|
-
matches(target) {
|
|
143
|
-
return toAssertion('SIGNATURE_ALGORITHM', 'MATCHES', target);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
/** Negotiated cipher suite (string) — exact, not-equal, or regex match. */
|
|
147
|
-
class CipherSuiteAssertionBuilder {
|
|
148
|
-
equals(target) {
|
|
149
|
-
return toAssertion('CIPHER_SUITE', 'EQUALS', target);
|
|
150
|
-
}
|
|
151
|
-
notEquals(target) {
|
|
152
|
-
return toAssertion('CIPHER_SUITE', 'NOT_EQUALS', target);
|
|
153
|
-
}
|
|
154
|
-
matches(target) {
|
|
155
|
-
return toAssertion('CIPHER_SUITE', 'MATCHES', target);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
/** Certificate issuer common name (string) — exact, not-equal, or regex match. */
|
|
159
|
-
class IssuerCnAssertionBuilder {
|
|
160
|
-
equals(target) {
|
|
161
|
-
return toAssertion('ISSUER_CN', 'EQUALS', target);
|
|
162
|
-
}
|
|
163
|
-
notEquals(target) {
|
|
164
|
-
return toAssertion('ISSUER_CN', 'NOT_EQUALS', target);
|
|
165
|
-
}
|
|
166
|
-
matches(target) {
|
|
167
|
-
return toAssertion('ISSUER_CN', 'MATCHES', target);
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
/** Certificate SHA-256 fingerprint (string, exact match only). */
|
|
171
|
-
class CertFingerprintSha256AssertionBuilder {
|
|
172
|
-
equals(target) {
|
|
173
|
-
return toAssertion('CERT_FINGERPRINT_SHA256', 'EQUALS', target);
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
/** Issuer SHA-256 fingerprint (string, exact match only). */
|
|
177
|
-
class IssuerFingerprintSha256AssertionBuilder {
|
|
178
|
-
equals(target) {
|
|
179
|
-
return toAssertion('ISSUER_FINGERPRINT_SHA256', 'EQUALS', target);
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
83
|
/**
|
|
183
84
|
* Builder class for creating SSL monitor assertions.
|
|
184
|
-
*
|
|
85
|
+
*
|
|
86
|
+
* Assertions are property-scoped: {@link certificate} and {@link connection} take the
|
|
87
|
+
* name of a certificate/connection property, {@link jsonResponse} takes a JSONPath and
|
|
88
|
+
* {@link textResponse} an optional regex. The comparison operators the backend accepts
|
|
89
|
+
* depend on the property's value type and are validated at deploy time.
|
|
185
90
|
*
|
|
186
91
|
* @example
|
|
187
92
|
* ```typescript
|
|
188
|
-
* //
|
|
189
|
-
* SslAssertionBuilder.
|
|
190
|
-
*
|
|
191
|
-
*
|
|
192
|
-
* SslAssertionBuilder.
|
|
193
|
-
* SslAssertionBuilder.hostnameVerified().equals(true)
|
|
93
|
+
* // Certificate facts, addressed by property name
|
|
94
|
+
* SslAssertionBuilder.certificate('daysUntilExpiry').greaterThan(30)
|
|
95
|
+
* SslAssertionBuilder.certificate('issuerCN').contains("Let's Encrypt")
|
|
96
|
+
* SslAssertionBuilder.certificate('signatureAlgorithm').equals(SignatureAlgorithm.SHA256_RSA)
|
|
97
|
+
* SslAssertionBuilder.certificate('selfSigned').equals(false)
|
|
194
98
|
*
|
|
195
|
-
* //
|
|
196
|
-
* SslAssertionBuilder.tlsVersion
|
|
197
|
-
* SslAssertionBuilder.
|
|
99
|
+
* // Connection / handshake facts
|
|
100
|
+
* SslAssertionBuilder.connection('tlsVersion').equals(TlsVersion.TLS1_3)
|
|
101
|
+
* SslAssertionBuilder.connection('cipherSuite').equals(CipherSuite.TLS_AES_256_GCM_SHA384)
|
|
102
|
+
* SslAssertionBuilder.connection('chainTrusted').equals(true)
|
|
198
103
|
*
|
|
199
|
-
* //
|
|
200
|
-
* SslAssertionBuilder.
|
|
201
|
-
* SslAssertionBuilder.
|
|
104
|
+
* // Response time, JSON and text responses
|
|
105
|
+
* SslAssertionBuilder.responseTime().lessThan(1000)
|
|
106
|
+
* SslAssertionBuilder.jsonResponse('$.status').equals('ok')
|
|
107
|
+
* SslAssertionBuilder.textResponse().contains('healthy')
|
|
202
108
|
* ```
|
|
203
109
|
*/
|
|
204
110
|
export class SslAssertionBuilder {
|
|
205
|
-
/** Assertion builder for the number of days until the certificate expires. */
|
|
206
|
-
static certExpiresInDays() {
|
|
207
|
-
return new CertExpiresInDaysAssertionBuilder();
|
|
208
|
-
}
|
|
209
|
-
/** Assertion builder for the certificate key size in bits. */
|
|
210
|
-
static keySizeBits() {
|
|
211
|
-
return new KeySizeBitsAssertionBuilder();
|
|
212
|
-
}
|
|
213
|
-
/** Assertion builder for whether the certificate is not expired. */
|
|
214
|
-
static certNotExpired() {
|
|
215
|
-
return new CertNotExpiredAssertionBuilder();
|
|
216
|
-
}
|
|
217
|
-
/** Assertion builder for whether the hostname is verified. */
|
|
218
|
-
static hostnameVerified() {
|
|
219
|
-
return new HostnameVerifiedAssertionBuilder();
|
|
220
|
-
}
|
|
221
|
-
/** Assertion builder for whether the certificate chain is trusted. */
|
|
222
|
-
static chainTrusted() {
|
|
223
|
-
return new ChainTrustedAssertionBuilder();
|
|
224
|
-
}
|
|
225
111
|
/**
|
|
226
|
-
*
|
|
227
|
-
*
|
|
228
|
-
*
|
|
112
|
+
* Creates an assertion builder for a certificate property.
|
|
113
|
+
* @param property The certificate property to assert on (e.g. `'daysUntilExpiry'`,
|
|
114
|
+
* `'issuerCN'`, `'signatureAlgorithm'`, `'sans'`, `'selfSigned'`).
|
|
229
115
|
*/
|
|
230
|
-
static
|
|
231
|
-
return
|
|
116
|
+
static certificate(property) {
|
|
117
|
+
return operatorsForProperty(certificateGrammar, 'CERTIFICATE', property);
|
|
232
118
|
}
|
|
233
119
|
/**
|
|
234
|
-
*
|
|
235
|
-
*
|
|
236
|
-
*
|
|
237
|
-
* `.matches()` with a regex pattern.
|
|
120
|
+
* Creates an assertion builder for a connection property.
|
|
121
|
+
* @param property The connection property to assert on (e.g. `'tlsVersion'`,
|
|
122
|
+
* `'cipherSuite'`, `'hostnameVerified'`, `'ocspStatus'`, `'resolvedIp'`).
|
|
238
123
|
*/
|
|
239
|
-
static
|
|
240
|
-
return
|
|
241
|
-
}
|
|
242
|
-
/** Assertion builder for the certificate issuer common name. */
|
|
243
|
-
static issuerCn() {
|
|
244
|
-
return new IssuerCnAssertionBuilder();
|
|
124
|
+
static connection(property) {
|
|
125
|
+
return operatorsForProperty(connectionGrammar, 'CONNECTION', property);
|
|
245
126
|
}
|
|
246
|
-
/**
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
static issuerFingerprintSha256() {
|
|
252
|
-
return new IssuerFingerprintSha256AssertionBuilder();
|
|
127
|
+
/**
|
|
128
|
+
* Creates an assertion builder for the TLS handshake response time in milliseconds.
|
|
129
|
+
*/
|
|
130
|
+
static responseTime() {
|
|
131
|
+
return new NumericAssertionBuilder('RESPONSE_TIME');
|
|
253
132
|
}
|
|
254
133
|
/**
|
|
255
|
-
*
|
|
256
|
-
*
|
|
257
|
-
* use the {@link SignatureAlgorithm} constants — or `.matches()` with a regex.
|
|
134
|
+
* Creates an assertion builder for a JSON response body.
|
|
135
|
+
* @param property Optional JSONPath to a specific value (e.g. `'$.status'`).
|
|
258
136
|
*/
|
|
259
|
-
static
|
|
260
|
-
return new
|
|
137
|
+
static jsonResponse(property) {
|
|
138
|
+
return new GeneralAssertionBuilder('JSON_RESPONSE', property);
|
|
261
139
|
}
|
|
262
|
-
/**
|
|
263
|
-
|
|
264
|
-
|
|
140
|
+
/**
|
|
141
|
+
* Creates an assertion builder for a text response body.
|
|
142
|
+
* @param regex Optional regex pattern (with a capture group) used to extract the value
|
|
143
|
+
* to compare from the serialized response document. Carried in the assertion's
|
|
144
|
+
* `property` field — the slot the backend and runner read the pattern from.
|
|
145
|
+
*/
|
|
146
|
+
static textResponse(regex) {
|
|
147
|
+
return new GeneralAssertionBuilder('TEXT_RESPONSE', regex);
|
|
265
148
|
}
|
|
266
149
|
}
|
|
267
150
|
//# sourceMappingURL=ssl-assertion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ssl-assertion.js","sourceRoot":"","sources":["../../src/constructs/ssl-assertion.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"ssl-assertion.js","sourceRoot":"","sources":["../../src/constructs/ssl-assertion.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAqB,oBAAoB,EAAE,MAAM,iCAAiC,CAAA;AACzF,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAElF;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;CACR,CAAA;AAIV;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,MAAM;IACN,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;IAClB,QAAQ,EAAE,UAAU;IACpB,UAAU,EAAE,YAAY;IACxB,UAAU,EAAE,YAAY;IACxB,UAAU,EAAE,YAAY;IACxB,aAAa,EAAE,eAAe;IAC9B,aAAa,EAAE,eAAe;IAC9B,aAAa,EAAE,eAAe;IAC9B,MAAM;IACN,QAAQ,EAAE,UAAU;IACpB,UAAU,EAAE,YAAY;IACxB,QAAQ;IACR,UAAU,EAAE,YAAY;IACxB,YAAY,EAAE,cAAc;IAC5B,YAAY,EAAE,cAAc;IAC5B,YAAY,EAAE,cAAc;IAC5B,QAAQ;IACR,OAAO,EAAE,SAAS;CACV,CAAA;AAIV;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,UAAU;IACV,sBAAsB,EAAE,wBAAwB;IAChD,sBAAsB,EAAE,wBAAwB;IAChD,4BAA4B,EAAE,8BAA8B;IAC5D,8CAA8C;IAC9C,qCAAqC,EAAE,uCAAuC;IAC9E,qCAAqC,EAAE,uCAAuC;IAC9E,uCAAuC,EAAE,yCAAyC;IAClF,uCAAuC,EAAE,yCAAyC;IAClF,2CAA2C,EAAE,6CAA6C;IAC1F,6CAA6C,EAAE,+CAA+C;IAC9F,6BAA6B;IAC7B,+BAA+B,EAAE,iCAAiC;IAClE,+BAA+B,EAAE,iCAAiC;IAClE,+BAA+B,EAAE,iCAAiC;IAClE,+BAA+B,EAAE,iCAAiC;IAClE,4BAA4B,EAAE,8BAA8B;IAC5D,4BAA4B,EAAE,8BAA8B;CACpD,CAAA;AA4BV;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,OAAO,mBAAmB;IAC9B;;;;OAIG;IACH,MAAM,CAAC,WAAW,CAChB,QAAkB;QAElB,OAAO,oBAAoB,CAAC,kBAAkB,EAAE,aAAa,EAAE,QAAQ,CAAC,CAAA;IAC1E,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,UAAU,CACf,QAAkB;QAElB,OAAO,oBAAoB,CAAC,iBAAiB,EAAE,YAAY,EAAE,QAAQ,CAAC,CAAA;IACxE,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,YAAY;QACjB,OAAO,IAAI,uBAAuB,CAAqB,eAAe,CAAC,CAAA;IACzE,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,YAAY,CAAE,QAAiB;QACpC,OAAO,IAAI,uBAAuB,CAAqB,eAAe,EAAE,QAAQ,CAAC,CAAA;IACnF,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,YAAY,CAAE,KAAc;QACjC,OAAO,IAAI,uBAAuB,CAAqB,eAAe,EAAE,KAAK,CAAC,CAAA;IAChF,CAAC;CACF"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export declare const tracerouteResponseTimeGrammar: {
|
|
2
|
+
/** Average round-trip time in milliseconds. */
|
|
3
|
+
readonly avg: {
|
|
4
|
+
readonly operators: readonly ["equals", "notEquals", "greaterThan", "lessThan"];
|
|
5
|
+
readonly target: import("./internal/assertion-grammar.js").TargetSpec<number>;
|
|
6
|
+
};
|
|
7
|
+
/** Minimum round-trip time in milliseconds. */
|
|
8
|
+
readonly min: {
|
|
9
|
+
readonly operators: readonly ["equals", "notEquals", "greaterThan", "lessThan"];
|
|
10
|
+
readonly target: import("./internal/assertion-grammar.js").TargetSpec<number>;
|
|
11
|
+
};
|
|
12
|
+
/** Maximum round-trip time in milliseconds. */
|
|
13
|
+
readonly max: {
|
|
14
|
+
readonly operators: readonly ["equals", "notEquals", "greaterThan", "lessThan"];
|
|
15
|
+
readonly target: import("./internal/assertion-grammar.js").TargetSpec<number>;
|
|
16
|
+
};
|
|
17
|
+
/** Standard deviation of round-trip times. */
|
|
18
|
+
readonly stdDev: {
|
|
19
|
+
readonly operators: readonly ["equals", "notEquals", "greaterThan", "lessThan"];
|
|
20
|
+
readonly target: import("./internal/assertion-grammar.js").TargetSpec<number>;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
/** Number of network hops. The backend omits notEquals. */
|
|
24
|
+
export declare const hopCountGrammar: {
|
|
25
|
+
readonly operators: readonly ["equals", "greaterThan", "lessThan"];
|
|
26
|
+
readonly target: import("./internal/assertion-grammar.js").TargetSpec<number>;
|
|
27
|
+
};
|
|
28
|
+
/** Packet loss percentage (0-100). The backend omits notEquals. */
|
|
29
|
+
export declare const packetLossGrammar: {
|
|
30
|
+
readonly operators: readonly ["equals", "greaterThan", "lessThan"];
|
|
31
|
+
readonly target: import("./internal/assertion-grammar.js").TargetSpec<number>;
|
|
32
|
+
};
|
|
33
|
+
export declare const tracerouteResponseTimeComparisons: Record<string, Record<string, true>>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { comparisonsForGrammar, defineGrammar, numberTarget } from './internal/assertion-grammar.js';
|
|
2
|
+
// The single declaration of the traceroute assertion grammar. RESPONSE_TIME is
|
|
3
|
+
// property-scoped over statistical properties, each taking the full numeric operator set.
|
|
4
|
+
// HOP_COUNT and PACKET_LOSS are single scalar sources whose backend grammar omits
|
|
5
|
+
// notEquals, so they exist as their own one-off declarations. The builder, its property
|
|
6
|
+
// union, and the validation whitelist all derive from these tables.
|
|
7
|
+
export const tracerouteResponseTimeGrammar = defineGrammar({
|
|
8
|
+
/** Average round-trip time in milliseconds. */
|
|
9
|
+
avg: { operators: ['equals', 'notEquals', 'greaterThan', 'lessThan'], target: numberTarget() },
|
|
10
|
+
/** Minimum round-trip time in milliseconds. */
|
|
11
|
+
min: { operators: ['equals', 'notEquals', 'greaterThan', 'lessThan'], target: numberTarget() },
|
|
12
|
+
/** Maximum round-trip time in milliseconds. */
|
|
13
|
+
max: { operators: ['equals', 'notEquals', 'greaterThan', 'lessThan'], target: numberTarget() },
|
|
14
|
+
/** Standard deviation of round-trip times. */
|
|
15
|
+
stdDev: { operators: ['equals', 'notEquals', 'greaterThan', 'lessThan'], target: numberTarget() },
|
|
16
|
+
});
|
|
17
|
+
/** Number of network hops. The backend omits notEquals. */
|
|
18
|
+
export const hopCountGrammar = {
|
|
19
|
+
operators: ['equals', 'greaterThan', 'lessThan'],
|
|
20
|
+
target: numberTarget(),
|
|
21
|
+
};
|
|
22
|
+
/** Packet loss percentage (0-100). The backend omits notEquals. */
|
|
23
|
+
export const packetLossGrammar = {
|
|
24
|
+
operators: ['equals', 'greaterThan', 'lessThan'],
|
|
25
|
+
target: numberTarget(),
|
|
26
|
+
};
|
|
27
|
+
// The wire comparisons each response-time property accepts, keyed by property. Derived here,
|
|
28
|
+
// beside the grammar (as SSL keeps its comparison derivation), so validation is a thin
|
|
29
|
+
// consumer and the two monitors resolve the same concept in the same place. Per-property
|
|
30
|
+
// rather than one shared set, so a property that later diverges is validated against its own
|
|
31
|
+
// row.
|
|
32
|
+
export const tracerouteResponseTimeComparisons = Object.fromEntries(Object.entries(tracerouteResponseTimeGrammar).map(([property, decl]) => [property, comparisonsForGrammar(decl)]));
|
|
33
|
+
//# sourceMappingURL=traceroute-assertion-grammar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"traceroute-assertion-grammar.js","sourceRoot":"","sources":["../../src/constructs/traceroute-assertion-grammar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,qBAAqB,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAA;AAErH,+EAA+E;AAC/E,0FAA0F;AAC1F,kFAAkF;AAClF,wFAAwF;AACxF,oEAAoE;AAEpE,MAAM,CAAC,MAAM,6BAA6B,GAAG,aAAa,CAAC;IACzD,+CAA+C;IAC/C,GAAG,EAAE,EAAE,SAAS,EAAE,CAAC,QAAQ,EAAE,WAAW,EAAE,aAAa,EAAE,UAAU,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE;IAC9F,+CAA+C;IAC/C,GAAG,EAAE,EAAE,SAAS,EAAE,CAAC,QAAQ,EAAE,WAAW,EAAE,aAAa,EAAE,UAAU,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE;IAC9F,+CAA+C;IAC/C,GAAG,EAAE,EAAE,SAAS,EAAE,CAAC,QAAQ,EAAE,WAAW,EAAE,aAAa,EAAE,UAAU,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE;IAC9F,8CAA8C;IAC9C,MAAM,EAAE,EAAE,SAAS,EAAE,CAAC,QAAQ,EAAE,WAAW,EAAE,aAAa,EAAE,UAAU,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE;CAClG,CAAC,CAAA;AAEF,2DAA2D;AAC3D,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,SAAS,EAAE,CAAC,QAAQ,EAAE,aAAa,EAAE,UAAU,CAAC;IAChD,MAAM,EAAE,YAAY,EAAE;CACY,CAAA;AAEpC,mEAAmE;AACnE,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,SAAS,EAAE,CAAC,QAAQ,EAAE,aAAa,EAAE,UAAU,CAAC;IAChD,MAAM,EAAE,YAAY,EAAE;CACY,CAAA;AAEpC,6FAA6F;AAC7F,uFAAuF;AACvF,yFAAyF;AACzF,6FAA6F;AAC7F,OAAO;AACP,MAAM,CAAC,MAAM,iCAAiC,GAC5C,MAAM,CAAC,WAAW,CAChB,MAAM,CAAC,OAAO,CAAC,6BAA6B,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,QAAQ,EAAE,qBAAqB,CAAC,IAAI,CAAC,CAAC,CAAC,CACjH,CAAA"}
|