fix(lsp): address codex review round 3

Final review pass on the local provider:
- Tear the instance down when `initialize` REJECTS (utf-8 negotiation, malformed
  result), not only on abort, so a permanently-rejecting `ready` is never pooled.
- Use the group-aware SIGKILL on a framing failure so helpers are reached.
- Validate maxMessageBytes and maxDocumentBytes positive at load alongside the
  other byte caps.
- Fix the location renderer's outside-workspace check to match a `..` segment
  exactly, so an in-workspace path like `..generated/a.ts` stays relative.
- Document the accepted ancestor-directory symlink-swap TOCTOU under the
  trusted-host model (O_NOFOLLOW guards only the final component).
This commit is contained in:
Dudu-0223
2026-07-16 14:17:21 +08:00
parent 0f3f0efd9c
commit 43d419ac5c
7 changed files with 35 additions and 11 deletions
+3 -1
View File
@@ -137,7 +137,9 @@ export function renderUri(uri: string, workspaceRoot: string): string {
}
const rel = relative(workspaceRoot, absolute)
if (rel === '') return '.'
const outside = rel.startsWith('..') || isAbsolute(rel)
// A leading `..` SEGMENT (or an absolute rel) means outside the workspace; guard against a false
// positive on an in-workspace path whose first component merely starts with dots (e.g. `..gen/x`).
const outside = rel === '..' || rel.startsWith(`..${sep}`) || isAbsolute(rel)
return outside ? absolute : rel.split(sep).join('/')
}