New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 873641 link

Starred by 1 user

Issue metadata

Status: Verified
Owner:
Closed: Sep 4
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 2
Type: Feature



Sign in to add a comment

Clean up and unify schema validators (c++/python)

Project Member Reported by hendrich@chromium.org, Aug 13

Issue description

Right now we have the following C++ schema validators:

components/policy/core/common/schema.h
 -validates a value against a schema
components/json_schema/json_schema_validator.h
 -validates a schema
 -validates a value against a schema (never used)

Both of these support different kind of schema features.

Task 1: Unify schema.h and json_schema_validator.h into one class and remove unused features. Also ensure that all features used in value validation and schema validation are the same.

Task 2: Create a python schema validator with the same capabilities as the C++ schema validator. Use it as a presubmit test to validate all schemas and validation_schemas and validate all the examples against the schema in policy_templates.json

Task 3: Write documentation about the supported schema validation features (see  crbug.com/856901 )
 
Project Member

Comment 1 by bugdroid1@chromium.org, Aug 22

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

commit bf75bad5d18f8190981830d28e8eec257d300e43
Author: Alexander Hendrich <hendrich@chromium.org>
Date: Wed Aug 22 14:02:20 2018

Add python schema validator

This CL adds a python schema validator that can validate JSON schemas.
The schema validator is used in a presubmit to validate all the schemas
in policy_templates.json. The schema validator itself supports the
minimal set of features needed for our current policies.

Bug:  873641 ,  856903 ,  856901 
Change-Id: Ie577e825807e4438eca6921722b88af7c8d1781c
Reviewed-on: https://chromium-review.googlesource.com/1172433
Commit-Queue: Alexander Hendrich <hendrich@chromium.org>
Reviewed-by: Lutz Justen <ljusten@chromium.org>
Cr-Commit-Position: refs/heads/master@{#585003}
[add] https://crrev.com/bf75bad5d18f8190981830d28e8eec257d300e43/components/policy/tools/schema_validator.py
[modify] https://crrev.com/bf75bad5d18f8190981830d28e8eec257d300e43/components/policy/tools/syntax_check_policy_template_json.py

Project Member

Comment 2 by bugdroid1@chromium.org, Aug 22

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

commit b2610da4adc8d07617094bd77a78ac6d702ce24e
Author: Alexander Hendrich <hendrich@chromium.org>
Date: Wed Aug 22 17:45:30 2018

Add ValidateValue() to python schema validator

This CL adds a method to validate a value against a given schema to the
python schema validator. This method is also used in a new presubmit
test to ensure all example values are valid in policy_templates.json.

Bug:  873641 ,  858980 ,  856901 
Change-Id: I2ad477785e8ee37a9e07ee7231c3d12d8501a43f
Reviewed-on: https://chromium-review.googlesource.com/1174443
Commit-Queue: Alexander Hendrich <hendrich@chromium.org>
Reviewed-by: Lutz Justen <ljusten@chromium.org>
Cr-Commit-Position: refs/heads/master@{#585145}
[modify] https://crrev.com/b2610da4adc8d07617094bd77a78ac6d702ce24e/components/policy/core/common/generate_policy_source_unittest.cc
[modify] https://crrev.com/b2610da4adc8d07617094bd77a78ac6d702ce24e/components/policy/resources/policy_templates.json
[modify] https://crrev.com/b2610da4adc8d07617094bd77a78ac6d702ce24e/components/policy/tools/schema_validator.py
[modify] https://crrev.com/b2610da4adc8d07617094bd77a78ac6d702ce24e/components/policy/tools/syntax_check_policy_template_json.py

Project Member

Comment 3 by bugdroid1@chromium.org, Aug 27

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

commit 18593a3a29a6a2cb5ce172c61f288e54cd2691a5
Author: Alexander Hendrich <hendrich@chromium.org>
Date: Mon Aug 27 16:25:25 2018

Remove value validation from json_schema_validator.h/.cc

This CL is part of a larger clean-up operation.
The schema validation from json_schema_validator.h/cc is only used in
schema.h/cc and will be merged there in a follow-up CL.
The value validation in json_schema_validator.h/cc is unused since
we use the value validation from schema.h/cc instead.

Bug:  873641 
Change-Id: Ibe45ac4b4c5911dfb852c6f24fbd7023ebe10ce6
Reviewed-on: https://chromium-review.googlesource.com/1181137
Reviewed-by: Lutz Justen <ljusten@chromium.org>
Commit-Queue: Alexander Hendrich <hendrich@chromium.org>
Cr-Commit-Position: refs/heads/master@{#586280}
[modify] https://crrev.com/18593a3a29a6a2cb5ce172c61f288e54cd2691a5/components/json_schema/BUILD.gn
[modify] https://crrev.com/18593a3a29a6a2cb5ce172c61f288e54cd2691a5/components/json_schema/json_schema_validator.cc
[modify] https://crrev.com/18593a3a29a6a2cb5ce172c61f288e54cd2691a5/components/json_schema/json_schema_validator.h
[modify] https://crrev.com/18593a3a29a6a2cb5ce172c61f288e54cd2691a5/components/json_schema/json_schema_validator_unittest.cc
[delete] https://crrev.com/5fb97b76ec296f803270d1fecef27bc066d724cb/components/json_schema/json_schema_validator_unittest_base.cc
[delete] https://crrev.com/5fb97b76ec296f803270d1fecef27bc066d724cb/components/json_schema/json_schema_validator_unittest_base.h

Project Member

Comment 4 by bugdroid1@chromium.org, Aug 29

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

commit 6f09586aa55208c90b80b6671433435199e1c581
Author: Alexander Hendrich <hendrich@chromium.org>
Date: Wed Aug 29 09:39:22 2018

Move schema validation from json_schema_validator.h/cc to schema.h/cc

This CL is part of a larger clean-up operation and moves the schema
validation from json_schema_validator.h/cc into schema.h/cc.
json_schema_constants.h/cc is moved to components/policy/core/common.
Also removes src/components/json_schema.
Final clean-up of schema/value validation will follow in the next CL.

Bug:  873641 
Change-Id: I2275e5e91c8e75204528d9a6a7ee5eba447e4bfc
Reviewed-on: https://chromium-review.googlesource.com/1181426
Reviewed-by: Cait Phillips <caitkp@chromium.org>
Reviewed-by: Lutz Justen <ljusten@chromium.org>
Commit-Queue: Alexander Hendrich <hendrich@chromium.org>
Cr-Commit-Position: refs/heads/master@{#587051}
[modify] https://crrev.com/6f09586aa55208c90b80b6671433435199e1c581/chrome/common/BUILD.gn
[modify] https://crrev.com/6f09586aa55208c90b80b6671433435199e1c581/components/BUILD.gn
[delete] https://crrev.com/e1731a3ae43e3a2af05e461fcf617b51e174bbd7/components/json_schema/BUILD.gn
[delete] https://crrev.com/e1731a3ae43e3a2af05e461fcf617b51e174bbd7/components/json_schema/DEPS
[delete] https://crrev.com/e1731a3ae43e3a2af05e461fcf617b51e174bbd7/components/json_schema/OWNERS
[delete] https://crrev.com/e1731a3ae43e3a2af05e461fcf617b51e174bbd7/components/json_schema/README
[delete] https://crrev.com/e1731a3ae43e3a2af05e461fcf617b51e174bbd7/components/json_schema/json_schema_validator.cc
[delete] https://crrev.com/e1731a3ae43e3a2af05e461fcf617b51e174bbd7/components/json_schema/json_schema_validator.h
[delete] https://crrev.com/e1731a3ae43e3a2af05e461fcf617b51e174bbd7/components/json_schema/json_schema_validator_unittest.cc
[modify] https://crrev.com/6f09586aa55208c90b80b6671433435199e1c581/components/policy/core/common/BUILD.gn
[rename] https://crrev.com/6f09586aa55208c90b80b6671433435199e1c581/components/policy/core/common/json_schema_constants.cc
[rename] https://crrev.com/6f09586aa55208c90b80b6671433435199e1c581/components/policy/core/common/json_schema_constants.h
[modify] https://crrev.com/6f09586aa55208c90b80b6671433435199e1c581/components/policy/core/common/policy_loader_win.cc
[modify] https://crrev.com/6f09586aa55208c90b80b6671433435199e1c581/components/policy/core/common/schema.cc
[modify] https://crrev.com/6f09586aa55208c90b80b6671433435199e1c581/components/policy/core/common/schema.h
[modify] https://crrev.com/6f09586aa55208c90b80b6671433435199e1c581/components/policy/core/common/schema_unittest.cc

Project Member

Comment 5 by bugdroid1@chromium.org, Aug 29

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

commit d538aa8b13fdccf6c8653538c13cae7899a8ec09
Author: Alexander Hendrich <hendrich@chromium.org>
Date: Wed Aug 29 10:54:17 2018

Clean-up schema validator features for schema/value validation

This Cl is part of a larger clean-up operation and removes unnecessary
features and data types, which are not supported by both schema and
value validation. This CL also adds documentation about the supported
subset of JSON schema features.

Bug:  873641 ,  856901 
Change-Id: I8d464ab7b6404bde5b0f1372cb04a92a0e07080f
Reviewed-on: https://chromium-review.googlesource.com/1183186
Commit-Queue: Alexander Hendrich <hendrich@chromium.org>
Reviewed-by: Lutz Justen <ljusten@chromium.org>
Cr-Commit-Position: refs/heads/master@{#587068}
[modify] https://crrev.com/d538aa8b13fdccf6c8653538c13cae7899a8ec09/components/policy/core/browser/android/policy_converter_unittest.cc
[modify] https://crrev.com/d538aa8b13fdccf6c8653538c13cae7899a8ec09/components/policy/core/common/json_schema_constants.cc
[modify] https://crrev.com/d538aa8b13fdccf6c8653538c13cae7899a8ec09/components/policy/core/common/json_schema_constants.h
[modify] https://crrev.com/d538aa8b13fdccf6c8653538c13cae7899a8ec09/components/policy/core/common/policy_loader_win_unittest.cc
[modify] https://crrev.com/d538aa8b13fdccf6c8653538c13cae7899a8ec09/components/policy/core/common/schema.cc
[modify] https://crrev.com/d538aa8b13fdccf6c8653538c13cae7899a8ec09/components/policy/core/common/schema.h
[modify] https://crrev.com/d538aa8b13fdccf6c8653538c13cae7899a8ec09/components/policy/core/common/schema_map_unittest.cc
[modify] https://crrev.com/d538aa8b13fdccf6c8653538c13cae7899a8ec09/components/policy/core/common/schema_registry_unittest.cc
[modify] https://crrev.com/d538aa8b13fdccf6c8653538c13cae7899a8ec09/components/policy/core/common/schema_unittest.cc

Project Member

Comment 6 by bugdroid1@chromium.org, Aug 29

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

commit 7ee2ff272246fe376ea1077ad5aea425bfab824f
Author: Alexander Hendrich <hendrich@chromium.org>
Date: Wed Aug 29 11:40:30 2018

Add 'sensitiveValue' to the known schema attributes

This CL adds the boolean schema attribute 'sensitiveValue' to the known
schema attributes. This attribute is used to mask sensitive values with
a replacement value, which can be displayed in the UI.

Bug:  856901 ,  873641 ,  849657 
Change-Id: I8afb2c3255d483737db8380abd898cd15d62e84a
Reviewed-on: https://chromium-review.googlesource.com/1183235
Commit-Queue: Alexander Hendrich <hendrich@chromium.org>
Reviewed-by: Lutz Justen <ljusten@chromium.org>
Reviewed-by: Pavol Marko <pmarko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#587079}
[modify] https://crrev.com/7ee2ff272246fe376ea1077ad5aea425bfab824f/components/policy/core/common/json_schema_constants.cc
[modify] https://crrev.com/7ee2ff272246fe376ea1077ad5aea425bfab824f/components/policy/core/common/json_schema_constants.h
[modify] https://crrev.com/7ee2ff272246fe376ea1077ad5aea425bfab824f/components/policy/core/common/schema.cc
[modify] https://crrev.com/7ee2ff272246fe376ea1077ad5aea425bfab824f/components/policy/core/common/schema.h

Status: Verified (was: Started)

Sign in to add a comment