@rizom/ops 0.2.0-alpha.205 → 0.2.0-alpha.207

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rizom/ops",
3
- "version": "0.2.0-alpha.205",
3
+ "version": "0.2.0-alpha.207",
4
4
  "description": "Operator CLI for managing private brain fleet registry repos",
5
5
  "keywords": [
6
6
  "brains",
@@ -39,9 +39,27 @@ if (Boolean(certificatePem) !== Boolean(privateKeyPem)) {
39
39
  "Custom-domain TLS secrets require both certificatePem and privateKeyPem",
40
40
  );
41
41
  }
42
+ // A corrupted stored value would otherwise only surface as a kamal-proxy
43
+ // "unable to load certificate" failure after the container has already booted.
44
+ assertPemShape("certificatePem", certificatePem);
45
+ assertPemShape("privateKeyPem", privateKeyPem);
42
46
  writeSecretGitHubEnv("CERTIFICATE_PEM", certificatePem);
43
47
  writeSecretGitHubEnv("PRIVATE_KEY_PEM", privateKeyPem);
44
48
 
49
+ function assertPemShape(name: string, value: string | undefined): void {
50
+ if (value === undefined || value.trim().length === 0) {
51
+ return;
52
+ }
53
+ if (
54
+ !/-----BEGIN [A-Z0-9 ]+-----/.test(value) ||
55
+ !/-----END [A-Z0-9 ]+-----/.test(value)
56
+ ) {
57
+ throw new Error(
58
+ `Secret ${name} is not PEM-shaped after unescaping; the stored value is corrupt`,
59
+ );
60
+ }
61
+ }
62
+
45
63
  writeGitHubOutput(
46
64
  "shared_ai_api_key_secret_name",
47
65
  requireFlatValue(pilot, "aiApiKey", "pilot.yaml"),