PAB-43: canonicalize API origins and host policy#123
Merged
Conversation
Co-authored-by: multica-agent <github@multica.ai>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Kody Review CompleteGreat news! 🎉 Keep up the excellent work! 🚀 Kody Guide: Usage and ConfigurationInteracting with Kody
Current Kody ConfigurationReview OptionsThe following review options are enabled or disabled:
|
Co-authored-by: multica-agent <github@multica.ai>
Co-authored-by: multica-agent <github@multica.ai>
Co-authored-by: multica-agent <github@multica.ai>
Co-authored-by: multica-agent <github@multica.ai>
…nonical-api-origin Co-authored-by: multica-agent <github@multica.ai> # Conflicts: # backend/src/lib/auth-config.test.ts # backend/src/lib/auth-config.ts # backend/src/pages/api/auth/preview-start.ts # backend/src/pages/api/auth/signin.test.ts # backend/src/pages/api/auth/signin.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR hardens the application’s origin handling by introducing a canonical, strictly validated host policy across all layers (backend, Electron app, smoke tests, and preview environments).
What changed (functionally)
https://www.nvm.fyi, and the machine‑to‑machine API uses the origin‑onlyhttps://api.nvm.fyi. No other hosts (e.g.,nvm.fyi, path‑bearing URLs) are accepted in production or preview contexts.public-originutility parses and validates origins against the expected policy (production web, production API, preview, local, smoke). It rejects paths, query strings, credentials, and non‑expected hosts early, preventing silent misconfigurations.https://nvm.fyi/api/,https://www.nvm.fyi) are automatically migrated to the canonicalhttps://api.nvm.fyi. Environment‑switching and deep‑link handling now validate origins before use.https://www.nvm.fyi.Context
These changes move the project from a set of sometimes‑ambiguous, hard‑coded URLs to a single source of truth for public origins. This reduces operational mistakes (e.g., redirect‑caused OAuth failures, webhook misdelivery) and improves security by eliminating unexpected host usage.