LiviaMedeiros
04d7c7a349
fs: make mutating options in Callback readdir() not affect results
...
PR-URL: https://github.com/nodejs/node/pull/56057
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2025-01-05 13:05:29 -05:00
Rafael Gonzaga
d2007aec28
lib: fix fs.readdir recursive async
...
Fixes: https://github.com/nodejs/node/issues/56006
PR-URL: https://github.com/nodejs/node/pull/56041
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev >
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com >
2025-01-05 12:57:36 -05:00
Gürgün Dayıoğlu
3a55bd9448
fs: lazily load ReadFileContext
...
PR-URL: https://github.com/nodejs/node/pull/55998
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: LiviaMedeiros <livia@cirno.name >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Jason Zhang <xzha4350@gmail.com >
2025-01-05 12:57:30 -05:00
Juan José
0571d5556f
lib: avoid excluding symlinks in recursive fs.readdir with filetypes
...
Fixes: https://github.com/nodejs/node/issues/52663
Signed-off-by: Juan José Arboleda <soyjuanarbol@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/55714
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev >
Reviewed-By: James M Snell <jasnell@gmail.com >
2025-01-05 12:57:26 -05:00
Gürgün Dayıoğlu
cefce4cbb0
lib: remove unnecessary optional chaining
...
PR-URL: https://github.com/nodejs/node/pull/55728
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: LiviaMedeiros <livia@cirno.name >
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
2024-11-27 11:03:33 -05:00
Carlos Espa
0bb5584288
src: add receiver to fast api callback methods
...
When creating an fast api the callback might use the receiver. In that
case if the internal binding is destructured the method won't have
access to the reciver and it will throw. Passing the receiver as second
argument ensures the receiver is available.
PR-URL: https://github.com/nodejs/node/pull/54408
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com >
2024-10-04 19:20:14 +02:00
Jonas
112228c15a
fs: remove unnecessary option argument validation
...
PR-URL: https://github.com/nodejs/node/pull/53958
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
2024-08-14 08:15:00 +02:00
Rafael Gonzaga
8c9a4ae12b
lib,permission: support Buffer to permission.has
...
PR-URL: https://github.com/nodejs/node/pull/54104
Fixes: https://github.com/nodejs/node/issues/54100
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
2024-08-14 08:14:49 +02:00
Jonas
8086337ea9
fs: remove unnecessary option argument validation
...
PR-URL: https://github.com/nodejs/node/pull/53861
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br >
2024-07-28 08:53:28 +02:00
Daniel Bayley
0a01abbd45
lib: refactor platform utility methods
...
PR-URL: https://github.com/nodejs/node/pull/53817
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com >
2024-07-16 12:06:56 +02:00
Yagiz Nizipli
603c2c5c08
fs: fix typings
...
PR-URL: https://github.com/nodejs/node/pull/53626
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2024-07-16 12:01:08 +02:00
RafaelGSS
0a0de3d491
lib,permission: support fs.lstat
...
PR-URL: https://github.com/nodejs-private/node-private/pull/486/
Fixes: https://hackerone.com/bugs?subject=nodejs&report_id=2145862
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
CVE-ID: CVE-2024-22018
2024-07-06 13:30:12 -03:00
RafaelGSS
93574335ff
lib,permission: disable fchmod/fchown when pm enabled
...
PR-URL: https://github.com/nodejs-private/node-private/pull/584
Refs: https://hackerone.com/reports/2472071
CVE-ID: CVE-2024-36137
2024-07-06 13:29:23 -03:00
Yagiz Nizipli and Daniel Lemire
105b006fd2
fs: move ToNamespacedPath to c++
...
Co-Authored-By: Daniel Lemire <daniel@lemire.me >
PR-URL: https://github.com/nodejs/node/pull/52135
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br >
Reviewed-By: Daniel Lemire <daniel@lemire.me >
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2024-06-20 14:45:27 +02:00
Feng Yu
718a3ab1ab
doc: add err param to fs.cp callback
...
PR-URL: https://github.com/nodejs/node/pull/53234
Reviewed-By: LiviaMedeiros <livia@cirno.name >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2024-06-07 10:37:15 -03:00
Feng Yu
d89bde26ff
doc: add err param to fs.copyFile callback
...
PR-URL: https://github.com/nodejs/node/pull/53234
Reviewed-By: LiviaMedeiros <livia@cirno.name >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2024-06-07 10:37:14 -03:00
Antoine du Hamel
d1adc9b140
lib: enforce ASCII order in error code imports
...
PR-URL: https://github.com/nodejs/node/pull/52625
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
2024-04-29 22:46:29 +02:00
Ruy Adorno
f23fa1de72
fs: fix read / readSync positional offset types
...
This changeset fixes the types in comments to match the implementation.
PR-URL: https://github.com/nodejs/node/pull/52603
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io >
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
Reviewed-By: LiviaMedeiros <livia@cirno.name >
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: James M Snell <jasnell@gmail.com >
2024-04-29 22:46:28 +02:00
Tobias Nießen
8c0b723ccb
fs,permission: make handling of buffers consistent
...
Commit 2000c267dd added explicit handling
of Buffers to fs.symlink, but not to fs.symlinkSync or
fs.promises.symlink. This change adapts the latter two functions to
behave like fs.symlink.
Refs: https://github.com/nodejs/node/pull/49156
Refs: https://github.com/nodejs/node/pull/51212
PR-URL: https://github.com/nodejs/node/pull/52348
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com >
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
2024-04-06 07:37:04 +00:00
Yagiz Nizipli
61e5de1268
fs: refactor maybeCallback function
...
PR-URL: https://github.com/nodejs/node/pull/52129
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Paolo Insogna <paolo@cowtech.it >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2024-03-19 18:32:16 +00:00
Yagiz Nizipli
639c096004
fs: validate fd from cpp on fchown
...
PR-URL: https://github.com/nodejs/node/pull/52051
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br >
Reviewed-By: Paolo Insogna <paolo@cowtech.it >
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com >
2024-03-14 02:01:26 +00:00
Yagiz Nizipli
9ac1fe05d7
fs: validate fd from cpp on close
...
PR-URL: https://github.com/nodejs/node/pull/52051
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br >
Reviewed-By: Paolo Insogna <paolo@cowtech.it >
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com >
2024-03-14 02:01:25 +00:00
Yagiz Nizipli
3ec20f25df
fs: validate file mode from cpp
...
PR-URL: https://github.com/nodejs/node/pull/52050
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br >
Reviewed-By: Daniel Lemire <daniel@lemire.me >
Reviewed-By: Paolo Insogna <paolo@cowtech.it >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2024-03-14 01:22:55 +00:00
Moshe Atlow
151d365ad1
fs: expose glob and globSync
...
PR-URL: https://github.com/nodejs/node/pull/51912
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
Reviewed-By: Nitzan Uziely <linkgoron@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2024-03-03 23:15:35 +00:00
Jungku Lee
27d839f468
fs: update jsdoc for filehandle.createWriteStream and appendFile
...
PR-URL: https://github.com/nodejs/node/pull/51494
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Deokjin Kim <deokjin81.kim@gmail.com >
2024-01-20 15:55:00 +00:00
Rafael Gonzaga
22f4482587
fs,test: add URL to string to fs.watch
...
Signed-off-by: RafaelGSS <rafael.nunu@hotmail.com >
PR-URL: https://github.com/nodejs/node/pull/51346
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2024-01-05 00:49:07 +00:00
Yagiz Nizipli
5155238064
fs: add missing jsdoc parameters to readSync
...
PR-URL: https://github.com/nodejs/node/pull/51225
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
2023-12-22 00:09:08 +01:00
Rafael Gonzaga
2000c267dd
lib,permission: handle buffer on fs.symlink
...
PR-URL: https://github.com/nodejs/node/pull/51212
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com >
Reviewed-By: Paolo Insogna <paolo@cowtech.it >
2023-12-21 17:36:13 +00:00
Yagiz Nizipli
202c87222c
fs: improve mkdtemp performance for buffer prefix
...
PR-URL: https://github.com/nodejs/node/pull/51078
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2023-12-20 10:44:12 +00:00
Yagiz Nizipli
65e70bf54e
fs: validate fd synchronously on c++
...
PR-URL: https://github.com/nodejs/node/pull/51027
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2023-12-18 22:06:45 +00:00
Yagiz Nizipli
3551dc07eb
fs: throw fchownSync error from c++
...
PR-URL: https://github.com/nodejs/node/pull/51075
Refs: https://github.com/nodejs/performance/issues/106
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2023-12-12 00:34:47 +00:00
Jungku Lee
42b238ec9a
fs: update params in jsdoc for createReadStream and createWriteStream
...
PR-URL: https://github.com/nodejs/node/pull/51063
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Raz Luvaton <rluvaton@gmail.com >
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
Reviewed-By: Deokjin Kim <deokjin81.kim@gmail.com >
2023-12-07 19:42:45 +00:00
IlyasShabi
27b2ce5ba6
fs: improve error performance of readvSync
...
PR-URL: https://github.com/nodejs/node/pull/50100
Refs: https://github.com/nodejs/performance/issues/106
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2023-12-05 18:31:23 +00:00
Murilo Kakazu
7bfb087727
fs: use default w flag for writeFileSync with utf8 encoding
...
PR-URL: https://github.com/nodejs/node/pull/50990
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io >
2023-12-03 13:49:50 +00:00
Antoine du Hamel
2e458d9736
fs: introduce dirent.parentPath
...
The goal is to replace `dirent.path` using a name that's less likely to
create confusion.
`dirent.path` value has not been stable, moving it to a different
property name should avoid breaking some upgrading user expectations.
PR-URL: https://github.com/nodejs/node/pull/50976
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev >
Reviewed-By: LiviaMedeiros <livia@cirno.name >
2023-12-02 22:49:21 +00:00
CanadaHonk
4466deeb34
fs: add c++ fast path for writeFileSync utf8
...
PR-URL: https://github.com/nodejs/node/pull/49884
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io >
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com >
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2023-11-27 00:01:39 +00:00
CanadaHonk
f11b2061ea
fs: improve error performance for rmdirSync
...
PR-URL: https://github.com/nodejs/node/pull/49846
Refs: https://github.com/nodejs/performance/issues/106
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br >
2023-11-26 19:23:41 +00:00
Jungku Lee
ec79232938
fs: fix to not return for void function
...
PR-URL: https://github.com/nodejs/node/pull/50769
Reviewed-By: Matthew Aitken <maitken033380023@gmail.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Qingyu Deng <i@ayase-lab.com >
2023-11-24 17:47:59 +00:00
CanadaHonk
dd338e3429
fs: replace deprecated path._makeLong in copyFile
...
PR-URL: https://github.com/nodejs/node/pull/50844
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2023-11-23 22:47:36 +00:00
CanadaHonk
ea88a3e1f2
fs: improve error perf of sync lstat+fstat
...
PR-URL: https://github.com/nodejs/node/pull/49868
Refs: https://github.com/nodejs/performance/issues/106
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2023-11-23 00:25:15 +00:00
Tobias Nießen
041d435be9
permission: do not create symlinks if target is relative
...
The permission model's security guarantees fall apart in the presence of
relative symbolic links. When an application attempts to create a
relative symlink, the permission model currently resolves the relative
path into an absolute path based on the process's current working
directory, checks whether the process has the relevant permissions, and
then creates the symlink using the absolute target path. This behavior
is plainly incorrect for two reasons:
1. The target path should never be resolved relative to the current
working directory. If anything, it should be resolved relative to the
symlink's location. (Of course, there is one insane exception to this
rule: on Windows, each process has a current working directory per
drive, and symlinks can be created with a target path relative to the
current working directory of a specific drive. In that case, the
relative path will be resolved relative to the current working
directory for the respective drive, and the symlink will be created
on disk with the resulting absolute path. Other relative symlinks
will be stored as-is.)
2. Silently creating an absolute symlink when the user requested a
relative symlink is wrong. The user may (or may not) rely on the
symlink being relative. For example, npm heavily relies on relative
symbolic links such that node_modules directories can be moved around
without breaking.
Because we don't know the user's intentions, we don't know if creating
an absolute symlink instead of a relative symlink is acceptable. This
patch prevents the faulty behavior by not (incorrectly) resolving
relative symlink targets when the permission model is enabled, and by
instead simply refusing the create any relative symlinks.
The fs APIs accept Uint8Array objects for paths to be able to handle
arbitrary file name charsets, however, checking whether such an object
represents a relative part in a reliable and portable manner is tricky.
Other parts of the permission model incorrectly convert such objects to
strings and then back to an Uint8Array (see 1f64147eb6 ),
however, for now, this bug fix will simply throw on non-string symlink
targets when the permission model is enabled. (The permission model
already breaks existing applications in various ways, so this shouldn't
be too dramatic.)
PR-URL: https://github.com/nodejs/node/pull/49156
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com >
Reviewed-By: Michael Dawson <midawson@redhat.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2023-11-22 17:30:36 +00:00
Aras Abbasi
83e6350b82
errors: improve hideStackFrames
...
PR-URL: https://github.com/nodejs/node/pull/49990
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2023-11-11 16:25:08 +00:00
Jungku Lee
63494a92b0
fs: update param in jsdoc for readdir
...
PR-URL: https://github.com/nodejs/node/pull/50448
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Deokjin Kim <deokjin81.kim@gmail.com >
2023-10-30 15:51:07 +00:00
Jungku Lee
506858bf13
fs: improve error performance for readSync
...
PR-URL: https://github.com/nodejs/node/pull/50033
Refs: https://github.com/nodejs/performance/issues/106
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2023-10-21 02:00:00 +00:00
Jungku Lee
fbd08ec4f3
fs: improve error performance for fsyncSync
...
PR-URL: https://github.com/nodejs/node/pull/49880
Refs: https://github.com/nodejs/performance/issues/106
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2023-10-20 23:39:14 +00:00
CanadaHonk
c37cf1832c
fs: improve error performance for mkdirSync
...
PR-URL: https://github.com/nodejs/node/pull/49847
Refs: https://github.com/nodejs/performance/issues/106
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2023-10-20 23:39:03 +00:00
Yagiz Nizipli
1a5db6f173
fs: improve error performance of realpathSync
...
PR-URL: https://github.com/nodejs/node/pull/49962
Refs: https://github.com/nodejs/performance/issues/106
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com >
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br >
2023-10-18 15:56:27 +00:00
Yagiz Nizipli
5f0276d7a0
fs: improve error performance of lchownSync
...
PR-URL: https://github.com/nodejs/node/pull/49962
Refs: https://github.com/nodejs/performance/issues/106
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com >
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br >
2023-10-18 15:56:26 +00:00
Yagiz Nizipli
449dc45691
fs: improve error performance of symlinkSync
...
PR-URL: https://github.com/nodejs/node/pull/49962
Refs: https://github.com/nodejs/performance/issues/106
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com >
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br >
2023-10-18 15:56:25 +00:00
Yagiz Nizipli
7603bf5b81
fs: improve error performance of readlinkSync
...
PR-URL: https://github.com/nodejs/node/pull/49962
Refs: https://github.com/nodejs/performance/issues/106
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com >
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br >
2023-10-18 15:56:24 +00:00