@getdial/cli 0.37.1 → 0.37.2

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.
@@ -2,6 +2,14 @@ import { chmodSync, mkdirSync, readFileSync, renameSync, statSync, unlinkSync, w
2
2
  import { join } from "node:path";
3
3
  import { logger } from "./log.js";
4
4
  const CHMOD_UNSUPPORTED_CODES = new Set(["ENOTSUP", "EOPNOTSUPP", "EPERM"]);
5
+ /**
6
+ * Windows has no POSIX permission bits: Node synthesizes mode 0o666 (or 0o444
7
+ * for read-only files) regardless of the file's ACL, and chmod can only toggle
8
+ * the read-only flag. Enforcing `secure` there would reject every file we just
9
+ * wrote ourselves, so access control falls to the ACL on the per-user state
10
+ * directory instead.
11
+ */
12
+ const hasPosixModes = () => process.platform !== "win32";
5
13
  function ensureDir(dir) {
6
14
  mkdirSync(dir, { recursive: true, mode: 0o700 });
7
15
  try {
@@ -41,7 +49,7 @@ export function defineVersionedFile(opts) {
41
49
  /** v0 is the legacy unversioned `<base>.json`. */
42
50
  const filePath = (version) => join(opts.dir(), version === 0 ? `${opts.base}.json` : `${opts.base}.v${version}.json`);
43
51
  function parseAt(path) {
44
- if (opts.secure) {
52
+ if (opts.secure && hasPosixModes()) {
45
53
  const fileMode = statSync(path).mode & 0o777;
46
54
  if (fileMode & 0o077) {
47
55
  throw new Error(`${path} has insecure permissions (mode ${fileMode.toString(8)})`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getdial/cli",
3
- "version": "0.37.1",
3
+ "version": "0.37.2",
4
4
  "description": "Dial CLI — install, sign up, and run the local listen service.",
5
5
  "license": "MIT",
6
6
  "repository": {
package/skills.tar.gz CHANGED
Binary file