-
Notifications
You must be signed in to change notification settings - Fork 0
observability(server): say when a request loses its project config #3457
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| import { getBaseLogger } from "#veryfront/utils"; | ||
| import { getHostEnv } from "#veryfront/platform/compat/process.ts"; | ||
| import type { VeryfrontConfig } from "#veryfront/config"; | ||
| import { prepareDeclarativeConfigContext } from "#veryfront/config/declarative-evaluator.ts"; | ||
|
|
@@ -17,6 +18,8 @@ import { buildHandlerContext } from "./handler-context-builder.ts"; | |
| import { extractRequestHeaders, resolveProject } from "./project-resolution.ts"; | ||
| import { shouldSkipEnrichedContext } from "./request-utils.ts"; | ||
|
|
||
| const logger = getBaseLogger("SERVER").component("project-runtime-context"); | ||
|
|
||
| type ProxyTrustVerifier = (req: Request) => Promise<boolean>; | ||
|
|
||
| export interface PrepareProjectRequestInput { | ||
|
|
@@ -322,6 +325,32 @@ export async function resolveProjectRuntimeContext( | |
| }) | ||
| : undefined; | ||
|
|
||
| // Falling back here substitutes the process-wide security config for the | ||
| // project's, which serves a 200 whose CSP is the platform floor rather than | ||
| // the project's policy. The response looks correct, so nothing downstream | ||
| // can notice. Record it where the substitution happens, with the branch that | ||
| // produced the absent config, so an intermittent config-resolution failure | ||
| // is legible from logs instead of only from diffing served headers. | ||
| // | ||
| // `deferred` is excluded: those control-plane endpoints authenticate a | ||
| // signed operation envelope and expose no browser surface, so a config-less | ||
| // security context is their intended shape, not a degradation. | ||
| if ( | ||
| input.isProxyMode && requestSecurity === undefined && | ||
| adapterRes.configOutcome !== "deferred" | ||
| ) { | ||
| logger.warn("No project config for this request; serving platform-default security headers", { | ||
| projectSlug: projectRes.projectSlug, | ||
| projectId: projectRes.projectId, | ||
| configOutcome: adapterRes.configOutcome, | ||
| releaseId: envRes.releaseId ?? null, | ||
| branch: reqCtx.branch ?? null, | ||
| environmentName: projectRes.environmentName ?? null, | ||
| resolvedEnvironment: envRes.resolvedEnvironment ?? null, | ||
| pathname: input.url.pathname, | ||
|
Comment on lines
+342
to
+350
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win Remove raw project and request metadata from both warnings. Both warning paths log tenant identifiers and request-derived values. These values can contain customer data or private infrastructure details. Use redacted values or an approved correlation identifier.
📍 Affects 2 files
🤖 Prompt for AI AgentsSource: Coding guidelines |
||
| }); | ||
| } | ||
|
|
||
| const handlerContext = buildHandlerContext({ | ||
| projectDir: adapterRes.projectDir, | ||
| adapter: adapterRes.adapter, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.