| Server IP : 159.203.156.69 / Your IP : 216.73.216.37 Web Server : nginx/1.24.0 System : Linux main-ubuntu 6.8.0-71-generic #71-Ubuntu SMP PREEMPT_DYNAMIC Tue Jul 22 16:52:38 UTC 2025 x86_64 User : root ( 0) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/tanviranik.com/node_modules/vinext/dist/server/ |
Upload File : |
//#region src/server/dev-origin-check.d.ts
/**
* Cross-origin request protection for the dev server.
*
* Prevents external websites from making cross-origin requests to the
* local dev server and reading the responses (data exfiltration).
*
* Vite 7 provides built-in CORS and WebSocket origin protection, but
* vinext overrides Vite's CORS config to allow OPTIONS passthrough.
* This module adds origin verification to vinext's own request handlers.
*/
/**
* Check if a request origin is allowed for dev server access.
*
* Returns true if the request should be allowed, false if it should be blocked.
*
* Allowed origins:
* - Requests with no Origin header (same-origin navigations, curl, etc.)
* - Requests from localhost, 127.0.0.1, or [::1] (any port)
* - Requests from any subdomain of localhost (e.g., foo.localhost)
* - Requests where Origin hostname matches the Host header
* - Requests from origins in the allowedDevOrigins list
*
* @param origin - The Origin header value (may be null/undefined)
* @param host - The Host header value for same-origin comparison
* @param allowedDevOrigins - Additional allowed origins from config
*/
declare function isAllowedDevOrigin(origin: string | null | undefined, host: string | null | undefined, allowedDevOrigins?: string[]): boolean;
/**
* Check if a cross-origin request should be blocked based on Sec-Fetch headers.
*
* Browsers set `Sec-Fetch-Site: cross-site` and `Sec-Fetch-Mode: no-cors` on
* requests from <script>, <img>, <link> tags on a different origin. These
* requests don't include an Origin header but can still exfiltrate data via
* script execution or timing side channels.
*
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Sec-Fetch-Site
*/
declare function isCrossSiteNoCorsRequest(secFetchSite: string | null | undefined, secFetchMode: string | null | undefined): boolean;
/**
* Validate a dev server request from a Node.js IncomingMessage.
*
* Returns null if the request is allowed, or a reason string if it should be blocked.
* This is used by the Pages Router connect middleware.
*/
declare function validateDevRequest(headers: {
origin?: string;
host?: string;
"x-forwarded-host"?: string;
"sec-fetch-site"?: string;
"sec-fetch-mode"?: string;
}, allowedDevOrigins?: string[]): string | null;
/**
* Generate JavaScript code for origin validation in the App Router RSC entry.
*
* The App Router handler runs in the RSC Vite environment where requests are
* Web API Request objects (not Node.js IncomingMessage). This generates inline
* code that performs the same checks as validateDevRequest().
*/
declare function generateDevOriginCheckCode(allowedDevOrigins?: string[]): string;
//#endregion
export { generateDevOriginCheckCode, isAllowedDevOrigin, isCrossSiteNoCorsRequest, validateDevRequest };
//# sourceMappingURL=dev-origin-check.d.ts.map