From 9504fb8abb305fffadf50918861c6a28d356d187 Mon Sep 17 00:00:00 2001
From: Rhys Arkins <rhys@arkins.net>
Date: Wed, 24 Jan 2018 07:18:11 +0100
Subject: [PATCH] refactor: use handlebars triple escapes in templates (#1434)

This stops HTML substitution from occurring
---
 lib/config/definitions.js                     |  4 +-
 lib/config/templates/default/branch-name.hbs  |  2 +-
 .../templates/default/commit-message.hbs      |  2 +-
 lib/config/templates/default/pr-body.hbs      |  6 +--
 lib/config/templates/default/pr-title.hbs     |  2 +-
 .../templates/docker-digest/branch-name.hbs   |  2 +-
 .../docker-digest/commit-message.hbs          |  2 +-
 .../templates/docker-digest/pr-body.hbs       |  4 +-
 .../templates/docker-digest/pr-title.hbs      |  2 +-
 lib/config/templates/docker-group/pr-body.hbs |  4 +-
 .../templates/docker-group/pr-title.hbs       |  2 +-
 .../templates/docker-pin-group/pr-body.hbs    |  4 +-
 .../templates/docker-pin/branch-name.hbs      |  2 +-
 lib/config/templates/docker-pin/pr-body.hbs   |  4 +-
 lib/config/templates/docker-pin/pr-title.hbs  |  2 +-
 lib/config/templates/docker/branch-name.hbs   |  2 +-
 .../templates/docker/commit-message.hbs       |  2 +-
 lib/config/templates/docker/pr-body.hbs       |  4 +-
 lib/config/templates/docker/pr-title.hbs      |  2 +-
 lib/config/templates/group/branch-name.hbs    |  2 +-
 lib/config/templates/group/commit-message.hbs |  2 +-
 lib/config/templates/group/pr-body.hbs        |  6 +--
 lib/config/templates/group/pr-title.hbs       |  2 +-
 .../lock-file-maintenance/branch-name.hbs     |  2 +-
 .../lock-file-maintenance/pr-body.hbs         |  2 +-
 lib/config/templates/node/branch-name.hbs     |  2 +-
 lib/config/templates/node/pr-body.hbs         |  4 +-
 lib/config/templates/node/pr-title.hbs        |  2 +-
 lib/workers/package/versions.js               |  4 +-
 test/config/__snapshots__/index.spec.js.snap  |  4 +-
 .../__snapshots__/resolve.spec.js.snap        | 46 +++++++++----------
 .../__snapshots__/versions.spec.js.snap       |  2 +-
 32 files changed, 67 insertions(+), 67 deletions(-)

diff --git a/lib/config/definitions.js b/lib/config/definitions.js
index f26e0bca18..67e7a90c03 100644
--- a/lib/config/definitions.js
+++ b/lib/config/definitions.js
@@ -444,7 +444,7 @@ const options = [
     type: 'json',
     default: {
       branchName:
-        '{{branchPrefix}}{{depNameSanitized}}-{{newVersionMajor}}.{{newVersionMinor}}.x',
+        '{{{branchPrefix}}}{{{depNameSanitized}}}-{{{newVersionMajor}}}.{{{newVersionMinor}}}.x',
     },
     cli: false,
     mergeable: true,
@@ -461,7 +461,7 @@ const options = [
       groupName: 'Pin Dependencies',
       group: {
         commitMessage: 'Pin Dependencies',
-        prTitle: '{{groupName}}',
+        prTitle: '{{{groupName}}}',
       },
     },
     cli: false,
diff --git a/lib/config/templates/default/branch-name.hbs b/lib/config/templates/default/branch-name.hbs
index 1ac2acbe25..438c009220 100644
--- a/lib/config/templates/default/branch-name.hbs
+++ b/lib/config/templates/default/branch-name.hbs
@@ -1 +1 @@
-{{branchPrefix}}{{depNameSanitized}}-{{newVersionMajor}}.x
+{{{branchPrefix}}}{{{depNameSanitized}}}-{{{newVersionMajor}}}.x
diff --git a/lib/config/templates/default/commit-message.hbs b/lib/config/templates/default/commit-message.hbs
index 13a4864be4..54cf257ffe 100644
--- a/lib/config/templates/default/commit-message.hbs
+++ b/lib/config/templates/default/commit-message.hbs
@@ -1 +1 @@
-Update dependency {{depName}} to {{#unless isRange}}v{{/unless}}{{newVersion}}
+Update dependency {{{depName}}} to {{#unless isRange}}v{{/unless}}{{{newVersion}}}
diff --git a/lib/config/templates/default/pr-body.hbs b/lib/config/templates/default/pr-body.hbs
index ea4ad06ccb..dc10c1846f 100644
--- a/lib/config/templates/default/pr-body.hbs
+++ b/lib/config/templates/default/pr-body.hbs
@@ -1,12 +1,12 @@
-This Pull Request {{#if isRollback}}rolls back{{else}}updates{{/if}} dependency {{#if repositoryUrl}}[{{depName}}]({{repositoryUrl}}){{else}}{{depName}}{{/if}} from `{{#unless isRange}}{{#unless isPin}}v{{/unless}}{{/unless}}{{currentVersion}}` to `{{#unless isRange}}v{{/unless}}{{newVersion}}`{{#if isRollback}}. This is necessary and important because `v{{currentVersion}}` cannot be found in the npm registry - probably because of it being unpublished.{{/if}}
+This Pull Request {{#if isRollback}}rolls back{{else}}updates{{/if}} dependency {{#if repositoryUrl}}[{{{depName}}}]({{{repositoryUrl}}}){{else}}{{{depName}}}{{/if}} from `{{#unless isRange}}{{#unless isPin}}v{{/unless}}{{/unless}}{{{currentVersion}}}` to `{{#unless isRange}}v{{/unless}}{{{newVersion}}}`{{#if isRollback}}. This is necessary and important because `v{{{currentVersion}}}` cannot be found in the npm registry - probably because of it being unpublished.{{/if}}
 {{#if hasTypes}}
 
-This PR also includes an upgrade to the corresponding [@types/{{depName}}](https://npmjs.com/package/@types/{{depName}}) package.
+This PR also includes an upgrade to the corresponding [@types/{{{depName}}}](https://npmjs.com/package/@types/{{{depName}}}) package.
 {{/if}}
 {{#if releases.length}}
 
 {{#if schedule}}
-**Note**: This PR was created on a configured schedule ("{{schedule}}"{{#if timezone}} in timezone `{{timezone}}`{{/if}}) and will not receive updates outside those times.
+**Note**: This PR was created on a configured schedule ("{{{schedule}}}"{{#if timezone}} in timezone `{{{timezone}}}`{{/if}}) and will not receive updates outside those times.
 {{/if}}
 
 {{#if isPin}}
diff --git a/lib/config/templates/default/pr-title.hbs b/lib/config/templates/default/pr-title.hbs
index e2cc17494d..540afe2a3e 100644
--- a/lib/config/templates/default/pr-title.hbs
+++ b/lib/config/templates/default/pr-title.hbs
@@ -1 +1 @@
-{{#if isPin}}Pin{{else}}{{#if isRollback}}Roll back{{else}}Update{{/if}}{{/if}} dependency {{depName}} to {{#if isRange}}{{newVersion}}{{else}}{{#if isMajor}}v{{newVersionMajor}}{{else}}v{{newVersion}}{{/if}}{{/if}}
+{{#if isPin}}Pin{{else}}{{#if isRollback}}Roll back{{else}}Update{{/if}}{{/if}} dependency {{{depName}}} to {{#if isRange}}{{{newVersion}}}{{else}}{{#if isMajor}}v{{{newVersionMajor}}}{{else}}v{{{newVersion}}}{{/if}}{{/if}}
diff --git a/lib/config/templates/docker-digest/branch-name.hbs b/lib/config/templates/docker-digest/branch-name.hbs
index 5a353edf92..06de4198bc 100644
--- a/lib/config/templates/docker-digest/branch-name.hbs
+++ b/lib/config/templates/docker-digest/branch-name.hbs
@@ -1 +1 @@
-{{branchPrefix}}docker-{{depNameSanitized}}-{{currentTag}}
+{{{branchPrefix}}}docker-{{{depNameSanitized}}}-{{{currentTag}}}
diff --git a/lib/config/templates/docker-digest/commit-message.hbs b/lib/config/templates/docker-digest/commit-message.hbs
index 0f3d052939..27a48b5643 100644
--- a/lib/config/templates/docker-digest/commit-message.hbs
+++ b/lib/config/templates/docker-digest/commit-message.hbs
@@ -1 +1 @@
-Update {{depName}}:{{currentTag}} digest
+Update {{{depName}}}:{{{currentTag}}} digest
diff --git a/lib/config/templates/docker-digest/pr-body.hbs b/lib/config/templates/docker-digest/pr-body.hbs
index e43694fd0d..ffbb2f6c70 100644
--- a/lib/config/templates/docker-digest/pr-body.hbs
+++ b/lib/config/templates/docker-digest/pr-body.hbs
@@ -1,7 +1,7 @@
-This Pull Request updates Docker base image `{{depName}}:{{currentTag}}` to the latest digest (`{{newDigest}}`). For details on Renovate's Docker support, please visit https://renovateapp.com/docs/language-support/docker
+This Pull Request updates Docker base image `{{{depName}}}:{{{currentTag}}}` to the latest digest (`{{{newDigest}}}`). For details on Renovate's Docker support, please visit https://renovateapp.com/docs/language-support/docker
 
 {{#if schedule}}
-**Note**: This PR was created on a configured schedule ("{{schedule}}"{{#if timezone}} in timezone `{{timezone}}`{{/if}}) and will not receive updates outside those times.
+**Note**: This PR was created on a configured schedule ("{{{schedule}}}"{{#if timezone}} in timezone `{{{timezone}}}`{{/if}}) and will not receive updates outside those times.
 {{/if}}
 
 {{#if hasErrors}}
diff --git a/lib/config/templates/docker-digest/pr-title.hbs b/lib/config/templates/docker-digest/pr-title.hbs
index 93a61546df..ada29e30cf 100644
--- a/lib/config/templates/docker-digest/pr-title.hbs
+++ b/lib/config/templates/docker-digest/pr-title.hbs
@@ -1 +1 @@
-Update Dockerfile {{depName}} image {{currentTag}} digest ({{newDigestShort}})
+Update Dockerfile {{{depName}}} image {{{currentTag}}} digest ({{{newDigestShort}}})
diff --git a/lib/config/templates/docker-group/pr-body.hbs b/lib/config/templates/docker-group/pr-body.hbs
index b63149a7af..d5f3015205 100644
--- a/lib/config/templates/docker-group/pr-body.hbs
+++ b/lib/config/templates/docker-group/pr-body.hbs
@@ -1,11 +1,11 @@
 This Pull Request updates Dockerfiles to use image digests.
 
 {{#if schedule}}
-**Note**: This PR was created on a configured schedule ("{{schedule}}"{{#if timezone}} in timezone `{{timezone}}`{{/if}}) and will not receive updates outside those times.
+**Note**: This PR was created on a configured schedule ("{{{schedule}}}"{{#if timezone}} in timezone `{{{timezone}}}`{{/if}}) and will not receive updates outside those times.
 {{/if}}
 
 {{#each upgrades as |upgrade|}}
--   {{#if repositoryUrl}}[{{upgrade.depName}}]({{upgrade.repositoryUrl}}){{else}}{{depName}}{{/if}}: `{{upgrade.newDigest}}`
+-   {{#if repositoryUrl}}[{{upgrade.depName}}]({{upgrade.repositoryUrl}}){{else}}{{{depName}}}{{/if}}: `{{upgrade.newDigest}}`
 {{/each}}
 
 {{#if hasErrors}}
diff --git a/lib/config/templates/docker-group/pr-title.hbs b/lib/config/templates/docker-group/pr-title.hbs
index b4feb91a67..aaebe61c28 100644
--- a/lib/config/templates/docker-group/pr-title.hbs
+++ b/lib/config/templates/docker-group/pr-title.hbs
@@ -1 +1 @@
-Update Docker {{groupName}} digests
+Update Docker {{{groupName}}} digests
diff --git a/lib/config/templates/docker-pin-group/pr-body.hbs b/lib/config/templates/docker-pin-group/pr-body.hbs
index c6f1ef0a18..8dc6851012 100644
--- a/lib/config/templates/docker-pin-group/pr-body.hbs
+++ b/lib/config/templates/docker-pin-group/pr-body.hbs
@@ -1,11 +1,11 @@
 This Pull Request pins Dockerfiles to use image digests. For details on Renovate's Docker support, please visit https://renovateapp.com/docs/language-support/docker
 
 {{#if schedule}}
-**Note**: This PR was created on a configured schedule ("{{schedule}}"{{#if timezone}} in timezone `{{timezone}}`{{/if}}) and will not receive updates outside those times.
+**Note**: This PR was created on a configured schedule ("{{{schedule}}}"{{#if timezone}} in timezone `{{{timezone}}}`{{/if}}) and will not receive updates outside those times.
 {{/if}}
 
 {{#each upgrades as |upgrade|}}
--   {{#if repositoryUrl}}[{{upgrade.depName}}]({{upgrade.repositoryUrl}}){{else}}{{depName}}{{/if}}: `{{upgrade.newDigest}}`
+-   {{#if repositoryUrl}}[{{upgrade.depName}}]({{upgrade.repositoryUrl}}){{else}}{{{depName}}}{{/if}}: `{{upgrade.newDigest}}`
 {{/each}}
 
 **Important**: Renovate will wait until you have merged this Pin request before creating PRs for any *upgrades*. If you do not wish to pin anything, please update your config accordingly instead of leaving this PR open.
diff --git a/lib/config/templates/docker-pin/branch-name.hbs b/lib/config/templates/docker-pin/branch-name.hbs
index 1e2d8ecf70..48b92818bb 100644
--- a/lib/config/templates/docker-pin/branch-name.hbs
+++ b/lib/config/templates/docker-pin/branch-name.hbs
@@ -1 +1 @@
-{{branchPrefix}}docker-pin-{{depNameSanitized}}-{{currentTag}}
+{{{branchPrefix}}}docker-pin-{{{depNameSanitized}}}-{{{currentTag}}}
diff --git a/lib/config/templates/docker-pin/pr-body.hbs b/lib/config/templates/docker-pin/pr-body.hbs
index f09ffdc21d..29a7c9337c 100644
--- a/lib/config/templates/docker-pin/pr-body.hbs
+++ b/lib/config/templates/docker-pin/pr-body.hbs
@@ -1,8 +1,8 @@
-This Pull Request pins Docker base image `{{depName}}:{{currentTag}}` to use a digest (`{{newDigest}}`).
+This Pull Request pins Docker base image `{{{depName}}}:{{{currentTag}}}` to use a digest (`{{{newDigest}}}`).
 This digest will then be kept updated via Pull Requests whenever the image is updated on the Docker registry. For details on Renovate's Docker support, please visit https://renovateapp.com/docs/language-support/docker
 
 {{#if schedule}}
-**Note**: This PR was created on a configured schedule ("{{schedule}}"{{#if timezone}} in timezone `{{timezone}}`{{/if}}) and will not receive updates outside those times.
+**Note**: This PR was created on a configured schedule ("{{{schedule}}}"{{#if timezone}} in timezone `{{{timezone}}}`{{/if}}) and will not receive updates outside those times.
 {{/if}}
 
 **Important**: Renovate will wait until you have merged this Pin request before creating PRs for any *upgrades*. If you do not wish to pin anything, please update your config accordingly instead of leaving this PR open.
diff --git a/lib/config/templates/docker-pin/pr-title.hbs b/lib/config/templates/docker-pin/pr-title.hbs
index b39098a478..5a1dffe908 100644
--- a/lib/config/templates/docker-pin/pr-title.hbs
+++ b/lib/config/templates/docker-pin/pr-title.hbs
@@ -1 +1 @@
-Pin Dockerfile {{depName}}:{{currentTag}} image digest
+Pin Dockerfile {{{depName}}}:{{{currentTag}}} image digest
diff --git a/lib/config/templates/docker/branch-name.hbs b/lib/config/templates/docker/branch-name.hbs
index 817fd2300e..a0e81a09ba 100644
--- a/lib/config/templates/docker/branch-name.hbs
+++ b/lib/config/templates/docker/branch-name.hbs
@@ -1 +1 @@
-{{branchPrefix}}docker-{{depNameSanitized}}-{{newVersionMajor}}.x
+{{{branchPrefix}}}docker-{{{depNameSanitized}}}-{{{newVersionMajor}}}.x
diff --git a/lib/config/templates/docker/commit-message.hbs b/lib/config/templates/docker/commit-message.hbs
index dd1848844b..01b064eaa1 100644
--- a/lib/config/templates/docker/commit-message.hbs
+++ b/lib/config/templates/docker/commit-message.hbs
@@ -1 +1 @@
-Update {{depName}} to tag {{newTag}}
+Update {{{depName}}} to tag {{{newTag}}}
diff --git a/lib/config/templates/docker/pr-body.hbs b/lib/config/templates/docker/pr-body.hbs
index a2eb4ce55b..593c4a60b5 100644
--- a/lib/config/templates/docker/pr-body.hbs
+++ b/lib/config/templates/docker/pr-body.hbs
@@ -1,7 +1,7 @@
-This Pull Request updates Docker base image {{depName}} from tag `{{currentTag}}` to new tag `{{newTag}}`. For details on Renovate's Docker support, please visit https://renovateapp.com/docs/language-support/docker
+This Pull Request updates Docker base image {{{depName}}} from tag `{{{currentTag}}}` to new tag `{{{newTag}}}`. For details on Renovate's Docker support, please visit https://renovateapp.com/docs/language-support/docker
 
 {{#if schedule}}
-**Note**: This PR was created on a configured schedule ("{{schedule}}"{{#if timezone}} in timezone `{{timezone}}`{{/if}}) and will not receive updates outside those times.
+**Note**: This PR was created on a configured schedule ("{{{schedule}}}"{{#if timezone}} in timezone `{{{timezone}}}`{{/if}}) and will not receive updates outside those times.
 {{/if}}
 
 {{#if hasErrors}}
diff --git a/lib/config/templates/docker/pr-title.hbs b/lib/config/templates/docker/pr-title.hbs
index 5a4e6e9d6c..b0f3d51d7f 100644
--- a/lib/config/templates/docker/pr-title.hbs
+++ b/lib/config/templates/docker/pr-title.hbs
@@ -1 +1 @@
-Update {{depName}} Dockerfile tag to {{#if isMajor}}v{{newVersionMajor}}{{else}}v{{newTag}}{{/if}}
+Update {{{depName}}} Dockerfile tag to {{#if isMajor}}v{{{newVersionMajor}}}{{else}}v{{{newTag}}}{{/if}}
diff --git a/lib/config/templates/group/branch-name.hbs b/lib/config/templates/group/branch-name.hbs
index e08a79f254..30d001b693 100644
--- a/lib/config/templates/group/branch-name.hbs
+++ b/lib/config/templates/group/branch-name.hbs
@@ -1 +1 @@
-{{branchPrefix}}{{groupSlug}}
+{{{branchPrefix}}}{{groupSlug}}
diff --git a/lib/config/templates/group/commit-message.hbs b/lib/config/templates/group/commit-message.hbs
index c30dd38dcc..16e6b7d8b9 100644
--- a/lib/config/templates/group/commit-message.hbs
+++ b/lib/config/templates/group/commit-message.hbs
@@ -1 +1 @@
-Update {{groupName}} packages
+Update {{{groupName}}} packages
diff --git a/lib/config/templates/group/pr-body.hbs b/lib/config/templates/group/pr-body.hbs
index efcf07d255..04679fed10 100644
--- a/lib/config/templates/group/pr-body.hbs
+++ b/lib/config/templates/group/pr-body.hbs
@@ -1,11 +1,11 @@
-This Pull Request renovates the package group "{{groupName}}".
+This Pull Request renovates the package group "{{{groupName}}}".
 
 {{#if schedule}}
-**Note**: This PR was created on a configured schedule ("{{schedule}}"{{#if timezone}} in timezone `{{timezone}}`{{/if}}) and will not receive updates outside those times.
+**Note**: This PR was created on a configured schedule ("{{{schedule}}}"{{#if timezone}} in timezone `{{{timezone}}}`{{/if}}) and will not receive updates outside those times.
 {{/if}}
 
 {{#each upgrades as |upgrade|}}
--   {{#if repositoryUrl}}[{{upgrade.depName}}]({{upgrade.repositoryUrl}}){{else}}{{depName}}{{/if}}: from `{{upgrade.currentVersion}}` to `{{upgrade.newVersion}}`
+-   {{#if repositoryUrl}}[{{upgrade.depName}}]({{upgrade.repositoryUrl}}){{else}}{{{depName}}}{{/if}}: from `{{upgrade.currentVersion}}` to `{{upgrade.newVersion}}`
 {{/each}}
 
 {{#unless isPin}}
diff --git a/lib/config/templates/group/pr-title.hbs b/lib/config/templates/group/pr-title.hbs
index 9f8028e529..30c85d545a 100644
--- a/lib/config/templates/group/pr-title.hbs
+++ b/lib/config/templates/group/pr-title.hbs
@@ -1 +1 @@
-Update {{groupName}} packages{{#if singleVersion}} to {{#unless isRange}}v{{/unless}}{{singleVersion}}{{/if}}
+Update {{{groupName}}} packages{{#if singleVersion}} to {{#unless isRange}}v{{/unless}}{{{singleVersion}}}{{/if}}
diff --git a/lib/config/templates/lock-file-maintenance/branch-name.hbs b/lib/config/templates/lock-file-maintenance/branch-name.hbs
index 01cdd676b6..4f4502faeb 100644
--- a/lib/config/templates/lock-file-maintenance/branch-name.hbs
+++ b/lib/config/templates/lock-file-maintenance/branch-name.hbs
@@ -1 +1 @@
-{{branchPrefix}}lock-file-maintenance
+{{{branchPrefix}}}lock-file-maintenance
diff --git a/lib/config/templates/lock-file-maintenance/pr-body.hbs b/lib/config/templates/lock-file-maintenance/pr-body.hbs
index b1dfe755fb..6aabf917ec 100644
--- a/lib/config/templates/lock-file-maintenance/pr-body.hbs
+++ b/lib/config/templates/lock-file-maintenance/pr-body.hbs
@@ -1,7 +1,7 @@
 This Pull Request updates `package.json` lock files to use the latest dependency versions.
 
 {{#if schedule}}
-**Note**: This PR was created on a configured schedule ("{{schedule}}"{{#if timezone}} in timezone `{{timezone}}`{{/if}}) and will not receive updates outside those times.
+**Note**: This PR was created on a configured schedule ("{{{schedule}}}"{{#if timezone}} in timezone `{{{timezone}}}`{{/if}}) and will not receive updates outside those times.
 {{/if}}
 
 {{#if hasErrors}}
diff --git a/lib/config/templates/node/branch-name.hbs b/lib/config/templates/node/branch-name.hbs
index 38a6f040df..2d1e57a7dd 100644
--- a/lib/config/templates/node/branch-name.hbs
+++ b/lib/config/templates/node/branch-name.hbs
@@ -1 +1 @@
-{{branchPrefix}}node-{{depNameSanitized}}
+{{{branchPrefix}}}node-{{{depNameSanitized}}}
diff --git a/lib/config/templates/node/pr-body.hbs b/lib/config/templates/node/pr-body.hbs
index 4d3a132787..f9a4ab4fe3 100644
--- a/lib/config/templates/node/pr-body.hbs
+++ b/lib/config/templates/node/pr-body.hbs
@@ -1,7 +1,7 @@
-This Pull Request updates {{depName}} versions from `{{currentVersions}}` to `{{newVersions}}`. This is according to the configured node.js support policy "{{supportPolicy}}".
+This Pull Request updates {{{depName}}} versions from `{{{currentVersions}}}` to `{{{newVersions}}}`. This is according to the configured node.js support policy "{{{supportPolicy}}}".
 
 {{#if schedule}}
-**Note**: This PR was created on a configured schedule ("{{schedule}}"{{#if timezone}} in timezone `{{timezone}}`{{/if}}) and will not receive updates outside those times.
+**Note**: This PR was created on a configured schedule ("{{{schedule}}}"{{#if timezone}} in timezone `{{{timezone}}}`{{/if}}) and will not receive updates outside those times.
 {{/if}}
 
 {{#if hasErrors}}
diff --git a/lib/config/templates/node/pr-title.hbs b/lib/config/templates/node/pr-title.hbs
index 55ab0e503e..49968ba46c 100644
--- a/lib/config/templates/node/pr-title.hbs
+++ b/lib/config/templates/node/pr-title.hbs
@@ -1 +1 @@
-Update {{depName}} versions to [{{newVersions}}]
+Update {{{depName}}} versions to [{{{newVersions}}}]
diff --git a/lib/workers/package/versions.js b/lib/workers/package/versions.js
index 15a1d4024b..b87e7196c3 100644
--- a/lib/workers/package/versions.js
+++ b/lib/workers/package/versions.js
@@ -62,7 +62,7 @@ function determineUpgrades(npmDep, config) {
         newVersionMajor: semver.major(rollbackVersion),
         semanticCommitType: 'fix',
         branchName:
-          '{{branchPrefix}}rollback-{{depNameSanitized}}-{{newVersionMajor}}.x',
+          '{{{branchPrefix}}}rollback-{{{depNameSanitized}}}-{{{newVersionMajor}}}.x',
       };
     } catch (err) /* istanbul ignore next */ {
       logger.info(
@@ -117,7 +117,7 @@ function determineUpgrades(npmDep, config) {
       } else if (!config.multipleMajorPrs && type === 'major') {
         upgradeKey = 'major';
       } else if (type === 'patch') {
-        upgradeKey = `{{newVersionMajor}}.{{newVersionMinor}}`;
+        upgradeKey = `{{{newVersionMajor}}}.{{{newVersionMinor}}}`;
       } else {
         // Use major version as lookup key
         upgradeKey = newVersionMajor;
diff --git a/test/config/__snapshots__/index.spec.js.snap b/test/config/__snapshots__/index.spec.js.snap
index 73df5d60dc..fd87494063 100644
--- a/test/config/__snapshots__/index.spec.js.snap
+++ b/test/config/__snapshots__/index.spec.js.snap
@@ -2,14 +2,14 @@
 
 exports[`config/index mergeChildConfig(parentConfig, childConfig) merges 1`] = `
 Object {
-  "branchName": "{{branchPrefix}}lock-file-maintenance",
+  "branchName": "{{{branchPrefix}}}lock-file-maintenance",
   "commitMessage": "Update lock file",
   "enabled": false,
   "groupName": null,
   "prBody": "This Pull Request updates \`package.json\` lock files to use the latest dependency versions.
 
 {{#if schedule}}
-**Note**: This PR was created on a configured schedule (\\"{{schedule}}\\"{{#if timezone}} in timezone \`{{timezone}}\`{{/if}}) and will not receive updates outside those times.
+**Note**: This PR was created on a configured schedule (\\"{{{schedule}}}\\"{{#if timezone}} in timezone \`{{{timezone}}}\`{{/if}}) and will not receive updates outside those times.
 {{/if}}
 
 {{#if hasErrors}}
diff --git a/test/manager/__snapshots__/resolve.spec.js.snap b/test/manager/__snapshots__/resolve.spec.js.snap
index 1e98a4fee3..12a73634dd 100644
--- a/test/manager/__snapshots__/resolve.spec.js.snap
+++ b/test/manager/__snapshots__/resolve.spec.js.snap
@@ -47,19 +47,19 @@ Array [
     "packageFile": "package.js",
   },
   Object {
-    "branchName": "{{branchPrefix}}docker-{{depNameSanitized}}-{{newVersionMajor}}.x",
-    "commitMessage": "Update {{depName}} to tag {{newTag}}",
+    "branchName": "{{{branchPrefix}}}docker-{{{depNameSanitized}}}-{{{newVersionMajor}}}.x",
+    "commitMessage": "Update {{{depName}}} to tag {{{newTag}}}",
     "content": "# comment
 FROM node:8
 ",
     "currentFrom": "node:8",
     "digest": Object {
-      "branchName": "{{branchPrefix}}docker-{{depNameSanitized}}-{{currentTag}}",
-      "commitMessage": "Update {{depName}}:{{currentTag}} digest",
-      "prBody": "This Pull Request updates Docker base image \`{{depName}}:{{currentTag}}\` to the latest digest (\`{{newDigest}}\`). For details on Renovate's Docker support, please visit https://renovateapp.com/docs/language-support/docker
+      "branchName": "{{{branchPrefix}}}docker-{{{depNameSanitized}}}-{{{currentTag}}}",
+      "commitMessage": "Update {{{depName}}}:{{{currentTag}}} digest",
+      "prBody": "This Pull Request updates Docker base image \`{{{depName}}}:{{{currentTag}}}\` to the latest digest (\`{{{newDigest}}}\`). For details on Renovate's Docker support, please visit https://renovateapp.com/docs/language-support/docker
 
 {{#if schedule}}
-**Note**: This PR was created on a configured schedule (\\"{{schedule}}\\"{{#if timezone}} in timezone \`{{timezone}}\`{{/if}}) and will not receive updates outside those times.
+**Note**: This PR was created on a configured schedule (\\"{{{schedule}}}\\"{{#if timezone}} in timezone \`{{{timezone}}}\`{{/if}}) and will not receive updates outside those times.
 {{/if}}
 
 {{#if hasErrors}}
@@ -91,18 +91,18 @@ Please make sure the following warnings are safe to ignore:
 ---
 
 This PR has been generated by [Renovate Bot](https://renovateapp.com).",
-      "prTitle": "Update Dockerfile {{depName}} image {{currentTag}} digest ({{newDigestShort}})",
+      "prTitle": "Update Dockerfile {{{depName}}} image {{{currentTag}}} digest ({{{newDigestShort}}})",
     },
     "enabled": true,
     "group": Object {
       "prBody": "This Pull Request updates Dockerfiles to use image digests.
 
 {{#if schedule}}
-**Note**: This PR was created on a configured schedule (\\"{{schedule}}\\"{{#if timezone}} in timezone \`{{timezone}}\`{{/if}}) and will not receive updates outside those times.
+**Note**: This PR was created on a configured schedule (\\"{{{schedule}}}\\"{{#if timezone}} in timezone \`{{{timezone}}}\`{{/if}}) and will not receive updates outside those times.
 {{/if}}
 
 {{#each upgrades as |upgrade|}}
--   {{#if repositoryUrl}}[{{upgrade.depName}}]({{upgrade.repositoryUrl}}){{else}}{{depName}}{{/if}}: \`{{upgrade.newDigest}}\`
+-   {{#if repositoryUrl}}[{{upgrade.depName}}]({{upgrade.repositoryUrl}}){{else}}{{{depName}}}{{/if}}: \`{{upgrade.newDigest}}\`
 {{/each}}
 
 {{#if hasErrors}}
@@ -134,23 +134,23 @@ Please make sure the following warnings are safe to ignore:
 ---
 
 This PR has been generated by [Renovate Bot](https://renovateapp.com).",
-      "prTitle": "Update Docker {{groupName}} digests",
+      "prTitle": "Update Docker {{{groupName}}} digests",
     },
     "major": Object {
       "enabled": false,
     },
     "packageFile": "Dockerfile",
     "pin": Object {
-      "branchName": "{{branchPrefix}}docker-pin-{{depNameSanitized}}-{{currentTag}}",
+      "branchName": "{{{branchPrefix}}}docker-pin-{{{depNameSanitized}}}-{{{currentTag}}}",
       "group": Object {
         "prBody": "This Pull Request pins Dockerfiles to use image digests. For details on Renovate's Docker support, please visit https://renovateapp.com/docs/language-support/docker
 
 {{#if schedule}}
-**Note**: This PR was created on a configured schedule (\\"{{schedule}}\\"{{#if timezone}} in timezone \`{{timezone}}\`{{/if}}) and will not receive updates outside those times.
+**Note**: This PR was created on a configured schedule (\\"{{{schedule}}}\\"{{#if timezone}} in timezone \`{{{timezone}}}\`{{/if}}) and will not receive updates outside those times.
 {{/if}}
 
 {{#each upgrades as |upgrade|}}
--   {{#if repositoryUrl}}[{{upgrade.depName}}]({{upgrade.repositoryUrl}}){{else}}{{depName}}{{/if}}: \`{{upgrade.newDigest}}\`
+-   {{#if repositoryUrl}}[{{upgrade.depName}}]({{upgrade.repositoryUrl}}){{else}}{{{depName}}}{{/if}}: \`{{upgrade.newDigest}}\`
 {{/each}}
 
 **Important**: Renovate will wait until you have merged this Pin request before creating PRs for any *upgrades*. If you do not wish to pin anything, please update your config accordingly instead of leaving this PR open.
@@ -187,11 +187,11 @@ This PR has been generated by [Renovate Bot](https://renovateapp.com).",
         "prTitle": "Pin Docker digests",
       },
       "groupName": "Pin Docker Digests",
-      "prBody": "This Pull Request pins Docker base image \`{{depName}}:{{currentTag}}\` to use a digest (\`{{newDigest}}\`).
+      "prBody": "This Pull Request pins Docker base image \`{{{depName}}}:{{{currentTag}}}\` to use a digest (\`{{{newDigest}}}\`).
 This digest will then be kept updated via Pull Requests whenever the image is updated on the Docker registry. For details on Renovate's Docker support, please visit https://renovateapp.com/docs/language-support/docker
 
 {{#if schedule}}
-**Note**: This PR was created on a configured schedule (\\"{{schedule}}\\"{{#if timezone}} in timezone \`{{timezone}}\`{{/if}}) and will not receive updates outside those times.
+**Note**: This PR was created on a configured schedule (\\"{{{schedule}}}\\"{{#if timezone}} in timezone \`{{{timezone}}}\`{{/if}}) and will not receive updates outside those times.
 {{/if}}
 
 **Important**: Renovate will wait until you have merged this Pin request before creating PRs for any *upgrades*. If you do not wish to pin anything, please update your config accordingly instead of leaving this PR open.
@@ -225,12 +225,12 @@ Please make sure the following warnings are safe to ignore:
 ---
 
 This PR has been generated by [Renovate Bot](https://renovateapp.com).",
-      "prTitle": "Pin Dockerfile {{depName}}:{{currentTag}} image digest",
+      "prTitle": "Pin Dockerfile {{{depName}}}:{{{currentTag}}} image digest",
     },
-    "prBody": "This Pull Request updates Docker base image {{depName}} from tag \`{{currentTag}}\` to new tag \`{{newTag}}\`. For details on Renovate's Docker support, please visit https://renovateapp.com/docs/language-support/docker
+    "prBody": "This Pull Request updates Docker base image {{{depName}}} from tag \`{{{currentTag}}}\` to new tag \`{{{newTag}}}\`. For details on Renovate's Docker support, please visit https://renovateapp.com/docs/language-support/docker
 
 {{#if schedule}}
-**Note**: This PR was created on a configured schedule (\\"{{schedule}}\\"{{#if timezone}} in timezone \`{{timezone}}\`{{/if}}) and will not receive updates outside those times.
+**Note**: This PR was created on a configured schedule (\\"{{{schedule}}}\\"{{#if timezone}} in timezone \`{{{timezone}}}\`{{/if}}) and will not receive updates outside those times.
 {{/if}}
 
 {{#if hasErrors}}
@@ -262,18 +262,18 @@ Please make sure the following warnings are safe to ignore:
 ---
 
 This PR has been generated by [Renovate Bot](https://renovateapp.com).",
-    "prTitle": "Update {{depName}} Dockerfile tag to {{#if isMajor}}v{{newVersionMajor}}{{else}}v{{newTag}}{{/if}}",
+    "prTitle": "Update {{{depName}}} Dockerfile tag to {{#if isMajor}}v{{{newVersionMajor}}}{{else}}v{{{newTag}}}{{/if}}",
   },
   Object {
-    "branchName": "{{branchPrefix}}node-{{depNameSanitized}}",
+    "branchName": "{{{branchPrefix}}}node-{{{depNameSanitized}}}",
     "content": "hello: world
 ",
     "enabled": true,
     "packageFile": ".travis.yml",
-    "prBody": "This Pull Request updates {{depName}} versions from \`{{currentVersions}}\` to \`{{newVersions}}\`. This is according to the configured node.js support policy \\"{{supportPolicy}}\\".
+    "prBody": "This Pull Request updates {{{depName}}} versions from \`{{{currentVersions}}}\` to \`{{{newVersions}}}\`. This is according to the configured node.js support policy \\"{{{supportPolicy}}}\\".
 
 {{#if schedule}}
-**Note**: This PR was created on a configured schedule (\\"{{schedule}}\\"{{#if timezone}} in timezone \`{{timezone}}\`{{/if}}) and will not receive updates outside those times.
+**Note**: This PR was created on a configured schedule (\\"{{{schedule}}}\\"{{#if timezone}} in timezone \`{{{timezone}}}\`{{/if}}) and will not receive updates outside those times.
 {{/if}}
 
 {{#if hasErrors}}
@@ -305,7 +305,7 @@ Please make sure the following warnings are safe to ignore:
 ---
 
 This PR has been generated by [Renovate Bot](https://renovateapp.com).",
-    "prTitle": "Update {{depName}} versions to [{{newVersions}}]",
+    "prTitle": "Update {{{depName}}} versions to [{{{newVersions}}}]",
     "supportPolicy": Array [
       "lts",
     ],
diff --git a/test/workers/package/__snapshots__/versions.spec.js.snap b/test/workers/package/__snapshots__/versions.spec.js.snap
index 1db60a1b7a..9e0e70b2d9 100644
--- a/test/workers/package/__snapshots__/versions.spec.js.snap
+++ b/test/workers/package/__snapshots__/versions.spec.js.snap
@@ -313,7 +313,7 @@ Array [
 
 exports[`workers/package/versions .determineUpgrades(npmDep, config) should downgrade from missing versions 1`] = `
 Object {
-  "branchName": "{{branchPrefix}}rollback-{{depNameSanitized}}-{{newVersionMajor}}.x",
+  "branchName": "{{{branchPrefix}}}rollback-{{{depNameSanitized}}}-{{{newVersionMajor}}}.x",
   "isRollback": true,
   "newVersion": "1.16.0",
   "newVersionMajor": 1,
-- 
GitLab