@http-forge/core 0.6.41 → 0.7.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.
- package/README.md +1 -0
- package/dist/di/service-container.d.ts +3 -1
- package/dist/di/service-identifiers.d.ts +2 -0
- package/dist/index.d.ts +6 -1
- package/dist/index.js +199 -198
- package/dist/index.mjs +189 -188
- package/dist/infrastructure/config/config.interface.d.ts +9 -1
- package/dist/infrastructure/execution/collection-request-executor.d.ts +4 -1
- package/dist/infrastructure/history/request-history-service-interfaces.d.ts +1 -1
- package/dist/infrastructure/history/request-history-service.d.ts +1 -1
- package/dist/infrastructure/script/script-executor.d.ts +10 -1
- package/dist/infrastructure/secrets/aws-secret-resolver.d.ts +5 -1
- package/dist/infrastructure/secrets/azure-keyvault-resolver.d.ts +1 -0
- package/dist/infrastructure/secrets/doppler-resolver.d.ts +5 -1
- package/dist/infrastructure/secrets/gcp-secret-resolver.d.ts +1 -0
- package/dist/infrastructure/secrets/hashicorp-vault-resolver.d.ts +4 -4
- package/dist/infrastructure/secrets/onepassword-resolver.d.ts +21 -6
- package/dist/infrastructure/secrets/secret-resolver-registry.d.ts +25 -3
- package/dist/infrastructure/security/secret-values.d.ts +26 -0
- package/dist/infrastructure/security/sensitive-data-redactor.d.ts +15 -6
- package/dist/infrastructure/websocket/node-socketio-client.d.ts +18 -0
- package/dist/infrastructure/websocket/node-websocket-client.d.ts +20 -0
- package/dist/infrastructure/websocket/socketio-request-runner.d.ts +15 -0
- package/dist/infrastructure/websocket/websocket-request-runner.d.ts +26 -0
- package/dist/runtime/execution-helpers.d.ts +9 -1
- package/dist/types/platform.d.ts +81 -1
- package/dist/types/secret-resolver.d.ts +40 -5
- package/dist/types/types.d.ts +148 -0
- package/package.json +10 -3
|
@@ -224,9 +224,11 @@ export interface ProxyConfig {
|
|
|
224
224
|
*/
|
|
225
225
|
export interface SecretProviderEntry {
|
|
226
226
|
/** Provider type */
|
|
227
|
-
provider: 'aws' | 'azure' | 'gcp' | 'vault' | '1password' | 'doppler';
|
|
227
|
+
provider: 'aws' | 'azure' | 'gcp' | 'vault' | '1password' | 'doppler' | 'custom';
|
|
228
228
|
/** AWS region (aws only) */
|
|
229
229
|
region?: string;
|
|
230
|
+
/** AWS shared-config profile (aws only; falls back to AWS_PROFILE) */
|
|
231
|
+
profile?: string;
|
|
230
232
|
/** Azure Key Vault URL (azure only) */
|
|
231
233
|
vaultUrl?: string;
|
|
232
234
|
/** GCP project ID (gcp only) */
|
|
@@ -239,8 +241,14 @@ export interface SecretProviderEntry {
|
|
|
239
241
|
namespace?: string;
|
|
240
242
|
/** 1Password vault name (1password only) */
|
|
241
243
|
vault?: string;
|
|
244
|
+
/** 1Password desktop-app account name or UUID (1password only; used when no service-account token is set) */
|
|
245
|
+
account?: string;
|
|
242
246
|
/** Doppler service token (doppler only; falls back to DOPPLER_TOKEN env var) */
|
|
243
247
|
serviceToken?: string;
|
|
248
|
+
/** Custom resolver module path or package name (custom only) */
|
|
249
|
+
module?: string;
|
|
250
|
+
/** Non-sensitive options passed to the custom resolver factory (custom only) */
|
|
251
|
+
options?: Record<string, unknown>;
|
|
244
252
|
}
|
|
245
253
|
/**
|
|
246
254
|
* Top-level secrets block in http-forge.config.json
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
* Platform-independent — no vscode dependency.
|
|
12
12
|
*/
|
|
13
13
|
import { IEnvironmentConfigService } from '../../types/environment-config';
|
|
14
|
+
import { IWebSocketClient, ISocketIoClient } from '../../types/platform';
|
|
14
15
|
import { ExecutionRequest, ExecutionResult, PreparedRequest, RequestAuth, RequestScripts } from '../../types/types';
|
|
15
16
|
import { IHttpRequestService } from '../http/interfaces';
|
|
16
17
|
import { ICookieJar, IScriptExecutor } from '../script/interfaces';
|
|
@@ -35,7 +36,9 @@ export declare class CollectionRequestExecutor implements ICollectionRequestExec
|
|
|
35
36
|
private readonly collectionAuth?;
|
|
36
37
|
private readonly iteration?;
|
|
37
38
|
private readonly iterationCount?;
|
|
38
|
-
|
|
39
|
+
private readonly webSocketClient?;
|
|
40
|
+
private readonly socketIoClient?;
|
|
41
|
+
constructor(httpService: IHttpRequestService, scriptExecutor: IScriptExecutor, envConfigService: IEnvironmentConfigService, requestPreparer: IRequestPreparer, environment: string, cookieJar?: ICookieJar | undefined, collectionScripts?: RequestScripts | undefined, folderScriptsChain?: (RequestScripts | RequestScripts[]) | undefined, onConsoleOutput?: ConsoleOutputCallback | undefined, collectionName?: string | undefined, collectionAuth?: RequestAuth | undefined, iteration?: number | undefined, iterationCount?: number | undefined, webSocketClient?: IWebSocketClient | undefined, socketIoClient?: ISocketIoClient | undefined);
|
|
39
42
|
/**
|
|
40
43
|
* Execute a request with full Postman parity.
|
|
41
44
|
*/
|
|
@@ -32,7 +32,7 @@ export interface IHistoryWriter {
|
|
|
32
32
|
* Full response storage operations
|
|
33
33
|
*/
|
|
34
34
|
export interface IResponseStorage {
|
|
35
|
-
saveFullResponse(environment: string, requestPath: string, requestId: string, entryId: string, response: FullResponse): void;
|
|
35
|
+
saveFullResponse(environment: string, requestPath: string, requestId: string, entryId: string, response: FullResponse, secretValues?: readonly string[]): void;
|
|
36
36
|
loadFullResponse(environment: string, requestPath: string, requestId: string, entryId: string): FullResponse | null;
|
|
37
37
|
loadSharedFullResponse(environment: string, requestPath: string, requestId: string, entryId: string): FullResponse | null;
|
|
38
38
|
}
|
|
@@ -121,7 +121,7 @@ export declare class RequestHistoryService implements IRequestHistoryService {
|
|
|
121
121
|
/**
|
|
122
122
|
* Save full response to a separate file
|
|
123
123
|
*/
|
|
124
|
-
saveFullResponse(environment: string, requestPath: string, requestId: string, entryId: string, response: FullResponse): void;
|
|
124
|
+
saveFullResponse(environment: string, requestPath: string, requestId: string, entryId: string, response: FullResponse, secretValues?: readonly string[]): void;
|
|
125
125
|
/**
|
|
126
126
|
* Load full response from file
|
|
127
127
|
*/
|
|
@@ -57,7 +57,16 @@ export declare class ScriptExecutor implements IScriptExecutor {
|
|
|
57
57
|
*/
|
|
58
58
|
private createVault;
|
|
59
59
|
/**
|
|
60
|
-
* Create sendRequest function using httpService
|
|
60
|
+
* Create sendRequest function using httpService.
|
|
61
|
+
*
|
|
62
|
+
* Postman resolves variables (including `{{secret:...}}` tokens) in
|
|
63
|
+
* pm.sendRequest definitions. The normal request pipeline does this in
|
|
64
|
+
* RequestPreparer, but pm.sendRequest calls the HTTP service directly, so
|
|
65
|
+
* resolve the script scopes here first. Secrets are resolved asynchronously
|
|
66
|
+
* and injected into the merged scope, where the existing `replaceIn`
|
|
67
|
+
* pipeline handles filters and nested references.
|
|
61
68
|
*/
|
|
62
69
|
private createSendRequest;
|
|
70
|
+
/** Recursively apply `replaceIn` to string values, preserving object shape. */
|
|
71
|
+
private replaceInObject;
|
|
63
72
|
}
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
* AWS Secrets Manager resolver
|
|
3
3
|
*
|
|
4
4
|
* Uses the AWS SDK v3 credential chain — no credentials are stored in HTTP Forge config.
|
|
5
|
-
*
|
|
5
|
+
* A configured profile selects ~/.aws/credentials or ~/.aws/config (including SSO)
|
|
6
|
+
* without requiring AWS_PROFILE in the extension host environment.
|
|
7
|
+
* Order: configured profile → env vars → ~/.aws/credentials → IAM instance role → ECS task role
|
|
6
8
|
*
|
|
7
9
|
* Token syntax: {{secret:aws/<secretId>}}
|
|
8
10
|
* e.g. {{secret:aws/myapp/prod/db-password}}
|
|
@@ -12,7 +14,9 @@ import type { AwsSecretsConfig, ISecretResolver } from '../../types/secret-resol
|
|
|
12
14
|
export declare class AwsSecretResolver implements ISecretResolver {
|
|
13
15
|
readonly providerName = "aws";
|
|
14
16
|
private readonly region;
|
|
17
|
+
private readonly profile;
|
|
15
18
|
private readonly moduleRequire;
|
|
19
|
+
private sdk?;
|
|
16
20
|
constructor(config: AwsSecretsConfig, moduleRequire?: (name: string) => any);
|
|
17
21
|
resolve(path: string): Promise<string | undefined>;
|
|
18
22
|
}
|
|
@@ -15,6 +15,7 @@ export declare class AzureKeyVaultResolver implements ISecretResolver {
|
|
|
15
15
|
readonly providerName = "azure";
|
|
16
16
|
private readonly vaultUrl;
|
|
17
17
|
private readonly moduleRequire;
|
|
18
|
+
private client?;
|
|
18
19
|
constructor(config: AzureKeyVaultConfig, moduleRequire?: (name: string) => any);
|
|
19
20
|
resolve(path: string): Promise<string | undefined>;
|
|
20
21
|
}
|
|
@@ -13,10 +13,14 @@
|
|
|
13
13
|
*
|
|
14
14
|
* Prerequisites: none (uses Node.js built-in https)
|
|
15
15
|
*/
|
|
16
|
+
import type { ClientRequest, IncomingMessage, RequestOptions } from 'http';
|
|
16
17
|
import type { DopplerConfig, ISecretResolver } from '../../types/secret-resolver';
|
|
18
|
+
type DopplerRequestFn = (url: string, options: RequestOptions, callback: (res: IncomingMessage) => void) => ClientRequest;
|
|
17
19
|
export declare class DopplerResolver implements ISecretResolver {
|
|
18
20
|
readonly providerName = "doppler";
|
|
19
21
|
private readonly token;
|
|
20
|
-
|
|
22
|
+
private readonly requestFn;
|
|
23
|
+
constructor(config: DopplerConfig, requestFn?: DopplerRequestFn);
|
|
21
24
|
resolve(path: string): Promise<string | undefined>;
|
|
22
25
|
}
|
|
26
|
+
export {};
|
|
@@ -16,6 +16,7 @@ export declare class GcpSecretResolver implements ISecretResolver {
|
|
|
16
16
|
readonly providerName = "gcp";
|
|
17
17
|
private readonly projectId;
|
|
18
18
|
private readonly moduleRequire;
|
|
19
|
+
private client?;
|
|
19
20
|
constructor(config: GcpSecretsConfig, moduleRequire?: (name: string) => any);
|
|
20
21
|
resolve(path: string): Promise<string | undefined>;
|
|
21
22
|
}
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
* HashiCorp Vault resolver
|
|
3
3
|
*
|
|
4
4
|
* Credentials are NEVER stored in HTTP Forge config.
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
5
|
+
* Settings:
|
|
6
|
+
* config.address server address, falling back to VAULT_ADDR
|
|
7
|
+
* config.namespace Enterprise/HCP namespace, falling back to VAULT_NAMESPACE
|
|
8
|
+
* VAULT_TOKEN env var (token auth, always required)
|
|
9
9
|
*
|
|
10
10
|
* Token syntax: {{secret:vault/<mountPath>/<secretPath>#<field>}}
|
|
11
11
|
* e.g. {{secret:vault/secret/myapp/prod#db_password}}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* 1Password
|
|
2
|
+
* 1Password secret resolver
|
|
3
3
|
*
|
|
4
4
|
* Credentials are NEVER stored in HTTP Forge config.
|
|
5
|
-
* Authentication
|
|
6
|
-
* OP_SERVICE_ACCOUNT_TOKEN
|
|
7
|
-
*
|
|
5
|
+
* Authentication priority:
|
|
6
|
+
* 1. OP_SERVICE_ACCOUNT_TOKEN env var → SDK service-account auth (no app/CLI)
|
|
7
|
+
* 2. `account` provider config → SDK DesktopAuth (personal account,
|
|
8
|
+
* requires the desktop app + SDK 0.5+)
|
|
9
|
+
* 3. `op` CLI signed-in session → interactive personal account
|
|
8
10
|
*
|
|
9
11
|
* Token syntax: {{secret:1password/<vault>/<item>/<field>}}
|
|
10
12
|
* e.g. {{secret:1password/MyVault/MyApp/api_key}}
|
|
@@ -13,14 +15,27 @@
|
|
|
13
15
|
* If `vault` is specified in the provider config, the token path may omit it:
|
|
14
16
|
* {{secret:1password/<item>/<field>}}
|
|
15
17
|
*
|
|
16
|
-
*
|
|
18
|
+
* The SDK is used when either a service-account token or a desktop account is
|
|
19
|
+
* configured; otherwise this falls back to the 1Password CLI (`op`). If the SDK
|
|
20
|
+
* package is missing, the CLI is also used with the configured account.
|
|
17
21
|
*/
|
|
18
22
|
import type { ISecretResolver, OnePasswordConfig } from '../../types/secret-resolver';
|
|
23
|
+
type ExecFileLike = (file: string, args: string[], options: Record<string, unknown>) => Promise<{
|
|
24
|
+
stdout: string;
|
|
25
|
+
stderr?: string;
|
|
26
|
+
}>;
|
|
19
27
|
export declare class OnePasswordResolver implements ISecretResolver {
|
|
20
28
|
readonly providerName = "1password";
|
|
21
29
|
private readonly defaultVault;
|
|
22
|
-
|
|
30
|
+
private readonly account;
|
|
31
|
+
private readonly moduleRequire;
|
|
32
|
+
private readonly execFileFn;
|
|
33
|
+
private sdkClientPromise?;
|
|
34
|
+
private sdkAuthKey?;
|
|
35
|
+
constructor(config: OnePasswordConfig, moduleRequire?: (name: string) => any, execFileFn?: ExecFileLike);
|
|
23
36
|
resolve(path: string): Promise<string | undefined>;
|
|
24
37
|
private tryResolveSdk;
|
|
38
|
+
private getSdkClient;
|
|
25
39
|
private resolveViaCli;
|
|
26
40
|
}
|
|
41
|
+
export {};
|
|
@@ -13,14 +13,21 @@
|
|
|
13
13
|
*/
|
|
14
14
|
import type { IConfigService } from '../config/config.interface';
|
|
15
15
|
export declare class SecretResolverRegistry {
|
|
16
|
+
private readonly configService?;
|
|
16
17
|
private readonly resolvers;
|
|
17
18
|
/**
|
|
18
19
|
* Require function rooted at the user's project (via config `scripts.modulePaths`),
|
|
19
20
|
* so optional cloud SDKs resolve from the same place users install custom script
|
|
20
|
-
* modules — not from the extension's own bundle.
|
|
21
|
+
* modules — not from the extension's own bundle. Rebuilt when module paths change.
|
|
21
22
|
*/
|
|
22
|
-
private
|
|
23
|
-
|
|
23
|
+
private moduleRequire;
|
|
24
|
+
/**
|
|
25
|
+
* Snapshot of the config blocks that determine the resolver set. A config
|
|
26
|
+
* reload (including file-watcher reloads) changes this key, which triggers a
|
|
27
|
+
* rebuild on the next resolution instead of leaving startup resolvers stale.
|
|
28
|
+
*/
|
|
29
|
+
private configKey?;
|
|
30
|
+
constructor(configService?: IConfigService | undefined);
|
|
24
31
|
/**
|
|
25
32
|
* Scan a string (or recursively, any object) for {{secret:alias/path}} tokens
|
|
26
33
|
* and resolve them all in parallel.
|
|
@@ -31,8 +38,23 @@ export declare class SecretResolverRegistry {
|
|
|
31
38
|
resolveSecretTokens(input: any, cache?: Map<string, string>): Promise<Record<string, string>>;
|
|
32
39
|
/** Whether any providers are configured */
|
|
33
40
|
get hasProviders(): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Rebuild the resolver set when the config snapshot changes.
|
|
43
|
+
*
|
|
44
|
+
* ConfigService.reload() swaps its in-memory config without notifying every
|
|
45
|
+
* consumer; comparing the small `secrets` block here keeps the registry in
|
|
46
|
+
* sync with file-watcher reloads while avoiding per-request rebuilds.
|
|
47
|
+
*/
|
|
48
|
+
private refreshProviders;
|
|
34
49
|
private collectTokens;
|
|
50
|
+
/**
|
|
51
|
+
* Normalize a captured template expression to the bare token.
|
|
52
|
+
* `{{secret:aws/x | upper}}` resolves the `secret:aws/x` value first and
|
|
53
|
+
* lets the normal interpolation pipeline apply the filter chain.
|
|
54
|
+
*/
|
|
55
|
+
private baseToken;
|
|
35
56
|
private createResolver;
|
|
57
|
+
private createCustomResolver;
|
|
36
58
|
/**
|
|
37
59
|
* Build a `require` function rooted at the user's project, so optional cloud SDKs
|
|
38
60
|
* resolve from the same `node_modules` where users install custom script modules
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolved secret value tracking and opacity.
|
|
3
|
+
*
|
|
4
|
+
* Secret values are tracked in a WeakMap keyed by the prepared request. This
|
|
5
|
+
* keeps them out of JSON/webview payloads while still letting persistence code
|
|
6
|
+
* redact exact occurrences later in the execution pipeline.
|
|
7
|
+
*
|
|
8
|
+
* The protect/unprotect helpers keep a resolved value opaque to recursive
|
|
9
|
+
* variable interpolation: a secret containing `{{...}}` must not be treated as
|
|
10
|
+
* a template and expanded again.
|
|
11
|
+
*/
|
|
12
|
+
/** Associate resolved secret values with a request/result object. */
|
|
13
|
+
export declare function attachSecretValues<T extends object>(target: T, values: Iterable<string> | undefined): T;
|
|
14
|
+
/** Read the resolved secret values associated with an object, if any. */
|
|
15
|
+
export declare function getSecretValues(target: object | null | undefined): readonly string[];
|
|
16
|
+
/** Copy tracked secret values from one object to a derived object. */
|
|
17
|
+
export declare function copySecretValues<T extends object>(source: object | null | undefined, target: T): T;
|
|
18
|
+
/** Replace template delimiters so a resolved value stays opaque during interpolation. */
|
|
19
|
+
export declare function protectSecretValue(value: string): string;
|
|
20
|
+
/** Restore template delimiters in a previously protected secret value. */
|
|
21
|
+
export declare function unprotectSecretValue(value: string): string;
|
|
22
|
+
/**
|
|
23
|
+
* Recursively restore protected delimiters in plain request data.
|
|
24
|
+
* Non-plain objects (Buffer, FormData, streams) are returned unchanged.
|
|
25
|
+
*/
|
|
26
|
+
export declare function unprotectSecretValuesDeep<T>(value: T): T;
|
|
@@ -37,21 +37,30 @@ export declare function redactUrl(url: string): string;
|
|
|
37
37
|
* Handles JSON objects, JSON strings, and URL-encoded form strings.
|
|
38
38
|
*/
|
|
39
39
|
export declare function redactBody(body: any): any;
|
|
40
|
+
/**
|
|
41
|
+
* Recursively replace exact resolved secret values in plain data. This catches
|
|
42
|
+
* secrets used in URL path segments, innocuous header/field names, response
|
|
43
|
+
* echo bodies, assertion messages, and console output — cases that name-based
|
|
44
|
+
* redaction cannot detect.
|
|
45
|
+
*/
|
|
46
|
+
export declare function redactSecretValuesDeep<T>(value: T, secretValues: readonly string[]): T;
|
|
40
47
|
/**
|
|
41
48
|
* Redact sensitive data from a HistoryEntry's sentRequest.
|
|
42
49
|
* Returns a deep copy with sensitive values replaced.
|
|
43
50
|
* The originalConfig (unresolved templates) is left untouched.
|
|
44
51
|
*/
|
|
45
|
-
export declare function redactHistoryEntry(entry: HistoryEntry): HistoryEntry;
|
|
52
|
+
export declare function redactHistoryEntry(entry: HistoryEntry, secretValues?: readonly string[]): HistoryEntry;
|
|
46
53
|
/**
|
|
47
|
-
* Redact sensitive data from a FullResponse (
|
|
48
|
-
*
|
|
54
|
+
* Redact sensitive data from a FullResponse (headers, cookies, and exact
|
|
55
|
+
* resolved secret values echoed in the response body).
|
|
49
56
|
*/
|
|
50
|
-
export declare function redactFullResponse(response: FullResponse): FullResponse;
|
|
57
|
+
export declare function redactFullResponse(response: FullResponse, secretValues?: readonly string[]): FullResponse;
|
|
51
58
|
/**
|
|
52
|
-
* Redact sensitive data from a FullResultDetails (suite test result)
|
|
59
|
+
* Redact sensitive data from a FullResultDetails (suite test result), including
|
|
60
|
+
* exact resolved secret values in request/response data, console output and
|
|
61
|
+
* assertion messages.
|
|
53
62
|
*/
|
|
54
|
-
export declare function redactFullResultDetails(result: FullResultDetails): FullResultDetails;
|
|
63
|
+
export declare function redactFullResultDetails(result: FullResultDetails, secretValues?: readonly string[]): FullResultDetails;
|
|
55
64
|
/** A single warning about a hardcoded sensitive value. */
|
|
56
65
|
export interface SensitiveDataWarning {
|
|
57
66
|
/** Where the issue was found (e.g. "header", "auth", "body", "query", "url") */
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { IDisposable } from '../../types/platform';
|
|
2
|
+
import type { ISocketIoClient, ISocketIoConnection, SocketIoConnectOptions, SocketIoEvent } from '../../types/platform';
|
|
3
|
+
export type { IDisposable, ISocketIoClient, ISocketIoConnection, SocketIoConnectOptions, SocketIoEvent };
|
|
4
|
+
/**
|
|
5
|
+
* Node.js Socket.IO transport adapter.
|
|
6
|
+
*
|
|
7
|
+
* Wraps the lazily loaded `socket.io-client` so Socket.IO requests can run
|
|
8
|
+
* headlessly (collection runner / suite executor) and interactively (Request
|
|
9
|
+
* Tester). `socket.io-client` stays out of the eager bundle.
|
|
10
|
+
*/
|
|
11
|
+
export declare class NodeSocketIoClient implements ISocketIoClient {
|
|
12
|
+
connect(options: SocketIoConnectOptions): Promise<ISocketIoConnection>;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Backwards-compatible alias for the extension's previous adapter name.
|
|
16
|
+
*/
|
|
17
|
+
export declare class SocketIoClientAdapter extends NodeSocketIoClient {
|
|
18
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node WebSocket client adapter.
|
|
3
|
+
*
|
|
4
|
+
* Uses `ws` lazily so HTTP-only consumers do not load it. The module is
|
|
5
|
+
* intentionally VS Code-free and exposes only the core WebSocket port.
|
|
6
|
+
*/
|
|
7
|
+
import { IWebSocketClient, IWebSocketConnection, WebSocketConnectOptions } from '../../types/platform';
|
|
8
|
+
export interface NodeWebSocketClientOptions {
|
|
9
|
+
/** Base directory used to resolve relative TLS certificate paths. */
|
|
10
|
+
basePath?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* WebSocket client backed by the `ws` package.
|
|
14
|
+
*/
|
|
15
|
+
export declare class NodeWebSocketClient implements IWebSocketClient {
|
|
16
|
+
private readonly options;
|
|
17
|
+
constructor(options?: NodeWebSocketClientOptions);
|
|
18
|
+
connect(options: WebSocketConnectOptions): Promise<IWebSocketConnection>;
|
|
19
|
+
private buildTransportOptions;
|
|
20
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Headless Socket.IO request runner.
|
|
3
|
+
*
|
|
4
|
+
* Mirrors `websocket-request-runner.ts` for the Socket.IO flavor: a Socket.IO
|
|
5
|
+
* request is executed as a bounded transcript (connect → emit saved messages
|
|
6
|
+
* → collect events for `websocket.settings.responseTimeout` → disconnect).
|
|
7
|
+
*
|
|
8
|
+
* Socket.IO is a higher-level protocol than raw WebSocket, so this runner
|
|
9
|
+
* talks to the injected `ISocketIoClient` (extension host / Node adapter) and
|
|
10
|
+
* records events + acknowledgements as transcript frames.
|
|
11
|
+
*/
|
|
12
|
+
import type { ISocketIoClient } from '../../types/platform';
|
|
13
|
+
import { ExecutionRequest, HttpResponse, PreparedRequest } from '../../types/types';
|
|
14
|
+
export declare const DEFAULT_SOCKETIO_RESPONSE_TIMEOUT_MS = 1000;
|
|
15
|
+
export declare function runSocketIoRequest(client: ISocketIoClient, request: ExecutionRequest, prepared: PreparedRequest, signal?: AbortSignal): Promise<HttpResponse>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Headless WebSocket request runner.
|
|
3
|
+
*
|
|
4
|
+
* Collection/suite execution has no interactive frame stream, so a WebSocket
|
|
5
|
+
* request is executed as a bounded transcript:
|
|
6
|
+
* 1. connect (prepared URL, headers, subprotocols, TLS/timeout settings)
|
|
7
|
+
* 2. send the saved messages in order
|
|
8
|
+
* 3. collect inbound frames for `websocket.settings.responseTimeout`
|
|
9
|
+
* 4. close and return a synthetic `HttpResponse`
|
|
10
|
+
*
|
|
11
|
+
* The response body is a `WebSocketRunTranscript`, exposed to post-response
|
|
12
|
+
* scripts as `pm.response.json()`. The executor owns pre/post script
|
|
13
|
+
* orchestration; this module only owns the socket lifecycle.
|
|
14
|
+
*/
|
|
15
|
+
import { IWebSocketClient } from '../../types/platform';
|
|
16
|
+
import { ExecutionRequest, HttpResponse, PreparedRequest } from '../../types/types';
|
|
17
|
+
/** Default time to collect inbound frames after the saved messages are sent. */
|
|
18
|
+
export declare const DEFAULT_WEBSOCKET_RESPONSE_TIMEOUT_MS = 1000;
|
|
19
|
+
/**
|
|
20
|
+
* Execute a WebSocket request headlessly and return its transcript response.
|
|
21
|
+
*
|
|
22
|
+
* Socket.IO requests are rejected for now: the client lives in the extension
|
|
23
|
+
* host so core stays free of `socket.io-client`. A core-side transport port is
|
|
24
|
+
* a separate design decision.
|
|
25
|
+
*/
|
|
26
|
+
export declare function runWebSocketRequest(client: IWebSocketClient, request: ExecutionRequest, prepared: PreparedRequest, signal?: AbortSignal): Promise<HttpResponse>;
|
|
@@ -8,9 +8,17 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import type { ServiceContainer } from '../di/service-container';
|
|
10
10
|
import type { CollectionRequest } from '../types/collection';
|
|
11
|
-
import type { ExecutionRequest, RequestAuth } from '../types/types';
|
|
11
|
+
import type { ExecutionRequest, RequestAuth, RequestType } from '../types/types';
|
|
12
12
|
export declare function disposeContainerResources(container: ServiceContainer): void;
|
|
13
13
|
export declare function isEnabled(value: string | undefined): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Transport-aware success check for run summaries.
|
|
16
|
+
*
|
|
17
|
+
* A successful WebSocket handshake is HTTP 101 (Switching Protocols), which
|
|
18
|
+
* falls outside the 2xx range used for HTTP requests. Suite/direct reporting
|
|
19
|
+
* must not label a working WebSocket run as failed.
|
|
20
|
+
*/
|
|
21
|
+
export declare function isSuccessfulExecutionStatus(status: number | undefined, requestType?: RequestType): boolean;
|
|
14
22
|
export declare function shouldEnforceMaxRequests(): boolean;
|
|
15
23
|
export declare function getDirectMaxRequestsLimit(): number;
|
|
16
24
|
export declare function shouldGenerateReports(include: string[], reporters?: string[]): boolean;
|
package/dist/types/platform.d.ts
CHANGED
|
@@ -188,13 +188,93 @@ export interface IFileSystem {
|
|
|
188
188
|
readDir(dirPath: string): Promise<string[]>;
|
|
189
189
|
isDirectory(filePath: string): Promise<boolean>;
|
|
190
190
|
}
|
|
191
|
-
import { HttpRequestOptions, HttpResponse } from './types';
|
|
191
|
+
import { HttpRequestOptions, HttpResponse, RequestSettings } from './types';
|
|
192
192
|
/**
|
|
193
193
|
* Interface for executing HTTP requests.
|
|
194
194
|
*/
|
|
195
195
|
export interface IHttpClient {
|
|
196
196
|
send(options: HttpRequestOptions): Promise<HttpResponse>;
|
|
197
197
|
}
|
|
198
|
+
/**
|
|
199
|
+
* Options for opening a WebSocket connection.
|
|
200
|
+
*/
|
|
201
|
+
export interface WebSocketConnectOptions {
|
|
202
|
+
url: string;
|
|
203
|
+
headers?: Record<string, string>;
|
|
204
|
+
protocols?: string[];
|
|
205
|
+
settings?: RequestSettings;
|
|
206
|
+
/** Maximum accepted message size in bytes. 0 or undefined means unlimited. */
|
|
207
|
+
maxPayloadBytes?: number;
|
|
208
|
+
signal?: AbortSignal;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* A single WebSocket message frame.
|
|
212
|
+
*
|
|
213
|
+
* Binary data is exposed as a Uint8Array so the port stays platform-neutral.
|
|
214
|
+
*/
|
|
215
|
+
export interface WebSocketFrame {
|
|
216
|
+
data: string | Uint8Array;
|
|
217
|
+
isBinary: boolean;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Close details for a WebSocket connection.
|
|
221
|
+
*/
|
|
222
|
+
export interface WebSocketCloseInfo {
|
|
223
|
+
code: number;
|
|
224
|
+
reason: string;
|
|
225
|
+
wasClean: boolean;
|
|
226
|
+
}
|
|
227
|
+
export type WebSocketConnectionState = 'connecting' | 'open' | 'closing' | 'closed';
|
|
228
|
+
/**
|
|
229
|
+
* An open WebSocket connection.
|
|
230
|
+
*/
|
|
231
|
+
export interface IWebSocketConnection extends IDisposable {
|
|
232
|
+
readonly state: WebSocketConnectionState;
|
|
233
|
+
readonly negotiatedProtocol: string;
|
|
234
|
+
readonly handshakeHeaders?: Record<string, string>;
|
|
235
|
+
send(data: string | Uint8Array): Promise<void>;
|
|
236
|
+
close(code?: number, reason?: string): Promise<void>;
|
|
237
|
+
onFrame(listener: (frame: WebSocketFrame) => void): IDisposable;
|
|
238
|
+
onClose(listener: (info: WebSocketCloseInfo) => void): IDisposable;
|
|
239
|
+
onError(listener: (error: Error) => void): IDisposable;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Platform abstraction for opening WebSocket connections.
|
|
243
|
+
*/
|
|
244
|
+
export interface IWebSocketClient {
|
|
245
|
+
connect(options: WebSocketConnectOptions): Promise<IWebSocketConnection>;
|
|
246
|
+
}
|
|
247
|
+
export interface SocketIoConnectOptions {
|
|
248
|
+
url: string;
|
|
249
|
+
headers?: Record<string, string>;
|
|
250
|
+
path?: string;
|
|
251
|
+
clientVersion?: string;
|
|
252
|
+
namespace?: string;
|
|
253
|
+
auth?: unknown;
|
|
254
|
+
transports?: Array<'websocket' | 'polling'>;
|
|
255
|
+
timeout?: number;
|
|
256
|
+
reconnectionAttempts?: number;
|
|
257
|
+
reconnectionDelay?: number;
|
|
258
|
+
listeners?: string[];
|
|
259
|
+
}
|
|
260
|
+
export interface SocketIoEvent {
|
|
261
|
+
event: string;
|
|
262
|
+
args: unknown[];
|
|
263
|
+
}
|
|
264
|
+
export interface ISocketIoConnection extends IDisposable {
|
|
265
|
+
readonly connected: boolean;
|
|
266
|
+
readonly id?: string;
|
|
267
|
+
send(event: string, args: unknown[], expectAck?: boolean): Promise<unknown[] | undefined>;
|
|
268
|
+
close(): void;
|
|
269
|
+
onEvent(listener: (event: SocketIoEvent) => void): IDisposable;
|
|
270
|
+
onConnect(listener: () => void): IDisposable;
|
|
271
|
+
onDisconnect(listener: (reason: string) => void): IDisposable;
|
|
272
|
+
onReconnectFailed(listener: () => void): IDisposable;
|
|
273
|
+
onError(listener: (error: Error) => void): IDisposable;
|
|
274
|
+
}
|
|
275
|
+
export interface ISocketIoClient {
|
|
276
|
+
connect(options: SocketIoConnectOptions): Promise<ISocketIoConnection>;
|
|
277
|
+
}
|
|
198
278
|
/**
|
|
199
279
|
* Interface for logging.
|
|
200
280
|
*/
|
|
@@ -6,16 +6,17 @@
|
|
|
6
6
|
*
|
|
7
7
|
* Token syntax resolved by this interface: {{secret:provider/path}}
|
|
8
8
|
* e.g. {{secret:aws/myapp/prod/db-password}}
|
|
9
|
-
* {{secret:azure/
|
|
10
|
-
* {{secret:vault/
|
|
11
|
-
* {{secret:
|
|
9
|
+
* {{secret:azure/my-api-key}}
|
|
10
|
+
* {{secret:vault/myapp/prod#password}}
|
|
11
|
+
* {{secret:op/MyVault/MyItem/password}}
|
|
12
12
|
*
|
|
13
13
|
* Credentials are NEVER stored in HTTP Forge config.
|
|
14
14
|
* Each provider uses its SDK's default credential chain:
|
|
15
15
|
* - AWS → SDK credential chain (env vars / ~/.aws / IAM role)
|
|
16
16
|
* - Azure → DefaultAzureCredential (env / managed identity / CLI login)
|
|
17
17
|
* - Vault → VAULT_TOKEN / VAULT_ADDR env vars
|
|
18
|
-
* - 1Password → OP_SERVICE_ACCOUNT_TOKEN env var
|
|
18
|
+
* - 1Password → OP_SERVICE_ACCOUNT_TOKEN env var, configured desktop account,
|
|
19
|
+
* or the signed-in `op` CLI session
|
|
19
20
|
*/
|
|
20
21
|
export interface ISecretResolver {
|
|
21
22
|
/**
|
|
@@ -33,6 +34,8 @@ export interface AwsSecretsConfig {
|
|
|
33
34
|
provider: 'aws';
|
|
34
35
|
/** AWS region, e.g. "us-east-1". Falls back to AWS_DEFAULT_REGION env var. */
|
|
35
36
|
region?: string;
|
|
37
|
+
/** AWS shared-config profile, e.g. "my-sso-profile". Falls back to AWS_PROFILE when omitted. */
|
|
38
|
+
profile?: string;
|
|
36
39
|
}
|
|
37
40
|
export interface AzureKeyVaultConfig {
|
|
38
41
|
provider: 'azure';
|
|
@@ -64,6 +67,14 @@ export interface OnePasswordConfig {
|
|
|
64
67
|
* If omitted, the path is expected to include vault/item/field.
|
|
65
68
|
*/
|
|
66
69
|
vault?: string;
|
|
70
|
+
/**
|
|
71
|
+
* 1Password desktop-app account name (or account UUID) for personal-account auth.
|
|
72
|
+
* When OP_SERVICE_ACCOUNT_TOKEN is not set, the SDK uses DesktopAuth(account).
|
|
73
|
+
* Requires the 1Password desktop app and @1password/sdk 0.5.0 or newer.
|
|
74
|
+
* When the SDK package is unavailable, the same value is passed to the CLI as
|
|
75
|
+
* OP_ACCOUNT. If omitted, HTTP Forge uses the signed-in `op` CLI session.
|
|
76
|
+
*/
|
|
77
|
+
account?: string;
|
|
67
78
|
}
|
|
68
79
|
export interface GcpSecretsConfig {
|
|
69
80
|
provider: 'gcp';
|
|
@@ -81,7 +92,31 @@ export interface DopplerConfig {
|
|
|
81
92
|
*/
|
|
82
93
|
serviceToken?: string;
|
|
83
94
|
}
|
|
84
|
-
export
|
|
95
|
+
export interface CustomSecretProviderConfig {
|
|
96
|
+
provider: 'custom';
|
|
97
|
+
/**
|
|
98
|
+
* Module path or package name resolved from the first `scripts.modulePaths`
|
|
99
|
+
* entry that contains a package.json. Relative paths are resolved from that
|
|
100
|
+
* module directory.
|
|
101
|
+
*/
|
|
102
|
+
module: string;
|
|
103
|
+
/** Non-sensitive options passed to the module's resolver factory. */
|
|
104
|
+
options?: Record<string, unknown>;
|
|
105
|
+
}
|
|
106
|
+
export interface CustomSecretProviderContext {
|
|
107
|
+
/** Alias used in `{{secret:<alias>/<path>}}`. */
|
|
108
|
+
alias: string;
|
|
109
|
+
/** The provider's `options` config, or an empty object. */
|
|
110
|
+
options: Record<string, unknown>;
|
|
111
|
+
}
|
|
112
|
+
export interface CustomSecretResolver {
|
|
113
|
+
/** Human-readable provider name; falls back to the configured alias. */
|
|
114
|
+
providerName?: string;
|
|
115
|
+
/** Resolve a secret path; return undefined when it does not exist. */
|
|
116
|
+
resolve(path: string): Promise<string | undefined>;
|
|
117
|
+
}
|
|
118
|
+
export type CustomSecretResolverFactory = (context: CustomSecretProviderContext) => CustomSecretResolver;
|
|
119
|
+
export type SecretProviderConfig = AwsSecretsConfig | AzureKeyVaultConfig | HashiCorpVaultConfig | OnePasswordConfig | GcpSecretsConfig | DopplerConfig | CustomSecretProviderConfig;
|
|
85
120
|
/**
|
|
86
121
|
* Top-level `secrets` block in http-forge.config.json
|
|
87
122
|
*/
|