Open Bug 1249925 Opened 4 years ago Updated 3 years ago

Validate Telemetry pings against schema in tests

Categories

(Toolkit :: Telemetry, defect, P4)

defect
Points:
3

Tracking

()

People

(Reporter: gfritzsche, Unassigned)

References

Details

(Whiteboard: [measurement:client] [data-integrity])

Attachments

(1 file)

No description provided.
The pipeline is starting to validate incoming pings against schemas defined here:
https://github.com/mozilla-services/mozilla-pipeline-schemas/

This patch hacks in initial support for validating pings against the main ping schema (from the current state in [0]).
This drops in JJV [1] for the validation code for now, i wonder if we have anything usable in-tree already.
The only thing i could find so far is Schemas.jsm [2], but this doesn't provide stand-alone schema validation and seems a bit tightly coupled with the extensions code.

0: https://github.com/mozilla-services/mozilla-pipeline-schemas/pull/1
1: https://github.com/acornejo/jjv/blob/master/lib/jjv.js
2: https://dxr.mozilla.org/mozilla-central/source/toolkit/components/extensions/Schemas.jsm
Points: --- → 3
Priority: -- → P2
Whiteboard: [measurement:client]
Dropping this temporarily until the mozilla-pipeline-schemas PRs are settled.
Assignee: gfritzsche → nobody
Status: ASSIGNED → NEW
Priority: P2 → P3
Whiteboard: [measurement:client] → [sync-data-integrity]
Georg: I've been working on doing this in the context of a sync telemetry ping, and I've tried a number of the json-schema validation libraries. 

Most are currently unmaintained, and have a number of bugs, and/or fail to validate against the existing telemetry ping schemas. 

As far as I can tell, https://github.com/epoberezkin/ajv is the most actively maintained one (and the one I'm planning on using for sync), but it has the downside that it compiles code on the fly (e.g. using `new Function`), which could be a security concern (although probably not?).  

For sync, any security concern doesn't even really matter since we'd be using it only for the test code, but since we'd like to avoid potential duplication of work/libraries in the case that the rest of the telemetry code wants to do something similar, :markh suggested I run this by you.
Flags: needinfo?(gfritzsche)
I don't think we would ever use that outside of tests, so security or performance of the validation library would not be a concern for me.
If we find one that's usable and can get it into the tree, that is great!
Do you have a bug on that that i could follow?
Flags: needinfo?(gfritzsche)
Whiteboard: [sync-data-integrity] → [measurement:client] [sync-data-integrity]
Awesome, and it's going to be rolled up into bug 1267919.
Whiteboard: [measurement:client] [sync-data-integrity] → [measurement:client] [data-integrity]
Priority: P3 → P4
You need to log in before you can comment on or make changes to this bug.