Commit 4b80a7b 1 parent 63ee335 commit 4b80a7b Copy full SHA for 4b80a7b
File tree 2 files changed +19
-0
lines changed
2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -2678,6 +2678,8 @@ static void Mkdtemp(const FunctionCallbackInfo<Value>& args) {
2678
2678
2679
2679
BufferValue tmpl (isolate, args[0 ]);
2680
2680
CHECK_NOT_NULL (*tmpl);
2681
+ THROW_IF_INSUFFICIENT_PERMISSIONS (
2682
+ env, permission::PermissionScope::kFileSystemWrite , tmpl.ToStringView ());
2681
2683
2682
2684
const enum encoding encoding = ParseEncoding (isolate, args[1 ], UTF8);
2683
2685
Original file line number Diff line number Diff line change @@ -130,6 +130,23 @@ const absoluteProtectedFolder = path.resolve(relativeProtectedFolder);
130
130
} ) ) ;
131
131
}
132
132
133
+ {
134
+ assert . throws ( ( ) => {
135
+ fs . mkdtempSync ( path . join ( blockedFolder , 'any-folder' ) ) ;
136
+ } , common . expectsError ( {
137
+ code : 'ERR_ACCESS_DENIED' ,
138
+ permission : 'FileSystemWrite' ,
139
+ } ) ) ;
140
+ assert . throws ( ( ) => {
141
+ fs . mkdtemp ( path . join ( relativeProtectedFolder , 'any-folder' ) , ( err ) => {
142
+ assert . ifError ( err ) ;
143
+ } ) ;
144
+ } , common . expectsError ( {
145
+ code : 'ERR_ACCESS_DENIED' ,
146
+ permission : 'FileSystemWrite' ,
147
+ } ) ) ;
148
+ }
149
+
133
150
// fs.rename
134
151
{
135
152
assert . throws ( ( ) => {
You can’t perform that action at this time.
0 commit comments