zappie 0.1.3 → 0.1.5

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/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # zappie
2
2
 
3
+ ## 0.1.5
4
+
5
+ ### Patch Changes
6
+
7
+ - 49d3708: The npm package ships each registry item once, under its plain name, instead of also shipping an identical `<name>@<version>.json` copy. The hosted registry keeps both names. When `--registry` points at a local directory without the pinned file, `zappie` reads the plain file and checks that its version matches.
8
+ - 32ecccf: Add report-only storefront security headers, per-request nonces, prerendered-script hashes and V18 security-header verification. The starter now applies the policy to every document response.
9
+
10
+ ## 0.1.4
11
+
12
+ ### Patch Changes
13
+
14
+ - edfc401: Audit storefront dependencies and widen secret scanning to tracked files, Worker output, server bundles and optional Git history.
15
+
3
16
  ## 0.1.3
4
17
 
5
18
  ### Patch Changes
package/dist/cli.js CHANGED
@@ -115,6 +115,8 @@ Options:
115
115
  ${registryFlag} Use a registry URL or folder. Default: zappie.json, then ${DEFAULT_REGISTRY}
116
116
  --json Print machine-readable output for init, add, list, diff, doctor, check or verify
117
117
  --all Keep running check after a step fails
118
+ --audit <mode> Turn dependency auditing off, report findings, or enforce critical findings
119
+ --history Include Git history in the secret scan
118
120
  --suite <name> Run the standard or extended verify suite
119
121
  --only <checks> Run only these verify checks, such as V01,V04 or quick
120
122
  --report <file> Save your verification report to a file
@@ -153,6 +155,8 @@ function parseCommand(argv) {
153
155
  installed: { type: "boolean" },
154
156
  apply: { type: "boolean" },
155
157
  all: { type: "boolean" },
158
+ audit: { type: "string" },
159
+ history: { type: "boolean" },
156
160
  suite: { type: "string" },
157
161
  report: { type: "string" },
158
162
  key: { type: "string" },
@@ -240,10 +244,16 @@ ${usage}`);
240
244
 
241
245
  ${usage}`);
242
246
  }
247
+ const audit = values.audit ?? "report";
248
+ if (audit !== "off" && audit !== "report" && audit !== "enforce") {
249
+ throw new CliError("Choose off, report or enforce for --audit.");
250
+ }
243
251
  return {
244
252
  name: name2,
245
253
  directory: rest[0],
246
254
  all: values.all === true,
255
+ audit,
256
+ history: values.history === true,
247
257
  json: json4
248
258
  };
249
259
  }
@@ -328,6 +338,8 @@ async function runProjectCheck(options) {
328
338
  const result = await loaded.runCheck({
329
339
  cwd: options.cwd,
330
340
  all: options.all,
341
+ audit: options.audit ?? "report",
342
+ history: options.history ?? false,
331
343
  packageManager: options.packageManager,
332
344
  ...options.signal ? { signal: options.signal } : {}
333
345
  });
@@ -596,7 +608,7 @@ import path6 from "path";
596
608
  import { satisfies as satisfies2 } from "semver";
597
609
 
598
610
  // src/registry.ts
599
- import { readFile } from "fs/promises";
611
+ import { access, readFile } from "fs/promises";
600
612
  import path5 from "path";
601
613
  function object(value, label) {
602
614
  if (typeof value !== "object" || value === null || Array.isArray(value)) {
@@ -679,9 +691,18 @@ var Registry = class {
679
691
  this.source = source2;
680
692
  this.cwd = cwd;
681
693
  }
694
+ remote() {
695
+ return /^https?:\/\//.test(this.source);
696
+ }
697
+ async exists(file) {
698
+ return access(path5.join(path5.resolve(this.cwd, this.source), file)).then(
699
+ () => true,
700
+ () => false
701
+ );
702
+ }
682
703
  async read(file) {
683
704
  try {
684
- if (/^https?:\/\//.test(this.source)) {
705
+ if (this.remote()) {
685
706
  const response = await fetch(
686
707
  `${this.source.replace(/\/+$/, "")}/${file}`
687
708
  );
@@ -701,8 +722,21 @@ var Registry = class {
701
722
  return index(await this.read("index.json"));
702
723
  }
703
724
  async item(name2, version2) {
704
- const suffix = version2 === void 0 ? name2 : `${name2}@${version2}`;
705
- return item(await this.read(`items/${suffix}.json`));
725
+ if (version2 === void 0) {
726
+ return item(await this.read(`items/${name2}.json`));
727
+ }
728
+ const pinned = `items/${name2}@${version2}.json`;
729
+ if (this.remote() || await this.exists(pinned)) {
730
+ return item(await this.read(pinned));
731
+ }
732
+ const current = item(await this.read(`items/${name2}.json`));
733
+ if (current.version !== version2) {
734
+ throw new CliError(
735
+ `We could not read registry ${pinned}: this registry has ${name2} ${current.version} only.`,
736
+ 3
737
+ );
738
+ }
739
+ return current;
706
740
  }
707
741
  };
708
742
 
@@ -1893,6 +1927,8 @@ async function main(argv) {
1893
1927
  const result = await runProjectCheck({
1894
1928
  cwd: directory,
1895
1929
  all: command.all,
1930
+ audit: command.audit,
1931
+ history: command.history,
1896
1932
  json: command.json,
1897
1933
  packageManager: detectPackageManager(directory),
1898
1934
  signal: controller.signal
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zappie",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "Install Zappie kit components and check storefront projects.",
5
5
  "type": "module",
6
6
  "bin": {