@akai-workflow-builder/cli-sdk 0.16.0 → 0.18.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.
Files changed (39) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/ctx/build-ctx.d.ts.map +1 -1
  3. package/dist/ctx/build-ctx.js +41 -4
  4. package/dist/ctx/dynamic-egress.d.ts +11 -0
  5. package/dist/ctx/dynamic-egress.d.ts.map +1 -1
  6. package/dist/ctx/dynamic-egress.js +7 -2
  7. package/dist/ctx/safe-fetch.d.ts +1 -0
  8. package/dist/ctx/safe-fetch.d.ts.map +1 -1
  9. package/dist/ctx/safe-fetch.js +1 -1
  10. package/dist/ctx/sftp-egress.d.ts +47 -0
  11. package/dist/ctx/sftp-egress.d.ts.map +1 -0
  12. package/dist/ctx/sftp-egress.js +99 -0
  13. package/dist/ctx/sftp.d.ts +101 -0
  14. package/dist/ctx/sftp.d.ts.map +1 -0
  15. package/dist/ctx/sftp.js +426 -0
  16. package/dist/index.d.ts +4 -1
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.js +1 -0
  19. package/dist/manifest/index.d.ts +1 -1
  20. package/dist/manifest/index.d.ts.map +1 -1
  21. package/dist/manifest/json-schema.d.ts +15 -0
  22. package/dist/manifest/json-schema.d.ts.map +1 -1
  23. package/dist/manifest/json-schema.js +11 -2
  24. package/dist/manifest/to-schema.d.ts.map +1 -1
  25. package/dist/manifest/to-schema.js +10 -0
  26. package/dist/manifest/types.d.ts +10 -1
  27. package/dist/manifest/types.d.ts.map +1 -1
  28. package/dist/runtime/executor/index.d.ts.map +1 -1
  29. package/dist/runtime/executor/index.js +22 -6
  30. package/dist/runtime/registry/loader.d.ts +18 -10
  31. package/dist/runtime/registry/loader.d.ts.map +1 -1
  32. package/dist/runtime/registry/loader.js +282 -143
  33. package/dist/runtime/registry/types.d.ts +11 -3
  34. package/dist/runtime/registry/types.d.ts.map +1 -1
  35. package/dist/tool.d.ts.map +1 -1
  36. package/dist/tool.js +30 -1
  37. package/dist/types.d.ts +13 -3
  38. package/dist/types.d.ts.map +1 -1
  39. package/package.json +3 -1
package/CHANGELOG.md CHANGED
@@ -4,6 +4,30 @@ All notable changes to `@akai-workflow-builder/cli-sdk` are documented here.
4
4
 
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
6
6
 
7
+ ## [0.18.0](https://github.com/akai-workflow-builder/akai-cli-sdk/compare/cli-sdk-v0.17.0...cli-sdk-v0.18.0) (2026-11-20)
8
+
9
+
10
+ ### Features
11
+
12
+ * transport 'sftp' with ctx.sftp, enforced host:port allowlist ([b821baa](https://github.com/akai-workflow-builder/akai-cli-sdk/commit/b821baad1353bf5043b4513b17f58a411b5fc65d))
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * report a runtime without ssh2 as unavailable ([1e26b4c](https://github.com/akai-workflow-builder/akai-cli-sdk/commit/1e26b4cf330fdceb98bccc07cb7bfdbd392e40d8))
18
+
19
+ ## [0.17.0](https://github.com/akai-workflow-builder/akai-cli-sdk/compare/cli-sdk-v0.16.0...cli-sdk-v0.17.0) (2026-11-11)
20
+
21
+
22
+ ### Features
23
+
24
+ * **registry:** leave out a connection a newer cli-sdk wrote, not its package (AKAI-1417) ([f45437b](https://github.com/akai-workflow-builder/akai-cli-sdk/commit/f45437bc521e70d923a7a51dbbf768fd6dc25a91))
25
+
26
+
27
+ ### Bug Fixes
28
+
29
+ * **registry:** skip a baseline package that fails to load unless strict ([340581b](https://github.com/akai-workflow-builder/akai-cli-sdk/commit/340581bc671f73d36bca7d964f8fec5b9d4bf5fb))
30
+
7
31
  ## [0.16.0](https://github.com/akai-workflow-builder/akai-cli-sdk/compare/cli-sdk-v0.15.1...cli-sdk-v0.16.0) (2026-11-10)
8
32
 
9
33
 
@@ -1 +1 @@
1
- {"version":3,"file":"build-ctx.d.ts","sourceRoot":"","sources":["../../src/ctx/build-ctx.ts"],"names":[],"mappings":"AAOA,OAAO,KA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} from './read-file.js';
6
6
  import { createReadFileStream } from './read-file-stream.js';
7
7
  import { createWriteFile, unavailableWriteFile } from './write-file.js';
8
- import { AkaiSecretError } from '../errors.js';
9
- import { resolveDynamicEgressHosts } from './dynamic-egress.js';
8
+ import { AkaiPropertyError, AkaiSecretError } from '../errors.js';
9
+ import { resolveBinding, resolveDynamicEgressHosts } from './dynamic-egress.js';
10
+ import { parseSftpEgress } from './sftp-egress.js';
11
+ import { createSftp, unavailableSftp } from './sftp.js';
10
12
  import { normalizePem } from './pem.js';
11
13
  function resolveTool(cli, toolName) {
12
14
  const t = cli.tools[toolName];
@@ -58,6 +60,30 @@ function resolveClientCert(tool, secrets, cliId, toolName) {
58
60
  key: normalizePem(key, { ...where, secretKey: ref.keySecretKey, kind: 'private key' }),
59
61
  };
60
62
  }
63
+ /**
64
+ * Resolve an sftp tool's egress to its host:port allowlist. The executor hands
65
+ * over a static list (it resolves the dynamic binding first, see
66
+ * `resolveEgress`); the step-fetcher path calls buildCtx with the dynamic
67
+ * reference itself. Either way every entry must parse — one bad entry fails
68
+ * the whole binding closed, never a partial allowlist.
69
+ */
70
+ function toSftpAllowlist(egress, cliId, toolName, secrets, properties) {
71
+ if (Array.isArray(egress)) {
72
+ const parsed = parseSftpEgress(egress.join(','));
73
+ if (parsed === undefined) {
74
+ throw new AkaiPropertyError(`buildCtx: tool \`${cliId}.${toolName}\` has an invalid sftp allowlist`);
75
+ }
76
+ return parsed;
77
+ }
78
+ const { key, isSecret, raw } = resolveBinding(egress, secrets, properties, cliId, toolName);
79
+ const parsed = parseSftpEgress(raw);
80
+ if (parsed === undefined) {
81
+ // Never echo the value: for a secret binding it is the secret.
82
+ const message = `${isSecret ? 'secret' : 'property'} \`${key}\` must be a list of host[:port] entries, each optionally followed by a SHA256: host-key fingerprint`;
83
+ throw isSecret ? new AkaiSecretError(message, { key }) : new AkaiPropertyError(message, { key });
84
+ }
85
+ return parsed;
86
+ }
61
87
  /**
62
88
  * Native tools have no network surface — `ctx.fetch` is wired to a
63
89
  * throwing stub so an accidental call surfaces as a clear error rather
@@ -66,7 +92,7 @@ function resolveClientCert(tool, secrets, cliId, toolName) {
66
92
  * handler", enforced at runtime.
67
93
  */
68
94
  function nativeFetch(_url, _init) {
69
- return Promise.reject(new Error('ctx.fetch is unavailable for transport: native tools — declare options.network and set transport: http to use it'));
95
+ return Promise.reject(new Error('ctx.fetch is only available to transport: http tools — declare options.network and set transport: http to use it'));
70
96
  }
71
97
  /**
72
98
  * Assemble a frozen {@link ToolCtx} for one tool invocation: resolves
@@ -93,7 +119,17 @@ export function buildCtx(params) {
93
119
  const secrets = buildScopedSecrets(params.cli.secrets, tool.options.secretKeys, params.secretValues, { oauthPresent: typeof params.oauthAccessToken === 'string' && params.oauthAccessToken !== '' });
94
120
  const properties = buildScopedProperties(params.cli.properties, tool.options.propertyKeys, params.propertyValues ?? {});
95
121
  const clientCert = resolveClientCert(tool, secrets, params.cli.id, params.toolName);
96
- const fetch = tool.transport === 'native' || tool.options.network === undefined
122
+ const isSftp = tool.transport === 'sftp' && tool.options.network !== undefined;
123
+ const sftp = isSftp
124
+ ? createSftp({
125
+ allowed: toSftpAllowlist(tool.options.network.egress, params.cli.id, params.toolName, secrets, properties),
126
+ cliId: params.cli.id,
127
+ toolName: params.toolName,
128
+ signal: params.signal,
129
+ maxReadBytes: tool.options.producesFiles === true ? PRODUCES_FILES_MAX_RESPONSE_BYTES : DEFAULT_MAX_RESPONSE_BYTES,
130
+ })
131
+ : unavailableSftp();
132
+ const fetch = tool.transport === 'native' || tool.transport === 'sftp' || tool.options.network === undefined
97
133
  ? nativeFetch
98
134
  : createSafeFetch({
99
135
  egress: toEgressList(tool.options.network.egress, params.cli.id, params.toolName, secrets, properties),
@@ -143,6 +179,7 @@ export function buildCtx(params) {
143
179
  readFile,
144
180
  readFileStream,
145
181
  writeFile,
182
+ sftp,
146
183
  ...(params.oauthAccessToken !== undefined && params.oauthAccessToken !== ''
147
184
  ? { oauth: Object.freeze({ accessToken: params.oauthAccessToken }) }
148
185
  : {}),
@@ -31,6 +31,17 @@ export declare function resolveDynamicEgressHosts(egress: DynamicEgress, secrets
31
31
  * `buildCtx` and `executeTool` split identically.
32
32
  */
33
33
  export declare function splitEgressEntries(raw: string): string[];
34
+ /**
35
+ * Strip the `secret:`/`property:` prefix and read the bound, trimmed value.
36
+ * Throws the same typed errors as {@link resolveDynamicEgressHosts} when the
37
+ * prefix is unsupported or the value is unset. Exported for sftp egress, whose
38
+ * entries carry a port and pin and so are parsed by ./sftp-egress.ts instead.
39
+ */
40
+ export declare function resolveBinding(egress: DynamicEgress, secrets: Readonly<Record<string, string | undefined>>, properties: Readonly<Record<string, string | undefined>>, cliId: string, toolName: string): {
41
+ key: string;
42
+ isSecret: boolean;
43
+ raw: string;
44
+ };
34
45
  /**
35
46
  * Derive the hostname from a dynamic-egress value: an absolute URL yields its
36
47
  * hostname; a bare `host[:port]` (e.g. sunfish's `SUNFISH_HOST`) parses as a bogus
@@ -1 +1 @@
1
- {"version":3,"file":"dynamic-egress.d.ts","sourceRoot":"","sources":["../../src/ctx/dynamic-egress.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGjD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,EACrD,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,EACxD,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,GACf,MAAM,EAAE,CAiBV;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAKxD;AAsCD;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAoB7D"}
1
+ {"version":3,"file":"dynamic-egress.d.ts","sourceRoot":"","sources":["../../src/ctx/dynamic-egress.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGjD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,EACrD,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,EACxD,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,GACf,MAAM,EAAE,CAiBV;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAKxD;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,EACrD,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,EACxD,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,GACf;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAejD;AAcD;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAoB7D"}
@@ -56,8 +56,13 @@ export function splitEgressEntries(raw) {
56
56
  .map((e) => e.trim())
57
57
  .filter((e) => e !== '');
58
58
  }
59
- /** Strip the `secret:`/`property:` prefix and read the bound, trimmed value. */
60
- function resolveBinding(egress, secrets, properties, cliId, toolName) {
59
+ /**
60
+ * Strip the `secret:`/`property:` prefix and read the bound, trimmed value.
61
+ * Throws the same typed errors as {@link resolveDynamicEgressHosts} when the
62
+ * prefix is unsupported or the value is unset. Exported for sftp egress, whose
63
+ * entries carry a port and pin and so are parsed by ./sftp-egress.ts instead.
64
+ */
65
+ export function resolveBinding(egress, secrets, properties, cliId, toolName) {
61
66
  const from = egress.from;
62
67
  // Match the SDK's prefix set and strip it by LENGTH — do NOT split on ':', the
63
68
  // value is a URL whose host:port also contains colons.
@@ -67,6 +67,7 @@ export interface SafeFetchBinding {
67
67
  readonly onPrivateEgressInvalid?: (message: string) => void;
68
68
  }
69
69
  export type SafeFetch = (url: string, init?: RequestInit) => Promise<Response>;
70
+ export declare function isPrivateIp(ip: string): boolean;
70
71
  /** What {@link matchPrivatePin} found: the pin that allows the call, and the addresses it is pinned to. */
71
72
  export interface PrivatePinMatch {
72
73
  readonly pin: NormalizedPrivateEgressPin;
@@ -1 +1 @@
1
- {"version":3,"file":"safe-fetch.d.ts","sourceRoot":"","sources":["../../src/ctx/safe-fetch.ts"],"names":[],"mappings":"AAEA,OAAO,EAAkB,KAAK,cAAc,EAAE,MAAM,UAAU,CAAC;AAI/D,OAAO,EAKL,KAAK,0BAA0B,EAC/B,KAAK,gBAAgB,EACtB,MAAM,qBAAqB,CAAC;AAG7B;;;;;;;;;;GAUG;AACH,eAAO,MAAM,0BAA0B,QAAkB,CAAC;AAE1D;;;;;;;;GAQG;AACH,eAAO,MAAM,iCAAiC,QAAoB,CAAC;AAEnE;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QA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SAAS,gBAAgB,EAAE,CAAC;IACrD,sFAAsF;IACtF,QAAQ,CAAC,sBAAsB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CAC7D;AAED,MAAM,MAAM,SAAS,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;AA6B/E,wBAAgB,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAwB/C;AASD,2GAA2G;AAC3G,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,GAAG,EAAE,0BAA0B,CAAC;IACzC,+GAA+G;IAC/G,QAAQ,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;CACvC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,SAAS,0BAA0B,EAAE,EAC3C,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,SAAS,MAAM,EAAE,GAC3B,eAAe,GAAG,IAAI,CAsBxB;AAED,6EAA6E;AAC7E,KAAK,YAAY,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAElD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,YAAY,GAAG,SAAS,GAAG,YAAY,CAEjF;AA8CD,wBAAgB,eAAe,CAAC,OAAO,EAAE,gBAAgB,GAAG,SAAS,CAsIpE;AA6DD;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,GAAG,cAAc,CASzE"}
@@ -54,7 +54,7 @@ function mappedIPv4(ipv6Lower) {
54
54
  }
55
55
  return null;
56
56
  }
57
- function isPrivateIp(ip) {
57
+ export function isPrivateIp(ip) {
58
58
  if (isIPv4(ip)) {
59
59
  const parts = ip.split('.').map(Number);
60
60
  const a = parts[0];
@@ -0,0 +1,47 @@
1
+ /**
2
+ * The egress vocabulary of `transport: 'sftp'` tools.
3
+ *
4
+ * An http tool's egress is a list of hostnames; an sftp tool also needs the
5
+ * port (SFTP servers commonly listen somewhere other than 22) and, optionally,
6
+ * the server's pinned host key. Each allowlist entry therefore reads:
7
+ *
8
+ * host[:port][ SHA256:<fingerprint>]
9
+ *
10
+ * e.g. `sftp.example.com`, `files.acme.io:2222`,
11
+ * `203.0.113.7:22 SHA256:47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU`. An
12
+ * `sftp://` prefix is accepted and dropped. The port defaults to 22. The
13
+ * fingerprint is the one OpenSSH prints (`ssh-keygen -lf`): `SHA256:` and the
14
+ * unpadded base64 of the SHA-256 of the server's public host key.
15
+ *
16
+ * The allowlist lives in the egress binding — a property the host runtime
17
+ * injects — never in tool input, so a handler cannot widen it or drop a pin.
18
+ * Parsing is all or nothing: one bad entry rejects the whole value, the same
19
+ * fail-closed rule http's dynamic egress follows.
20
+ */
21
+ export interface SftpEgressEntry {
22
+ /** Lowercase hostname or IPv4 literal. */
23
+ readonly host: string;
24
+ readonly port: number;
25
+ /** `SHA256:<43 base64 chars>` when the entry pins the server's host key. */
26
+ readonly hostKeySha256?: string;
27
+ }
28
+ export declare const DEFAULT_SFTP_PORT = 22;
29
+ /**
30
+ * Normalise a host-key fingerprint to `SHA256:<43 chars>`. Accepts it with or
31
+ * without the `SHA256:` prefix and with the trailing `=` pad base64 adds.
32
+ * Returns undefined for anything else.
33
+ */
34
+ export declare function normalizeHostKeyFingerprint(raw: string): string | undefined;
35
+ /** Parse one allowlist entry, or return undefined when it is not valid. */
36
+ export declare function parseSftpEgressEntry(raw: string): SftpEgressEntry | undefined;
37
+ /**
38
+ * Parse a whole allowlist value (entries separated by commas or newlines).
39
+ * Returns undefined when it holds no entry or any entry is invalid. An entry
40
+ * repeated for the same host and port keeps its first appearance; two entries
41
+ * for one host and port that disagree on the pin are invalid, since either
42
+ * reading would silently drop a pin someone set.
43
+ */
44
+ export declare function parseSftpEgress(raw: string): SftpEgressEntry[] | undefined;
45
+ /** The canonical text of an entry: `host:port`, plus ` SHA256:…` when pinned. */
46
+ export declare function formatSftpEgressEntry(entry: SftpEgressEntry): string;
47
+ //# sourceMappingURL=sftp-egress.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sftp-egress.d.ts","sourceRoot":"","sources":["../../src/ctx/sftp-egress.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAIH,MAAM,WAAW,eAAe;IAC9B,0CAA0C;IAC1C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,4EAA4E;IAC5E,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;CACjC;AAED,eAAO,MAAM,iBAAiB,KAAK,CAAC;AAQpC;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAI3E;AAED,2EAA2E;AAC3E,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS,CA4B7E;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,eAAe,EAAE,GAAG,SAAS,CAc1E;AAED,iFAAiF;AACjF,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,eAAe,GAAG,MAAM,CAGpE"}
@@ -0,0 +1,99 @@
1
+ /**
2
+ * The egress vocabulary of `transport: 'sftp'` tools.
3
+ *
4
+ * An http tool's egress is a list of hostnames; an sftp tool also needs the
5
+ * port (SFTP servers commonly listen somewhere other than 22) and, optionally,
6
+ * the server's pinned host key. Each allowlist entry therefore reads:
7
+ *
8
+ * host[:port][ SHA256:<fingerprint>]
9
+ *
10
+ * e.g. `sftp.example.com`, `files.acme.io:2222`,
11
+ * `203.0.113.7:22 SHA256:47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU`. An
12
+ * `sftp://` prefix is accepted and dropped. The port defaults to 22. The
13
+ * fingerprint is the one OpenSSH prints (`ssh-keygen -lf`): `SHA256:` and the
14
+ * unpadded base64 of the SHA-256 of the server's public host key.
15
+ *
16
+ * The allowlist lives in the egress binding — a property the host runtime
17
+ * injects — never in tool input, so a handler cannot widen it or drop a pin.
18
+ * Parsing is all or nothing: one bad entry rejects the whole value, the same
19
+ * fail-closed rule http's dynamic egress follows.
20
+ */
21
+ import { isIPv4 } from 'node:net';
22
+ export const DEFAULT_SFTP_PORT = 22;
23
+ // RFC 1123 labels; at least one dot; last label starts with a letter so a bare
24
+ // number never reads as a host. IPv4 literals are matched separately.
25
+ const HOSTNAME_RE = /^(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z](?:[a-z0-9-]*[a-z0-9])?$/;
26
+ // 32 bytes of SHA-256 → 43 base64 chars once the single `=` pad is dropped.
27
+ const FINGERPRINT_RE = /^SHA256:([A-Za-z0-9+/]{43})=?$/;
28
+ /**
29
+ * Normalise a host-key fingerprint to `SHA256:<43 chars>`. Accepts it with or
30
+ * without the `SHA256:` prefix and with the trailing `=` pad base64 adds.
31
+ * Returns undefined for anything else.
32
+ */
33
+ export function normalizeHostKeyFingerprint(raw) {
34
+ const value = raw.trim();
35
+ const m = FINGERPRINT_RE.exec(value.startsWith('SHA256:') ? value : `SHA256:${value}`);
36
+ return m ? `SHA256:${m[1]}` : undefined;
37
+ }
38
+ /** Parse one allowlist entry, or return undefined when it is not valid. */
39
+ export function parseSftpEgressEntry(raw) {
40
+ const parts = raw.trim().split(/\s+/);
41
+ if (parts.length === 0 || parts.length > 2 || parts[0] === '')
42
+ return undefined;
43
+ let hostKeySha256;
44
+ if (parts.length === 2) {
45
+ hostKeySha256 = normalizeHostKeyFingerprint(parts[1]);
46
+ if (hostKeySha256 === undefined)
47
+ return undefined;
48
+ }
49
+ let authority = parts[0].toLowerCase();
50
+ if (authority.startsWith('sftp://'))
51
+ authority = authority.slice('sftp://'.length);
52
+ if (authority.endsWith('/'))
53
+ authority = authority.slice(0, -1);
54
+ let host = authority;
55
+ let port = DEFAULT_SFTP_PORT;
56
+ const colon = authority.lastIndexOf(':');
57
+ if (colon !== -1) {
58
+ host = authority.slice(0, colon);
59
+ const portText = authority.slice(colon + 1);
60
+ if (!/^\d{1,5}$/.test(portText))
61
+ return undefined;
62
+ port = Number(portText);
63
+ if (port < 1 || port > 65535)
64
+ return undefined;
65
+ }
66
+ if (host.length > 253 || !(HOSTNAME_RE.test(host) || isIPv4(host)))
67
+ return undefined;
68
+ return hostKeySha256 === undefined ? { host, port } : { host, port, hostKeySha256 };
69
+ }
70
+ /**
71
+ * Parse a whole allowlist value (entries separated by commas or newlines).
72
+ * Returns undefined when it holds no entry or any entry is invalid. An entry
73
+ * repeated for the same host and port keeps its first appearance; two entries
74
+ * for one host and port that disagree on the pin are invalid, since either
75
+ * reading would silently drop a pin someone set.
76
+ */
77
+ export function parseSftpEgress(raw) {
78
+ const entries = [];
79
+ for (const text of raw.split(/[,\n]+/)) {
80
+ if (text.trim() === '')
81
+ continue;
82
+ const entry = parseSftpEgressEntry(text);
83
+ if (entry === undefined)
84
+ return undefined;
85
+ const same = entries.find((e) => e.host === entry.host && e.port === entry.port);
86
+ if (same === undefined) {
87
+ entries.push(entry);
88
+ }
89
+ else if (same.hostKeySha256 !== entry.hostKeySha256) {
90
+ return undefined;
91
+ }
92
+ }
93
+ return entries.length > 0 ? entries : undefined;
94
+ }
95
+ /** The canonical text of an entry: `host:port`, plus ` SHA256:…` when pinned. */
96
+ export function formatSftpEgressEntry(entry) {
97
+ const base = `${entry.host}:${entry.port}`;
98
+ return entry.hostKeySha256 === undefined ? base : `${base} ${entry.hostKeySha256}`;
99
+ }
@@ -0,0 +1,101 @@
1
+ /**
2
+ * `ctx.sftp` — the SFTP client a `transport: 'sftp'` tool gets in place of
3
+ * `ctx.fetch`.
4
+ *
5
+ * The network rules mirror safe-fetch, applied to an SSH socket instead of an
6
+ * HTTPS request:
7
+ *
8
+ * - the host AND port must be an entry of the tool's resolved egress
9
+ * allowlist (see ./sftp-egress.ts), matched exactly — no subdomains;
10
+ * - the host is resolved once, every resolved address must be public
11
+ * (loopback, RFC 1918, link-local and the metadata address are refused),
12
+ * and the socket is dialled to the address that was checked, so a second
13
+ * DNS answer cannot redirect it;
14
+ * - when the entry pins a host key, a server presenting any other key is
15
+ * refused before credentials are sent. Unpinned, the presented fingerprint
16
+ * is reported on the session so it can be pinned;
17
+ * - the invocation's AbortSignal closes the connection.
18
+ *
19
+ * Credentials come from the handler (the connector reads them from its
20
+ * secrets): a password, an OpenSSH/PEM private key with optional passphrase,
21
+ * or both — ssh2 tries the key first, then the password, then
22
+ * keyboard-interactive answered with the password.
23
+ *
24
+ * ssh2 is imported lazily so tools that never open an SFTP connection do not
25
+ * load it.
26
+ */
27
+ import { Readable } from 'node:stream';
28
+ import { type SftpEgressEntry } from './sftp-egress.js';
29
+ /** Credentials and target for {@link SftpApi.connect}. */
30
+ export interface SftpConnectOptions {
31
+ /** Allowlisted host. May be omitted when the allowlist holds exactly one entry. */
32
+ readonly host?: string;
33
+ /** Port. Defaults to the allowlisted entry's port when the host has only one. */
34
+ readonly port?: number;
35
+ readonly username: string;
36
+ readonly password?: string;
37
+ /** OpenSSH or PEM private key. Newlines collapsed to spaces or escaped as `\n` are repaired. */
38
+ readonly privateKey?: string;
39
+ readonly passphrase?: string;
40
+ }
41
+ export type SftpEntryType = 'file' | 'directory' | 'symlink' | 'other';
42
+ export interface SftpEntry {
43
+ readonly name: string;
44
+ readonly type: SftpEntryType;
45
+ readonly size: number;
46
+ /** ISO-8601 modification time. */
47
+ readonly modifiedAt: string;
48
+ }
49
+ export interface SftpSession {
50
+ readonly host: string;
51
+ readonly port: number;
52
+ /** Fingerprint the server presented, `SHA256:<base64>`. */
53
+ readonly hostKeySha256: string;
54
+ /** True when the allowlist entry pinned the host key (and it matched). */
55
+ readonly hostKeyPinned: boolean;
56
+ /** List a directory. `.` and `..` are omitted. */
57
+ list(path: string): Promise<SftpEntry[]>;
58
+ stat(path: string): Promise<SftpEntry>;
59
+ /** Read a remote file into memory, refusing one larger than the tool's response cap. */
60
+ readFile(path: string): Promise<Buffer>;
61
+ /** Write a remote file, replacing it if it exists. Resolves to the bytes written. */
62
+ writeFile(path: string, data: Buffer | Uint8Array | string | Readable): Promise<number>;
63
+ mkdir(path: string, opts?: {
64
+ recursive?: boolean;
65
+ }): Promise<void>;
66
+ rename(from: string, to: string): Promise<void>;
67
+ /** Delete a file. */
68
+ remove(path: string): Promise<void>;
69
+ /** Delete an empty directory. */
70
+ rmdir(path: string): Promise<void>;
71
+ close(): void;
72
+ }
73
+ export interface SftpApi {
74
+ /** The resolved allowlist, for messages and host selection. */
75
+ readonly allowed: readonly SftpEgressEntry[];
76
+ connect(opts: SftpConnectOptions): Promise<SftpSession>;
77
+ /** Connect, run `fn`, and close the connection however `fn` ends. */
78
+ withSession<T>(opts: SftpConnectOptions, fn: (session: SftpSession) => Promise<T>): Promise<T>;
79
+ }
80
+ export interface SftpBinding {
81
+ readonly allowed: readonly SftpEgressEntry[];
82
+ readonly cliId: string;
83
+ readonly toolName: string;
84
+ readonly signal: AbortSignal;
85
+ readonly maxReadBytes: number;
86
+ /** Test seam: the ssh2 module. */
87
+ readonly loadSsh2?: () => Promise<typeof import('ssh2')>;
88
+ /** Test seam: resolve a hostname to all its addresses. */
89
+ readonly resolve?: (hostname: string) => Promise<string[]>;
90
+ }
91
+ /** For tools whose transport is not sftp: every call explains what to declare instead. */
92
+ export declare function unavailableSftp(): SftpApi;
93
+ export declare function createSftp(binding: SftpBinding): SftpApi;
94
+ /**
95
+ * Repair the ways a private key gets mangled on its way into a secret field:
96
+ * newlines escaped to a literal `\n`, or collapsed to spaces. The body is
97
+ * re-wrapped at 70 columns (what ssh-keygen writes); a PEM with headers
98
+ * (`Proc-Type:` …) is left alone apart from the `\n` unescape.
99
+ */
100
+ export declare function normalizeSshPrivateKey(ra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