@contrast/agent-bundle 5.41.0 → 5.42.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 (43) hide show
  1. package/node_modules/@contrast/agent/package.json +5 -4
  2. package/node_modules/@contrast/agentify/package.json +2 -2
  3. package/node_modules/@contrast/assess/package.json +2 -2
  4. package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/traces/index.d.ts +11 -11
  5. package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/traces/index.js +76 -86
  6. package/node_modules/@contrast/reporter/package.json +1 -1
  7. package/node_modules/@contrast/route-coverage/lib/install/hapi.js +9 -2
  8. package/node_modules/@contrast/route-coverage/package.json +1 -1
  9. package/node_modules/@swc/types/index.d.ts +3 -2
  10. package/node_modules/@swc/types/package.json +1 -1
  11. package/node_modules/@types/node/README.md +1 -1
  12. package/node_modules/@types/node/crypto.d.ts +17 -1
  13. package/node_modules/@types/node/fs/promises.d.ts +7 -3
  14. package/node_modules/@types/node/fs.d.ts +0 -2
  15. package/node_modules/@types/node/http2.d.ts +13 -11
  16. package/node_modules/@types/node/inspector.d.ts +110 -6
  17. package/node_modules/@types/node/module.d.ts +24 -0
  18. package/node_modules/@types/node/package.json +4 -9
  19. package/node_modules/@types/node/perf_hooks.d.ts +14 -0
  20. package/node_modules/@types/node/repl.d.ts +11 -1
  21. package/node_modules/@types/node/sqlite.d.ts +0 -1
  22. package/node_modules/@types/node/stream/web.d.ts +4 -0
  23. package/node_modules/@types/node/stream.d.ts +17 -6
  24. package/node_modules/@types/node/test.d.ts +16 -1
  25. package/node_modules/@types/node/timers.d.ts +0 -2
  26. package/node_modules/@types/node/url.d.ts +1 -1
  27. package/node_modules/@types/node/util.d.ts +6 -2
  28. package/node_modules/@types/node/worker_threads.d.ts +12 -0
  29. package/node_modules/@types/node/zlib.d.ts +8 -2
  30. package/node_modules/undici-types/agent.d.ts +4 -0
  31. package/node_modules/undici-types/client-stats.d.ts +15 -0
  32. package/node_modules/undici-types/client.d.ts +6 -3
  33. package/node_modules/undici-types/mock-agent.d.ts +3 -0
  34. package/node_modules/undici-types/package.json +1 -1
  35. package/node_modules/undici-types/pool.d.ts +2 -0
  36. package/node_modules/undici-types/proxy-agent.d.ts +1 -0
  37. package/node_modules/yaml/README.md +2 -20
  38. package/node_modules/yaml/browser/dist/stringify/stringifyString.js +1 -1
  39. package/node_modules/yaml/dist/stringify/stringifyString.js +1 -1
  40. package/node_modules/yaml/package.json +2 -1
  41. package/package.json +3 -2
  42. package/node_modules/@types/node/ts5.1/compatibility/disposable.d.ts +0 -12
  43. package/node_modules/@types/node/ts5.1/index.d.ts +0 -98
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrast/agent",
3
- "version": "5.41.0",
3
+ "version": "5.42.0",
4
4
  "description": "Assess and Protect agents for Node.js",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "author": "Contrast Security <nodejs@contrastsecurity.com> (https://www.contrastsecurity.com)",
@@ -19,6 +19,7 @@
19
19
  "./lib/index.js": "./lib/index.js",
20
20
  "./lib/start-agent.js": "./lib/start-agent.js"
21
21
  },
22
+ "main": "./lib/index.js",
22
23
  "engines": {
23
24
  "npm": ">=6.13.7 <7 || >= 8.3.1",
24
25
  "node": ">=16.9.1 <17 || >=18.7.0 <19 || >=20.6.0 <21 || >= 22.5.1 <23"
@@ -27,14 +28,14 @@
27
28
  "test": "bash ../scripts/test.sh"
28
29
  },
29
30
  "dependencies": {
30
- "@contrast/agentify": "1.53.0",
31
+ "@contrast/agentify": "1.54.0",
31
32
  "@contrast/architecture-components": "1.43.0",
32
- "@contrast/assess": "1.59.0",
33
+ "@contrast/assess": "1.60.0",
33
34
  "@contrast/common": "1.35.0",
34
35
  "@contrast/core": "1.55.0",
35
36
  "@contrast/library-analysis": "1.45.0",
36
37
  "@contrast/protect": "1.65.0",
37
- "@contrast/route-coverage": "1.46.0",
38
+ "@contrast/route-coverage": "1.47.0",
38
39
  "@contrast/sec-obs": "1.0.0-alpha.9",
39
40
  "@contrast/telemetry": "1.30.0"
40
41
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrast/agentify",
3
- "version": "1.53.0",
3
+ "version": "1.54.0",
4
4
  "description": "Configures Contrast agent services and instrumentation within an application",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "author": "Contrast Security <nodejs@contrastsecurity.com> (https://www.contrastsecurity.com)",
@@ -32,7 +32,7 @@
32
32
  "@contrast/metrics": "1.32.0",
33
33
  "@contrast/patcher": "1.27.0",
34
34
  "@contrast/perf": "1.3.1",
35
- "@contrast/reporter": "1.52.0",
35
+ "@contrast/reporter": "1.53.0",
36
36
  "@contrast/rewriter": "1.31.0",
37
37
  "@contrast/scopes": "1.25.0",
38
38
  "@contrast/sources": "1.1.0",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrast/assess",
3
- "version": "1.59.0",
3
+ "version": "1.60.0",
4
4
  "description": "Contrast service providing framework-agnostic Assess support",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "author": "Contrast Security <nodejs@contrastsecurity.com> (https://www.contrastsecurity.com)",
@@ -29,7 +29,7 @@
29
29
  "@contrast/logger": "1.28.0",
30
30
  "@contrast/patcher": "1.27.0",
31
31
  "@contrast/rewriter": "1.31.0",
32
- "@contrast/route-coverage": "1.46.0",
32
+ "@contrast/route-coverage": "1.47.0",
33
33
  "@contrast/scopes": "1.25.0",
34
34
  "@contrast/sources": "1.1.0",
35
35
  "semver": "^7.6.0"
@@ -2,21 +2,22 @@ import { AxiosInstance } from 'axios';
2
2
  import { RequestStore } from '@contrast/common';
3
3
  import BaseReporter, { Core } from '../../../base';
4
4
  import NgEndpoint from '../ng-endpoint';
5
- export declare enum States {
6
- INCOMPLETE = "INCOMPLETE",
7
- COMPLETE = "COMPLETE"
8
- }
9
- export type Accum = {
10
- messages: any[];
11
- request?: any;
5
+ export type AbstractFinding = {
6
+ events?: any[];
7
+ properties?: any;
8
+ ruleId: string;
9
+ time: number;
12
10
  routes?: any[];
13
- state: States;
11
+ };
12
+ export type SourceFindingsAccum = {
13
+ findings: AbstractFinding[];
14
+ request?: any;
14
15
  store: RequestStore;
15
16
  timestamp: number;
16
17
  };
17
18
  export default class Traces extends NgEndpoint {
18
19
  hashSet: Set<any>;
19
- accumMap: Map<RequestStore, Accum>;
20
+ findingsAccum: Map<RequestStore, SourceFindingsAccum>;
20
21
  reporter: BaseReporter;
21
22
  inProd: boolean;
22
23
  eventDetail: string;
@@ -26,8 +27,7 @@ export default class Traces extends NgEndpoint {
26
27
  initMessageListeners(): void;
27
28
  initIntervals(): void;
28
29
  getStore(msg: any): RequestStore | null;
29
- getAccum(store: RequestStore): Accum;
30
- initiateCompletenessCondition(accum: Accum): void;
30
+ getFindingsAccum(msg: any): SourceFindingsAccum | null;
31
31
  put(): Promise<void>;
32
32
  filter(): Promise<null | any[]>;
33
33
  }
@@ -40,26 +40,19 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
40
40
  return (mod && mod.__esModule) ? mod : { "default": mod };
41
41
  };
42
42
  Object.defineProperty(exports, "__esModule", { value: true });
43
- exports.States = void 0;
44
43
  const common_1 = require("@contrast/common");
45
44
  const ng_endpoint_1 = __importDefault(require("../ng-endpoint"));
46
45
  const tx = __importStar(require("./translations"));
47
46
  const { StringPrototypeSplit } = common_1.primordials;
48
- var States;
49
- (function (States) {
50
- States["INCOMPLETE"] = "INCOMPLETE";
51
- States["COMPLETE"] = "COMPLETE";
52
- })(States || (exports.States = States = {}));
53
- // wait this long after request finishes before reporting in case findings occur in async activity
54
- const REPORT_WAIT_MS = 3000;
55
- const PROD = 'PRODUCTION';
47
+ const FINDING_QUEUE_FLUSH_INTERVAL_MS = 2000;
48
+ const DEDUPE_HASH_RESET_INTERVAL = 3000;
56
49
  class Traces extends ng_endpoint_1.default {
57
50
  constructor(core, uiReporter) {
58
51
  super(core, { ...uiReporter, url: '/api/ng/traces' });
59
52
  this.hashSet = new Set();
60
- this.accumMap = new Map();
53
+ this.findingsAccum = new Map();
61
54
  this.reporter = uiReporter;
62
- this.inProd = this.core.config.getEffectiveValue('server.environment') === PROD;
55
+ this.inProd = this.core.config.getEffectiveValue('server.environment') === common_1.ServerEnvironment.PRODUCTION;
63
56
  this.eventDetail = this.core.config.getEffectiveValue('assess.probabilistic_sampling.event_detail');
64
57
  this.initMessageListeners();
65
58
  this.initIntervals();
@@ -67,80 +60,76 @@ class Traces extends ng_endpoint_1.default {
67
60
  initMessageListeners() {
68
61
  this.reporter.subscribeWithLock(common_1.Event.SERVER_SETTINGS_UPDATE, (msg) => {
69
62
  // reset based on effective value
70
- this.inProd = this.core.config.getEffectiveValue('server.environment') === PROD;
63
+ this.inProd = this.core.config.getEffectiveValue('server.environment') === common_1.ServerEnvironment.PRODUCTION;
71
64
  });
72
65
  this.reporter.subscribeWithLock(common_1.Event.ASSESS_DATAFLOW_FINDING, (msg) => {
73
- const { ruleId, sinkEvent } = msg;
74
- const store = this.getStore(msg);
75
- if (!store)
66
+ const accum = this.getFindingsAccum(msg);
67
+ if (!accum)
76
68
  return;
77
- this.getAccum(store).messages.push({
69
+ const { store: { route } } = accum;
70
+ const { ruleId, sinkEvent } = msg;
71
+ accum.findings.push({
78
72
  events: tx.getTraceEvents(sinkEvent, this.inProd, this.eventDetail),
79
73
  properties: sinkEvent.properties,
74
+ routes: route ? tx.getRoutes(route, this.inProd) : undefined,
80
75
  ruleId: ruleId === common_1.Rule.NOSQL_INJECTION_MONGO ? common_1.Rule.NOSQL_INJECTION : ruleId,
81
76
  time: Date.now(),
82
77
  });
83
78
  });
84
79
  this.reporter.subscribeWithLock(common_1.Event.ASSESS_RESPONSE_SCANNING_FINDING, (msg) => {
85
- const { ruleId, vulnerabilityMetadata } = msg;
86
- const store = this.getStore(msg);
87
- if (!store)
80
+ const accum = this.getFindingsAccum(msg);
81
+ if (!accum)
88
82
  return;
89
- this.getAccum(store).messages.push({
83
+ const { store: { route } } = accum;
84
+ const { ruleId, vulnerabilityMetadata } = msg;
85
+ accum.findings.push({
90
86
  properties: vulnerabilityMetadata,
87
+ routes: route ? tx.getRoutes(route, this.inProd) : undefined,
91
88
  ruleId,
92
89
  time: Date.now(),
93
90
  });
94
91
  });
95
92
  this.reporter.subscribeWithLock(common_1.Event.ASSESS_SESSION_CONFIGURATION_FINDING, (msg) => {
96
- const { ruleId, sinkEvent, properties } = msg;
97
- const store = this.getStore(msg);
98
- if (!store)
93
+ const accum = this.getFindingsAccum(msg);
94
+ if (!accum)
99
95
  return;
100
- this.getAccum(store).messages.push({
96
+ const { store: { route } } = accum;
97
+ const { ruleId, sinkEvent, properties } = msg;
98
+ accum.findings.push({
101
99
  events: tx.getTraceEvents(sinkEvent, this.inProd, this.eventDetail),
102
100
  properties,
101
+ routes: route ? tx.getRoutes(route, this.inProd) : undefined,
103
102
  ruleId,
104
103
  time: Date.now(),
105
104
  });
106
105
  });
107
106
  this.reporter.subscribeWithLock(common_1.Event.ASSESS_CRYPTO_ANALYSIS_FINDING, (msg) => {
108
- const { ruleId, finding } = msg;
109
- const store = this.getStore(msg);
110
- if (!store)
107
+ const accum = this.getFindingsAccum(msg);
108
+ if (!accum)
111
109
  return;
112
- this.getAccum(store).messages.push({
110
+ const { store: { route } } = accum;
111
+ const { ruleId, finding } = msg;
112
+ accum.findings.push({
113
113
  events: [tx.getCryptoEvent(finding)],
114
+ routes: route ? tx.getRoutes(route, this.inProd) : undefined,
114
115
  ruleId,
115
116
  time: Date.now(),
116
117
  });
117
118
  });
118
- this.reporter.subscribeWithLock(common_1.Event.RESPONSE_FINISH, (store) => {
119
- const { route, assess } = store;
120
- // this event is emitted by agentify and is feature agnostic,
121
- // so we need to check if the current request has assess enabled.
122
- if (!assess?.policy)
123
- return;
124
- const accum = this.getAccum(store);
125
- if (route) {
126
- accum.routes = tx.getRoutes(route, this.inProd);
127
- }
128
- if (store?.sourceInfo) {
129
- accum.request = tx.getRequest(store, this.inProd);
130
- }
131
- this.initiateCompletenessCondition(accum);
132
- });
133
119
  this.reporter.subscribeWithLock(common_1.Event.UNINSTALL, () => {
134
120
  // should we log that we're dropping this data?
135
121
  this.hashSet.clear();
136
- this.accumMap.clear();
122
+ this.findingsAccum.clear();
137
123
  });
138
124
  }
139
125
  initIntervals() {
126
+ this.reporter.setInterval(() => {
127
+ this.put();
128
+ }, FINDING_QUEUE_FLUSH_INTERVAL_MS);
140
129
  this.reporter.setInterval(() => {
141
130
  // this will take a little bit of pressure off of TS /preflight if we can dedupe
142
131
  this.hashSet.clear();
143
- }, 3000);
132
+ }, DEDUPE_HASH_RESET_INTERVAL);
144
133
  }
145
134
  getStore(msg) {
146
135
  const store = this.core.scopes.sources.getStore();
@@ -151,23 +140,27 @@ class Traces extends ng_endpoint_1.default {
151
140
  }, 'skipping traces accumulation - no source info during event handling');
152
141
  return null;
153
142
  }
154
- getAccum(store) {
155
- let meta = this.accumMap.get(store);
156
- if (!meta) {
157
- meta = {
158
- messages: [],
159
- state: States.INCOMPLETE,
143
+ getFindingsAccum(msg) {
144
+ const store = this.getStore(msg);
145
+ if (!store?.assess?.policy)
146
+ return null;
147
+ let accum = this.findingsAccum.get(store);
148
+ if (!accum) {
149
+ accum = {
150
+ findings: [],
151
+ request: null,
160
152
  store,
161
- timestamp: Date.now(),
153
+ timestamp: Date.now()
162
154
  };
163
- this.accumMap.set(store, meta);
155
+ this.findingsAccum.set(store, accum);
164
156
  }
165
- return meta;
166
- }
167
- initiateCompletenessCondition(accum) {
168
- setTimeout(() => {
169
- accum.state = States.COMPLETE;
170
- }, REPORT_WAIT_MS).unref();
157
+ if (accum.request) {
158
+ // todo: make sure standardNormalizedUri value is up-to-date given latest store data
159
+ }
160
+ else {
161
+ accum.request = tx.getRequest(store, this.inProd);
162
+ }
163
+ return accum;
171
164
  }
172
165
  async put() {
173
166
  const filtered = await this.filter();
@@ -201,36 +194,33 @@ class Traces extends ng_endpoint_1.default {
201
194
  }
202
195
  }
203
196
  async filter() {
204
- const complete = [];
205
- for (const accum of this.accumMap.values()) {
206
- if (accum.state === States.COMPLETE) {
207
- this.accumMap.delete(accum.store);
208
- // flatten
209
- accum.messages.forEach(({ ruleId, events, properties, time }) => {
210
- const traceData = {
211
- ruleId,
212
- properties,
213
- events,
214
- routes: accum.routes,
215
- request: accum.request,
216
- time
217
- };
218
- const hash = tx.getEventHash(traceData);
219
- if (!this.hashSet.has(hash)) {
220
- this.hashSet.add(hash);
221
- complete.push({ ...traceData, hash });
222
- }
223
- });
224
- }
197
+ const findingsToFilter = [];
198
+ for (const accum of this.findingsAccum.values()) {
199
+ accum.findings.forEach(({ events, properties, routes, ruleId, time }) => {
200
+ const traceData = {
201
+ ruleId,
202
+ properties,
203
+ events,
204
+ routes,
205
+ request: accum.request,
206
+ time
207
+ };
208
+ const hash = tx.getEventHash(traceData);
209
+ if (!this.hashSet.has(hash)) {
210
+ this.hashSet.add(hash);
211
+ findingsToFilter.push({ ...traceData, hash });
212
+ }
213
+ });
225
214
  }
226
- if (!complete.length)
215
+ this.findingsAccum.clear();
216
+ if (!findingsToFilter.length)
227
217
  return null;
228
218
  try {
229
219
  const res = await this.client({
230
220
  method: 'put',
231
221
  url: 'api/ng/preflight',
232
222
  data: {
233
- messages: complete.map((traceData, i) => {
223
+ messages: findingsToFilter.map((traceData, i) => {
234
224
  const { ruleId, routes, hash } = traceData;
235
225
  return {
236
226
  appLanguage: 'Node',
@@ -246,14 +236,14 @@ class Traces extends ng_endpoint_1.default {
246
236
  tags: this.core.config.assess.tags || '',
247
237
  }
248
238
  });
249
- const itemsToReport = [];
239
+ const findingsToReport = [];
250
240
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
251
241
  // @ts-ignore
252
242
  for (const idx of StringPrototypeSplit.call(res.data, ',')) {
253
- const item = complete[Number(idx)];
254
- item && itemsToReport.push(item);
243
+ const item = findingsToFilter[Number(idx)];
244
+ item && findingsToReport.push(item);
255
245
  }
256
- return itemsToReport;
246
+ return findingsToReport;
257
247
  }
258
248
  catch (err) {
259
249
  this.core.logger.error({ err }, 'failed put request to preflight');
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrast/reporter",
3
- "version": "1.52.0",
3
+ "version": "1.53.0",
4
4
  "description": "Subscribes to agent messages and reports them",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "author": "Contrast Security <nodejs@contrastsecurity.com> (https://www.contrastsecurity.com)",
@@ -62,11 +62,18 @@ module.exports = function init(core) {
62
62
  patcher.patch(data.result.route.settings, 'handler', {
63
63
  name: 'route.settings.handler',
64
64
  patchType,
65
- post({ args }) {
65
+ // this needs to be in a pre-hook so that the route
66
+ // data is in the store before our dataflow hooks run
67
+ pre({ args }) {
66
68
  const [{ method, path: url, route }] = args;
67
69
  //TODO: Will this signature always be associated with an existing route?
68
70
  const signature = createSignature(method, path);
69
- routeCoverage.observe({ signature, url, method: StringPrototypeToLowerCase.call(method), normalizedUrl: route.path });
71
+ routeCoverage.observe({
72
+ signature,
73
+ url,
74
+ method: StringPrototypeToLowerCase.call(method),
75
+ normalizedUrl: route.path,
76
+ });
70
77
  }
71
78
  });
72
79
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrast/route-coverage",
3
- "version": "1.46.0",
3
+ "version": "1.47.0",
4
4
  "description": "Handles route discovery and observation",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "author": "Contrast Security <nodejs@contrastsecurity.com> (https://www.contrastsecurity.com)",
@@ -396,7 +396,7 @@ export interface Options extends Config {
396
396
  */
397
397
  sourceRoot?: string;
398
398
  plugin?: Plugin;
399
- isModule?: boolean | "unknown";
399
+ isModule?: boolean | "unknown" | "commonjs";
400
400
  /**
401
401
  * Destination path. Note that this value is used only to fix source path
402
402
  * of source map files and swc does not write output to this path.
@@ -640,7 +640,7 @@ export interface EsParserConfig {
640
640
  */
641
641
  importAssertions?: boolean;
642
642
  /**
643
- * Defaults to `false`
643
+ * @deprecated Always true in swc
644
644
  */
645
645
  importAttributes?: boolean;
646
646
  /**
@@ -694,6 +694,7 @@ export interface TransformConfig {
694
694
  * https://www.typescriptlang.org/tsconfig#verbatimModuleSyntax
695
695
  */
696
696
  verbatimModuleSyntax?: boolean;
697
+ tsEnumIsMutable?: boolean;
697
698
  }
698
699
  export interface ReactConfig {
699
700
  /**
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@swc/types",
3
3
  "packageManager": "yarn@4.0.2",
4
- "version": "0.1.23",
4
+ "version": "0.1.24",
5
5
  "description": "Typings for the swc project.",
6
6
  "types": "./index.d.ts",
7
7
  "sideEffects": false,
@@ -8,7 +8,7 @@ This package contains type definitions for node (https://nodejs.org/).
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Tue, 22 Jul 2025 11:34:36 GMT
11
+ * Last updated: Fri, 08 Aug 2025 16:38:49 GMT
12
12
  * Dependencies: [undici-types](https://npmjs.com/package/undici-types)
13
13
 
14
14
  # Credits
@@ -3771,7 +3771,23 @@ declare module "crypto" {
3771
3771
  */
3772
3772
  checkIP(ip: string): string | undefined;
3773
3773
  /**
3774
- * Checks whether this certificate was issued by the given `otherCert`.
3774
+ * Checks whether this certificate was potentially issued by the given `otherCert`
3775
+ * by comparing the certificate metadata.
3776
+ *
3777
+ * This is useful for pruning a list of possible issuer certificates which have been
3778
+ * selected using a more rudimentary filtering routine, i.e. just based on subject
3779
+ * and issuer names.
3780
+ *
3781
+ * Finally, to verify that this certificate's signature was produced by a private key
3782
+ * corresponding to `otherCert`'s public key use `x509.verify(publicKey)`
3783
+ * with `otherCert`'s public key represented as a `KeyObject`
3784
+ * like so
3785
+ *
3786
+ * ```js
3787
+ * if (!x509.verify(otherCert.publicKey)) {
3788
+ * throw new Error('otherCert did not issue x509');
3789
+ * }
3790
+ * ```
3775
3791
  * @since v15.6.0
3776
3792
  */
3777
3793
  checkIssued(otherCert: X509Certificate): boolean;
@@ -88,6 +88,9 @@ declare module "fs/promises" {
88
88
  highWaterMark?: number | undefined;
89
89
  flush?: boolean | undefined;
90
90
  }
91
+ interface ReadableWebStreamOptions {
92
+ autoClose?: boolean | undefined;
93
+ }
91
94
  // TODO: Add `EventEmitter` close
92
95
  interface FileHandle {
93
96
  /**
@@ -261,7 +264,7 @@ declare module "fs/promises" {
261
264
  * close the `FileHandle` automatically. User code must still call the`fileHandle.close()` method.
262
265
  * @since v17.0.0
263
266
  */
264
- readableWebStream(): ReadableStream;
267
+ readableWebStream(options?: ReadableWebStreamOptions): ReadableStream;
265
268
  /**
266
269
  * Asynchronously reads the entire contents of a file.
267
270
  *
@@ -474,8 +477,9 @@ declare module "fs/promises" {
474
477
  */
475
478
  close(): Promise<void>;
476
479
  /**
477
- * An alias for {@link FileHandle.close()}.
478
- * @since v20.4.0
480
+ * Calls `filehandle.close()` and returns a promise that fulfills when the
481
+ * filehandle is closed.
482
+ * @since v20.4.0, v18.8.0
479
483
  */
480
484
  [Symbol.asyncDispose](): Promise<void>;
481
485
  }
@@ -325,13 +325,11 @@ declare module "fs" {
325
325
  /**
326
326
  * An alias for `dir.close()`.
327
327
  * @since v24.1.0
328
- * @experimental
329
328
  */
330
329
  [Symbol.dispose](): void;
331
330
  /**
332
331
  * An alias for `dir.closeSync()`.
333
332
  * @since v24.1.0
334
- * @experimental
335
333
  */
336
334
  [Symbol.asyncDispose](): void;
337
335
  }
@@ -32,18 +32,14 @@ declare module "http2" {
32
32
  ":scheme"?: string | undefined;
33
33
  }
34
34
  // Http2Stream
35
- export interface StreamPriorityOptions {
36
- exclusive?: boolean | undefined;
37
- parent?: number | undefined;
38
- weight?: number | undefined;
39
- silent?: boolean | undefined;
40
- }
41
35
  export interface StreamState {
42
36
  localWindowSize?: number | undefined;
43
37
  state?: number | undefined;
44
38
  localClose?: number | undefined;
45
39
  remoteClose?: number | undefined;
40
+ /** @deprecated */
46
41
  sumDependencyWeight?: number | undefined;
42
+ /** @deprecated */
47
43
  weight?: number | undefined;
48
44
  }
49
45
  export interface ServerStreamResponseOptions {
@@ -151,10 +147,9 @@ declare module "http2" {
151
147
  */
152
148
  close(code?: number, callback?: () => void): void;
153
149
  /**
154
- * Updates the priority for this `Http2Stream` instance.
155
- * @since v8.4.0
150
+ * @deprecated Priority signaling is no longer supported in Node.js.
156
151
  */
157
- priority(options: StreamPriorityOptions): void;
152
+ priority(options: unknown): void;
158
153
  /**
159
154
  * ```js
160
155
  * import http2 from 'node:http2';
@@ -395,7 +390,7 @@ declare module "http2" {
395
390
  ): void;
396
391
  pushStream(
397
392
  headers: OutgoingHttpHeaders,
398
- options?: StreamPriorityOptions,
393
+ options?: Pick<ClientSessionRequestOptions, "exclusive" | "parent">,
399
394
  callback?: (err: Error | null, pushStream: ServerHttp2Stream, headers: OutgoingHttpHeaders) => void,
400
395
  ): void;
401
396
  /**
@@ -629,7 +624,6 @@ declare module "http2" {
629
624
  endStream?: boolean | undefined;
630
625
  exclusive?: boolean | undefined;
631
626
  parent?: number | undefined;
632
- weight?: number | undefined;
633
627
  waitForTrailers?: boolean | undefined;
634
628
  signal?: AbortSignal | undefined;
635
629
  }
@@ -1294,6 +1288,14 @@ declare module "http2" {
1294
1288
  * @default 100000
1295
1289
  */
1296
1290
  unknownProtocolTimeout?: number | undefined;
1291
+ /**
1292
+ * If `true`, it turns on strict leading
1293
+ * and trailing whitespace validation for HTTP/2 header field names and values
1294
+ * as per [RFC-9113](https://www.rfc-editor.org/rfc/rfc9113.html#section-8.2.1).
1295
+ * @since v24.2.0
1296
+ * @default true
1297
+ */
1298
+ strictFieldWhitespaceValidation?: boolean | undefined;
1297
1299
  }
1298
1300
  export interface ClientSessionOptions extends SessionOptions {
1299
1301
  /**