You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Metadata export: ValueError message returned to anonymous users (CodeQL information exposure) #240
What: In api/views/metadata_export.py:49, except ValueError as exc wraps the whole export_dataset() call and returns str(exc) with a 400. CodeQL flags this as information exposure through an exception (raised on #239). Why it matters: The endpoint is public. Any internal ValueError (from the crosswalk, date handling or rdflib) reaches an anonymous user verbatim and is reported as a client error instead of a 500. Evidence: Only the 2 ValueErrors at exporter.py:106-113 (unknown standard / format) are meant for users. Fix: Not fixed yet. Validate standard/fmt against crosswalk.standard_ids() / allowed_formats() before the try, and return a fixed message plus export_options(). Let every other exception fall through to the existing generic 500 handler. test_api_018's 400 test still passes.
Fix: Merged into dev in #245. The view now checks standard and format against export_options() before exporting and returns a fixed 400 message with the options. The except ValueError that returned str(exc) is removed, so every other error falls to the logged generic 500. No migration. Check after deploy:GET /api/datasets/<uuid>/export/?standard=xyz should return {"error": "Unknown standard", "options": …} with 400, without the input echoed back.
Activity
fix(api): stop returning exception text from metadata export
anantjain341 commentedon Oct 12, 2026
Fix: Merged into
devin #245. The view now checksstandardandformatagainstexport_options()before exporting and returns a fixed 400 message with the options. Theexcept ValueErrorthat returnedstr(exc)is removed, so every other error falls to the logged generic 500. No migration.Check after deploy:
GET /api/datasets/<uuid>/export/?standard=xyzshould return{"error": "Unknown standard", "options": …}with 400, without the input echoed back.Moving to Ready to test.