Skip to content

Commit e14e1f7

Browse files
committed
Migrate TLS tests to more reliable linting service
This doesn't migrate the wildcard test yet, since there's some issues there. Uses autodetect profile for now but we'll switch to baseline requirements and tighten up generally shortly.
1 parent a0be747 commit e14e1f7

File tree

1 file changed

+29
-49
lines changed

1 file changed

+29
-49
lines changed

test/ca.spec.ts

Lines changed: 29 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -142,26 +142,22 @@ nodeOnly(() => {
142142
const { cert } = caCertificate;
143143

144144
const response = await ignoreNetworkError(
145-
fetch('https://crt.sh/lintcert', {
145+
fetch('https://pkimet.al/lintcert', {
146146
method: 'POST',
147147
headers: { 'content-type': 'application/x-www-form-urlencoded' },
148-
body: new URLSearchParams({'b64cert': cert})
148+
body: new URLSearchParams({
149+
'b64input': cert,
150+
'format': 'json',
151+
'severity': 'warning',
152+
'profile': 'autodetect'
153+
})
149154
}),
150155
{ context: this }
151156
);
152157

153-
const lintOutput = await response.text();
154-
155-
const lintResults = lintOutput
156-
.split('\n')
157-
.map(line => line.split('\t').slice(1))
158-
.filter(line => line.length > 1);
159-
160-
const errors = lintResults
161-
.filter(([level]) => level === 'ERROR')
162-
.map(([_level, message]) => message);
163-
164-
expect(errors.join('\n')).to.equal('');
158+
expect(response.status).to.equal(200);
159+
const results = await response.json();
160+
expect(results).to.deep.equal([]);
165161
});
166162

167163
it("should generate CA certs that can be used to create domain certs that pass lintcert checks", async function () {
@@ -178,34 +174,22 @@ nodeOnly(() => {
178174
expect((certData.getExtension('subjectAltName') as any).altNames[0].value).to.equal('httptoolkit.com');
179175

180176
const response = await ignoreNetworkError(
181-
fetch('https://crt.sh/lintcert', {
177+
fetch('https://pkimet.al/lintcert', {
182178
method: 'POST',
183179
headers: { 'content-type': 'application/x-www-form-urlencoded' },
184-
body: new URLSearchParams({'b64cert': cert})
180+
body: new URLSearchParams({
181+
'b64input': cert,
182+
'format': 'json',
183+
'severity': 'warning',
184+
'profile': 'autodetect'
185+
})
185186
}),
186187
{ context: this }
187188
);
188189

189190
expect(response.status).to.equal(200);
190-
const lintOutput = await response.text();
191-
192-
const lintResults = lintOutput
193-
.split('\n')
194-
.map(line => line.split('\t').slice(1))
195-
.filter(line => line.length > 1);
196-
197-
const errors = lintResults
198-
.filter(([level]) => level === 'ERROR' || level === 'FATAL')
199-
.map(([_level, message]) => message)
200-
.filter((message) =>
201-
// TODO: We don't yet support AIA due to https://github.com/digitalbazaar/forge/issues/988
202-
// This is relatively new, tricky to support (we'd need an OCSP server), and not yet required
203-
// anywhere AFAICT, so not a high priority short-term, but good to do later if possible.
204-
!message.includes("OCSP") &&
205-
!message.includes("authorityInformationAccess")
206-
);
207-
208-
expect(errors.join('\n')).to.equal('');
191+
const results = await response.json();
192+
expect(results).to.deep.equal([]);
209193
});
210194

211195
it("should generate wildcard certs that pass lintcert checks for invalid subdomain names", async function () {
@@ -267,26 +251,22 @@ nodeOnly(() => {
267251
const { cert } = caCertificate;
268252

269253
const response = await ignoreNetworkError(
270-
fetch('https://crt.sh/lintcert', {
254+
fetch('https://pkimet.al/lintcert', {
271255
method: 'POST',
272256
headers: { 'content-type': 'application/x-www-form-urlencoded' },
273-
body: new URLSearchParams({'b64cert': cert})
257+
body: new URLSearchParams({
258+
'b64input': cert,
259+
'format': 'json',
260+
'severity': 'warning',
261+
'profile': 'autodetect'
262+
})
274263
}),
275264
{ context: this }
276265
);
277266

278-
const lintOutput = await response.text();
279-
280-
const lintResults = lintOutput
281-
.split('\n')
282-
.map(line => line.split('\t').slice(1))
283-
.filter(line => line.length > 1);
284-
285-
const errors = lintResults
286-
.filter(([level]) => level === 'ERROR')
287-
.map(([_level, message]) => message);
288-
289-
expect(errors.join('\n')).to.equal('');
267+
expect(response.status).to.equal(200);
268+
const results = await response.json();
269+
expect(results).to.deep.equal([]);
290270
});
291271

292272
});

0 commit comments

Comments
 (0)