@remix-run/node 2.17.1 → 2.17.3

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/dist/crypto.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @remix-run/node v2.17.1
2
+ * @remix-run/node v2.17.3
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
package/dist/globals.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @remix-run/node v2.17.1
2
+ * @remix-run/node v2.17.3
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @remix-run/node v2.17.1
2
+ * @remix-run/node v2.17.3
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @remix-run/node v2.17.1
2
+ * @remix-run/node v2.17.3
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -19,5 +19,5 @@ interface FileSessionStorageOptions {
19
19
  * @see https://remix.run/utils/sessions#createfilesessionstorage-node
20
20
  */
21
21
  export declare function createFileSessionStorage<Data = SessionData, FlashData = Data>({ cookie, dir, }: FileSessionStorageOptions): SessionStorage<Data, FlashData>;
22
- export declare function getFile(dir: string, id: string): string;
22
+ export declare function getFile(dir: string, id: string): string | null;
23
23
  export {};
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @remix-run/node v2.17.1
2
+ * @remix-run/node v2.17.3
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -68,6 +68,9 @@ function createFileSessionStorage({
68
68
  let id = Buffer.from(randomBytes).toString("hex");
69
69
  try {
70
70
  let file = getFile(dir, id);
71
+ if (!file) {
72
+ throw new Error("Error generating session");
73
+ }
71
74
  await node_fs.promises.mkdir(path__namespace.dirname(file), {
72
75
  recursive: true
73
76
  });
@@ -84,6 +87,9 @@ function createFileSessionStorage({
84
87
  async readData(id) {
85
88
  try {
86
89
  let file = getFile(dir, id);
90
+ if (!file) {
91
+ return null;
92
+ }
87
93
  let content = JSON.parse(await node_fs.promises.readFile(file, "utf-8"));
88
94
  let data = content.data;
89
95
  let expires = typeof content.expires === "string" ? new Date(content.expires) : null;
@@ -105,6 +111,9 @@ function createFileSessionStorage({
105
111
  expires
106
112
  });
107
113
  let file = getFile(dir, id);
114
+ if (!file) {
115
+ return;
116
+ }
108
117
  await node_fs.promises.mkdir(path__namespace.dirname(file), {
109
118
  recursive: true
110
119
  });
@@ -116,8 +125,12 @@ function createFileSessionStorage({
116
125
  if (!id) {
117
126
  return;
118
127
  }
128
+ let file = getFile(dir, id);
129
+ if (!file) {
130
+ return;
131
+ }
119
132
  try {
120
- await node_fs.promises.unlink(getFile(dir, id));
133
+ await node_fs.promises.unlink(file);
121
134
  } catch (error) {
122
135
  if (error.code !== "ENOENT") throw error;
123
136
  }
@@ -125,6 +138,10 @@ function createFileSessionStorage({
125
138
  });
126
139
  }
127
140
  function getFile(dir, id) {
141
+ if (!/^[0-9a-f]{16}$/i.test(id)) {
142
+ return null;
143
+ }
144
+
128
145
  // Divide the session id up into a directory (first 2 bytes) and filename
129
146
  // (remaining 6 bytes) to reduce the chance of having very large directories,
130
147
  // which should speed up file access. This is a maximum of 2^16 directories,
package/dist/stream.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @remix-run/node v2.17.1
2
+ * @remix-run/node v2.17.3
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @remix-run/node v2.17.1
2
+ * @remix-run/node v2.17.3
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remix-run/node",
3
- "version": "2.17.1",
3
+ "version": "2.17.3",
4
4
  "description": "Node.js platform abstractions for Remix",
5
5
  "bugs": {
6
6
  "url": "https://github.com/remix-run/remix/issues"
@@ -23,7 +23,7 @@
23
23
  "source-map-support": "^0.5.21",
24
24
  "stream-slice": "^0.1.2",
25
25
  "undici": "^6.21.2",
26
- "@remix-run/server-runtime": "2.17.1"
26
+ "@remix-run/server-runtime": "2.17.3"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@types/cookie-signature": "^1.0.3",