@photostructure/fs-metadata 1.2.0 → 1.3.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.
- package/CHANGELOG.md +6 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -2
- package/dist/index.d.mts +14 -2
- package/dist/index.d.ts +14 -2
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/doc/SECURITY_AUDIT_2026.md +1 -0
- package/package.json +1 -1
- package/prebuilds/darwin-arm64/@photostructure+fs-metadata.glibc.node +0 -0
- package/prebuilds/darwin-x64/@photostructure+fs-metadata.glibc.node +0 -0
- package/prebuilds/win32-arm64/@photostructure+fs-metadata.glibc.node +0 -0
- package/prebuilds/win32-x64/@photostructure+fs-metadata.glibc.node +0 -0
- package/src/index.ts +6 -2
- package/src/types/options.ts +14 -0
- package/src/volume_metadata.ts +6 -4
|
@@ -190,6 +190,7 @@ A caller could theoretically provide a malicious pattern causing ReDoS.
|
|
|
190
190
|
**Files**: `src/windows/volume_mount_points.cpp`, `src/windows/volume_metadata.cpp`, `src/windows/system_volume.h`
|
|
191
191
|
|
|
192
192
|
**Issue**: `GetVolumeInformationW` was called redundantly:
|
|
193
|
+
|
|
193
194
|
- In `volume_mount_points.cpp`: once for `fstype`/`isReadOnly`, then again inside `IsSystemVolume()`
|
|
194
195
|
- In `volume_metadata.cpp`: `IsSystemVolume()` queried the API, then `VolumeInfo` queried it again 5 lines later
|
|
195
196
|
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/src/index.ts
CHANGED
|
@@ -122,7 +122,9 @@ export function getVolumeMetadata(
|
|
|
122
122
|
*/
|
|
123
123
|
export function getVolumeMetadataForPath(
|
|
124
124
|
pathname: string,
|
|
125
|
-
opts?: Partial<
|
|
125
|
+
opts?: Partial<
|
|
126
|
+
Pick<Options, "timeoutMs" | "linuxMountTablePaths" | "mountPoints">
|
|
127
|
+
>,
|
|
126
128
|
): Promise<VolumeMetadata> {
|
|
127
129
|
return getVolumeMetadataForPathImpl(
|
|
128
130
|
pathname,
|
|
@@ -148,7 +150,9 @@ export function getVolumeMetadataForPath(
|
|
|
148
150
|
*/
|
|
149
151
|
export function getMountPointForPath(
|
|
150
152
|
pathname: string,
|
|
151
|
-
opts?: Partial<
|
|
153
|
+
opts?: Partial<
|
|
154
|
+
Pick<Options, "timeoutMs" | "linuxMountTablePaths" | "mountPoints">
|
|
155
|
+
>,
|
|
152
156
|
): Promise<string> {
|
|
153
157
|
return getMountPointForPathImpl(
|
|
154
158
|
pathname,
|
package/src/types/options.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
// src/types/options.ts
|
|
2
2
|
|
|
3
|
+
import type { MountPoint } from "./mount_point";
|
|
4
|
+
|
|
3
5
|
/**
|
|
4
6
|
* Configuration options for filesystem operations.
|
|
5
7
|
*
|
|
@@ -7,6 +9,18 @@
|
|
|
7
9
|
* @see {@link OptionsDefault} for the default values
|
|
8
10
|
*/
|
|
9
11
|
export interface Options {
|
|
12
|
+
/**
|
|
13
|
+
* Pre-fetched mount points to use instead of querying the system.
|
|
14
|
+
*
|
|
15
|
+
* When provided, functions like {@link getMountPointForPath} and
|
|
16
|
+
* {@link getVolumeMetadataForPath} will use these mount points for device ID
|
|
17
|
+
* matching instead of calling {@link getVolumeMountPoints} internally. This
|
|
18
|
+
* avoids redundant system queries when resolving multiple paths.
|
|
19
|
+
*
|
|
20
|
+
* Obtain via `getVolumeMountPoints({ includeSystemVolumes: true })` — system
|
|
21
|
+
* volumes must be included for device ID matching to work correctly.
|
|
22
|
+
*/
|
|
23
|
+
mountPoints?: MountPoint[];
|
|
10
24
|
/**
|
|
11
25
|
* Timeout in milliseconds for filesystem operations.
|
|
12
26
|
*
|
package/src/volume_metadata.ts
CHANGED
|
@@ -235,10 +235,12 @@ export async function findMountPointByDeviceId(
|
|
|
235
235
|
nativeFn: NativeBindingsFn,
|
|
236
236
|
): Promise<string> {
|
|
237
237
|
const targetDev = resolvedStat.dev;
|
|
238
|
-
const mountPoints =
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
238
|
+
const mountPoints =
|
|
239
|
+
opts.mountPoints ??
|
|
240
|
+
(await getVolumeMountPointsImpl(
|
|
241
|
+
{ ...opts, includeSystemVolumes: true },
|
|
242
|
+
nativeFn,
|
|
243
|
+
));
|
|
242
244
|
|
|
243
245
|
const prefixMatches: string[] = [];
|
|
244
246
|
const deviceMatches: string[] = [];
|