@securecoms/agent-bridge 0.34.0 → 0.35.0

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.
@@ -0,0 +1,42 @@
1
+ export declare const VAULT_OUTBOX_DIRNAME = "vault-outbox";
2
+ export declare class PathOutsideOutboxError extends Error {
3
+ constructor();
4
+ }
5
+ /** The outbox as observed at start(); every read must still see exactly this directory. */
6
+ export interface OutboxPin {
7
+ /** The configured path (what the authenticated GET /v1/vault-outbox reports). */
8
+ readonly dir: string;
9
+ /** realpath of the outbox at pin time; the open path is built from this. */
10
+ readonly real: string;
11
+ readonly dev: number;
12
+ readonly ino: number;
13
+ }
14
+ /** A file read from the outbox; `consumeOutboxFile` deletes exactly this inode. */
15
+ export interface OutboxRead {
16
+ readonly bytes: Uint8Array;
17
+ readonly path: string;
18
+ readonly dev: number;
19
+ readonly ino: number;
20
+ }
21
+ /**
22
+ * Create the outbox 0700 if missing and pin it. An existing outbox owned by
23
+ * this uid is tightened to 0700; one that is a symlink, not a directory, or
24
+ * owned by another uid is refused.
25
+ */
26
+ export declare function ensureOutbox(dir: string): OutboxPin;
27
+ /**
28
+ * Read `callerPath` iff it is a regular file directly inside the pinned
29
+ * outbox. A relative `callerPath` resolves against the outbox. A null pin
30
+ * (no data dir, or the outbox could not be created at start) refuses every
31
+ * path: fail closed.
32
+ */
33
+ export declare function readOutboxFile(pin: OutboxPin | null, callerPath: string): Promise<OutboxRead>;
34
+ /**
35
+ * Delete an uploaded file from the outbox, but only if the outbox is still
36
+ * the pinned directory (same checks as a read) and the name still holds the
37
+ * inode that was read (a file swapped in after the read is left alone). The
38
+ * unlink goes through the pinned realpath. A window remains between these
39
+ * lstats and the unlink (Node has no unlinkat): narrowed, not closed.
40
+ * Returns whether it was deleted; never throws (the upload already happened).
41
+ */
42
+ export declare function consumeOutboxFile(pin: OutboxPin, read: OutboxRead): Promise<boolean>;
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const BRIDGE_VERSION = "0.34.0";
1
+ export declare const BRIDGE_VERSION = "0.35.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@securecoms/agent-bridge",
3
- "version": "0.34.0",
3
+ "version": "0.35.0",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=24"