@mandujs/core 0.54.26 → 0.54.27
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/package.json
CHANGED
|
@@ -174,11 +174,22 @@ export class SourceContextProvider {
|
|
|
174
174
|
* 안전한 경로 확인 (Path Traversal 방지)
|
|
175
175
|
*/
|
|
176
176
|
private resolveSafePath(file: string): string | null {
|
|
177
|
+
// Reject absolute inputs outright: path.resolve(root, "/etc/passwd")
|
|
178
|
+
// returns "/etc/passwd", escaping the project root.
|
|
179
|
+
if (path.isAbsolute(file)) {
|
|
180
|
+
return null;
|
|
181
|
+
}
|
|
182
|
+
|
|
177
183
|
const absolutePath = path.resolve(this.options.projectRoot, file);
|
|
178
184
|
const normalizedRoot = path.normalize(this.options.projectRoot);
|
|
179
|
-
|
|
180
|
-
//
|
|
181
|
-
|
|
185
|
+
// Compare with a trailing separator so a sibling sharing the root's
|
|
186
|
+
// prefix (e.g. "/app/project-secrets" vs root "/app/project") is NOT
|
|
187
|
+
// treated as inside the root. Allow the root itself.
|
|
188
|
+
const rootWithSep = normalizedRoot.endsWith(path.sep)
|
|
189
|
+
? normalizedRoot
|
|
190
|
+
: normalizedRoot + path.sep;
|
|
191
|
+
|
|
192
|
+
if (absolutePath !== normalizedRoot && !absolutePath.startsWith(rootWithSep)) {
|
|
182
193
|
return null;
|
|
183
194
|
}
|
|
184
195
|
|
|
@@ -245,6 +245,8 @@ export class WorkerManager {
|
|
|
245
245
|
{ source: '[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\\\.[a-zA-Z]{2,}', label: 'EMAIL' },
|
|
246
246
|
{ source: '\\\\+?[1-9]\\\\d{1,14}', label: 'PHONE' },
|
|
247
247
|
{ source: '\\\\b(?:\\\\d{1,3}\\\\.){3}\\\\d{1,3}\\\\b', label: 'IP' },
|
|
248
|
+
{ source: '\\\\b(?:\\\\d{4}[- ]?){3}\\\\d{4}\\\\b', label: 'CARD' },
|
|
249
|
+
{ source: '\\\\b\\\\d{3}-\\\\d{2}-\\\\d{4}\\\\b', label: 'SSN' },
|
|
248
250
|
];
|
|
249
251
|
|
|
250
252
|
function applyPattern(text, pattern) {
|