Switch enterprise policies to the vendored cfworker schema in the tree
Categories
(Firefox :: Enterprise Policies, task)
Tracking
()
People
(Reporter: mkaply, Assigned: mkaply)
References
Details
Attachments
(8 external files, 4 obsolete files)
We currently uses a custom schema validator which makes things a little painful when using our schema in other places.
Want to switch to a standard schema (already in the tree).
| Assignee | ||
Comment 1•5 months ago
|
||
Thin enterprise-local wrapper around the compliant validator in
JsonSchema.sys.mjs (vendored @cfworker/json-schema). It delegates
structural validation to that validator and reproduces the
policy-specific coercion the legacy JsonSchemaValidator provided:
0/1 to boolean, JSON-string parsing, URL/origin objects, and lenient
origin arrays. No consumers yet.
| Assignee | ||
Comment 2•5 months ago
|
||
Rewrites the custom schema types (URL, URLorEmpty, origin, JSON) in
policies-schema.json to standard JSON Schema plus annotation keywords
the validator ignores (x-moz-format, contentMediaType,
x-moz-drop-invalid-items), and switches EnterprisePoliciesParent to
PolicySchemaValidator.
Behavior is preserved, including several quirks of the legacy validator:
boolean fields that are also numeric keep their 0/1 integer value;
URL/origin failures log the same messages; DisplayBookmarksToolbar and
DisplayMenuBar accept a boolean or an enumerated string (now via anyOf,
since the legacy validator skipped enum checks for booleans); and
SecurityDevices keeps accepting both its flat name-to-path form and the
Add/Delete form (its catch-all patternProperties now excludes Add and
Delete so they do not collide under the compliant validator's combined
properties + patternProperties semantics).
| Assignee | ||
Comment 3•5 months ago
|
||
The documentation tab dumps the policy schema verbatim. Convert it
back to its pre-migration presentation (URL/URLorEmpty/origin/JSON,
strict, and boolean-or-enum types) so the internal x-moz-* and
contentMediaType keywords introduced by the migration do not leak
into the admin-facing view.
| Assignee | ||
Comment 4•5 months ago
|
||
macOS delivers booleans as 0/1 integers (NSNumber) and nests via
unflattened keys; no existing policy-engine test exercises those value
shapes against the validator. This validates representative macOS-shaped
values (integer booleans, nested objects, origin arrays) against the real
schema, guarding the coercion the macOS path depends on. It is
platform-independent (the macOS-only parser/reader are covered by
test_macosparser_unflatten.js and by manual config-profile testing).
| Assignee | ||
Comment 5•5 months ago
|
||
Thin enterprise-local wrapper around the compliant validator in
JsonSchema.sys.mjs (vendored @cfworker/json-schema). It delegates
structural validation to that validator and reproduces the
policy-specific coercion the legacy JsonSchemaValidator provided:
0/1 to boolean, JSON-string parsing, URL/origin objects, and lenient
origin arrays. No consumers yet.
| Assignee | ||
Comment 6•5 months ago
|
||
Rewrites the custom schema types (URL, URLorEmpty, origin, JSON) in
policies-schema.json to standard JSON Schema plus annotation keywords
the validator ignores (x-moz-format, contentMediaType,
x-moz-drop-invalid-items), and switches EnterprisePoliciesParent to
PolicySchemaValidator.
Behavior is preserved, including several quirks of the legacy validator:
boolean fields that are also numeric keep their 0/1 integer value;
URL/origin failures log the same messages; DisplayBookmarksToolbar and
DisplayMenuBar accept a boolean or an enumerated string (now via anyOf,
since the legacy validator skipped enum checks for booleans); and
SecurityDevices keeps accepting both its flat name-to-path form and the
Add/Delete form (its catch-all patternProperties now excludes Add and
Delete so they do not collide under the compliant validator's combined
properties + patternProperties semantics).
| Assignee | ||
Comment 7•5 months ago
|
||
The documentation tab dumps the policy schema verbatim. Convert it
back to its pre-migration presentation (URL/URLorEmpty/origin/JSON,
strict, and boolean-or-enum types) so the internal x-moz-* and
contentMediaType keywords introduced by the migration do not leak
into the admin-facing view.
| Assignee | ||
Comment 8•5 months ago
|
||
macOS delivers booleans as 0/1 integers (NSNumber) and nests via
unflattened keys; no existing policy-engine test exercises those value
shapes against the validator. This validates representative macOS-shaped
values (integer booleans, nested objects, origin arrays) against the real
schema, guarding the coercion the macOS path depends on. It is
platform-independent (the macOS-only parser/reader are covered by
test_macosparser_unflatten.js and by manual config-profile testing).
Updated•5 months ago
|
Updated•5 months ago
|
Updated•5 months ago
|
Updated•5 months ago
|
Updated•5 months ago
|
Updated•5 months ago
|
Updated•5 months ago
|
Updated•5 months ago
|
Updated•5 months ago
|
Comment 10•5 months ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/dc4ee0738da7
https://hg.mozilla.org/mozilla-central/rev/9c5e0cfe8eb6
https://hg.mozilla.org/mozilla-central/rev/e058295ac228
https://hg.mozilla.org/mozilla-central/rev/14f5d279154f
Updated•4 months ago
|
| Assignee | ||
Comment 11•3 months ago
|
||
PolicySchemaValidator wraps the compliant validator in JsonSchema.sys.mjs
and turns raw policy input into validated, ready-to-use data in three
stages: normalize source quirks into standard JSON (0/1 to boolean, and
JSON-string to object for fields marked contentMediaType application/json),
validate against standard JSON Schema, then hydrate format:uri strings into
URL objects. Each list entry is validated on its own, so an invalid entry
is dropped and logged rather than discarding the whole list. No consumers
yet.
Original Revision: https://phabricator.services.mozilla.com/D304186
Updated•3 months ago
|
| Assignee | ||
Comment 12•3 months ago
|
||
Rewrites the custom schema types (URL, URLorEmpty, origin, JSON) in
policies-schema.json to standard JSON Schema and switches
EnterprisePoliciesParent to PolicySchemaValidator. Validity now lives
entirely in the schema (format:uri, pattern, anyOf), so the same file can
be validated by off-the-shelf tooling; contentMediaType marks the fields
that may arrive as a JSON string. Shared types (url, urlOrEmpty, origin)
are defined once under "definitions" and referenced with $ref, resolved
when the schema is loaded for the per-policy validator. The $schema is
bumped to draft-07 to match the keywords used.
Behavior is preserved: boolean fields that are also numeric keep their 0/1
integer value; DisplayBookmarksToolbar and DisplayMenuBar accept a boolean
or an enumerated string (via anyOf); SecurityDevices and ExtensionSettings
exclude their literal special keys from the catch-all patternProperties so
those keys are not validated against two schemas at once; and an invalid
entry in a list is dropped rather than discarding the whole policy. Also
fixes a misplaced "required" in AutoLaunchProtocolsFromOrigins.
Original Revision: https://phabricator.services.mozilla.com/D304187
Updated•3 months ago
|
| Assignee | ||
Comment 13•3 months ago
|
||
about:policies prints the policy schema to administrators. The schema is
standard JSON Schema, but a few constructs (format and pattern for URLs and
origins, contentMediaType for JSON-string fields) are verbose, so the
documentation view rewrites them into the shorter presentation used
historically (URL, origin, JSON). This is a display-only transform.
Original Revision: https://phabricator.services.mozilla.com/D304188
Updated•3 months ago
|
Comment 14•3 months ago
|
||
firefox-esr153 Uplift Approval Request
- User impact if declined/Reason for urgency: Not having this in 153 means we'll have to do extra work for all other uplifts to 153 because of internal schema differences.
This is an enterprise policy change is thoroughly tested (although there is a followon for better errors)
- Code covered by automated testing?: yes
- Fix verified in Nightly?: yes
- Needs manual QE testing?: no
- Steps to reproduce for manual QE testing:
- Risk associated with taking this patch: low
- Explanation of risk level: Policy only.
- String changes made/needed?: None
- Is Android affected?: no
| Assignee | ||
Comment 15•3 months ago
|
||
macOS delivers booleans as 0/1 integers (NSNumber) and nests via
unflattened keys; no existing policy-engine test exercises those value
shapes against the validator. This validates representative macOS-shaped
values (integer booleans, nested objects, origin arrays) against the real
schema, guarding the coercion the macOS path depends on. It is
platform-independent (the macOS-only parser/reader are covered by
test_macosparser_unflatten.js and by manual config-profile testing).
Original Revision: https://phabricator.services.mozilla.com/D304189
Updated•3 months ago
|
Updated•3 months ago
|
Updated•3 months ago
|
Updated•3 months ago
|
Updated•3 months ago
|
Updated•3 months ago
|
Comment 16•3 months ago
|
||
| uplift | ||
Description
•