-
Notifications
You must be signed in to change notification settings - Fork 9
Description
Description
The Daikoku/Otoroshi synchronization job assumes that all entries in a subscription's
customMetadata field are key/value pairs of type String.
When a boolean value is present, the metadata consolidation step fails silently:
the deserialization of customMetadata into Map[String, String] returns None,
falling back to an empty map. As a result, only the metadata defined at the plan level
is synchronized — subscription-specific metadata is lost.
Root Cause
The boolean values are likely introduced by an unchecked return from a WASM script call,
where the output is trusted as-is without type validation.
Impact
- Subscription-level metadata is not synchronized to Otoroshi
- Only plan-level metadata is pushed, leading to incomplete API key configuration in Otoroshi
- No error is raised — the sync appears successful
Steps to Reproduce
- Create a subscription with a WASM script that returns boolean values in its metadata output
- Trigger the Otoroshi sync job
- Observe that subscription-specific metadata is absent from the Otoroshi API key
Expected Behavior
Boolean values in customMetadata should be coerced to their string equivalent
("true" / "false") and included in the synchronization.
Actual Behavior
The entire customMetadata map is discarded when any value is not of type String,
causing silent data loss during sync.
Workaround
Manually update the affected boolean values in the database to their stringified equivalent
via SQL before the next sync cycle.