feat(myopencre): gate MyOpenCRE behind deployment capability flag#700
feat(myopencre): gate MyOpenCRE behind deployment capability flag#700PRAteek-singHWY wants to merge 24 commits intoOWASP:mainfrom
Conversation
- Validate file type, encoding, and required headers - Accept CSVs generated from CRE catalogue export - Skip empty and padding rows present in exported templates - Validate CRE format only when CRE references exist - Guard against misaligned rows with extra columns - Return structured validation errors before import This keeps the importer aligned with the exporter while preventing malformed inputs from causing server errors.
… header error handling
|
Hi @northdpole 👋 I’ve implemented the backend capability-gating we discussed for MyOpenCRE. The feature is now deployment-scoped via ENABLE_MYOPENCRE and disabled by default — when off, MyOpenCRE routes return 404 and no CSV parsing, DB writes, embeddings, or gap analysis can be triggered. I also added a small /api/capabilities endpoint so the frontend can rely on backend-provided signals rather than assumptions. This keeps MyOpenCRE strictly self-hosted/admin-only unless explicitly enabled and avoids any accidental exposure on opencre.org. Would appreciate a quick review whenever you have time, mainly to confirm this matches the direction you had in mind. |
Summary
This PR introduces deployment-level capability gating for MyOpenCRE.
It is stacked on top of the existing MyOpenCRE no-op / CSV UX work (starting from #684).
This PR intentionally focuses only on backend capability control, not UI behavior.
MyOpenCRE is intended for self-hosted / admin-controlled OpenCRE deployments.
This change ensures the feature is completely unavailable on opencre.org unless explicitly enabled by the deployment owner.
What changed
ENABLE_MYOPENCRE/api/capabilitiesWhen
ENABLE_MYOPENCREis disabled:404Why
MyOpenCRE performs heavyweight operations (CSV parsing, graph writes, embeddings generation, gap analysis).
These are appropriate for self-hosted or admin-managed environments, but not for public opencre.org usage.
This change ensures:
Testing
ENABLE_MYOPENCRE=false(default)GET /api/capabilities→{ "myopencre": false }/rest/v1/cre_csv→404/rest/v1/cre_csv_import→404ENABLE_MYOPENCRE=trueGET /api/capabilities→{ "myopencre": true }Stacking / Follow-ups
This PR is logically stacked on top of #684 (no-op CSV handling).
Subsequent UI-focused PRs (#685 preview, #686 help guide) will be rebased onto
mainafter this PR is merged, as they depend on this backend capability signal.Next step:
A follow-up PR will update the frontend to consume /api/capabilities and conditionally expose or hide MyOpenCRE UI based on backend-provided capability signals.