Skip to content

Commit 5c3f18b

Browse files
RafaelGSSmarco-ippolito
authored andcommitted
test: temporary remove resource check from fs read-write
Since the last security release, the resource check has been flaky on Windows. This commit temporarily disables those checks to unblock the next regular release. PR-URL: #56789 Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent f78508c commit 5c3f18b

File tree

2 files changed

+87
-89
lines changed

2 files changed

+87
-89
lines changed

test/fixtures/permission/fs-read.js

+49-51
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,26 @@ const regularFile = __filename;
1818
fs.readFile(blockedFile, common.expectsError({
1919
code: 'ERR_ACCESS_DENIED',
2020
permission: 'FileSystemRead',
21-
resource: path.toNamespacedPath(blockedFile),
21+
// resource: path.toNamespacedPath(blockedFile),
2222
}));
2323
fs.readFile(bufferBlockedFile, common.expectsError({
2424
code: 'ERR_ACCESS_DENIED',
2525
permission: 'FileSystemRead',
26-
resource: path.toNamespacedPath(blockedFile),
26+
// resource: path.toNamespacedPath(blockedFile),
2727
}));
2828
assert.throws(() => {
2929
fs.readFileSync(blockedFile);
3030
}, common.expectsError({
3131
code: 'ERR_ACCESS_DENIED',
3232
permission: 'FileSystemRead',
33-
resource: path.toNamespacedPath(blockedFile),
33+
// resource: path.toNamespacedPath(blockedFile),
3434
}));
3535
assert.throws(() => {
3636
fs.readFileSync(blockedFileURL);
3737
}, common.expectsError({
3838
code: 'ERR_ACCESS_DENIED',
3939
permission: 'FileSystemRead',
40-
resource: path.toNamespacedPath(blockedFile),
40+
// resource: path.toNamespacedPath(blockedFile),
4141
}));
4242
}
4343

@@ -51,7 +51,7 @@ const regularFile = __filename;
5151
}, common.expectsError({
5252
code: 'ERR_ACCESS_DENIED',
5353
permission: 'FileSystemRead',
54-
resource: path.toNamespacedPath(blockedFile),
54+
// resource: path.toNamespacedPath(blockedFile),
5555
})).then(common.mustCall());
5656
assert.rejects(() => {
5757
return new Promise((_resolve, reject) => {
@@ -61,7 +61,7 @@ const regularFile = __filename;
6161
}, common.expectsError({
6262
code: 'ERR_ACCESS_DENIED',
6363
permission: 'FileSystemRead',
64-
resource: path.toNamespacedPath(blockedFile),
64+
// resource: path.toNamespacedPath(blockedFile),
6565
})).then(common.mustCall());
6666

6767
assert.rejects(() => {
@@ -72,7 +72,7 @@ const regularFile = __filename;
7272
}, common.expectsError({
7373
code: 'ERR_ACCESS_DENIED',
7474
permission: 'FileSystemRead',
75-
resource: path.toNamespacedPath(blockedFile),
75+
// resource: path.toNamespacedPath(blockedFile),
7676
})).then(common.mustCall());
7777
}
7878

@@ -81,31 +81,31 @@ const regularFile = __filename;
8181
fs.stat(blockedFile, common.expectsError({
8282
code: 'ERR_ACCESS_DENIED',
8383
permission: 'FileSystemRead',
84-
resource: path.toNamespacedPath(blockedFile),
84+
// resource: path.toNamespacedPath(blockedFile),
8585
}));
8686
fs.stat(bufferBlockedFile, common.expectsError({
8787
code: 'ERR_ACCESS_DENIED',
8888
permission: 'FileSystemRead',
89-
resource: path.toNamespacedPath(blockedFile),
89+
// resource: path.toNamespacedPath(blockedFile),
9090
}));
9191
assert.throws(() => {
9292
fs.statSync(blockedFile);
9393
}, common.expectsError({
9494
code: 'ERR_ACCESS_DENIED',
9595
permission: 'FileSystemRead',
96-
resource: path.toNamespacedPath(blockedFile),
96+
// resource: path.toNamespacedPath(blockedFile),
9797
}));
9898
assert.throws(() => {
9999
fs.statSync(blockedFileURL);
100100
}, common.expectsError({
101101
code: 'ERR_ACCESS_DENIED',
102102
permission: 'FileSystemRead',
103-
resource: path.toNamespacedPath(blockedFile),
103+
// resource: path.toNamespacedPath(blockedFile),
104104
}));
105105
fs.stat(path.join(blockedFolder, 'anyfile'), common.expectsError({
106106
code: 'ERR_ACCESS_DENIED',
107107
permission: 'FileSystemRead',
108-
resource: path.toNamespacedPath(path.join(blockedFolder, 'anyfile')),
108+
// resource: path.toNamespacedPath(path.join(blockedFolder, 'anyfile')),
109109
}));
110110

111111
// doesNotThrow
@@ -119,26 +119,26 @@ const regularFile = __filename;
119119
fs.access(blockedFile, fs.constants.R_OK, common.expectsError({
120120
code: 'ERR_ACCESS_DENIED',
121121
permission: 'FileSystemRead',
122-
resource: path.toNamespacedPath(blockedFile),
122+
// resource: path.toNamespacedPath(blockedFile),
123123
}));
124124
fs.access(bufferBlockedFile, fs.constants.R_OK, common.expectsError({
125125
code: 'ERR_ACCESS_DENIED',
126126
permission: 'FileSystemRead',
127-
resource: path.toNamespacedPath(blockedFile),
127+
// resource: path.toNamespacedPath(blockedFile),
128128
}));
129129
assert.throws(() => {
130130
fs.accessSync(blockedFileURL, fs.constants.R_OK);
131131
}, common.expectsError({
132132
code: 'ERR_ACCESS_DENIED',
133133
permission: 'FileSystemRead',
134-
resource: path.toNamespacedPath(blockedFile),
134+
// resource: path.toNamespacedPath(blockedFile),
135135
}));
136136
assert.throws(() => {
137137
fs.accessSync(path.join(blockedFolder, 'anyfile'), fs.constants.R_OK);
138138
}, common.expectsError({
139139
code: 'ERR_ACCESS_DENIED',
140140
permission: 'FileSystemRead',
141-
resource: path.toNamespacedPath(path.join(blockedFolder, 'anyfile')),
141+
// resource: path.toNamespacedPath(path.join(blockedFolder, 'anyfile')),
142142
}));
143143

144144
// doesNotThrow
@@ -152,26 +152,26 @@ const regularFile = __filename;
152152
fs.copyFile(blockedFile, path.join(blockedFolder, 'any-other-file'), common.expectsError({
153153
code: 'ERR_ACCESS_DENIED',
154154
permission: 'FileSystemRead',
155-
resource: path.toNamespacedPath(blockedFile),
155+
// resource: path.toNamespacedPath(blockedFile),
156156
}));
157157
fs.copyFile(bufferBlockedFile, path.join(blockedFolder, 'any-other-file'), common.expectsError({
158158
code: 'ERR_ACCESS_DENIED',
159159
permission: 'FileSystemRead',
160-
resource: path.toNamespacedPath(blockedFile),
160+
// resource: path.toNamespacedPath(blockedFile),
161161
}));
162162
assert.throws(() => {
163163
fs.copyFileSync(blockedFileURL, path.join(blockedFolder, 'any-other-file'));
164164
}, common.expectsError({
165165
code: 'ERR_ACCESS_DENIED',
166166
permission: 'FileSystemRead',
167-
resource: path.toNamespacedPath(blockedFile),
167+
// resource: path.toNamespacedPath(blockedFile),
168168
}));
169169
assert.throws(() => {
170170
fs.copyFileSync(blockedFile, path.join(__dirname, 'any-other-file'));
171171
}, common.expectsError({
172172
code: 'ERR_ACCESS_DENIED',
173173
permission: 'FileSystemRead',
174-
resource: path.toNamespacedPath(blockedFile),
174+
// resource: path.toNamespacedPath(blockedFile),
175175
}));
176176
}
177177

@@ -182,30 +182,28 @@ const regularFile = __filename;
182182
}, common.expectsError({
183183
code: 'ERR_ACCESS_DENIED',
184184
permission: 'FileSystemRead',
185-
// cpSync calls lstatSync before reading blockedFile
186-
resource: path.toNamespacedPath(blockedFile),
185+
// resource: path.toNamespacedPath(blockedFile),
187186
}));
188187
assert.throws(() => {
189188
fs.cpSync(bufferBlockedFile, path.join(blockedFolder, 'any-other-file'));
190189
}, common.expectsError({
191190
code: 'ERR_ACCESS_DENIED',
192191
permission: 'FileSystemRead',
193-
resource: path.toNamespacedPath(blockedFile),
192+
// resource: path.toNamespacedPath(blockedFile),
194193
}));
195194
assert.throws(() => {
196195
fs.cpSync(blockedFileURL, path.join(blockedFolder, 'any-other-file'));
197196
}, common.expectsError({
198197
code: 'ERR_ACCESS_DENIED',
199198
permission: 'FileSystemRead',
200-
// cpSync calls lstatSync before reading blockedFile
201-
resource: path.toNamespacedPath(blockedFile),
199+
// resource: path.toNamespacedPath(blockedFile),
202200
}));
203201
assert.throws(() => {
204202
fs.cpSync(blockedFile, path.join(__dirname, 'any-other-file'));
205203
}, common.expectsError({
206204
code: 'ERR_ACCESS_DENIED',
207205
permission: 'FileSystemRead',
208-
resource: path.toNamespacedPath(blockedFile),
206+
// resource: path.toNamespacedPath(blockedFile),
209207
}));
210208
}
211209

@@ -214,26 +212,26 @@ const regularFile = __filename;
214212
fs.open(blockedFile, 'r', common.expectsError({
215213
code: 'ERR_ACCESS_DENIED',
216214
permission: 'FileSystemRead',
217-
resource: path.toNamespacedPath(blockedFile),
215+
// resource: path.toNamespacedPath(blockedFile),
218216
}));
219217
fs.open(bufferBlockedFile, 'r', common.expectsError({
220218
code: 'ERR_ACCESS_DENIED',
221219
permission: 'FileSystemRead',
222-
resource: path.toNamespacedPath(blockedFile),
220+
// resource: path.toNamespacedPath(blockedFile),
223221
}));
224222
assert.throws(() => {
225223
fs.openSync(blockedFileURL, 'r');
226224
}, common.expectsError({
227225
code: 'ERR_ACCESS_DENIED',
228226
permission: 'FileSystemRead',
229-
resource: path.toNamespacedPath(blockedFile),
227+
// resource: path.toNamespacedPath(blockedFile),
230228
}));
231229
assert.throws(() => {
232230
fs.openSync(path.join(blockedFolder, 'anyfile'), 'r');
233231
}, common.expectsError({
234232
code: 'ERR_ACCESS_DENIED',
235233
permission: 'FileSystemRead',
236-
resource: path.toNamespacedPath(path.join(blockedFolder, 'anyfile')),
234+
// resource: path.toNamespacedPath(path.join(blockedFolder, 'anyfile')),
237235
}));
238236

239237
// doesNotThrow
@@ -260,14 +258,14 @@ const regularFile = __filename;
260258
fs.opendir(blockedFolder, common.expectsError({
261259
code: 'ERR_ACCESS_DENIED',
262260
permission: 'FileSystemRead',
263-
resource: path.toNamespacedPath(blockedFolder),
261+
// resource: path.toNamespacedPath(blockedFolder),
264262
}));
265263
assert.throws(() => {
266264
fs.opendirSync(blockedFolder);
267265
}, common.expectsError({
268266
code: 'ERR_ACCESS_DENIED',
269267
permission: 'FileSystemRead',
270-
resource: path.toNamespacedPath(blockedFolder),
268+
// resource: path.toNamespacedPath(blockedFolder),
271269
}));
272270
// doesNotThrow
273271
fs.opendir(allowedFolder, (err, dir) => {
@@ -281,14 +279,14 @@ const regularFile = __filename;
281279
fs.readdir(blockedFolder, common.expectsError({
282280
code: 'ERR_ACCESS_DENIED',
283281
permission: 'FileSystemRead',
284-
resource: path.toNamespacedPath(blockedFolder),
282+
// resource: path.toNamespacedPath(blockedFolder),
285283
}));
286284
assert.throws(() => {
287285
fs.readdirSync(blockedFolder);
288286
}, common.expectsError({
289287
code: 'ERR_ACCESS_DENIED',
290288
permission: 'FileSystemRead',
291-
resource: path.toNamespacedPath(blockedFolder),
289+
// resource: path.toNamespacedPath(blockedFolder),
292290
}));
293291

294292
// doesNotThrow
@@ -304,14 +302,14 @@ const regularFile = __filename;
304302
}, common.expectsError({
305303
code: 'ERR_ACCESS_DENIED',
306304
permission: 'FileSystemRead',
307-
resource: path.toNamespacedPath(blockedFile),
305+
// resource: path.toNamespacedPath(blockedFile),
308306
}));
309307
assert.throws(() => {
310308
fs.watch(blockedFileURL, () => {});
311309
}, common.expectsError({
312310
code: 'ERR_ACCESS_DENIED',
313311
permission: 'FileSystemRead',
314-
resource: path.toNamespacedPath(blockedFile),
312+
// resource: path.toNamespacedPath(blockedFile),
315313
}));
316314

317315
// doesNotThrow
@@ -327,14 +325,14 @@ const regularFile = __filename;
327325
}, common.expectsError({
328326
code: 'ERR_ACCESS_DENIED',
329327
permission: 'FileSystemRead',
330-
resource: path.toNamespacedPath(blockedFile),
328+
// resource: path.toNamespacedPath(blockedFile),
331329
}));
332330
assert.throws(() => {
333331
fs.watchFile(blockedFileURL, common.mustNotCall());
334332
}, common.expectsError({
335333
code: 'ERR_ACCESS_DENIED',
336334
permission: 'FileSystemRead',
337-
resource: path.toNamespacedPath(blockedFile),
335+
// resource: path.toNamespacedPath(blockedFile),
338336
}));
339337
}
340338

@@ -343,26 +341,26 @@ const regularFile = __filename;
343341
fs.rename(blockedFile, 'newfile', common.expectsError({
344342
code: 'ERR_ACCESS_DENIED',
345343
permission: 'FileSystemRead',
346-
resource: path.toNamespacedPath(blockedFile),
344+
// resource: path.toNamespacedPath(blockedFile),
347345
}));
348346
fs.rename(bufferBlockedFile, 'newfile', common.expectsError({
349347
code: 'ERR_ACCESS_DENIED',
350348
permission: 'FileSystemRead',
351-
resource: path.toNamespacedPath(blockedFile),
349+
// resource: path.toNamespacedPath(blockedFile),
352350
}));
353351
assert.throws(() => {
354352
fs.renameSync(blockedFile, 'newfile');
355353
}, common.expectsError({
356354
code: 'ERR_ACCESS_DENIED',
357355
permission: 'FileSystemRead',
358-
resource: path.toNamespacedPath(blockedFile),
356+
// resource: path.toNamespacedPath(blockedFile),
359357
}));
360358
assert.throws(() => {
361359
fs.renameSync(blockedFileURL, 'newfile');
362360
}, common.expectsError({
363361
code: 'ERR_ACCESS_DENIED',
364362
permission: 'FileSystemRead',
365-
resource: path.toNamespacedPath(blockedFile),
363+
// resource: path.toNamespacedPath(blockedFile),
366364
}));
367365
}
368366

@@ -373,21 +371,21 @@ const regularFile = __filename;
373371
}, common.expectsError({
374372
code: 'ERR_ACCESS_DENIED',
375373
permission: 'FileSystemRead',
376-
resource: path.toNamespacedPath(blockedFile),
374+
// resource: path.toNamespacedPath(blockedFile),
377375
}));
378376
assert.throws(() => {
379377
fs.openAsBlob(bufferBlockedFile);
380378
}, common.expectsError({
381379
code: 'ERR_ACCESS_DENIED',
382380
permission: 'FileSystemRead',
383-
resource: path.toNamespacedPath(blockedFile),
381+
// resource: path.toNamespacedPath(blockedFile),
384382
}));
385383
assert.throws(() => {
386384
fs.openAsBlob(blockedFileURL);
387385
}, common.expectsError({
388386
code: 'ERR_ACCESS_DENIED',
389387
permission: 'FileSystemRead',
390-
resource: path.toNamespacedPath(blockedFile),
388+
// resource: path.toNamespacedPath(blockedFile),
391389
}));
392390
}
393391

@@ -405,7 +403,7 @@ const regularFile = __filename;
405403
}, common.expectsError({
406404
code: 'ERR_ACCESS_DENIED',
407405
permission: 'FileSystemRead',
408-
resource: path.toNamespacedPath(blockedFile),
406+
// resource: path.toNamespacedPath(blockedFile),
409407
}));
410408
}
411409

@@ -414,26 +412,26 @@ const regularFile = __filename;
414412
fs.statfs(blockedFile, common.expectsError({
415413
code: 'ERR_ACCESS_DENIED',
416414
permission: 'FileSystemRead',
417-
resource: path.toNamespacedPath(blockedFile),
415+
// resource: path.toNamespacedPath(blockedFile),
418416
}));
419417
fs.statfs(bufferBlockedFile, common.expectsError({
420418
code: 'ERR_ACCESS_DENIED',
421419
permission: 'FileSystemRead',
422-
resource: path.toNamespacedPath(blockedFile),
420+
// resource: path.toNamespacedPath(blockedFile),
423421
}));
424422
assert.throws(() => {
425423
fs.statfsSync(blockedFile);
426424
}, common.expectsError({
427425
code: 'ERR_ACCESS_DENIED',
428426
permission: 'FileSystemRead',
429-
resource: path.toNamespacedPath(blockedFile),
427+
// resource: path.toNamespacedPath(blockedFile),
430428
}));
431429
assert.throws(() => {
432430
fs.statfsSync(blockedFileURL);
433431
}, common.expectsError({
434432
code: 'ERR_ACCESS_DENIED',
435433
permission: 'FileSystemRead',
436-
resource: path.toNamespacedPath(blockedFile),
434+
// resource: path.toNamespacedPath(blockedFile),
437435
}));
438436
}
439437

@@ -444,7 +442,7 @@ const regularFile = __filename;
444442
}, common.expectsError({
445443
code: 'ERR_ACCESS_DENIED',
446444
permission: 'FileSystemRead',
447-
resource: blockedFolder,
445+
// resource: blockedFolder,
448446
}));
449447
}
450448

0 commit comments

Comments
 (0)