norn-cli 1.6.1 → 1.6.2

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 (40) hide show
  1. package/AGENTS.md +9 -1
  2. package/CHANGELOG.md +12 -0
  3. package/dist/cli.js +161 -59
  4. package/package.json +1 -1
  5. package/out/assertionRunner.js +0 -537
  6. package/out/chatParticipant.js +0 -722
  7. package/out/cli/colors.js +0 -129
  8. package/out/cli/formatters/assertion.js +0 -75
  9. package/out/cli/formatters/index.js +0 -23
  10. package/out/cli/formatters/response.js +0 -106
  11. package/out/cli/formatters/summary.js +0 -187
  12. package/out/cli/redaction.js +0 -237
  13. package/out/cli/reporters/html.js +0 -634
  14. package/out/cli/reporters/index.js +0 -22
  15. package/out/cli/reporters/junit.js +0 -211
  16. package/out/cli.js +0 -989
  17. package/out/codeLensProvider.js +0 -248
  18. package/out/compareContentProvider.js +0 -85
  19. package/out/completionProvider.js +0 -2404
  20. package/out/contractDecorationProvider.js +0 -243
  21. package/out/coverageCalculator.js +0 -837
  22. package/out/coveragePanel.js +0 -545
  23. package/out/diagnosticProvider.js +0 -1113
  24. package/out/environmentProvider.js +0 -442
  25. package/out/extension.js +0 -1114
  26. package/out/httpClient.js +0 -269
  27. package/out/jsonFileReader.js +0 -320
  28. package/out/nornPrompt.js +0 -580
  29. package/out/nornapiParser.js +0 -326
  30. package/out/parser.js +0 -725
  31. package/out/responsePanel.js +0 -4674
  32. package/out/schemaGenerator.js +0 -393
  33. package/out/scriptRunner.js +0 -419
  34. package/out/sequenceRunner.js +0 -3046
  35. package/out/swaggerBodyIntellisenseCache.js +0 -147
  36. package/out/swaggerParser.js +0 -419
  37. package/out/test/coverageCalculator.test.js +0 -100
  38. package/out/test/extension.test.js +0 -48
  39. package/out/testProvider.js +0 -658
  40. package/out/validationCache.js +0 -245
@@ -1,237 +0,0 @@
1
- "use strict";
2
- /**
3
- * Redaction module for sensitive data in CLI output
4
- *
5
- * Automatically redacts:
6
- * - Authorization headers (Bearer tokens, Basic auth, API keys)
7
- * - Common sensitive field names (password, secret, token, api_key, etc.)
8
- * - User-defined secrets from .nornenv `secret` declarations
9
- */
10
- Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.createRedactionOptions = createRedactionOptions;
12
- exports.redactHeaders = redactHeaders;
13
- exports.redactString = redactString;
14
- exports.redactBody = redactBody;
15
- exports.redactUrl = redactUrl;
16
- exports.getRedactedMarker = getRedactedMarker;
17
- const REDACTED = '***REDACTED***';
18
- /**
19
- * Common header names that should always be redacted
20
- */
21
- const SENSITIVE_HEADERS = new Set([
22
- 'authorization',
23
- 'x-api-key',
24
- 'x-auth-token',
25
- 'x-access-token',
26
- 'api-key',
27
- 'apikey',
28
- 'cookie',
29
- 'set-cookie',
30
- 'x-csrf-token',
31
- 'x-xsrf-token',
32
- ]);
33
- /**
34
- * Patterns for sensitive values in headers/bodies
35
- * These patterns match common token/key formats
36
- */
37
- const SENSITIVE_PATTERNS = [
38
- // Bearer tokens
39
- /Bearer\s+[A-Za-z0-9\-_=]+\.?[A-Za-z0-9\-_=]*\.?[A-Za-z0-9\-_=]*/gi,
40
- // Basic auth
41
- /Basic\s+[A-Za-z0-9+/=]+/gi,
42
- // API keys (common formats)
43
- /api[_-]?key[=:]\s*["']?[A-Za-z0-9\-_]+["']?/gi,
44
- ];
45
- /**
46
- * Field names in JSON that should have their values redacted
47
- */
48
- const SENSITIVE_FIELD_NAMES = new Set([
49
- 'password',
50
- 'passwd',
51
- 'secret',
52
- 'token',
53
- 'access_token',
54
- 'accesstoken',
55
- 'refresh_token',
56
- 'refreshtoken',
57
- 'api_key',
58
- 'apikey',
59
- 'api-key',
60
- 'private_key',
61
- 'privatekey',
62
- 'client_secret',
63
- 'clientsecret',
64
- 'auth',
65
- 'authorization',
66
- 'credential',
67
- 'credentials',
68
- ]);
69
- /**
70
- * Create default redaction options
71
- */
72
- function createRedactionOptions(secretNames = new Set(), secretValues = new Map(), enabled = true) {
73
- return { secretNames, secretValues, enabled };
74
- }
75
- /**
76
- * Redact sensitive headers
77
- */
78
- function redactHeaders(headers, options) {
79
- if (!options.enabled) {
80
- return headers;
81
- }
82
- const redacted = {};
83
- for (const [key, value] of Object.entries(headers)) {
84
- const lowerKey = key.toLowerCase();
85
- // Check if header name is sensitive
86
- if (SENSITIVE_HEADERS.has(lowerKey)) {
87
- redacted[key] = REDACTED;
88
- continue;
89
- }
90
- // Check for Bearer/Basic patterns in value
91
- let redactedValue = value;
92
- for (const pattern of SENSITIVE_PATTERNS) {
93
- redactedValue = redactedValue.replace(pattern, REDACTED);
94
- }
95
- // Check if value matches any secret values
96
- redactedValue = redactSecretValues(redactedValue, options);
97
- redacted[key] = redactedValue;
98
- }
99
- return redacted;
100
- }
101
- /**
102
- * Redact sensitive values in a string
103
- */
104
- function redactString(text, options) {
105
- if (!options.enabled || !text) {
106
- return text;
107
- }
108
- let result = text;
109
- // Apply pattern-based redaction
110
- for (const pattern of SENSITIVE_PATTERNS) {
111
- result = result.replace(pattern, REDACTED);
112
- }
113
- // Redact user-defined secret values
114
- result = redactSecretValues(result, options);
115
- return result;
116
- }
117
- /**
118
- * Redact secret values from .nornenv
119
- */
120
- function redactSecretValues(text, options) {
121
- if (!text || options.secretValues.size === 0) {
122
- return text;
123
- }
124
- let result = text;
125
- // Replace each secret value with redacted marker
126
- for (const [, value] of options.secretValues) {
127
- if (value && value.length > 0) {
128
- // Escape special regex characters in the value
129
- const escaped = value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
130
- result = result.replace(new RegExp(escaped, 'g'), REDACTED);
131
- }
132
- }
133
- return result;
134
- }
135
- /**
136
- * Redact sensitive fields in JSON body
137
- */
138
- function redactBody(body, options) {
139
- if (!options.enabled) {
140
- return body;
141
- }
142
- if (typeof body === 'string') {
143
- // Try to parse as JSON first
144
- try {
145
- const parsed = JSON.parse(body);
146
- return JSON.stringify(redactObject(parsed, options), null, 2);
147
- }
148
- catch {
149
- // Not JSON, apply string redaction
150
- return redactString(body, options);
151
- }
152
- }
153
- if (typeof body === 'object' && body !== null) {
154
- return redactObject(body, options);
155
- }
156
- return body;
157
- }
158
- /**
159
- * Recursively redact sensitive fields in an object
160
- */
161
- function redactObject(obj, options) {
162
- if (Array.isArray(obj)) {
163
- return obj.map(item => redactObject(item, options));
164
- }
165
- if (typeof obj !== 'object' || obj === null) {
166
- if (typeof obj === 'string') {
167
- return redactSecretValues(obj, options);
168
- }
169
- return obj;
170
- }
171
- const result = {};
172
- for (const [key, value] of Object.entries(obj)) {
173
- const lowerKey = key.toLowerCase();
174
- // Check if field name indicates sensitive data
175
- if (SENSITIVE_FIELD_NAMES.has(lowerKey)) {
176
- result[key] = REDACTED;
177
- continue;
178
- }
179
- // Check if this is a user-defined secret variable name
180
- if (options.secretNames.has(key)) {
181
- result[key] = REDACTED;
182
- continue;
183
- }
184
- // Recursively process nested objects
185
- if (typeof value === 'object' && value !== null) {
186
- result[key] = redactObject(value, options);
187
- }
188
- else if (typeof value === 'string') {
189
- result[key] = redactSecretValues(value, options);
190
- }
191
- else {
192
- result[key] = value;
193
- }
194
- }
195
- return result;
196
- }
197
- /**
198
- * Redact a URL (query parameters with sensitive names)
199
- */
200
- function redactUrl(url, options) {
201
- if (!options.enabled) {
202
- return url;
203
- }
204
- try {
205
- const urlObj = new URL(url);
206
- const params = new URLSearchParams(urlObj.search);
207
- let modified = false;
208
- for (const [key] of params.entries()) {
209
- const lowerKey = key.toLowerCase();
210
- if (SENSITIVE_FIELD_NAMES.has(lowerKey) ||
211
- lowerKey.includes('token') ||
212
- lowerKey.includes('key') ||
213
- lowerKey.includes('secret') ||
214
- lowerKey.includes('password')) {
215
- params.set(key, REDACTED);
216
- modified = true;
217
- }
218
- }
219
- if (modified) {
220
- urlObj.search = params.toString();
221
- return urlObj.toString();
222
- }
223
- // Also redact secret values that appear in the URL
224
- return redactSecretValues(url, options);
225
- }
226
- catch {
227
- // If URL parsing fails, just do string-based redaction
228
- return redactSecretValues(url, options);
229
- }
230
- }
231
- /**
232
- * Get the redaction marker (for display purposes)
233
- */
234
- function getRedactedMarker() {
235
- return REDACTED;
236
- }
237
- //# sourceMappingURL=redaction.js.map