@http-forge/core 0.3.3 → 0.4.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 +2 -1
- package/dist/di/service-identifiers.d.ts +1 -0
- package/dist/index.d.ts +9 -1
- package/dist/index.js +169 -169
- package/dist/index.mjs +170 -170
- package/dist/infrastructure/config/config.interface.d.ts +32 -0
- package/dist/infrastructure/environment/environment-config-service.d.ts +26 -2
- package/dist/infrastructure/environment/environment-file-loader.d.ts +5 -0
- package/dist/infrastructure/execution/request-preparer.d.ts +3 -1
- package/dist/infrastructure/secrets/aws-secret-resolver.d.ts +18 -0
- package/dist/infrastructure/secrets/azure-keyvault-resolver.d.ts +20 -0
- package/dist/infrastructure/secrets/doppler-resolver.d.ts +22 -0
- package/dist/infrastructure/secrets/gcp-secret-resolver.d.ts +21 -0
- package/dist/infrastructure/secrets/hashicorp-vault-resolver.d.ts +25 -0
- package/dist/infrastructure/secrets/onepassword-resolver.d.ts +26 -0
- package/dist/infrastructure/secrets/secret-resolver-registry.d.ts +43 -0
- package/dist/types/environment-config.d.ts +13 -0
- package/dist/types/secret-resolver.d.ts +106 -0
- package/package.json +13 -1
|
@@ -110,6 +110,36 @@ export interface ProxyConfig {
|
|
|
110
110
|
/** List of hosts to bypass proxy */
|
|
111
111
|
bypass?: string[];
|
|
112
112
|
}
|
|
113
|
+
/**
|
|
114
|
+
* Cloud secret provider configuration (used in SecretsConfig.providers)
|
|
115
|
+
*/
|
|
116
|
+
export interface SecretProviderEntry {
|
|
117
|
+
/** Provider type */
|
|
118
|
+
provider: 'aws' | 'azure' | 'gcp' | 'vault' | '1password' | 'doppler';
|
|
119
|
+
/** AWS region (aws only) */
|
|
120
|
+
region?: string;
|
|
121
|
+
/** Azure Key Vault URL (azure only) */
|
|
122
|
+
vaultUrl?: string;
|
|
123
|
+
/** GCP project ID (gcp only) */
|
|
124
|
+
projectId?: string;
|
|
125
|
+
/** Vault server address (vault only) */
|
|
126
|
+
address?: string;
|
|
127
|
+
/** Vault mount path (vault only, default "secret") */
|
|
128
|
+
mountPath?: string;
|
|
129
|
+
/** Vault namespace (vault only, Enterprise/HCP) */
|
|
130
|
+
namespace?: string;
|
|
131
|
+
/** 1Password vault name (1password only) */
|
|
132
|
+
vault?: string;
|
|
133
|
+
/** Doppler service token (doppler only; falls back to DOPPLER_TOKEN env var) */
|
|
134
|
+
serviceToken?: string;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Top-level secrets block in http-forge.config.json
|
|
138
|
+
* Configures named cloud secret providers for {{secret:alias/path}} tokens.
|
|
139
|
+
*/
|
|
140
|
+
export interface SecretsConfig {
|
|
141
|
+
providers: Record<string, SecretProviderEntry>;
|
|
142
|
+
}
|
|
113
143
|
/**
|
|
114
144
|
* Main HTTP Forge configuration (http-forge.config.json)
|
|
115
145
|
*/
|
|
@@ -132,6 +162,8 @@ export interface HttpForgeConfig {
|
|
|
132
162
|
mcp?: McpConfig;
|
|
133
163
|
/** Proxy configuration (optional) */
|
|
134
164
|
proxy?: ProxyConfig | null;
|
|
165
|
+
/** Cloud secret provider configuration (optional) */
|
|
166
|
+
secrets?: SecretsConfig;
|
|
135
167
|
}
|
|
136
168
|
/**
|
|
137
169
|
* Configuration service interface
|
|
@@ -5,13 +5,14 @@
|
|
|
5
5
|
* VS Code's workspaceState/globalState.
|
|
6
6
|
*/
|
|
7
7
|
import type { IEnvironmentConfigService, ImportedEnvironment, LocalConfig, ResolvedEnvironment, SharedConfig } from '../../types/environment-config';
|
|
8
|
-
import { IFileWatcherFactory, IKeyValueStore } from '../../types/platform';
|
|
8
|
+
import { IFileWatcherFactory, IKeyValueStore, ISecretStore } from '../../types/platform';
|
|
9
9
|
import { IConfigService } from '../config';
|
|
10
10
|
export declare class EnvironmentConfigService implements IEnvironmentConfigService {
|
|
11
11
|
private workspaceFolder;
|
|
12
12
|
private workspaceStore;
|
|
13
13
|
private configService;
|
|
14
14
|
private fileWatcherFactory?;
|
|
15
|
+
private secretStore?;
|
|
15
16
|
private environmentsPath;
|
|
16
17
|
private sharedConfigPath;
|
|
17
18
|
private localConfigPath;
|
|
@@ -27,12 +28,14 @@ export declare class EnvironmentConfigService implements IEnvironmentConfigServi
|
|
|
27
28
|
*/
|
|
28
29
|
private localGlobalValues;
|
|
29
30
|
private localEnvironmentValues;
|
|
31
|
+
/** In-memory cache of secret values fetched from SecretStorage — keyed by envName */
|
|
32
|
+
private secretValuesCache;
|
|
30
33
|
/**
|
|
31
34
|
* Callback invoked when environment files change on disk.
|
|
32
35
|
* Set by the extension host to refresh tree views and panels.
|
|
33
36
|
*/
|
|
34
37
|
onEnvironmentsChanged?: () => void;
|
|
35
|
-
constructor(workspaceFolder: string, workspaceStore: IKeyValueStore, configService: IConfigService, fileWatcherFactory?: IFileWatcherFactory | undefined);
|
|
38
|
+
constructor(workspaceFolder: string, workspaceStore: IKeyValueStore, configService: IConfigService, fileWatcherFactory?: IFileWatcherFactory | undefined, secretStore?: ISecretStore | undefined);
|
|
36
39
|
private setupFileWatcher;
|
|
37
40
|
dispose(): void;
|
|
38
41
|
getWorkspaceFolder(): string;
|
|
@@ -83,6 +86,27 @@ export declare class EnvironmentConfigService implements IEnvironmentConfigServi
|
|
|
83
86
|
/** @deprecated Use getEnvironmentVariableLocal instead */
|
|
84
87
|
hasSessionVariable(key: string): boolean;
|
|
85
88
|
getResolvedEnvironment(envName?: string): ResolvedEnvironment | null;
|
|
89
|
+
/**
|
|
90
|
+
* Retrieve a secret variable value from SecretStorage.
|
|
91
|
+
* Returns undefined when no SecretStorage is available (e.g. CLI context).
|
|
92
|
+
*/
|
|
93
|
+
getSecretVariable(envName: string, key: string): Promise<string | undefined>;
|
|
94
|
+
/**
|
|
95
|
+
* Store a secret variable value in SecretStorage.
|
|
96
|
+
* No-op when no SecretStorage is available (e.g. CLI context).
|
|
97
|
+
*/
|
|
98
|
+
setSecretVariable(envName: string, key: string, value: string): Promise<void>;
|
|
99
|
+
/**
|
|
100
|
+
* Delete a secret variable from SecretStorage.
|
|
101
|
+
* No-op when no SecretStorage is available (e.g. CLI context).
|
|
102
|
+
*/
|
|
103
|
+
deleteSecretVariable(envName: string, key: string): Promise<void>;
|
|
104
|
+
/**
|
|
105
|
+
* Pre-load all secret values for an environment into the in-memory cache.
|
|
106
|
+
* Call this when switching environments or on extension activation so that
|
|
107
|
+
* the synchronous getResolvedEnvironment() always has secret values available.
|
|
108
|
+
*/
|
|
109
|
+
loadSecretVariables(envName?: string): Promise<void>;
|
|
86
110
|
resolveVariables(input: string, envName?: string): string;
|
|
87
111
|
exportEnvironmentsToFolder(outDir: string, mergeGlobals?: boolean): void;
|
|
88
112
|
resolveVariablesWithExtra(input: string, extraVariables: Record<string, string>, envName?: string): string;
|
|
@@ -28,6 +28,11 @@ export interface EnvironmentEntry {
|
|
|
28
28
|
description?: string;
|
|
29
29
|
requiresConfirmation?: boolean;
|
|
30
30
|
variables: Record<string, string>;
|
|
31
|
+
/**
|
|
32
|
+
* Names of variables whose values are stored in SecretStorage, not in the JSON file.
|
|
33
|
+
* These names are persisted in the JSON; the values are never written to disk.
|
|
34
|
+
*/
|
|
35
|
+
secretVariables?: string[];
|
|
31
36
|
}
|
|
32
37
|
/**
|
|
33
38
|
* Determine whether a filename is a system/meta file (not an environment file).
|
|
@@ -15,6 +15,7 @@ import { ExecutionRequest, PreparedRequest } from '../../types/types';
|
|
|
15
15
|
import { IOAuth2TokenManager } from '../auth/interfaces';
|
|
16
16
|
import { IHttpRequestService } from '../http/interfaces';
|
|
17
17
|
import { IRequestPreprocessor } from '../http/request-preprocessor';
|
|
18
|
+
import { SecretResolverRegistry } from '../secrets/secret-resolver-registry';
|
|
18
19
|
import { IRequestPreparer } from './request-preparer-interfaces';
|
|
19
20
|
/**
|
|
20
21
|
* RequestPreparer implementation
|
|
@@ -28,7 +29,8 @@ export declare class RequestPreparer implements IRequestPreparer {
|
|
|
28
29
|
private readonly preprocessor;
|
|
29
30
|
private readonly tokenManager?;
|
|
30
31
|
private readonly appInfo?;
|
|
31
|
-
|
|
32
|
+
private readonly secretRegistry?;
|
|
33
|
+
constructor(envConfigService: IEnvironmentConfigService, httpService: IHttpRequestService, preprocessor: IRequestPreprocessor, tokenManager?: IOAuth2TokenManager | undefined, appInfo?: IApplicationInfo | undefined, secretRegistry?: SecretResolverRegistry | undefined);
|
|
32
34
|
prepareRequest(input: ExecutionRequest, environment: string, resolvedEnv: ResolvedEnvironment, extraVariables?: Record<string, string>): Promise<PreparedRequest>;
|
|
33
35
|
private applyOAuth2;
|
|
34
36
|
private applyApiKey;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AWS Secrets Manager resolver
|
|
3
|
+
*
|
|
4
|
+
* Uses the AWS SDK v3 credential chain — no credentials are stored in HTTP Forge config.
|
|
5
|
+
* Order: env vars → ~/.aws/credentials → IAM instance role → ECS task role
|
|
6
|
+
*
|
|
7
|
+
* Token syntax: {{secret:aws/<secretId>}}
|
|
8
|
+
* e.g. {{secret:aws/myapp/prod/db-password}}
|
|
9
|
+
* {{secret:aws/myapp/prod/api-key#field}} (JSON secret field)
|
|
10
|
+
*/
|
|
11
|
+
import type { AwsSecretsConfig, ISecretResolver } from '../../types/secret-resolver';
|
|
12
|
+
export declare class AwsSecretResolver implements ISecretResolver {
|
|
13
|
+
readonly providerName = "aws";
|
|
14
|
+
private readonly region;
|
|
15
|
+
private readonly moduleRequire;
|
|
16
|
+
constructor(config: AwsSecretsConfig, moduleRequire?: (name: string) => any);
|
|
17
|
+
resolve(path: string): Promise<string | undefined>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Azure Key Vault resolver
|
|
3
|
+
*
|
|
4
|
+
* Uses DefaultAzureCredential — no credentials stored in HTTP Forge config.
|
|
5
|
+
* Order: env vars (AZURE_*) → managed identity → Azure CLI login → VS Code login
|
|
6
|
+
*
|
|
7
|
+
* Token syntax: {{secret:azure/<secretName>}}
|
|
8
|
+
* e.g. {{secret:azure/my-api-key}}
|
|
9
|
+
* {{secret:azure/my-api-key/1.0}} (specific version)
|
|
10
|
+
*
|
|
11
|
+
* Config requires vaultUrl, e.g. "https://myvault.vault.azure.net"
|
|
12
|
+
*/
|
|
13
|
+
import type { AzureKeyVaultConfig, ISecretResolver } from '../../types/secret-resolver';
|
|
14
|
+
export declare class AzureKeyVaultResolver implements ISecretResolver {
|
|
15
|
+
readonly providerName = "azure";
|
|
16
|
+
private readonly vaultUrl;
|
|
17
|
+
private readonly moduleRequire;
|
|
18
|
+
constructor(config: AzureKeyVaultConfig, moduleRequire?: (name: string) => any);
|
|
19
|
+
resolve(path: string): Promise<string | undefined>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Doppler secret resolver
|
|
3
|
+
*
|
|
4
|
+
* Uses the Doppler REST API — no SDK required, just a service token.
|
|
5
|
+
* Credentials: DOPPLER_TOKEN env var (or serviceToken in config for per-project override)
|
|
6
|
+
*
|
|
7
|
+
* Token syntax: {{secret:doppler/<secretName>}}
|
|
8
|
+
* e.g. {{secret:doppler/API_KEY}}
|
|
9
|
+
* {{secret:doppler/DATABASE_URL}}
|
|
10
|
+
*
|
|
11
|
+
* The Doppler project/config are baked into the service token itself —
|
|
12
|
+
* no project or config fields needed in http-forge.config.json.
|
|
13
|
+
*
|
|
14
|
+
* Prerequisites: none (uses Node.js built-in https)
|
|
15
|
+
*/
|
|
16
|
+
import type { DopplerConfig, ISecretResolver } from '../../types/secret-resolver';
|
|
17
|
+
export declare class DopplerResolver implements ISecretResolver {
|
|
18
|
+
readonly providerName = "doppler";
|
|
19
|
+
private readonly token;
|
|
20
|
+
constructor(config: DopplerConfig);
|
|
21
|
+
resolve(path: string): Promise<string | undefined>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Google Cloud Secret Manager resolver
|
|
3
|
+
*
|
|
4
|
+
* Uses Application Default Credentials — no credentials stored in HTTP Forge config.
|
|
5
|
+
* Order: GOOGLE_APPLICATION_CREDENTIALS env var → gcloud CLI login → Workload Identity (GKE)
|
|
6
|
+
* → Metadata server (Cloud Run, Compute Engine)
|
|
7
|
+
*
|
|
8
|
+
* Token syntax: {{secret:gcp/<secretName>}}
|
|
9
|
+
* {{secret:gcp/<secretName>/versions/<version>}} (specific version, default: latest)
|
|
10
|
+
*
|
|
11
|
+
* Config: { "provider": "gcp", "projectId": "my-project" }
|
|
12
|
+
* projectId falls back to GOOGLE_CLOUD_PROJECT / GCLOUD_PROJECT env vars.
|
|
13
|
+
*/
|
|
14
|
+
import type { GcpSecretsConfig, ISecretResolver } from '../../types/secret-resolver';
|
|
15
|
+
export declare class GcpSecretResolver implements ISecretResolver {
|
|
16
|
+
readonly providerName = "gcp";
|
|
17
|
+
private readonly projectId;
|
|
18
|
+
private readonly moduleRequire;
|
|
19
|
+
constructor(config: GcpSecretsConfig, moduleRequire?: (name: string) => any);
|
|
20
|
+
resolve(path: string): Promise<string | undefined>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HashiCorp Vault resolver
|
|
3
|
+
*
|
|
4
|
+
* Credentials are NEVER stored in HTTP Forge config.
|
|
5
|
+
* Authentication uses:
|
|
6
|
+
* VAULT_TOKEN env var (token auth)
|
|
7
|
+
* VAULT_ADDR env var (server address, overrides config)
|
|
8
|
+
* VAULT_NAMESPACE env var (Enterprise/HCP namespace, overridden by config.namespace)
|
|
9
|
+
*
|
|
10
|
+
* Token syntax: {{secret:vault/<mountPath>/<secretPath>#<field>}}
|
|
11
|
+
* e.g. {{secret:vault/secret/myapp/prod#db_password}}
|
|
12
|
+
* {{secret:vault/kv/myapp/config#api_key}}
|
|
13
|
+
*
|
|
14
|
+
* The path format after the provider prefix: <mount>/<path>#<field>
|
|
15
|
+
* If no field is specified and the secret has a single key "value", that is returned.
|
|
16
|
+
*/
|
|
17
|
+
import type { HashiCorpVaultConfig, ISecretResolver } from '../../types/secret-resolver';
|
|
18
|
+
export declare class HashiCorpVaultResolver implements ISecretResolver {
|
|
19
|
+
readonly providerName = "vault";
|
|
20
|
+
private readonly address;
|
|
21
|
+
private readonly mountPath;
|
|
22
|
+
private readonly namespace;
|
|
23
|
+
constructor(config: HashiCorpVaultConfig);
|
|
24
|
+
resolve(path: string): Promise<string | undefined>;
|
|
25
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 1Password Connect / Service Account resolver
|
|
3
|
+
*
|
|
4
|
+
* Credentials are NEVER stored in HTTP Forge config.
|
|
5
|
+
* Authentication uses:
|
|
6
|
+
* OP_SERVICE_ACCOUNT_TOKEN env var (1Password Service Account — recommended for CI)
|
|
7
|
+
* OP_CONNECT_TOKEN + OP_CONNECT_HOST env vars (1Password Connect Server)
|
|
8
|
+
*
|
|
9
|
+
* Token syntax: {{secret:1password/<vault>/<item>/<field>}}
|
|
10
|
+
* e.g. {{secret:1password/MyVault/MyApp/api_key}}
|
|
11
|
+
* {{secret:1password/Shared/prod-db/password}}
|
|
12
|
+
*
|
|
13
|
+
* If `vault` is specified in the provider config, the token path may omit it:
|
|
14
|
+
* {{secret:1password/<item>/<field>}}
|
|
15
|
+
*
|
|
16
|
+
* Uses the 1Password CLI (`op`) via child_process if SDK is unavailable.
|
|
17
|
+
*/
|
|
18
|
+
import type { ISecretResolver, OnePasswordConfig } from '../../types/secret-resolver';
|
|
19
|
+
export declare class OnePasswordResolver implements ISecretResolver {
|
|
20
|
+
readonly providerName = "1password";
|
|
21
|
+
private readonly defaultVault;
|
|
22
|
+
constructor(config: OnePasswordConfig);
|
|
23
|
+
resolve(path: string): Promise<string | undefined>;
|
|
24
|
+
private tryResolveSdk;
|
|
25
|
+
private resolveViaCli;
|
|
26
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Secret Resolver Registry — Phase 3
|
|
3
|
+
*
|
|
4
|
+
* Builds and caches ISecretResolver instances from config, and provides
|
|
5
|
+
* async pre-resolution of {{secret:provider/path}} tokens in template strings.
|
|
6
|
+
*
|
|
7
|
+
* Design:
|
|
8
|
+
* - Registry is created once at startup from IConfigService
|
|
9
|
+
* - resolveSecretTokens() is called BEFORE variable interpolation per-request
|
|
10
|
+
* - Resolved values are injected as extraVariables so the sync VariableResolver
|
|
11
|
+
* picks them up transparently
|
|
12
|
+
* - Results are cached within a single request lifetime to avoid redundant API calls
|
|
13
|
+
*/
|
|
14
|
+
import type { IConfigService } from '../config/config.interface';
|
|
15
|
+
export declare class SecretResolverRegistry {
|
|
16
|
+
private readonly resolvers;
|
|
17
|
+
/**
|
|
18
|
+
* Require function rooted at the user's project (via config `scripts.modulePaths`),
|
|
19
|
+
* so optional cloud SDKs resolve from the same place users install custom script
|
|
20
|
+
* modules — not from the extension's own bundle.
|
|
21
|
+
*/
|
|
22
|
+
private readonly moduleRequire;
|
|
23
|
+
constructor(configService?: IConfigService);
|
|
24
|
+
/**
|
|
25
|
+
* Scan a string (or recursively, any object) for {{secret:alias/path}} tokens
|
|
26
|
+
* and resolve them all in parallel.
|
|
27
|
+
*
|
|
28
|
+
* Returns a flat map of "secret:alias/path" → plaintext value
|
|
29
|
+
* suitable for injection as extraVariables into VariableResolver.
|
|
30
|
+
*/
|
|
31
|
+
resolveSecretTokens(input: any, cache?: Map<string, string>): Promise<Record<string, string>>;
|
|
32
|
+
/** Whether any providers are configured */
|
|
33
|
+
get hasProviders(): boolean;
|
|
34
|
+
private collectTokens;
|
|
35
|
+
private createResolver;
|
|
36
|
+
/**
|
|
37
|
+
* Build a `require` function rooted at the user's project, so optional cloud SDKs
|
|
38
|
+
* resolve from the same `node_modules` where users install custom script modules
|
|
39
|
+
* (via config `scripts.modulePaths`). Falls back to the default `require` so the
|
|
40
|
+
* CLI (which lists SDKs in optionalDependencies) still works without modulePaths.
|
|
41
|
+
*/
|
|
42
|
+
private buildModuleRequire;
|
|
43
|
+
}
|
|
@@ -11,6 +11,11 @@ export interface EnvironmentConfig {
|
|
|
11
11
|
description?: string;
|
|
12
12
|
requiresConfirmation?: boolean;
|
|
13
13
|
variables?: Record<string, string>;
|
|
14
|
+
/**
|
|
15
|
+
* Names of variables whose values are stored in SecretStorage rather than the JSON file.
|
|
16
|
+
* The JSON file stores the variable name only; the value is fetched at resolution time.
|
|
17
|
+
*/
|
|
18
|
+
secretVariables?: string[];
|
|
14
19
|
}
|
|
15
20
|
/**
|
|
16
21
|
* Shared configuration file structure
|
|
@@ -115,6 +120,14 @@ export interface IVariableManager {
|
|
|
115
120
|
export interface IEnvironmentConfigService extends IEnvironmentConfigReader, IEnvironmentConfigWriter, IEnvironmentSelector, IVariableResolver, IVariableManager {
|
|
116
121
|
loadConfigs(): void;
|
|
117
122
|
exportEnvironmentsToFolder(outDir: string, mergeGlobals?: boolean): void;
|
|
123
|
+
/** Read a single secret variable from SecretStorage. */
|
|
124
|
+
getSecretVariable(envName: string, key: string): Promise<string | undefined>;
|
|
125
|
+
/** Store a secret variable value in SecretStorage. */
|
|
126
|
+
setSecretVariable(envName: string, key: string, value: string): Promise<void>;
|
|
127
|
+
/** Delete a secret variable from SecretStorage. */
|
|
128
|
+
deleteSecretVariable(envName: string, key: string): Promise<void>;
|
|
129
|
+
/** Load all secrets for an environment (or current) into cache. */
|
|
130
|
+
loadSecretVariables(envName?: string): Promise<void>;
|
|
118
131
|
}
|
|
119
132
|
/**
|
|
120
133
|
* Interface for storing and retrieving environment variables
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cloud Secret Resolver — Phase 3
|
|
3
|
+
*
|
|
4
|
+
* Defines the ISecretResolver abstraction and the per-provider configuration
|
|
5
|
+
* types used in http-forge.config.json under the `secrets` key.
|
|
6
|
+
*
|
|
7
|
+
* Token syntax resolved by this interface: {{secret:provider/path}}
|
|
8
|
+
* e.g. {{secret:aws/myapp/prod/db-password}}
|
|
9
|
+
* {{secret:azure/https://myvault.vault.azure.net/secrets/apiKey}}
|
|
10
|
+
* {{secret:vault/secret/data/myapp#password}}
|
|
11
|
+
* {{secret:1password/MyVault/MyItem/password}}
|
|
12
|
+
*
|
|
13
|
+
* Credentials are NEVER stored in HTTP Forge config.
|
|
14
|
+
* Each provider uses its SDK's default credential chain:
|
|
15
|
+
* - AWS → SDK credential chain (env vars / ~/.aws / IAM role)
|
|
16
|
+
* - Azure → DefaultAzureCredential (env / managed identity / CLI login)
|
|
17
|
+
* - Vault → VAULT_TOKEN / VAULT_ADDR env vars
|
|
18
|
+
* - 1Password → OP_SERVICE_ACCOUNT_TOKEN env var
|
|
19
|
+
*/
|
|
20
|
+
export interface ISecretResolver {
|
|
21
|
+
/**
|
|
22
|
+
* Resolve a secret by its provider-relative path.
|
|
23
|
+
* @param path The path after the provider prefix, e.g. "myapp/prod/apiKey"
|
|
24
|
+
* @returns The plaintext secret value, or undefined if not found
|
|
25
|
+
*/
|
|
26
|
+
resolve(path: string): Promise<string | undefined>;
|
|
27
|
+
/**
|
|
28
|
+
* Human-readable provider name, e.g. "aws", "azure", "vault", "1password"
|
|
29
|
+
*/
|
|
30
|
+
readonly providerName: string;
|
|
31
|
+
}
|
|
32
|
+
export interface AwsSecretsConfig {
|
|
33
|
+
provider: 'aws';
|
|
34
|
+
/** AWS region, e.g. "us-east-1". Falls back to AWS_DEFAULT_REGION env var. */
|
|
35
|
+
region?: string;
|
|
36
|
+
}
|
|
37
|
+
export interface AzureKeyVaultConfig {
|
|
38
|
+
provider: 'azure';
|
|
39
|
+
/**
|
|
40
|
+
* Key Vault URL, e.g. "https://myvault.vault.azure.net"
|
|
41
|
+
* The path portion of the token is used as the secret name.
|
|
42
|
+
*/
|
|
43
|
+
vaultUrl: string;
|
|
44
|
+
}
|
|
45
|
+
export interface HashiCorpVaultConfig {
|
|
46
|
+
provider: 'vault';
|
|
47
|
+
/**
|
|
48
|
+
* Vault server address, e.g. "https://vault.example.com:8200"
|
|
49
|
+
* Falls back to VAULT_ADDR env var.
|
|
50
|
+
*/
|
|
51
|
+
address?: string;
|
|
52
|
+
/** Mount path prefix, e.g. "secret". Defaults to "secret". */
|
|
53
|
+
mountPath?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Vault namespace (Enterprise / HCP Vault), e.g. "admin" or "admin/team-a".
|
|
56
|
+
* Sent as the X-Vault-Namespace header. Falls back to VAULT_NAMESPACE env var.
|
|
57
|
+
*/
|
|
58
|
+
namespace?: string;
|
|
59
|
+
}
|
|
60
|
+
export interface OnePasswordConfig {
|
|
61
|
+
provider: '1password';
|
|
62
|
+
/**
|
|
63
|
+
* Vault name to search, e.g. "MyVault".
|
|
64
|
+
* If omitted, the path is expected to include vault/item/field.
|
|
65
|
+
*/
|
|
66
|
+
vault?: string;
|
|
67
|
+
}
|
|
68
|
+
export interface GcpSecretsConfig {
|
|
69
|
+
provider: 'gcp';
|
|
70
|
+
/**
|
|
71
|
+
* GCP project ID, e.g. "my-project-123".
|
|
72
|
+
* Falls back to GOOGLE_CLOUD_PROJECT / GCLOUD_PROJECT env vars.
|
|
73
|
+
*/
|
|
74
|
+
projectId?: string;
|
|
75
|
+
}
|
|
76
|
+
export interface DopplerConfig {
|
|
77
|
+
provider: 'doppler';
|
|
78
|
+
/**
|
|
79
|
+
* Doppler service token. Falls back to DOPPLER_TOKEN env var.
|
|
80
|
+
* The project/config are baked into the service token itself.
|
|
81
|
+
*/
|
|
82
|
+
serviceToken?: string;
|
|
83
|
+
}
|
|
84
|
+
export type SecretProviderConfig = AwsSecretsConfig | AzureKeyVaultConfig | HashiCorpVaultConfig | OnePasswordConfig | GcpSecretsConfig | DopplerConfig;
|
|
85
|
+
/**
|
|
86
|
+
* Top-level `secrets` block in http-forge.config.json
|
|
87
|
+
*/
|
|
88
|
+
export interface SecretsConfig {
|
|
89
|
+
/**
|
|
90
|
+
* Named provider configs. Keys are provider aliases used in the token:
|
|
91
|
+
* {{secret:<alias>/<path>}}
|
|
92
|
+
*
|
|
93
|
+
* Example:
|
|
94
|
+
* ```json
|
|
95
|
+
* {
|
|
96
|
+
* "secrets": {
|
|
97
|
+
* "providers": {
|
|
98
|
+
* "aws": { "provider": "aws", "region": "us-east-1" },
|
|
99
|
+
* "vault": { "provider": "vault", "address": "https://vault.example.com" }
|
|
100
|
+
* }
|
|
101
|
+
* }
|
|
102
|
+
* }
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
105
|
+
providers: Record<string, SecretProviderConfig>;
|
|
106
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@http-forge/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Headless HTTP testing engine with Postman collection support, dynamic variables, and script-based automation.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -59,6 +59,18 @@
|
|
|
59
59
|
"uuid": "^14.0.0",
|
|
60
60
|
"yaml": "^2.7.0"
|
|
61
61
|
},
|
|
62
|
+
"peerDependencies": {
|
|
63
|
+
"@aws-sdk/client-secrets-manager": ">=3.0.0",
|
|
64
|
+
"@azure/keyvault-secrets": ">=4.0.0",
|
|
65
|
+
"@azure/identity": ">=3.0.0",
|
|
66
|
+
"node-vault": ">=0.9.0"
|
|
67
|
+
},
|
|
68
|
+
"peerDependenciesMeta": {
|
|
69
|
+
"@aws-sdk/client-secrets-manager": { "optional": true },
|
|
70
|
+
"@azure/keyvault-secrets": { "optional": true },
|
|
71
|
+
"@azure/identity": { "optional": true },
|
|
72
|
+
"node-vault": { "optional": true }
|
|
73
|
+
},
|
|
62
74
|
"devDependencies": {
|
|
63
75
|
"@types/lodash": "^4.14.202",
|
|
64
76
|
"@types/node": "^20.10.0",
|