[Debt] Remove new Function workaround from campaign bulk import #51

Closed
opened 2026-07-11 11:39:43 +02:00 by zemion · 1 comment
Owner

Campaign bulk import uses new Function for a dynamic Node import. The specifier is constant, so this is not user-code execution, but it weakens CSP posture and can require unsafe-eval.

Code path: webui/src/features/campaigns/utils/bulkImport.ts:218.

Acceptance: replace the workaround with a bundler-compatible import path or split browser/node entry points, browser builds do not require unsafe-eval, and existing spreadsheet import tests continue to pass.

Campaign bulk import uses `new Function` for a dynamic Node import. The specifier is constant, so this is not user-code execution, but it weakens CSP posture and can require `unsafe-eval`. Code path: `webui/src/features/campaigns/utils/bulkImport.ts:218`. Acceptance: replace the workaround with a bundler-compatible import path or split browser/node entry points, browser builds do not require `unsafe-eval`, and existing spreadsheet import tests continue to pass. <!-- codex-audit-2026-07-11:campaign-new-function -->
Author
Owner

Codex State: done

Summary

  • Removed the CSP-hostile dynamic new Function import path from campaign XLSX bulk import loading.
  • Kept browser loading on read-excel-file/browser and non-browser fallback on read-excel-file/universal.

Changed Files

  • webui/src/features/campaigns/utils/bulkImport.ts

Verification

  • npm run test:import-utils (passes; existing npm tmp config warning still emitted)
## Codex State: done ### Summary - Removed the CSP-hostile dynamic new Function import path from campaign XLSX bulk import loading. - Kept browser loading on read-excel-file/browser and non-browser fallback on read-excel-file/universal. ### Changed Files - `webui/src/features/campaigns/utils/bulkImport.ts` ### Verification - `npm run test:import-utils (passes; existing npm tmp config warning still emitted)`
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: add-ideas/govoplan-campaign#51
No description provided.