@http-forge/core 0.2.6 → 0.2.8
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 +54 -1
- package/dist/index.d.ts +10 -9
- package/dist/index.js +158 -157
- package/dist/index.mjs +158 -157
- package/dist/infrastructure/history/history-interfaces.d.ts +1 -0
- package/dist/infrastructure/script/request-script-session.d.ts +4 -0
- package/dist/infrastructure/security/sensitive-data-redactor.d.ts +43 -0
- package/dist/infrastructure/test-suite/result-storage-service.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
- 🔐 **CryptoJS** - Full crypto library: hash, HMAC, AES/DES/TripleDES, PBKDF2, encoding helpers
|
|
21
21
|
- 🎯 **Execution Flow** - `pm.setNextRequest()`, `pm.execution.skipRequest()` for suite runner flow control
|
|
22
22
|
- 📈 **Visualizer** - `pm.visualizer.set(template, data)` for custom Handlebars-based HTML output
|
|
23
|
-
-
|
|
23
|
+
- �️ **Sensitive Data Redaction** - Auto-redacts tokens, passwords, secrets from persisted history/result files
|
|
24
|
+
- �🔌 **Extensible** - Custom interceptors, HTTP clients, and module loaders
|
|
24
25
|
|
|
25
26
|
**Ideal for:**
|
|
26
27
|
- CI/CD pipeline integration (GitHub Actions, GitLab CI, Jenkins)
|
|
@@ -379,6 +380,47 @@ const entries = history.getAll(); // All requests
|
|
|
379
380
|
const byId = history.getByRequestId(id); // Specific request history
|
|
380
381
|
```
|
|
381
382
|
|
|
383
|
+
### 🛡️ Sensitive Data Redaction
|
|
384
|
+
|
|
385
|
+
History and result files automatically redact sensitive data before writing to disk. This prevents tokens, passwords, and credentials from being persisted in plaintext.
|
|
386
|
+
|
|
387
|
+
```typescript
|
|
388
|
+
import {
|
|
389
|
+
redactHeaders, redactUrl, redactBody,
|
|
390
|
+
redactHistoryEntry, redactFullResponse, redactFullResultDetails
|
|
391
|
+
} from '@http-forge/core';
|
|
392
|
+
|
|
393
|
+
// Redact sensitive headers
|
|
394
|
+
redactHeaders({ 'Authorization': 'Bearer eyJ...', 'Content-Type': 'application/json' });
|
|
395
|
+
// → { 'Authorization': '***', 'Content-Type': 'application/json' }
|
|
396
|
+
|
|
397
|
+
// Any header containing 'token', 'cookie', 'secret' is redacted
|
|
398
|
+
redactHeaders({ 'avs-token': 'abc123', 'telus-access-token-cookie': 'xyz' });
|
|
399
|
+
// → { 'avs-token': '***', 'telus-access-token-cookie': '***' }
|
|
400
|
+
|
|
401
|
+
// Redact sensitive URL query params
|
|
402
|
+
redactUrl('https://api.example.com/auth?client_secret=abc&scope=read');
|
|
403
|
+
// → 'https://api.example.com/auth?client_secret=***&scope=read'
|
|
404
|
+
|
|
405
|
+
// Redact sensitive JSON body fields (recursive)
|
|
406
|
+
redactBody({ user: 'admin', password: 'hunter2', data: { api_token: 'xyz' } });
|
|
407
|
+
// → { user: 'admin', password: '***', data: { api_token: '***' } }
|
|
408
|
+
|
|
409
|
+
// Redact URL-encoded form bodies
|
|
410
|
+
redactBody('username=admin&password=secret&grant_type=password');
|
|
411
|
+
// → 'username=admin&password=***&grant_type=***'
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
**Auto-detected patterns:**
|
|
415
|
+
- **Headers**: `authorization`, `proxy-authorization`, `www-authenticate`, and any header containing `token`, `cookie`, `secret`, `credential`, `api-key`, `bearer`, `session-id`
|
|
416
|
+
- **Fields/Params**: Any name containing `password`, `passwd`, `pwd`, `token`, `cookie`, `secret`, `credential`, `api_key`, `access_token`, `refresh_token`, `client_secret`, `private_key`, `auth_code`, `bearer`, `session_id`, `jwt`
|
|
417
|
+
|
|
418
|
+
**Integration points:**
|
|
419
|
+
- `RequestHistoryService.addEntry()` — redacts `sentRequest` (headers, body, URL) before saving
|
|
420
|
+
- `RequestHistoryService.saveFullResponse()` — redacts response headers and cookies
|
|
421
|
+
- `ResultStorageService.saveResult()` — redacts request/response headers and body in suite results
|
|
422
|
+
- `originalConfig` (unresolved `{{variable}}` templates) is never redacted — only resolved values
|
|
423
|
+
|
|
382
424
|
## 📖 API Reference
|
|
383
425
|
|
|
384
426
|
### ForgeContainer
|
|
@@ -753,6 +795,17 @@ MIT © Henry Huang
|
|
|
753
795
|
|
|
754
796
|
## 📝 Changelog
|
|
755
797
|
|
|
798
|
+
### 0.2.6 (Sensitive Data Redaction & Variable Propagation Fix)
|
|
799
|
+
|
|
800
|
+
- ✅ **Sensitive data redaction** — History files, shared history, suite test results, and full response files automatically redact sensitive data before persisting to disk:
|
|
801
|
+
- Headers matching `authorization`, `proxy-authorization`, or containing `token`, `cookie`, `secret`, `credential`, `api-key`, `bearer`, `session-id`
|
|
802
|
+
- URL query params and JSON/form body fields matching `password`, `token`, `secret`, `api_key`, `client_secret`, `private_key`, `auth_code`, `jwt`, etc.
|
|
803
|
+
- Response `Set-Cookie` headers and cookies with sensitive names
|
|
804
|
+
- Unresolved `{{variable}}` templates in `originalConfig` are preserved — only resolved values redacted
|
|
805
|
+
- Exported functions: `redactHeaders()`, `redactUrl()`, `redactBody()`, `redactHistoryEntry()`, `redactFullResponse()`, `redactFullResultDetails()`
|
|
806
|
+
- ✅ **Fixed `pm.environment.set()` propagation** — Post-response script `pm.environment.set()` now correctly propagates to `{{variable}}` resolution in subsequent collection runner requests. The session now uses live scope references instead of a disconnected snapshot.
|
|
807
|
+
- ✅ **Cookie jar flush in collection runner** — `flush()` is now called in the `finally` block ensuring script-set cookies persist to the shared session store after a run completes.
|
|
808
|
+
|
|
756
809
|
### 0.2.5 (OpenAPI Constraint Round-Trip & Collision Merging)
|
|
757
810
|
|
|
758
811
|
- ✅ **Full parameter constraint round-trip** — OpenAPI import/export now preserves all schema constraint fields: `pattern`, `minimum`, `maximum`, `exclusiveMinimum`, `exclusiveMaximum`, `minLength`, `maxLength`, and `oneOf` on both `KeyValueEntry` and `PathParamEntry`
|
package/dist/index.d.ts
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
*/
|
|
19
19
|
export { ForgeContainer } from './container';
|
|
20
20
|
export type { ForgeContainerOptions, StorageFormat } from './container';
|
|
21
|
-
export {
|
|
21
|
+
export { getServiceContainer, registerCoreServices, ServiceContainer, ServiceIdentifiers } from './di';
|
|
22
22
|
export type { PlatformAdapters, ServiceIdentifier } from './di';
|
|
23
23
|
export * from './types/console-service';
|
|
24
24
|
export * from './types/platform';
|
|
@@ -32,7 +32,7 @@ export { PersistentCookieJar } from './infrastructure/cookie/persistent-cookie-j
|
|
|
32
32
|
export { FetchHttpClient } from './infrastructure/http/fetch-http-client';
|
|
33
33
|
export { HttpRequestService } from './infrastructure/http/http-request-service';
|
|
34
34
|
export { InterceptorChain, LoggingRequestInterceptor, RetryErrorInterceptor, TimingResponseInterceptor } from './infrastructure/http/interceptor-chain';
|
|
35
|
-
export type { IErrorInterceptor, IInterceptorChain, IRequestInterceptor, IResponseInterceptor
|
|
35
|
+
export type { IErrorInterceptor, IInterceptorChain, InterceptorContext, IRequestInterceptor, IResponseInterceptor } from './infrastructure/http/interceptor-chain';
|
|
36
36
|
export type { IHttpRequestService } from './infrastructure/http/interfaces';
|
|
37
37
|
export { mergeRequestSettings } from './infrastructure/http/merge-request-settings';
|
|
38
38
|
export { DEFAULT_REQUEST_SETTINGS, NodeHttpClient } from './infrastructure/http/native-http-client';
|
|
@@ -41,7 +41,7 @@ export type { IRequestPreprocessor } from './infrastructure/http/request-preproc
|
|
|
41
41
|
export { UrlBuilder } from './infrastructure/http/url-builder';
|
|
42
42
|
export type { IUrlBuilder } from './infrastructure/http/url-builder';
|
|
43
43
|
export * from './infrastructure/script/interfaces';
|
|
44
|
-
export {
|
|
44
|
+
export { createLodashShim, createModuleLoader, createMomentShim, ModuleLoader } from './infrastructure/script/module-loader';
|
|
45
45
|
export type { ModuleLoaderOptions } from './infrastructure/script/module-loader';
|
|
46
46
|
export { RequestScriptSession } from './infrastructure/script/request-script-session';
|
|
47
47
|
export type { SessionDependencies } from './infrastructure/script/request-script-session';
|
|
@@ -50,6 +50,7 @@ export { createExpectChain, createResponseObject } from './infrastructure/script
|
|
|
50
50
|
export type { ExpectChain, ResponseAssertions, ScriptResponse } from './infrastructure/script/script-factories';
|
|
51
51
|
export { concatenateScripts, createScriptConsole, createTestFunction, formatConsoleOutput, hasChanged, normalizeHeaders } from './infrastructure/script/script-utils';
|
|
52
52
|
export type { ConsoleMessage } from './infrastructure/script/script-utils';
|
|
53
|
+
export { redactBody, redactFullResponse, redactFullResultDetails, redactHeaders, redactHistoryEntry, redactUrl } from './infrastructure/security/sensitive-data-redactor';
|
|
53
54
|
export { CollectionLoader } from './infrastructure/collection/collection-loader';
|
|
54
55
|
export type { LoadOptions } from './infrastructure/collection/collection-loader';
|
|
55
56
|
export { CollectionLoaderFactory } from './infrastructure/collection/collection-loader-factory';
|
|
@@ -59,8 +60,8 @@ export { FolderCollectionStore } from './infrastructure/collection/folder-collec
|
|
|
59
60
|
export * from './infrastructure/collection/folder-io';
|
|
60
61
|
export { generateSlug } from './infrastructure/collection/folder-io';
|
|
61
62
|
export { ParserRegistry } from './infrastructure/collection/parser-registry';
|
|
62
|
-
export type { Collection, ICollectionService } from './types/collection';
|
|
63
63
|
export { JsonCollectionLoader } from './infrastructure/collection/json-collection-loader';
|
|
64
|
+
export type { Collection, ICollectionService } from './types/collection';
|
|
64
65
|
export { EnvironmentConfigService } from './infrastructure/environment/environment-config-service';
|
|
65
66
|
export { isSystemEnvironmentFile, loadEnvironmentsFromFolder } from './infrastructure/environment/environment-file-loader';
|
|
66
67
|
export type { EnvironmentEntry, EnvironmentFolderData } from './infrastructure/environment/environment-file-loader';
|
|
@@ -68,9 +69,9 @@ export { EnvironmentResolver } from './infrastructure/environment/environment-re
|
|
|
68
69
|
export type { Environment, EnvironmentStoreConfig } from './infrastructure/environment/environment-resolver';
|
|
69
70
|
export { ForgeEnv } from './infrastructure/environment/forge-env';
|
|
70
71
|
export type { IForgeEnv } from './infrastructure/environment/forge-env';
|
|
71
|
-
export
|
|
72
|
-
export { VariableInterpolator, VariableResolver, createVariableResolver } from './infrastructure/environment/variable-interpolator';
|
|
72
|
+
export { createVariableResolver, VariableInterpolator, VariableResolver } from './infrastructure/environment/variable-interpolator';
|
|
73
73
|
export type { VariableResolverConfig } from './infrastructure/environment/variable-interpolator';
|
|
74
|
+
export type { IEnvironmentConfigService } from './types/environment-config';
|
|
74
75
|
export { CollectionRequestExecutor } from './infrastructure/execution/collection-request-executor';
|
|
75
76
|
export * from './infrastructure/execution/collection-request-executor-interfaces';
|
|
76
77
|
export { RequestExecutor } from './infrastructure/execution/request-executor';
|
|
@@ -94,8 +95,8 @@ export { CONFIG_FILES, ConfigService, DEFAULT_CONFIG, ROOT_DIRECTORIES } from '.
|
|
|
94
95
|
export type { EnvironmentsConfig, HttpForgeConfig, IConfigService, ProxyConfig, RequestConfig, RestClientExportConfig, RunnerConfig, ScriptsConfig, StorageConfig } from './infrastructure/config';
|
|
95
96
|
export { DEFAULT_SUITE_CONFIG } from './infrastructure/test-suite/interfaces';
|
|
96
97
|
export type { ErrorSummary, IStatisticsService, ITestSuiteService, RequestStatistics, RunStatistics, RunSummary, SuiteConfig, SuiteRequest, TestSuite } from './infrastructure/test-suite/interfaces';
|
|
97
|
-
export {
|
|
98
|
-
export type { FullResultDetails,
|
|
98
|
+
export { buildResultFileName, expandSummary, HTTP_METHOD_MAP, HTTP_METHOD_REVERSE } from './infrastructure/test-suite/result-storage';
|
|
99
|
+
export type { FullResultDetails, IndexPage, IResultStorageService, RecentError, RequestStats, ResultSummary, RunConfig, RunManifest, RunStats } from './infrastructure/test-suite/result-storage';
|
|
99
100
|
export { ResultStorageService } from './infrastructure/test-suite/result-storage-service';
|
|
100
101
|
export { StatisticsService } from './infrastructure/test-suite/statistics-service';
|
|
101
102
|
export { TestSuiteService } from './infrastructure/test-suite/test-suite-service';
|
|
@@ -109,7 +110,7 @@ export { exportCollectionToRestClient, getRestClientExportFolder, writeEnvFile,
|
|
|
109
110
|
export { DataFileParser } from './infrastructure/platform/data-file-parser';
|
|
110
111
|
export type { IDataFileParser } from './infrastructure/platform/data-file-parser';
|
|
111
112
|
export { NodeFileSystem } from './infrastructure/platform/node-file-system';
|
|
112
|
-
export {
|
|
113
|
+
export { augmentWithDynamicVars, DYNAMIC_VARIABLES, resolveDynamicVariable, resolveDynamicVariablesInString } from './utils/dynamic-variables';
|
|
113
114
|
export { evaluateExpression, isExpression } from './utils/expression-evaluator';
|
|
114
115
|
export { applyFilterChain, parseFilterChain } from './utils/filter-engine';
|
|
115
116
|
export { deepClone, formatBytes, formatDuration, generateId, generateUUID, isPlainObject, mergeHeadersCaseInsensitive, safeJsonParse, sanitizeName } from './utils/helpers';
|