Skip to content

Commit

Permalink
fix(remix-dev/vite): validate server bundle IDs (#8598)
Browse files Browse the repository at this point in the history
  • Loading branch information
markdalgleish committed Jan 25, 2024
1 parent 656aa29 commit 4651e6a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/remix-dev/vite/build.ts
Expand Up @@ -155,6 +155,11 @@ async function getServerBuilds(ctx: RemixPluginContext): Promise<{
if (typeof serverBundleId !== "string") {
throw new Error(`The "serverBundles" function must return a string`);
}
if (!/^[a-zA-Z0-9-_]+$/.test(serverBundleId)) {
throw new Error(
`The "serverBundles" function must only return strings containing alphanumeric characters, hyphens and underscores.`
);
}
buildManifest.routeIdToServerBundleId[route.id] = serverBundleId;

let relativeServerBundleDirectory = path.relative(
Expand Down

0 comments on commit 4651e6a

Please sign in to comment.