fix(modules): harden @use paths (backslash, null byte, '..' folder) #306

Merged
abiwab merged 1 commit from fix/use-path-hardening into main 2026-11-29 09:54:33 +01:00
Owner

Lot 1a of .notes/v1.6/plan-finitions-techniques-1.6.md.

  • validateSpecifier() rejects \ (with a "use forward slashes" hint, checked first so C:\foo.gram gets it) and null bytes, and is now exported from @gram-lang/modules.
  • confine() (CLI and LSP hosts): rel === ".." || rel.startsWith("..${sep}") instead of startsWith(".."), so ..notes/a.gram is no longer a false positive.
  • Tests: Windows absolute paths, inner backslash, null byte, nested traversal, sibling-prefix folder, ..notes folder (CLI + LSP, file: URI).
  • Docs (en/fr): / only in @use paths.
  • Patch changeset on modules, cli, language-server.

The @use … as {…} completion check from the plan is a dev/1.6-only feature: it goes there after main is merged into dev/1.6.

Lot 1a of `.notes/v1.6/plan-finitions-techniques-1.6.md`. - `validateSpecifier()` rejects `\` (with a "use forward slashes" hint, checked first so `C:\foo.gram` gets it) and null bytes, and is now exported from `@gram-lang/modules`. - `confine()` (CLI and LSP hosts): `rel === ".." || rel.startsWith("..${sep}")` instead of `startsWith("..")`, so `..notes/a.gram` is no longer a false positive. - Tests: Windows absolute paths, inner backslash, null byte, nested traversal, sibling-prefix folder, `..notes` folder (CLI + LSP, file: URI). - Docs (en/fr): `/` only in `@use` paths. - Patch changeset on modules, cli, language-server. The `@use … as {…}` completion check from the plan is a `dev/1.6`-only feature: it goes there after `main` is merged into `dev/1.6`.
abiwab merged commit a845b38985 into main 2026-11-29 09:54:33 +01:00
abiwab deleted branch fix/use-path-hardening 2026-11-29 09:54:33 +01:00
Sign in to join this conversation.
No description provided.