@optimuslabs/harness-map-staging 1.5.24 → 1.5.25

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.
@@ -214,6 +214,7 @@ async function collectAllConfigFiles(endpointBase) {
214
214
  hookRunLog(`worktree_scan: active=${worktreeReport.length} config_files ${beforeFilter}→${filtered.length}`);
215
215
  return { configFiles: filtered, worktreeReport };
216
216
  }
217
+ /** Adds the sensitive paths audit to the batch; false when it could not be run (nothing added). */
217
218
  async function addSensitivePathsAudit(endpointBase, configFiles) {
218
219
  hookRunLog(`running sensitive paths audit`);
219
220
  const auditOutputDir = join(homedir(), OPTIMUSLABS_LOGS_REL, LOG_GROUP_AUDIT);
@@ -221,12 +222,14 @@ async function addSensitivePathsAudit(endpointBase, configFiles) {
221
222
  const auditResult = await runSensitivePathsAudit(endpointBase, auditOutputDir, PROJECT_ROOT);
222
223
  hookRunLog(`sensitive_paths_audit: ${auditResult.paths.length} path(s)`);
223
224
  configFiles.push({ file_type: 'sensitive_paths_audit', file_path: 'sensitive_paths_audit.txt', raw_content: { paths: auditResult.paths } });
225
+ return true;
224
226
  }
225
227
  catch (err) {
226
228
  // Send no audit rather than an empty one: the backend keeps the machine's last good audit.
227
229
  hookRunLog(`sensitive_paths_audit_error: ${err instanceof Error ? err.message : String(err)} (audit not sent)`);
228
230
  hookLogError('sensitive_paths_audit', err, { endpoint: endpointBase, output_dir: auditOutputDir });
229
231
  await reportFunctionalFailureAwait('inventory', 'sensitive_paths_audit', err);
232
+ return false;
230
233
  }
231
234
  }
232
235
  /** POSIX mode of every collected file, plus granted folders (and their ancestors) and sensitive audit hits within a budget. stat() only. */
@@ -334,9 +337,16 @@ async function main() {
334
337
  hookRunLog(`patterns_error: ${err instanceof Error ? err.message : String(err)}`);
335
338
  throw err;
336
339
  }
337
- await addSensitivePathsAudit(endpointBase, configFiles);
340
+ const sensitiveAudited = await addSensitivePathsAudit(endpointBase, configFiles);
338
341
  ensureCursorUserSettingsSnapshotInBatch(configFiles);
339
- addPathPermissionsAudit(configFiles);
342
+ if (sensitiveAudited) {
343
+ addPathPermissionsAudit(configFiles);
344
+ }
345
+ else {
346
+ // Built without the sensitive paths, it would replace the backend's last good permissions
347
+ // audit and drop those paths' modes; skip it so both audits stay as last sent.
348
+ hookRunLog('path_permissions_audit: skipped (no sensitive paths audit this run)');
349
+ }
340
350
  const fileTypes = [...new Set(configFiles.map((c) => c.file_type))].join(', ');
341
351
  hookRunLog(`collected ${configFiles.length} config file(s) file_types=${fileTypes}`);
342
352
  for (const c of configFiles) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optimuslabs/harness-map-staging",
3
- "version": "1.5.24",
3
+ "version": "1.5.25",
4
4
  "description": "CLI helpers for logging hardware UUIDs and posting startup payloads to Optimus Security.",
5
5
  "type": "module",
6
6
  "bin": {