fix: Move NCMEC routing of reports to env config#474
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughThis PR centralizes NCMEC test/production endpoint selection under an environment variable, ChangesNCMEC environment-based routing
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
server/iocContainer/index.ts (1)
1127-1256:⚠️ Potential issue | 🟠 Major | ⚡ Quick winWrap this switch clause in braces to avoid lexical declaration hazards.
Line 1205 declares
const isTestdirectly under thecase 'SUBMIT_NCMEC_REPORT':label. This violatesnoSwitchDeclarationsand creates scope hazards. The entire case body contains multiple lexical declarations (lines 1133, 1145, 1152, 1157, 1158, 1205, 1226, 1232) that all require block scope. Wrap the case body in braces.Suggested fix
- case 'SUBMIT_NCMEC_REPORT': + case 'SUBMIT_NCMEC_REPORT': { if (job.payload.kind !== 'NCMEC') { throw new Error( 'Attempting to submit a NCMEC report for a non-NCMEC job', ); } @@ if ( actionAndPolicy != null && actionAndPolicy.actionsToRunIds != null && isNonEmptyArray(decisionActions) && !isTest ) { await publishActions({ decisionActions, policyIds: actionAndPolicy.policyIds, orgId, item: job.payload.item, actorId: reviewerId, actorEmail: reviewerEmail, }); } break; + }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@server/iocContainer/index.ts` around lines 1127 - 1256, The switch case for 'SUBMIT_NCMEC_REPORT' contains multiple lexical declarations (e.g., const itemType, displayName, profilePicUrl, media, createdAt, isTest) and should be wrapped in a block to avoid lexical-declaration hazards; fix by adding braces after the case label and before the corresponding break so the entire case body (the code that builds media via decision.reportedMedia, calls container.getItemTypeEventuallyConsistent, container.NcmecService.submitReport, container.NcmecService.getNCMECActionsToRunAndPolicies, and publishActions) is scoped within { ... }.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/NCMEC.md`:
- Line 32: Fix the broken Markdown in the bullet that starts with **A dedicated
NCMEC manual review queue named "NCMEC Review** by closing the bold and the
quote; update the text so the quoted queue name is properly closed (e.g., change
to **A dedicated NCMEC manual review queue named "NCMEC Review"**:) so the
bullet renders correctly alongside references like NCMEC_ENV.
---
Outside diff comments:
In `@server/iocContainer/index.ts`:
- Around line 1127-1256: The switch case for 'SUBMIT_NCMEC_REPORT' contains
multiple lexical declarations (e.g., const itemType, displayName, profilePicUrl,
media, createdAt, isTest) and should be wrapped in a block to avoid
lexical-declaration hazards; fix by adding braces after the case label and
before the corresponding break so the entire case body (the code that builds
media via decision.reportedMedia, calls
container.getItemTypeEventuallyConsistent, container.NcmecService.submitReport,
container.NcmecService.getNCMECActionsToRunAndPolicies, and publishActions) is
scoped within { ... }.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 01761243-edc0-47d5-9d1a-1c979a4fa95e
📒 Files selected for processing (6)
docs/NCMEC.mdserver/.env.exampleserver/decs.d.tsserver/iocContainer/index.tsserver/services/ncmecService/index.tsserver/services/ncmecService/ncmecService.ts
💤 Files with no reviewable changes (1)
- server/services/ncmecService/index.ts
Context & Requests for Reviewers
Fix bug coming from SaaS era. Move NCMEC routing of reports and display to an env variable to determine whether submissions go to NCMEC's sandbox (
exttest.cybertip.org) or production (report.cybertip.org).Previously, this was gated by a hardcoded allowlist of MRT queue UUIDs in
server/services/ncmecService/ncmecService.ts(ncmecProdQueues). Adding a new tenant required a code change. That doesn't make sense for a self-hosted OSS project each deployment running Coop, not the maintainers, should decide whether their deployment talks to prod.Summary by CodeRabbit
Documentation
Configuration Enhancement