GreedyBear icon indicating copy to clipboard operation
GreedyBear copied to clipboard

A valid honeypot name, date, makes feed-type statistics return HTTP 500

Open ABHIGYA0205 opened this issue 1 month ago • 2 comments

SensorCreateSerializer accepts honeypot_software="date". Event processing can use this value to create an active Honeypot named date.

On a cache miss, GET /api/statistics/feeds_types builds annotation aliases from active honeypot names. The statistics query first uses date for its time-bucket annotation, so the honeypot annotation conflicts with it and the endpoint returns HTTP 500:

ValueError: The annotation 'date' conflicts with a field on the model.

Reproduction: Create an active Honeypot named date, then request /api/statistics/feeds_types with an empty or invalidated cache. The request is unauthenticated. A valid sensor/event ingestion path can introduce this name; registering a sensor requires an authenticated user with an active APISource.

Expected: HTTP 200, with a date feed-type count (or rejection of the reserved value at ingestion).

Suggested fix: Use safe internal ORM aliases and map those aliases back to honeypot names in the response. Add a regression test for an active Honeypot named date.

Verification note: The actual Django view returned HTTP 500 with an active date Honeypot supplied. The serializer acceptance and event-processing path were checked separately; the full database-backed ingestion flow was not run in that environment.

ABHIGYA0205 avatar Oct 15 '26 14:10 ABHIGYA0205

Hey @ABHIGYA0205 ! Good catch! You want to work on the fix?

regulartim avatar Oct 15 '26 15:10 regulartim

Yes, I’ll take this on. I’ll add a regression test for an active honeypot named date, change the aggregation to use safe internal aliases while preserving the response keys, and run the focused statistics tests. I’ll open a PR against develop using the repository’s PR template and link it here.

ABHIGYA0205 avatar Oct 15 '26 15:10 ABHIGYA0205