@photostructure/fs-metadata 0.9.0 → 1.0.1

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 CHANGED
@@ -14,6 +14,21 @@ Fixed for any bug fixes.
14
14
  Security in case of vulnerabilities.
15
15
  -->
16
16
 
17
+ ## 1.0.1 - 2026-03-01
18
+
19
+ ### Fixed
20
+
21
+ - `isHidden()` and `getHiddenMetadata()` now return `false` for root directories on all platforms. Windows root drives (e.g. `C:\`) have `FILE_ATTRIBUTE_HIDDEN` set by default as a system quirk, not user intent.
22
+
23
+ ## 1.0.0 - 2026-02-23
24
+
25
+ ### Security
26
+
27
+ - Windows: add `/NXCOMPAT` (DEP) and `/HIGHENTROPYVA` (x64 high-entropy ASLR) linker flags
28
+ - Windows: add `WarningLevel: 4` as structured MSBuild property on x64 and ARM64 targets (avoids `/W` flag ordering conflicts with node-gyp defaults)
29
+ - Linux/macOS: add `-D_FORTIFY_SOURCE=2` and `-Wformat-security` compiler flags
30
+ - Linux x64: add `-fcf-protection=full` (Intel CET); Linux ARM64: add `-mbranch-protection=standard` (PAC+BTI)
31
+
17
32
  ## 0.9.0 - 2025-12-28
18
33
 
19
34
  ### Added
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- ![PhotoStructure fs-metadata logo](https://raw.githubusercontent.com/photostructure/fs-metadata/main/doc/logo.svg)
1
+ <img src="https://raw.githubusercontent.com/photostructure/fs-metadata/main/doc/logo.svg" alt="PhotoStructure fs-metadata logo" width="200">
2
2
 
3
3
  Cross-platform native Node.js module for filesystem metadata, mount points, and volume information. Built for and supported by [PhotoStructure](https://photostructure.com).
4
4
 
@@ -7,7 +7,7 @@ Cross-platform native Node.js module for filesystem metadata, mount points, and
7
7
  [![Node-API v9 Badge](https://raw.githubusercontent.com/nodejs/abi-stable-node/refs/heads/doc/assets/Node-API%20v9%20Badge.svg)](https://nodejs.org/dist/latest/docs/api/n-api.html#node-api-version-matrix)
8
8
  [![View on GitHub](https://img.shields.io/badge/View%20on-GitHub-blue)](https://github.com/photostructure/fs-metadata)
9
9
 
10
- ## Quick Start
10
+ ## Quick start
11
11
 
12
12
  ```bash
13
13
  npm install @photostructure/fs-metadata
@@ -28,14 +28,14 @@ const metadata = await getVolumeMetadata("/");
28
28
  console.log(metadata);
29
29
  ```
30
30
 
31
- ## Key Features
31
+ ## Features
32
32
 
33
- - **Volume Management**: List mount points, get volume metadata, space usage
34
- - **Hidden Files**: Get/set hidden attributes, recursive checks, cross-platform support
33
+ - **Volume management**: List mount points, get volume metadata, space usage
34
+ - **Hidden files**: Get/set hidden attributes, recursive checks, cross-platform support
35
35
  - **Performance**: Non-blocking async operations with timeout protection
36
- - **TypeScript**: Full type definitions with ESM and CommonJS support
36
+ - **TypeScript**: Type definitions with ESM and CommonJS support
37
37
 
38
- ## Supported Platforms
38
+ ## Supported platforms
39
39
 
40
40
  | Platform | Architecture | Node.js | OS Version |
41
41
  | ------------- | ------------ | ------- | ------------------------- |
package/binding.gyp CHANGED
@@ -32,14 +32,32 @@
32
32
  ],
33
33
  "cflags": [
34
34
  "-fPIC",
35
- "-fstack-protector-strong"
35
+ "-fstack-protector-strong",
36
+ "-D_FORTIFY_SOURCE=2",
37
+ "-Wformat-security"
36
38
  ],
37
39
  "cflags_cc": [
38
40
  "-fexceptions",
39
41
  "-fPIC",
40
- "-fstack-protector-strong"
42
+ "-fstack-protector-strong",
43
+ "-D_FORTIFY_SOURCE=2",
44
+ "-Wformat-security"
41
45
  ],
42
46
  "conditions": [
47
+ [
48
+ "target_arch=='x64'",
49
+ {
50
+ "cflags": ["-fcf-protection=full"],
51
+ "cflags_cc": ["-fcf-protection=full"]
52
+ }
53
+ ],
54
+ [
55
+ "target_arch=='arm64'",
56
+ {
57
+ "cflags": ["-mbranch-protection=standard"],
58
+ "cflags_cc": ["-mbranch-protection=standard"]
59
+ }
60
+ ],
43
61
  [
44
62
  "enable_gio=='true'",
45
63
  {
@@ -88,6 +106,7 @@
88
106
  ],
89
107
  "msvs_settings": {
90
108
  "VCCLCompilerTool": {
109
+ "WarningLevel": 4,
91
110
  "AdditionalOptions": [
92
111
  "/Qspectre",
93
112
  "/guard:cf",
@@ -101,6 +120,8 @@
101
120
  "AdditionalOptions": [
102
121
  "/guard:cf",
103
122
  "/DYNAMICBASE",
123
+ "/HIGHENTROPYVA",
124
+ "/NXCOMPAT",
104
125
  "/CETCOMPAT"
105
126
  ]
106
127
  }
@@ -118,6 +139,7 @@
118
139
  ],
119
140
  "msvs_settings": {
120
141
  "VCCLCompilerTool": {
142
+ "WarningLevel": 4,
121
143
  "AdditionalOptions": [
122
144
  "/guard:cf", # Control Flow Guard (supported on ARM64)
123
145
  "/ZH:SHA_256", # SHA-256 hash algorithm for checksums
@@ -133,38 +155,14 @@
133
155
  "VCLinkerTool": {
134
156
  "AdditionalOptions": [
135
157
  "/guard:cf", # Control Flow Guard at link time
136
- "/DYNAMICBASE" # ASLR (Address Space Layout Randomization)
137
- # NOTE: /CETCOMPAT omitted - Intel CET is x64-specific
158
+ "/DYNAMICBASE", # ASLR (Address Space Layout Randomization)
159
+ "/NXCOMPAT" # DEP (Data Execution Prevention)
160
+ # NOTE: /HIGHENTROPYVA and /CETCOMPAT are x64-specific
138
161
  # ARM64 has equivalent hardware security features
139
162
  ]
140
163
  }
141
164
  }
142
165
  }
143
- ],
144
- [
145
- "target_arch=='ia32'",
146
- {
147
- "defines": [
148
- "_M_IX86"
149
- ],
150
- "msvs_settings": {
151
- "VCCLCompilerTool": {
152
- "AdditionalOptions": [
153
- "/guard:cf",
154
- "/ZH:SHA_256",
155
- "/sdl"
156
- ],
157
- "ExceptionHandling": 1,
158
- "RuntimeTypeInfo": "true"
159
- },
160
- "VCLinkerTool": {
161
- "AdditionalOptions": [
162
- "/guard:cf",
163
- "/DYNAMICBASE"
164
- ]
165
- }
166
- }
167
- }
168
166
  ]
169
167
  ]
170
168
  }
@@ -183,17 +181,23 @@
183
181
  "CLANG_CXX_LIBRARY": "libc++",
184
182
  "MACOSX_DEPLOYMENT_TARGET": "10.15",
185
183
  "OTHER_CFLAGS": [
186
- "-fstack-protector-strong"
184
+ "-fstack-protector-strong",
185
+ "-D_FORTIFY_SOURCE=2",
186
+ "-Wformat-security"
187
187
  ]
188
188
  },
189
189
  "cflags": [
190
190
  "-fexceptions",
191
191
  "-fPIC",
192
- "-fstack-protector-strong"
192
+ "-fstack-protector-strong",
193
+ "-D_FORTIFY_SOURCE=2",
194
+ "-Wformat-security"
193
195
  ],
194
196
  "cflags_cc": [
195
197
  "-fexceptions",
196
- "-fstack-protector-strong"
198
+ "-fstack-protector-strong",
199
+ "-D_FORTIFY_SOURCE=2",
200
+ "-Wformat-security"
197
201
  ],
198
202
  "link_settings": {
199
203
  "libraries": [
package/claude.sh CHANGED
@@ -12,7 +12,10 @@ claude --append-system-prompt "$(
12
12
  # MANDATORY GUIDELINES
13
13
  - **Study your CLAUDE.md** - Every conversation begins by studying CLAUDE.md
14
14
  - **Always Start By Reading** - You must study the referenced codebase and related documentation before making any change. NEVER assume APIs or implementation details.
15
- - **Assume Concurrent Edits** - STOP if build errors aren't from your changes
15
+ - **Assume Concurrent Edits** - if you encounter a compilation error that you don't think you caused, **STOP immediately**, do not try to fix it blindly, **describe the error** to the user clearly, and **use AskUserQuestion** with these options:
16
+ - "Build is now fixed, continue"
17
+ - "Please fix the build and then continue"
18
+
16
19
  - **Validate your work** - Does your code compile? Can we clean up compilation warnings? Do the related tests pass?
17
20
  - **Don't use git checkout to undo changes** - Instead, re-apply your diff in reverse. You have to assume that the git tree was not clean when you made edits.
18
21
  - **Ask questions** - If anything is nebulous or unclear, it is IMPERATIVE that you ask clarifying questions to maximize velocity and avoid spurious work.
package/dist/index.cjs CHANGED
@@ -493,6 +493,10 @@ async function isHiddenImpl(pathname, nativeFn2) {
493
493
  throw new Error("Invalid pathname: " + JSON.stringify(pathname));
494
494
  }
495
495
  debug("Normalized path: %s", norm);
496
+ if (isRootDirectory(norm)) {
497
+ debug("Root directory, returning false");
498
+ return false;
499
+ }
496
500
  debug(
497
501
  "LocalSupport: dotPrefix=%s, systemFlag=%s",
498
502
  LocalSupport.dotPrefix,
@@ -565,6 +569,14 @@ async function getHiddenMetadataImpl(pathname, nativeFn2) {
565
569
  if (norm == null) {
566
570
  throw new Error("Invalid pathname: " + JSON.stringify(pathname));
567
571
  }
572
+ if (isRootDirectory(norm)) {
573
+ return {
574
+ hidden: false,
575
+ dotPrefix: false,
576
+ systemFlag: false,
577
+ supported: LocalSupport
578
+ };
579
+ }
568
580
  const dotPrefix = isPosixHidden(norm);
569
581
  const systemFlag = await isSystemHidden(norm, nativeFn2);
570
582
  return {