Page MenuHomePhabricator

efSchemaValidate permits unrecognized additional fields
Closed, ResolvedPublic

Description

If you add additional fields to your event that aren't in the schema+id you specify, efLogServerSideEvent nevertheless logs the event with isValid: true.

In the same situation client-side logEvent() will log with isValid: false and a warning "Unrecognized property: (bogus field's name)".

Depending on how json2sql handles this, the event won't be inserted in the SQL table, or will generate a set of table columns unsuitable for future events.

To reproduce, just add a "boGUSNewKEY" => 666, to a server-side event in PHP.


Version: unspecified
Severity: normal

Details

Reference
bz44454

Event Timeline

bzimport raised the priority of this task from to Needs Triage.
bzimport set Reference to bz44454.
ori added a comment.Jan 29 2013, 8:03 AM

This is permitted by the JSON Schema draft v3:

5.4. additionalProperties

This attribute defines a schema for all properties that are not
explicitly defined in an object type definition. If specified, the
value MUST be a schema or a boolean. If false is provided, no
additional properties are allowed beyond the properties defined in
the schema. The default value is an empty schema which allows any
value for additional properties.

http://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.4

Nevertheless, this bug is valid, because:

  1. Client-side and server-side validation should behave the same way
  2. A stricter interpretation of the draft in which additional values are disallowed seems sensible.

Merged by Ori on the 29th.

[moving from MediaWiki extensions to Analytics product - see bug 61946]

Restricted Application added a subscriber: StudiesWorld. · View Herald TranscriptJan 28 2016, 6:06 PM