Combine AIA fields into XCA-style editor
CI / Build and push docker image (push) Successful in 1m43s
CI / Build and push OCSP image (push) Successful in 33s

This commit is contained in:
Walter Oggioni
2026-10-26 23:55:50 +08:00
committed by woggioni
parent cc05d450a2
commit 555f3f28f7
6 changed files with 210 additions and 57 deletions
+1 -1
View File
@@ -37,7 +37,7 @@ test("advanced extensions, validation and vault export", async ({ page }) => {
await (await field(page, "Country (C)")).fill("DE");
await page.locator("#new-key").check();
await page.locator("textarea[placeholder='http://example.com/ca.crl']").fill("http://example.com/ca.crl");
await page.locator("textarea[placeholder='http://ocsp.example.com']").fill("http://ocsp.example.com");
await page.locator("#aia").fill("OCSP;URI:http://ocsp.example.com");
await page.locator("textarea[placeholder*='raw']").fill(
'{"raw":[{"oid":"1.2.3.4","critical":false,"der_hex":"0c03616263"}]}'
);
+36
View File
@@ -38,6 +38,11 @@ test("advanced extension list editors", async ({ page }) => {
const vaultName = unique("List Editors");
const certName = unique("constraints.example");
const crlUrls = ["https://ca.example.com/root.crl", "https://backup.example.com/root.crl"];
const aiaEntries = [
["OCSP;URI", "https://ocsp.example.com"],
["caIssuers;URI", "https://ca.example.com/issuer.crt"],
];
const aiaText = aiaEntries.map(([type, value]) => `${type}:${value}`).join(", ");
const cpsUrls = ["https://example.com/cps", "https://example.com/policy"];
await login(page, user);
@@ -79,6 +84,24 @@ test("advanced extension list editors", async ({ page }) => {
await expect(dialog.getByLabel("Critical", { exact: true })).toBeChecked();
await dialog.getByRole("button", { name: "Cancel", exact: true }).click();
// AIA combines the access method and XCA general-name type in each row.
dialog = await openEditor(page, "#edit-aia", "Authority information access");
await expect(dialog.getByLabel("Critical", { exact: true })).not.toBeChecked();
for (const [type, value] of aiaEntries) {
await addRow(dialog, type, value);
}
await dialog.getByLabel("Critical", { exact: true }).check();
await dialog.getByRole("button", { name: "Apply", exact: true }).click();
await expect(page.locator("#aia")).toHaveValue(aiaText);
dialog = await openEditor(page, "#edit-aia", "Authority information access");
await expect(dialog.locator(".list-entry")).toHaveCount(2);
await expect(dialog.locator(".list-entry").nth(0).locator("select")).toHaveValue("OCSP;URI");
await expect(dialog.locator(".list-entry").nth(1).locator("select")).toHaveValue("caIssuers;URI");
await expect(dialog.locator(".list-entry").nth(1).locator(".list-value")).toHaveValue(aiaEntries[1][1]);
await expect(dialog.getByLabel("Critical", { exact: true })).toBeChecked();
await dialog.getByRole("button", { name: "Cancel", exact: true }).click();
// Name constraints use typed rows and share one extension-level critical flag.
dialog = await openEditor(page, "#edit-nc-permitted", "Name constraints · permitted");
await expect(dialog.getByLabel("Critical", { exact: true })).toBeChecked();
@@ -117,6 +140,7 @@ test("advanced extension list editors", async ({ page }) => {
await expect(page.locator("#nc-excluded")).toHaveValue("DNS:.bad.example");
await page.getByRole("button", { name: "Validate extensions" }).click();
await expect(page.getByText("Extension preview")).toBeVisible();
await expect(page.locator("pre.pem")).toContainText("Authority Information Access");
await expect(page.locator("pre.pem")).toContainText("Name Constraints");
await expect(page.locator("pre.pem")).toContainText("Certificate Policies");
@@ -129,6 +153,13 @@ test("advanced extension list editors", async ({ page }) => {
}, certApiUrl);
const extensions = detail.extension_spec;
expect(extensions.crl_distribution_points).toEqual({ critical: true, urls: crlUrls });
expect(extensions.authority_information_access).toEqual({
critical: true,
descriptions: aiaEntries.map(([type, value]) => ({
method: type.startsWith("OCSP") ? "ocsp" : "ca_issuers",
location: { type: "uri", value },
})),
});
expect(extensions.name_constraints).toEqual({
critical: true,
permitted: [
@@ -149,4 +180,9 @@ test("advanced extension list editors", async ({ page }) => {
await addRow(dialog, "URI", "https://template.example.com/root.crl");
await dialog.getByRole("button", { name: "Apply", exact: true }).click();
await expect(page.locator("#crl-urls")).toHaveValue("https://template.example.com/root.crl");
dialog = await openEditor(page, "#edit-aia", "Authority information access");
await addRow(dialog, "OCSP;URI", "https://template.example.com/ocsp");
await dialog.getByRole("button", { name: "Apply", exact: true }).click();
await expect(page.locator("#aia")).toHaveValue("OCSP;URI:https://template.example.com/ocsp");
});