Conversation
|
🚅 Deployed to the rivet-pr-4297 environment in rivet-frontend
|
How to use the Graphite Merge QueueAdd the label merge-queue to this PR to add it to the merge queue. You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
PR Review: fix: inspector dev envSummaryThis PR refactors two files to use the isDev() helper instead of direct getNodeEnv() === "development" comparisons, and includes minor code formatting improvements. The intent is clearly to consolidate environment detection logic, which is a good goal. However, there is a security-relevant semantic change that needs attention before merging. Security Concern: Behavior Change with Unset NODE_ENVThe core issue is that isDev() and getNodeEnv() === "development" are not equivalent: // env-vars.ts
export const isDev = (): boolean => getNodeEnv() \!== "production";
In manager/router.ts, the affected guard is: if (\!isDev()) {
if (\!config.token) {
throw new RestrictedFeature("KV store access");
}
// token verification ...
}Before this PR: if NODE_ENV was not set, getNodeEnv() !== "development" was true, so the KV store access token check was enforced. After this PR: if NODE_ENV is not set, !isDev() is false, so the KV store access token check is skipped. A deployment that does not explicitly set NODE_ENV=production would silently skip auth enforcement on the KV store endpoints. The same semantic shift applies to the inspector auth bypass in actor/router.ts, though that one is lower risk since it only skips a warning log and auth when the token is also absent. Recommendation: Either update the security gates to use a stricter check, or introduce a dedicated isProd() helper: // Option: introduce isProd() to be explicit in security gates
export const isProd = (): boolean => getNodeEnv() === "production";
// Then use:
if (\!isProd()) { /* warn in dev */ }
if (isProd()) { /* enforce auth */ }Non-Security ObservationsImport reorganization - Moving RegistryConfig between import blocks and replacing getNodeEnv with isDev is clean and consistent with the rest of the codebase where isDev is already the standard helper. Code formatting - The ternary and method-chain reformatting improves readability with no functional change. PR DescriptionThe PR checklist is entirely unchecked, with no description of what was changed, why, or how it was tested. Given the subtle behavioral difference above, a brief explanation of intent would help reviewers assess whether the semantic shift is intentional. VerdictThe formatting and import changes are fine. The security gate change in manager/router.ts needs a decision: is the new "unset = dev" behavior intentional? If so, document it and confirm it will not affect real deployments. If not, revert those two specific guard conditions to the stricter form. |

Description
Please include a summary of the changes and the related issue. Please also include relevant motivation and context.
Type of change
How Has This Been Tested?
Please describe the tests that you ran to verify your changes.
Checklist: