summaryrefslogtreecommitdiff
path: root/ext/fs/30_fs.js
diff options
context:
space:
mode:
authorLuca Casonato <hello@lcas.dev>2024-05-23 00:03:35 +0200
committerGitHub <noreply@github.com>2024-05-23 00:03:35 +0200
commit971f09abe486185247e1faf4e8d1419ba2506b8d (patch)
tree3ed0cf608116ad06e88a87552333e930824cc790 /ext/fs/30_fs.js
parent6c167c64d61ecfc912dc1b68d300f02aa3677235 (diff)
fix(runtime): use more null proto objects (#23921)
This is a primordialization effort to improve resistance against users tampering with the global `Object` prototype. --------- Co-authored-by: Bartek IwaƄczuk <biwanczuk@gmail.com>
Diffstat (limited to 'ext/fs/30_fs.js')
-rw-r--r--ext/fs/30_fs.js22
1 files changed, 11 insertions, 11 deletions
diff --git a/ext/fs/30_fs.js b/ext/fs/30_fs.js
index f0078392a..d65f8560d 100644
--- a/ext/fs/30_fs.js
+++ b/ext/fs/30_fs.js
@@ -155,7 +155,7 @@ function chdir(directory) {
op_fs_chdir(pathFromURL(directory));
}
-function makeTempDirSync(options = {}) {
+function makeTempDirSync(options = { __proto__: null }) {
return op_fs_make_temp_dir_sync(
options.dir,
options.prefix,
@@ -163,7 +163,7 @@ function makeTempDirSync(options = {}) {
);
}
-function makeTempDir(options = {}) {
+function makeTempDir(options = { __proto__: null }) {
return op_fs_make_temp_dir_async(
options.dir,
options.prefix,
@@ -171,7 +171,7 @@ function makeTempDir(options = {}) {
);
}
-function makeTempFileSync(options = {}) {
+function makeTempFileSync(options = { __proto__: null }) {
return op_fs_make_temp_file_sync(
options.dir,
options.prefix,
@@ -179,7 +179,7 @@ function makeTempFileSync(options = {}) {
);
}
-function makeTempFile(options = {}) {
+function makeTempFile(options = { __proto__: null }) {
return op_fs_make_temp_file_async(
options.dir,
options.prefix,
@@ -241,7 +241,7 @@ function realPath(path) {
function removeSync(
path,
- options = {},
+ options = { __proto__: null },
) {
op_fs_remove_sync(
pathFromURL(path),
@@ -251,7 +251,7 @@ function removeSync(
async function remove(
path,
- options = {},
+ options = { __proto__: null },
) {
await op_fs_remove_async(
pathFromURL(path),
@@ -773,7 +773,7 @@ class FsFile {
return core.isTerminal(this.#rid);
}
- setRaw(mode, options = {}) {
+ setRaw(mode, options = { __proto__: null }) {
const cbreak = !!(options.cbreak ?? false);
op_set_raw(this.#rid, mode, cbreak);
}
@@ -889,7 +889,7 @@ async function readTextFile(path, options) {
function writeFileSync(
path,
data,
- options = {},
+ options = { __proto__: null },
) {
options.signal?.throwIfAborted();
op_fs_write_file_sync(
@@ -905,7 +905,7 @@ function writeFileSync(
async function writeFile(
path,
data,
- options = {},
+ options = { __proto__: null },
) {
let cancelRid;
let abortHandler;
@@ -951,7 +951,7 @@ async function writeFile(
function writeTextFileSync(
path,
data,
- options = {},
+ options = { __proto__: null },
) {
const encoder = new TextEncoder();
return writeFileSync(path, encoder.encode(data), options);
@@ -960,7 +960,7 @@ function writeTextFileSync(
function writeTextFile(
path,
data,
- options = {},
+ options = { __proto__: null },
) {
if (ObjectPrototypeIsPrototypeOf(ReadableStreamPrototype, data)) {
return writeFile(