fix: validate untrusted project binding IDs

FE
2mo ago
+62-5

Fixes #279.

A committed .insta/project.json or INSTA_PROJECT_ID could supply a value such as ../.., changing the route of a project-scoped API request. Validate project IDs when resolving either input, accepting letters, digits, underscores and hyphens and rejecting malformed bindings with a static diagnostic. Valid IDs, environment-variable precedence and foreign-control-plane handling are preserved.

Scope: shared project bindings and the environment override. No changes to explicit command arguments, org/branch identifiers, or server authorization.

Validation: the new rejection cases fail on the baseline; 53 focused tests pass with the fix, including valid IDs and existing foreign-link behavior. Typecheck, the full 1,993-test suite across 100 files, and whitespace checks passed. Independent review and mutations removing either input guard passed. No formatter/linter scripts are configured; no cloud QA needed for local binding resolution.


Summary by cubic

Validates project IDs from committed .insta/project.json files and the INSTA_PROJECT_ID environment variable so a value like ../.. can no longer change the route of a project-scoped API request.

  • Accepts letters, digits, underscores, and hyphens; rejects malformed bindings with a static diagnostic.
  • Preserves valid IDs, environment-variable precedence, and foreign-control-plane handling.