New issue
Advanced search Search tips

Issue 834893 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Jun 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 2
Type: Bug



Sign in to add a comment

Double quotes (") are not properly escaped in the auto-generated .reg template

Project Member Reported by rob@robwu.nl, Apr 19 2018

Issue description

STR:
1. Downloaded the latest version of the templates from:
   wget https://dl.google.com/dl/edgedl/chrome/policy/policy_templates.zip
2. unzip policy_templates.zip windows/examples/chrome.reg
3. view windows/examples/chrome.reg

Then look at the lines containing:
- ExtensionSettings
- ManagedBookmarks
- RegisteredProtocolHandlers

... and observe that the quotes in the string are not quoted.

For example:
"RegisteredProtocolHandlers"="[{"default": true, "protocol": "mailto", "url": "https://mail.google.com/mail/?extsrc=mailto&url=%s"}]"



Some other keys, such as "DefaultPrinterSelection" are quoted as expected:
"DefaultPrinterSelection"="{ \"kind\": \"cloud\", \"idPattern\": \".*public\", \"namePattern\": \".*Color\" }"

 
chrome.reg
28.3 KB Download
Cc: pastarmovj@chromium.org
Owner: ljusten@chromium.org
Owner: olsen@chromium.org
Status: Assigned (was: Untriaged)

Comment 3 by olsen@chromium.org, Jun 19 2018

Status: Started (was: Assigned)
Project Member

Comment 4 by bugdroid1@chromium.org, Jun 19 2018

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

commit 4d547b4bcce9bc2d9e6b13fbd09e398839d308f6
Author: A Olsen <olsen@chromium.org>
Date: Tue Jun 19 13:06:40 2018

Escape quotes (") in auto-generated .reg template

When generating the .reg template, policies that are strings are
properly escaped. And for policies that are dicts - the strings inside
those dicts are properly escaped eg:
{"quote_of_the_day": "\"I'll be back\" - Arnold"}

But then the dict as a whole is wrapped in quotes but not escaped.
Eg:
"{"quote_of_the_day": "\"I'll be back\" - Arnold"}"
Note that this string ends immediately due to improper escaping: "{"

This affects three policies (that are included in the REG file):
ManagedBookmarks, ExtensionSettings and RegisteredProtocolHandlers.

The diff in the generated REG file is available internally here:
go/chromeregdiff

Bug:  834893 
Change-Id: Ied752f1f4fea4fdf3a31706080f0e3e9484060e8
Reviewed-on: https://chromium-review.googlesource.com/1104465
Reviewed-by: Lutz Justen <ljusten@chromium.org>
Commit-Queue: A Olsen <olsen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#568422}
[modify] https://crrev.com/4d547b4bcce9bc2d9e6b13fbd09e398839d308f6/components/policy/tools/template_writers/writers/reg_writer.py
[modify] https://crrev.com/4d547b4bcce9bc2d9e6b13fbd09e398839d308f6/components/policy/tools/template_writers/writers/reg_writer_unittest.py

Comment 5 by olsen@chromium.org, Jun 19 2018

Status: Fixed (was: Started)

Sign in to add a comment