@darkhunt-security/endpoint-codex 0.9.7 → 0.9.8

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "darkhunt-guard",
3
- "version": "0.9.7",
3
+ "version": "0.9.8",
4
4
  "hooks": "./hooks/hooks.json",
5
5
  "description": "Darkhunt endpoint plugin for Codex CLI \u2014 full session trace capture and PreToolUse guardrails.",
6
6
  "author": {
@@ -18135,6 +18135,11 @@ function readSecure(path) {
18135
18135
  throw new ConfigError(`${path} is mode ${mode.toString(8)}; must be 0600`);
18136
18136
  return readFileSync(path, "utf8");
18137
18137
  }
18138
+ function isBlank(path) {
18139
+ if (statSync(path).size === 0)
18140
+ return true;
18141
+ return readFileSync(path, "utf8").trim() === "";
18142
+ }
18138
18143
  function readJson(path) {
18139
18144
  try {
18140
18145
  return JSON.parse(readSecure(path));
@@ -18159,6 +18164,9 @@ function readConfigFile(vendor) {
18159
18164
  if (!existsSync(configPath())) {
18160
18165
  throw new ConfigMissingError(`${configPath()} does not exist \u2014 run init.mjs to create it`);
18161
18166
  }
18167
+ if (isBlank(configPath())) {
18168
+ throw new ConfigMissingError(`${configPath()} is empty \u2014 run init.mjs to create it`);
18169
+ }
18162
18170
  const file = readJson(configPath());
18163
18171
  if (!file) {
18164
18172
  throw new ConfigError(`cannot read ${configPath()} \u2014 it exists but did not parse`);
@@ -18135,6 +18135,11 @@ function readSecure(path) {
18135
18135
  throw new ConfigError(`${path} is mode ${mode.toString(8)}; must be 0600`);
18136
18136
  return readFileSync(path, "utf8");
18137
18137
  }
18138
+ function isBlank(path) {
18139
+ if (statSync(path).size === 0)
18140
+ return true;
18141
+ return readFileSync(path, "utf8").trim() === "";
18142
+ }
18138
18143
  function readJson(path) {
18139
18144
  try {
18140
18145
  return JSON.parse(readSecure(path));
@@ -18159,6 +18164,9 @@ function readConfigFile(vendor) {
18159
18164
  if (!existsSync(configPath())) {
18160
18165
  throw new ConfigMissingError(`${configPath()} does not exist \u2014 run init.mjs to create it`);
18161
18166
  }
18167
+ if (isBlank(configPath())) {
18168
+ throw new ConfigMissingError(`${configPath()} is empty \u2014 run init.mjs to create it`);
18169
+ }
18162
18170
  const file = readJson(configPath());
18163
18171
  if (!file) {
18164
18172
  throw new ConfigError(`cannot read ${configPath()} \u2014 it exists but did not parse`);
@@ -196,6 +196,11 @@ function readSecure(path) {
196
196
  throw new ConfigError(`${path} is mode ${mode.toString(8)}; must be 0600`);
197
197
  return readFileSync(path, "utf8");
198
198
  }
199
+ function isBlank(path) {
200
+ if (statSync(path).size === 0)
201
+ return true;
202
+ return readFileSync(path, "utf8").trim() === "";
203
+ }
199
204
  function readJson(path) {
200
205
  try {
201
206
  return JSON.parse(readSecure(path));
@@ -234,6 +239,9 @@ function readConfigFile(vendor) {
234
239
  if (!existsSync(configPath())) {
235
240
  throw new ConfigMissingError(`${configPath()} does not exist \u2014 run init.mjs to create it`);
236
241
  }
242
+ if (isBlank(configPath())) {
243
+ throw new ConfigMissingError(`${configPath()} is empty \u2014 run init.mjs to create it`);
244
+ }
237
245
  const file = readJson(configPath());
238
246
  if (!file) {
239
247
  throw new ConfigError(`cannot read ${configPath()} \u2014 it exists but did not parse`);
@@ -42,6 +42,11 @@ function readSecure(path) {
42
42
  throw new ConfigError(`${path} is mode ${mode.toString(8)}; must be 0600`);
43
43
  return readFileSync(path, "utf8");
44
44
  }
45
+ function isBlank(path) {
46
+ if (statSync(path).size === 0)
47
+ return true;
48
+ return readFileSync(path, "utf8").trim() === "";
49
+ }
45
50
  function readJson(path) {
46
51
  try {
47
52
  return JSON.parse(readSecure(path));
@@ -80,6 +85,9 @@ function readConfigFile(vendor) {
80
85
  if (!existsSync(configPath())) {
81
86
  throw new ConfigMissingError(`${configPath()} does not exist \u2014 run init.mjs to create it`);
82
87
  }
88
+ if (isBlank(configPath())) {
89
+ throw new ConfigMissingError(`${configPath()} is empty \u2014 run init.mjs to create it`);
90
+ }
83
91
  const file = readJson(configPath());
84
92
  if (!file) {
85
93
  throw new ConfigError(`cannot read ${configPath()} \u2014 it exists but did not parse`);
@@ -62,6 +62,11 @@ function readSecure(path) {
62
62
  throw new ConfigError(`${path} is mode ${mode.toString(8)}; must be 0600`);
63
63
  return readFileSync(path, "utf8");
64
64
  }
65
+ function isBlank(path) {
66
+ if (statSync(path).size === 0)
67
+ return true;
68
+ return readFileSync(path, "utf8").trim() === "";
69
+ }
65
70
  function readJson(path) {
66
71
  try {
67
72
  return JSON.parse(readSecure(path));
@@ -86,6 +91,9 @@ function readConfigFile(vendor) {
86
91
  if (!existsSync(configPath())) {
87
92
  throw new ConfigMissingError(`${configPath()} does not exist \u2014 run init.mjs to create it`);
88
93
  }
94
+ if (isBlank(configPath())) {
95
+ throw new ConfigMissingError(`${configPath()} is empty \u2014 run init.mjs to create it`);
96
+ }
89
97
  const file = readJson(configPath());
90
98
  if (!file) {
91
99
  throw new ConfigError(`cannot read ${configPath()} \u2014 it exists but did not parse`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@darkhunt-security/endpoint-codex",
3
- "version": "0.9.7",
3
+ "version": "0.9.8",
4
4
  "type": "module",
5
5
  "description": "Darkhunt endpoint adapter for Codex CLI: hook codec, rollout transcript mapper, plugin manifest.",
6
6
  "bin": {