New issue
Advanced search Search tips

Issue 855054 link

Starred by 2 users

Issue metadata

Status: Verified
Owner:
Closed: Sep 7
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 1
Type: Bug



Sign in to add a comment

Display schema validation errors for device policies

Project Member Reported by ljusten@chromium.org, Jun 21 2018

Issue description

In device_policy_decoder_chromeos.cc:

- Make sure all JSON policies go through DecodeJsonStringAndDropUnknownBySchema
E.g. DeviceWallpaperImage is not right now.

- Pipe error from schema validation through to chrome://policy page
Could be as simple as policies->SetError(error)?

- NativeDevicePrinters doesn't check whether JSON actually parsed!


 
Description: Show this description
Cc: olsen@chromium.org
Owner: ljusten@chromium.org
Owner: hendrich@chromium.org
Cc: ljusten@chromium.org
Project Member

Comment 5 by bugdroid1@chromium.org, Aug 23

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/eccc469815f1c55d5d2acd556beaafbbffe1161d

commit eccc469815f1c55d5d2acd556beaafbbffe1161d
Author: Alexander Hendrich <hendrich@chromium.org>
Date: Thu Aug 23 11:40:47 2018

Display schema validation errors

This CL makes sure all JSON device policies use
DecodeJsonStringAndDropUnknownBySchema to decode the proto and adhere
to the associated schema. Unknown properties are dropped. If the json
string can't be decoded or does not comply with the associated schema
in policy_templates.json, the policy value will be set to the original
json string. This way, the faulty value can still be seen in
chrome://policy along with any errors/warnings.

Bug:  855054 
Change-Id: I73a2bc7cc88a293b06339482437f88ac48932b83
Reviewed-on: https://chromium-review.googlesource.com/1163507
Reviewed-by: Julian Pastarmov <pastarmovj@chromium.org>
Reviewed-by: Lutz Justen <ljusten@chromium.org>
Commit-Queue: Alexander Hendrich <hendrich@chromium.org>
Cr-Commit-Position: refs/heads/master@{#585451}
[modify] https://crrev.com/eccc469815f1c55d5d2acd556beaafbbffe1161d/chrome/browser/chromeos/BUILD.gn
[modify] https://crrev.com/eccc469815f1c55d5d2acd556beaafbbffe1161d/chrome/browser/chromeos/policy/device_policy_decoder_chromeos.cc
[modify] https://crrev.com/eccc469815f1c55d5d2acd556beaafbbffe1161d/chrome/browser/chromeos/policy/device_policy_decoder_chromeos.h
[add] https://crrev.com/eccc469815f1c55d5d2acd556beaafbbffe1161d/chrome/browser/chromeos/policy/device_policy_decoder_chromeos_unittest.cc
[modify] https://crrev.com/eccc469815f1c55d5d2acd556beaafbbffe1161d/chrome/browser/chromeos/settings/device_settings_provider.cc
[modify] https://crrev.com/eccc469815f1c55d5d2acd556beaafbbffe1161d/chrome/browser/chromeos/settings/device_settings_provider_unittest.cc

Status: Fixed (was: Assigned)
Hi..
Could you please provide steps if this needs manual verification.
Thanks.!
Status: Assigned (was: Fixed)
Hi Alexander,

Could you please confirm that the correct error messages are displaying in chrome://policy (see attached screenshot) for NativePrinters policy:

Key "items[0]": Error while parsing JSON value: Line: 1, column: 1, Unexpected token.
Key "items[1]": Error while parsing JSON value: Line: 1, column: 1, Unexpected token.

Chrome OS: 11021.5.0
Chrome: 70.0.3538.7
Device: Robo360
Screenshot 2018-09-06 at 10.10.09 AM.png
155 KB View Download
yes this is correct.
Thanks for testing!
Status: Verified (was: Assigned)
Marked as "Verified", thanks!

Sign in to add a comment