Skip to content

Commit 9bc32ef

Browse files
committed
permission: store resolved path in worker fs allowlist intersection
FilterPathListToParentSubset validated resolved paths but pushed the raw input into the filtered allowlist. Store ResolveForCompare output so the checked and granted strings match. Drop unreachable empty-list fallback gated on w->permission after callers already force permission true. Signed-off-by: yunshingng <yunshingng25@gmail.com>
1 parent 5b2b378 commit 9bc32ef

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

src/node_worker.cc

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -595,10 +595,10 @@ void FilterPathListToParentSubset(Environment* env,
595595
const std::vector<std::string>& parent) {
596596
if (worker == nullptr) return;
597597

598-
// Worker enabled permission but listed no paths → keep empty (restrict).
598+
// Worker listed no fs paths → keep empty (restrict).
599+
// Callers set w->permission = true before this runs, so inheriting the
600+
// parent list via w->permission here is unreachable.
599601
if (worker->empty()) {
600-
if (w->permission || w->permission_audit) return;
601-
*worker = parent;
602602
return;
603603
}
604604

@@ -613,9 +613,11 @@ void FilterPathListToParentSubset(Environment* env,
613613
saw_star = true;
614614
continue;
615615
}
616+
// Store the resolved form validated against the parent, not raw input.
617+
const std::string resolved_wpath = ResolveForCompare(env, wpath);
616618
for (const std::string& entry : parent) {
617619
if (PathCoveredByParentEntry(env, entry, wpath)) {
618-
out.push_back(wpath);
620+
out.push_back(resolved_wpath);
619621
break;
620622
}
621623
}

0 commit comments

Comments
 (0)