Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
import {
PaloAltoNetworksPkiSyncConfigSchema,
PaloAltoNetworksPkiSyncOptionsSchema,
PaloAltoNetworksSslTlsProfilePkiSyncConfigSchema,
PaloAltoNetworksSslTlsProfileRemovalOptionsSchema
} from "./palo-alto-networks-pki-sync-schemas";
const parseNameSchema = (certificateNameSchema: string) =>
PaloAltoNetworksPkiSyncOptionsSchema.safeParse({ certificateNameSchema }).success;
describe("Palo Alto Networks certificateNameSchema validation", () => {
test("accepts the default and short-id schemas within the 31-char Panorama limit", () => {
expect(parseNameSchema("INF-{{shortCertificateId}}")).toBe(true);
expect(parseNameSchema("web-{{shortCertificateId}}")).toBe(true);
});
test("rejects schemas that compile beyond 31 characters", () => {
expect(parseNameSchema("{{certificateId}}")).toBe(false);
expect(parseNameSchema("Infisical-{{shortCertificateId}}")).toBe(false);
});
test("rejects periods, which PAN-OS certificate names do not allow", () => {
expect(parseNameSchema("web.{{shortCertificateId}}")).toBe(false);
});
});
describe("Palo Alto Networks destination config validation", () => {
test("certificates sync accepts a firewall config and defaults push to devices on", () => {
expect(PaloAltoNetworksPkiSyncConfigSchema.parse({}).pushToDevices).toBe(true);
});
test("SSL/TLS profile sync requires a profile and accepts a template vsys", () => {
expect(PaloAltoNetworksSslTlsProfilePkiSyncConfigSchema.safeParse({ template: "branch-tpl" }).success).toBe(false);
expect(
PaloAltoNetworksSslTlsProfilePkiSyncConfigSchema.safeParse({
template: "branch-tpl",
sslTlsServiceProfileName: "gp-portal-profile",
sslTlsServiceProfileVsys: "vsys1"
}).success
).toBe(true);
});
test("rejects names that could break out of an XPath predicate", () => {
expect(PaloAltoNetworksPkiSyncConfigSchema.safeParse({ template: "a']/../entry[@name='b" }).success).toBe(false);
expect(
PaloAltoNetworksSslTlsProfilePkiSyncConfigSchema.safeParse({ sslTlsServiceProfileName: "p<x/>" }).success
).toBe(false);
});
});
describe("Palo Alto Networks SSL/TLS profile removal options validation", () => {
const parse = (value: unknown) => PaloAltoNetworksSslTlsProfileRemovalOptionsSchema.safeParse(value).success;
test("accepts no replacement and a valid certificate name", () => {
expect(parse({})).toBe(true);
expect(parse({ replacementCertificateName: "backup-cert" })).toBe(true);
});
test("rejects unknown keys and names PAN-OS would not accept", () => {
expect(parse({ replacementCertificate: "backup-cert" })).toBe(false);
expect(parse({ replacementCertificateName: "a<b/>" })).toBe(false);
expect(parse({ replacementCertificateName: "x".repeat(64) })).toBe(false);
});
});