Tighten Camino runtime auth enforcement
This commit is contained in:
@@ -721,6 +721,11 @@ export const serveQuixosPackageRuntime = <
|
|||||||
const port = Number(process.env.QUIXOS_RUNTIME_PORT ?? "0");
|
const port = Number(process.env.QUIXOS_RUNTIME_PORT ?? "0");
|
||||||
const caminoUrl = process.env.CAMINO_URL ?? "http://127.0.0.1:7310";
|
const caminoUrl = process.env.CAMINO_URL ?? "http://127.0.0.1:7310";
|
||||||
const runtimeToken = process.env.CAMINO_RUNTIME_AUTH_TOKEN ?? "";
|
const runtimeToken = process.env.CAMINO_RUNTIME_AUTH_TOKEN ?? "";
|
||||||
|
if (process.env.CAMINO_RUNTIME_AUTH_REQUIRED === "1" && !runtimeToken) {
|
||||||
|
throw new Error(
|
||||||
|
"CAMINO_RUNTIME_AUTH_REQUIRED=1 but CAMINO_RUNTIME_AUTH_TOKEN is missing",
|
||||||
|
);
|
||||||
|
}
|
||||||
const runtimeTokenInterceptor: Interceptor = (next) => async (request) => {
|
const runtimeTokenInterceptor: Interceptor = (next) => async (request) => {
|
||||||
if (runtimeToken) {
|
if (runtimeToken) {
|
||||||
request.header.set("x-camino-runtime-token", runtimeToken);
|
request.header.set("x-camino-runtime-token", runtimeToken);
|
||||||
|
|||||||
Reference in New Issue
Block a user