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.
Files changed (45) hide show
  1. package/dist/ai-context/context.js +4 -4
  2. package/dist/ai-context/skills-command/references/configure-ssl-monitors.md +4 -4
  3. package/dist/constructs/grpc-assertion-codegen.js +60 -4
  4. package/dist/constructs/grpc-assertion-codegen.js.map +1 -1
  5. package/dist/constructs/grpc-assertion-validation.js +16 -0
  6. package/dist/constructs/grpc-assertion-validation.js.map +1 -1
  7. package/dist/constructs/grpc-assertion.d.ts +37 -2
  8. package/dist/constructs/grpc-assertion.js +42 -3
  9. package/dist/constructs/grpc-assertion.js.map +1 -1
  10. package/dist/constructs/grpc-request-codegen.js +0 -3
  11. package/dist/constructs/grpc-request-codegen.js.map +1 -1
  12. package/dist/constructs/grpc-request.d.ts +0 -6
  13. package/dist/constructs/internal/assertion-codegen.d.ts +11 -2
  14. package/dist/constructs/internal/assertion-codegen.js +14 -17
  15. package/dist/constructs/internal/assertion-codegen.js.map +1 -1
  16. package/dist/constructs/internal/assertion-grammar.d.ts +35 -0
  17. package/dist/constructs/internal/assertion-grammar.js +75 -0
  18. package/dist/constructs/internal/assertion-grammar.js.map +1 -0
  19. package/dist/constructs/internal/assertion.js +2 -2
  20. package/dist/constructs/internal/assertion.js.map +1 -1
  21. package/dist/constructs/ssl-assertion-codegen.d.ts +2 -0
  22. package/dist/constructs/ssl-assertion-codegen.js +65 -27
  23. package/dist/constructs/ssl-assertion-codegen.js.map +1 -1
  24. package/dist/constructs/ssl-assertion-grammar.d.ts +123 -0
  25. package/dist/constructs/ssl-assertion-grammar.js +90 -0
  26. package/dist/constructs/ssl-assertion-grammar.js.map +1 -0
  27. package/dist/constructs/ssl-assertion-validation.d.ts +6 -6
  28. package/dist/constructs/ssl-assertion-validation.js +97 -28
  29. package/dist/constructs/ssl-assertion-validation.js.map +1 -1
  30. package/dist/constructs/ssl-assertion.d.ts +59 -114
  31. package/dist/constructs/ssl-assertion.js +59 -176
  32. package/dist/constructs/ssl-assertion.js.map +1 -1
  33. package/dist/constructs/traceroute-assertion-grammar.d.ts +33 -0
  34. package/dist/constructs/traceroute-assertion-grammar.js +33 -0
  35. package/dist/constructs/traceroute-assertion-grammar.js.map +1 -0
  36. package/dist/constructs/traceroute-assertion-validation.js +21 -27
  37. package/dist/constructs/traceroute-assertion-validation.js.map +1 -1
  38. package/dist/constructs/traceroute-assertion.d.ts +6 -25
  39. package/dist/constructs/traceroute-assertion.js +5 -51
  40. package/dist/constructs/traceroute-assertion.js.map +1 -1
  41. package/dist/reporters/abstract-list.d.ts +2 -0
  42. package/dist/reporters/abstract-list.js +29 -11
  43. package/dist/reporters/abstract-list.js.map +1 -1
  44. package/oclif.manifest.json +206 -206
  45. 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 with {@link SslAssertionBuilder.tlsVersion}.
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().equals(TlsVersion.TLS1_3)
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) with {@link SslAssertionBuilder.signatureAlgorithm}.
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().equals(SignatureAlgorithm.SHA256_RSA)
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 with
48
- * {@link SslAssertionBuilder.cipherSuite}. Includes TLS 1.3 suites and
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().equals(CipherSuite.TLS_AES_256_GCM_SHA384)
54
- * SslAssertionBuilder.cipherSuite().equals(CipherSuite.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256)
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 = 'CERT_EXPIRES_IN_DAYS' | 'CERT_NOT_EXPIRED' | 'HOSTNAME_VERIFIED' | 'CHAIN_TRUSTED' | 'TLS_VERSION' | 'CIPHER_SUITE' | 'ISSUER_CN' | 'CERT_FINGERPRINT_SHA256' | 'ISSUER_FINGERPRINT_SHA256' | 'KEY_SIZE_BITS' | 'SIGNATURE_ALGORITHM' | 'OCSP_STAPLED';
79
+ type SslAssertionSource = 'CERTIFICATE' | 'CONNECTION' | 'RESPONSE_TIME' | 'JSON_RESPONSE' | 'TEXT_RESPONSE';
76
80
  export type SslAssertion = CoreAssertion<SslAssertionSource>;
77
- /** Days until the certificate expires (numeric). */
78
- declare class CertExpiresInDaysAssertionBuilder {
79
- equals(target: number): SslAssertion;
80
- notEquals(target: number): SslAssertion;
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
- * Provides methods to create assertions for TLS certificates.
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
- * // Alert when the certificate is within 30 days of expiry
143
- * SslAssertionBuilder.certExpiresInDays().greaterThan(30)
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
- * // Require a trusted chain and a verified hostname
146
- * SslAssertionBuilder.chainTrusted().equals(true)
147
- * SslAssertionBuilder.hostnameVerified().equals(true)
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
- * // Enforce a specific TLS version and key size
150
- * SslAssertionBuilder.tlsVersion().equals('TLS1.3')
151
- * SslAssertionBuilder.keySizeBits().equals(2048)
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
- * Assertion builder for the negotiated TLS version. `.equals()` accepts only the
171
- * known TLS version strings use the {@link TlsVersion} constants or the string
172
- * literals `'TLS1.0'`…`'TLS1.3'`.
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 tlsVersion(): TlsVersionAssertionBuilder;
128
+ static responseTime(): NumericAssertionBuilder<SslAssertionSource, string>;
175
129
  /**
176
- * Assertion builder for the negotiated cipher suite. Go's `tls.CipherSuiteName()`
177
- * can return hundreds of IANA names plus `0x....` hex fallbacks, so `.equals()` is
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 cipherSuite(): CipherSuiteAssertionBuilder;
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
- * Assertion builder for the certificate signature algorithm. `.equals()` takes a
190
- * Go `x509.Certificate.SignatureAlgorithm.String()` value (e.g. `'SHA256-RSA'`)
191
- * use the {@link SignatureAlgorithm} constants or `.matches()` with a regex.
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 signatureAlgorithm(): SignatureAlgorithmAssertionBuilder;
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 { toAssertion } from './internal/assertion.js';
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 with {@link SslAssertionBuilder.tlsVersion}.
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().equals(TlsVersion.TLS1_3)
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) with {@link SslAssertionBuilder.signatureAlgorithm}.
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().equals(SignatureAlgorithm.SHA256_RSA)
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 with
50
- * {@link SslAssertionBuilder.cipherSuite}. Includes TLS 1.3 suites and
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().equals(CipherSuite.TLS_AES_256_GCM_SHA384)
56
- * SslAssertionBuilder.cipherSuite().equals(CipherSuite.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256)
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
- * Provides methods to create assertions for TLS certificates.
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
- * // Alert when the certificate is within 30 days of expiry
189
- * SslAssertionBuilder.certExpiresInDays().greaterThan(30)
190
- *
191
- * // Require a trusted chain and a verified hostname
192
- * SslAssertionBuilder.chainTrusted().equals(true)
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
- * // Enforce a specific TLS version and key size
196
- * SslAssertionBuilder.tlsVersion().equals('TLS1.3')
197
- * SslAssertionBuilder.keySizeBits().equals(2048)
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
- * // Match the issuer or cipher suite against a regex
200
- * SslAssertionBuilder.issuerCn().matches("^Let's Encrypt")
201
- * SslAssertionBuilder.cipherSuite().matches('TLS_(AES|CHACHA)')
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
- * Assertion builder for the negotiated TLS version. `.equals()` accepts only the
227
- * known TLS version strings use the {@link TlsVersion} constants or the string
228
- * literals `'TLS1.0'`…`'TLS1.3'`.
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 tlsVersion() {
231
- return new TlsVersionAssertionBuilder();
116
+ static certificate(property) {
117
+ return operatorsForProperty(certificateGrammar, 'CERTIFICATE', property);
232
118
  }
233
119
  /**
234
- * Assertion builder for the negotiated cipher suite. Go's `tls.CipherSuiteName()`
235
- * can return hundreds of IANA names plus `0x....` hex fallbacks, so `.equals()` is
236
- * unconstrained; use the {@link CipherSuite} constants for common suites, or
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 cipherSuite() {
240
- return new CipherSuiteAssertionBuilder();
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
- /** Assertion builder for the certificate SHA-256 fingerprint. */
247
- static certFingerprintSha256() {
248
- return new CertFingerprintSha256AssertionBuilder();
249
- }
250
- /** Assertion builder for the issuer SHA-256 fingerprint. */
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
- * Assertion builder for the certificate signature algorithm. `.equals()` takes a
256
- * Go `x509.Certificate.SignatureAlgorithm.String()` value (e.g. `'SHA256-RSA'`)
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 signatureAlgorithm() {
260
- return new SignatureAlgorithmAssertionBuilder();
137
+ static jsonResponse(property) {
138
+ return new GeneralAssertionBuilder('JSON_RESPONSE', property);
261
139
  }
262
- /** Assertion builder for whether a stapled OCSP response was provided. */
263
- static ocspStapled() {
264
- return new OcspStapledAssertionBuilder();
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,EAA8B,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAEjF;;;;;;;GAOG;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;;;;;;;;;GASG;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,wB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ACH,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/tracero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