@cortexkit/common-auth 0.1.1 → 0.1.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.
@@ -9,6 +9,12 @@ export interface SidebarFileOptions<T> {
9
9
  defaultValue: T;
10
10
  normalize: (parsed: unknown) => T;
11
11
  timeoutMs?: number;
12
+ /**
13
+ * Create the parent directory private and tighten it to 0o700 before each
14
+ * write. Defaults to true. Pass false for a directory the user chose (an
15
+ * override path), whose permissions are theirs to set.
16
+ */
17
+ secureDir?: boolean;
12
18
  logger?: {
13
19
  warn: (message: string, payload?: unknown) => void;
14
20
  debug: (message: string, payload?: unknown) => void;
@@ -41,12 +41,16 @@ export function createSidebarFile(options) {
41
41
  };
42
42
  const persist = async (merge, hooks) => {
43
43
  const parent = dirname(path);
44
- await mkdir(parent, { recursive: true, mode: 0o700 });
45
- await chmod(parent, 0o700).catch((error) => {
46
- options.logger?.warn('sidebar directory permission remediation failed', {
47
- error: error instanceof Error ? error.message : String(error),
48
- });
44
+ const secureDir = options.secureDir ?? true;
45
+ await mkdir(parent, {
46
+ recursive: true,
47
+ mode: secureDir ? 0o700 : undefined,
49
48
  });
49
+ if (secureDir) {
50
+ await chmod(parent, 0o700).catch((error) => {
51
+ options.logger?.warn('sidebar directory permission remediation failed', { error: error instanceof Error ? error.message : String(error) });
52
+ });
53
+ }
50
54
  await withLock(path, {
51
55
  ...WRITER_LOCK_CONSTANTS.sidebar,
52
56
  timeoutMs: options.timeoutMs ?? WRITER_LOCK_CONSTANTS.sidebar.timeoutMs,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cortexkit/common-auth",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Shared plumbing for the CortexKit auth plugins: loopback RPC, file locks and atomic writes, logger, sidebar state file, TUI preferences and TUI build.",
5
5
  "license": "MIT",
6
6
  "repository": {