checkly 8.16.0 → 8.17.0-prerelease-b6e0d74
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/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 +1 -1
- package/package.json +7 -7
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { booleanTarget, comparisonsForGrammar, defineGrammar, numberTarget, stringTarget, valueTypeForGrammar, } from './internal/assertion-grammar.js';
|
|
2
|
+
// The single declaration of the SSL certificate/connection assertion grammar. Each row is
|
|
3
|
+
// a property's entire contract — the operators it exposes and the type of its target. The
|
|
4
|
+
// public `SslAssertionBuilder`, its property unions, the validation whitelist, and codegen
|
|
5
|
+
// all derive from these two tables, so a property cannot gain an operator the whitelist
|
|
6
|
+
// rejects, or a target type codegen renders wrong, without editing this one row.
|
|
7
|
+
export const certificateGrammar = defineGrammar({
|
|
8
|
+
/** Days until the certificate expires (numeric). */
|
|
9
|
+
daysUntilExpiry: { operators: ['equals', 'notEquals', 'greaterThan', 'lessThan'], target: numberTarget() },
|
|
10
|
+
/** Certificate key size in bits (numeric). */
|
|
11
|
+
keySizeBits: { operators: ['equals', 'notEquals', 'greaterThan', 'lessThan'], target: numberTarget() },
|
|
12
|
+
/** Certificate subject common name (free-form string). */
|
|
13
|
+
subjectCN: { operators: ['equals', 'notEquals', 'contains', 'notContains'], target: stringTarget() },
|
|
14
|
+
/** Certificate issuer common name (free-form string). */
|
|
15
|
+
issuerCN: { operators: ['equals', 'notEquals', 'contains', 'notContains'], target: stringTarget() },
|
|
16
|
+
/** Certificate serial number — an opaque identifier, compared whole. */
|
|
17
|
+
serialNumber: { operators: ['equals', 'notEquals'], target: stringTarget() },
|
|
18
|
+
/** Certificate SHA-256 fingerprint — an opaque identifier, compared whole. */
|
|
19
|
+
fingerprintSha256: { operators: ['equals', 'notEquals'], target: stringTarget() },
|
|
20
|
+
/** Issuer SHA-256 fingerprint — an opaque identifier, compared whole. */
|
|
21
|
+
issuerFingerprintSha256: { operators: ['equals', 'notEquals'], target: stringTarget() },
|
|
22
|
+
/** Certificate public key algorithm (e.g. `'RSA'`, `'ECDSA'`), compared whole. */
|
|
23
|
+
keyAlgorithm: { operators: ['equals', 'notEquals'], target: stringTarget() },
|
|
24
|
+
/** Certificate signature algorithm — a Go `x509 SignatureAlgorithm.String()` value. */
|
|
25
|
+
signatureAlgorithm: { operators: ['equals', 'notEquals'], target: stringTarget() },
|
|
26
|
+
/** Certificate subject alternative names. A list, so only membership can be asserted. */
|
|
27
|
+
sans: { operators: ['contains', 'notContains'], target: stringTarget() },
|
|
28
|
+
/** Whether the certificate is self-signed (boolean). */
|
|
29
|
+
selfSigned: { operators: ['equals'], target: booleanTarget() },
|
|
30
|
+
/** Whether the certificate is a CA certificate (boolean). */
|
|
31
|
+
isCA: { operators: ['equals'], target: booleanTarget() },
|
|
32
|
+
});
|
|
33
|
+
export const connectionGrammar = defineGrammar({
|
|
34
|
+
/** Negotiated TLS version. Ordered, so `greaterThan` expresses a minimum. */
|
|
35
|
+
tlsVersion: { operators: ['equals', 'notEquals', 'greaterThan', 'lessThan'], target: stringTarget() },
|
|
36
|
+
/** Negotiated cipher suite (free-form string; hundreds of IANA names). */
|
|
37
|
+
cipherSuite: { operators: ['equals', 'notEquals', 'contains', 'notContains'], target: stringTarget() },
|
|
38
|
+
/** Whether the hostname is verified against the certificate (boolean). */
|
|
39
|
+
hostnameVerified: { operators: ['equals'], target: booleanTarget() },
|
|
40
|
+
/** Whether the certificate chain is trusted (boolean). */
|
|
41
|
+
chainTrusted: { operators: ['equals'], target: booleanTarget() },
|
|
42
|
+
/** Whether a stapled OCSP response was provided during the handshake (boolean). */
|
|
43
|
+
ocspStapled: { operators: ['equals'], target: booleanTarget() },
|
|
44
|
+
/** OCSP revocation status (e.g. `'good'`, `'revoked'`), compared whole. */
|
|
45
|
+
ocspStatus: { operators: ['equals', 'notEquals'], target: stringTarget() },
|
|
46
|
+
/** The IP address the hostname resolved to (free-form string). */
|
|
47
|
+
resolvedIp: { operators: ['equals', 'notEquals', 'contains', 'notContains'], target: stringTarget() },
|
|
48
|
+
});
|
|
49
|
+
const grammarBySource = {
|
|
50
|
+
CERTIFICATE: certificateGrammar,
|
|
51
|
+
CONNECTION: connectionGrammar,
|
|
52
|
+
};
|
|
53
|
+
function propertyGrammar(source, property) {
|
|
54
|
+
const grammar = Object.hasOwn(grammarBySource, source) ? grammarBySource[source] : undefined;
|
|
55
|
+
if (grammar === undefined || !Object.hasOwn(grammar, property)) {
|
|
56
|
+
return undefined;
|
|
57
|
+
}
|
|
58
|
+
return grammar[property];
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* The wire comparisons each property of a source accepts, keyed by property name. Empty for
|
|
62
|
+
* a source with no property-scoped grammar. Used by validation to reject an unsupported
|
|
63
|
+
* comparison written as an object literal.
|
|
64
|
+
*/
|
|
65
|
+
export function sslComparisonsForSource(source) {
|
|
66
|
+
const grammar = Object.hasOwn(grammarBySource, source) ? grammarBySource[source] : {};
|
|
67
|
+
return Object.fromEntries(Object.entries(grammar).map(([property, decl]) => [property, comparisonsForGrammar(decl)]));
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* How the target of a property-scoped SSL assertion is written, or `undefined` for a
|
|
71
|
+
* property the backend does not define. Callers must handle the unknown case: object
|
|
72
|
+
* literals bypass the builder's compile-time check and are reported by
|
|
73
|
+
* `validateSslAssertion` instead.
|
|
74
|
+
*/
|
|
75
|
+
export function sslPropertyValueType(source, property) {
|
|
76
|
+
const decl = propertyGrammar(source, property);
|
|
77
|
+
return decl === undefined ? undefined : valueTypeForGrammar(decl);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Whether a target is one this CLI treats as a number.
|
|
81
|
+
*
|
|
82
|
+
* Validation and codegen must agree: anything validation accepts, codegen has to render as
|
|
83
|
+
* a bare numeric literal, because the property's operators take a `number` and a quoted
|
|
84
|
+
* target would not compile. Targets are plain strings on the wire and reach here from object
|
|
85
|
+
* literals and remote monitors, so this is a runtime predicate rather than a type.
|
|
86
|
+
*/
|
|
87
|
+
export function isSslNumericTarget(target) {
|
|
88
|
+
return target.trim() !== '' && Number.isFinite(Number(target));
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=ssl-assertion-grammar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ssl-assertion-grammar.js","sourceRoot":"","sources":["../../src/constructs/ssl-assertion-grammar.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,aAAa,EACb,qBAAqB,EACrB,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,mBAAmB,GACpB,MAAM,iCAAiC,CAAA;AAGxC,0FAA0F;AAC1F,0FAA0F;AAC1F,2FAA2F;AAC3F,wFAAwF;AACxF,iFAAiF;AAEjF,MAAM,CAAC,MAAM,kBAAkB,GAAG,aAAa,CAAC;IAC9C,oDAAoD;IACpD,eAAe,EAAE,EAAE,SAAS,EAAE,CAAC,QAAQ,EAAE,WAAW,EAAE,aAAa,EAAE,UAAU,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE;IAC1G,8CAA8C;IAC9C,WAAW,EAAE,EAAE,SAAS,EAAE,CAAC,QAAQ,EAAE,WAAW,EAAE,aAAa,EAAE,UAAU,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE;IACtG,0DAA0D;IAC1D,SAAS,EAAE,EAAE,SAAS,EAAE,CAAC,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE,aAAa,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE;IACpG,yDAAyD;IACzD,QAAQ,EAAE,EAAE,SAAS,EAAE,CAAC,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE,aAAa,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE;IACnG,wEAAwE;IACxE,YAAY,EAAE,EAAE,SAAS,EAAE,CAAC,QAAQ,EAAE,WAAW,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE;IAC5E,8EAA8E;IAC9E,iBAAiB,EAAE,EAAE,SAAS,EAAE,CAAC,QAAQ,EAAE,WAAW,CAAC,EAAE,MAA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AAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,QAAQ,EAAE,qBAAqB,CAAC,IAAI,CAAC,CAAC,CAAC,CAC3F,CAAA;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAAE,MAAc,EAAE,QAAgB;IACpE,MAAM,IAAI,GAAG,eAAe,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;IAC9C,OAAO,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAA;AACnE,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,kBAAkB,CAAE,MAAc;IAChD,OAAO,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAA;AAChE,CAAC"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Diagnostics } from './diagnostics.js';
|
|
2
2
|
import { SslAssertion } from './ssl-assertion.js';
|
|
3
3
|
/**
|
|
4
|
-
* Reports SSL assertions whose source, comparison or boolean target the
|
|
5
|
-
* not accept.
|
|
4
|
+
* Reports SSL assertions whose source, property, comparison or boolean target the
|
|
5
|
+
* backend does not accept.
|
|
6
6
|
*
|
|
7
7
|
* Assertions written as plain object literals bypass SslAssertionBuilder and are
|
|
8
|
-
* type-legal, because the fields are declared as plain strings. The backend rejects
|
|
9
|
-
* an unknown
|
|
10
|
-
*
|
|
11
|
-
* evaluation, so it is reported too.
|
|
8
|
+
* type-legal, because the fields are declared as plain strings. The backend rejects an
|
|
9
|
+
* unknown source, an unknown property or an operator not allowed for the property with
|
|
10
|
+
* a 400; a boolean or numeric property whose target is not of that type is accepted at
|
|
11
|
+
* deploy but never matches at evaluation, so it is reported too.
|
|
12
12
|
*/
|
|
13
13
|
export declare function validateSslAssertion(diagnostics: Diagnostics, assertion: SslAssertion, index: number): void;
|
|
@@ -1,30 +1,87 @@
|
|
|
1
1
|
import { addAssertionDiagnostic, quotedKeys } from './internal/assertion-validation.js';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
// fails to compile.
|
|
2
|
+
import { isSslNumericTarget, sslComparisonsForSource, sslPropertyValueType } from './ssl-assertion-grammar.js';
|
|
3
|
+
const NUMBER = { EQUALS: true, NOT_EQUALS: true, GREATER_THAN: true, LESS_THAN: true };
|
|
4
|
+
// Keyed by the source union so adding a source without a rule fails to compile.
|
|
5
5
|
const rules = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
6
|
+
CERTIFICATE: { properties: sslComparisonsForSource('CERTIFICATE') },
|
|
7
|
+
CONNECTION: { properties: sslComparisonsForSource('CONNECTION') },
|
|
8
|
+
RESPONSE_TIME: { comparisons: NUMBER, valueType: 'number' },
|
|
9
|
+
JSON_RESPONSE: {
|
|
10
|
+
comparisons: {
|
|
11
|
+
EQUALS: true,
|
|
12
|
+
NOT_EQUALS: true,
|
|
13
|
+
IS_EMPTY: true,
|
|
14
|
+
NOT_EMPTY: true,
|
|
15
|
+
GREATER_THAN: true,
|
|
16
|
+
LESS_THAN: true,
|
|
17
|
+
CONTAINS: true,
|
|
18
|
+
NOT_CONTAINS: true,
|
|
19
|
+
IS_NULL: true,
|
|
20
|
+
NOT_NULL: true,
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
TEXT_RESPONSE: {
|
|
24
|
+
comparisons: {
|
|
25
|
+
EQUALS: true,
|
|
26
|
+
NOT_EQUALS: true,
|
|
27
|
+
IS_EMPTY: true,
|
|
28
|
+
NOT_EMPTY: true,
|
|
29
|
+
CONTAINS: true,
|
|
30
|
+
NOT_CONTAINS: true,
|
|
31
|
+
GREATER_THAN: true,
|
|
32
|
+
LESS_THAN: true,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
18
35
|
};
|
|
36
|
+
function isPropertyScoped(rule) {
|
|
37
|
+
return 'properties' in rule;
|
|
38
|
+
}
|
|
39
|
+
function formatValue(value) {
|
|
40
|
+
return value === '' ? '(none)' : `"${value}"`;
|
|
41
|
+
}
|
|
19
42
|
/**
|
|
20
|
-
* Reports
|
|
21
|
-
*
|
|
43
|
+
* Reports a target that is not of the value type its source or property expects.
|
|
44
|
+
*
|
|
45
|
+
* Target *values* are checked where the accepted set is universal — booleans are two
|
|
46
|
+
* values, numbers are a total predicate — so a typo is a pure footgun the backend will not
|
|
47
|
+
* catch: it accepts any target string at deploy and simply never matches at evaluation,
|
|
48
|
+
* leaving an assertion that looks configured but silently never fires.
|
|
49
|
+
*
|
|
50
|
+
* The closed *enumerated* sets (tlsVersion, signatureAlgorithm) are deliberately not
|
|
51
|
+
* checked: the builder's typed operators already constrain them, and restating their
|
|
52
|
+
* members here would duplicate the value unions.
|
|
53
|
+
*/
|
|
54
|
+
function validateTargetValue(diagnostics, assertion, location, valueType, subject) {
|
|
55
|
+
// `target` is declared a string, but object-literal assertions are not typechecked when
|
|
56
|
+
// a check file is loaded, so a hand-written `target: 30` or an omitted target reaches
|
|
57
|
+
// here as a non-string. Report it rather than dereferencing it — a TypeError out of
|
|
58
|
+
// validate() would abort the command with no location or message.
|
|
59
|
+
const target = assertion.target;
|
|
60
|
+
if (typeof target !== 'string') {
|
|
61
|
+
if (valueType !== undefined) {
|
|
62
|
+
addAssertionDiagnostic(diagnostics, `The ${subject} assertion at "${location}" must compare against a ${valueType} written as a string, `
|
|
63
|
+
+ `but got ${JSON.stringify(target) ?? String(target)}.`);
|
|
64
|
+
}
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
if (valueType === 'boolean' && target !== 'true' && target !== 'false') {
|
|
68
|
+
addAssertionDiagnostic(diagnostics, `The ${subject} assertion at "${location}" must compare against "true" or "false", `
|
|
69
|
+
+ `but got "${target}".`);
|
|
70
|
+
}
|
|
71
|
+
if (valueType === 'number' && !isSslNumericTarget(target)) {
|
|
72
|
+
addAssertionDiagnostic(diagnostics, `The ${subject} assertion at "${location}" must compare against a number, `
|
|
73
|
+
+ `but got ${formatValue(target)}.`);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Reports SSL assertions whose source, property, comparison or boolean target the
|
|
78
|
+
* backend does not accept.
|
|
22
79
|
*
|
|
23
80
|
* Assertions written as plain object literals bypass SslAssertionBuilder and are
|
|
24
|
-
* type-legal, because the fields are declared as plain strings. The backend rejects
|
|
25
|
-
* an unknown
|
|
26
|
-
*
|
|
27
|
-
* evaluation, so it is reported too.
|
|
81
|
+
* type-legal, because the fields are declared as plain strings. The backend rejects an
|
|
82
|
+
* unknown source, an unknown property or an operator not allowed for the property with
|
|
83
|
+
* a 400; a boolean or numeric property whose target is not of that type is accepted at
|
|
84
|
+
* deploy but never matches at evaluation, so it is reported too.
|
|
28
85
|
*/
|
|
29
86
|
export function validateSslAssertion(diagnostics, assertion, index) {
|
|
30
87
|
const location = `request.assertions[${index}]`;
|
|
@@ -36,14 +93,26 @@ export function validateSslAssertion(diagnostics, assertion, index) {
|
|
|
36
93
|
+ `Expected one of ${quotedKeys(rules)}.`);
|
|
37
94
|
return;
|
|
38
95
|
}
|
|
39
|
-
if (!
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
96
|
+
if (!isPropertyScoped(rule)) {
|
|
97
|
+
if (!Object.hasOwn(rule.comparisons, assertion.comparison)) {
|
|
98
|
+
addAssertionDiagnostic(diagnostics, `The ${assertion.source} assertion at "${location}" has an unsupported comparison `
|
|
99
|
+
+ `${formatValue(assertion.comparison)}. Expected one of ${quotedKeys(rule.comparisons)}.`);
|
|
100
|
+
}
|
|
101
|
+
validateTargetValue(diagnostics, assertion, location, rule.valueType, assertion.source);
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
const comparisons = Object.hasOwn(rule.properties, assertion.property)
|
|
105
|
+
? rule.properties[assertion.property]
|
|
106
|
+
: undefined;
|
|
107
|
+
if (comparisons === undefined) {
|
|
108
|
+
addAssertionDiagnostic(diagnostics, `The ${assertion.source} assertion at "${location}" has an unknown property `
|
|
109
|
+
+ `${formatValue(assertion.property)}. Expected one of ${quotedKeys(rule.properties)}.`);
|
|
110
|
+
return;
|
|
43
111
|
}
|
|
44
|
-
if (
|
|
45
|
-
addAssertionDiagnostic(diagnostics, `The ${assertion.source} assertion at "${location}"
|
|
46
|
-
+
|
|
112
|
+
if (!Object.hasOwn(comparisons, assertion.comparison)) {
|
|
113
|
+
addAssertionDiagnostic(diagnostics, `The ${assertion.source} "${assertion.property}" assertion at "${location}" has an unsupported comparison `
|
|
114
|
+
+ `${formatValue(assertion.comparison)}. Expected one of ${quotedKeys(comparisons)}.`);
|
|
47
115
|
}
|
|
116
|
+
validateTargetValue(diagnostics, assertion, location, sslPropertyValueType(assertion.source, assertion.property), `${assertion.source} "${assertion.property}"`);
|
|
48
117
|
}
|
|
49
118
|
//# sourceMappingURL=ssl-assertion-validation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ssl-assertion-validation.js","sourceRoot":"","sources":["../../src/constructs/ssl-assertion-validation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAA;
|
|
1
|
+
{"version":3,"file":"ssl-assertion-validation.js","sourceRoot":"","sources":["../../src/constructs/ssl-assertion-validation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAA;AAEvF,OAAO,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAA;AAO9G,MAAM,MAAM,GAAgB,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAA;AAYnG,gFAAgF;AAChF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IAC1F,CAAC;IAED,mBAAmB,CACjB,WAAW,EACX,SAAS,EACT,QAAQ,EACR,oBAAoB,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,QAAQ,CAAC,EAC1D,GAAG,SAAS,CAAC,MAAM,KAAK,SAAS,CAAC,QAAQ,GAAG,CAC9C,CAAA;AACH,CAAC"}
|
|
@@ -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 {};
|