Skip to content
This repository was archived by the owner on Sep 9, 2020. It is now read-only.
This repository was archived by the owner on Sep 9, 2020. It is now read-only.

v0.12 Regression: param values with double quotes are unexpectedly escaped #861

@jessesuen

Description

@jessesuen

Is this a BUG REPORT or FEATURE REQUEST?: BUG REPORT

/kind bug

What happened:

We were just bitten by a issue where our manifests were rendered differently after upgrading to ksonnet v0.12. Parameter values with double quotes are being escaped when referenced in a component, such that a literal slash started appearing in the values.

I have the following params.libsonnet:

{
  global: {
  },
  components: {
    foo: {
      data: 'something "with" double-quotes'
    }
  },
}

And component: foo.jsonnet

local params = std.extVar("__ksonnet/params").components["foo"];
{
  "kind": "ConfigMap",
  "apiVersion": "v1",
  "metadata": {
    "name": "foo"
  },
  "data": {
    "from-param": params.data,
    "from-literal": 'something "with" double-quotes',
  },
}

In ksonnet 0.11.0, this is the output of ks show:

$ ks-0.11.0 show default
---
apiVersion: v1
data:
  from-literal: something "with" double-quotes
  from-param: something "with" double-quotes
kind: ConfigMap
metadata:
  name: foo

In ksonnet 0.12.0, this is the output of ks show:

$ ks-0.12.0 show default
WARNING ksonnet has moved ksonnet-lib paths to "/Users/jsuen/ws/ksonnet-examples/escape-bug/lib/ksonnet-lib". The current location of of your existing ksonnet-libs can be automatically moved by ksonnet with `ks upgrade`
---
apiVersion: v1
data:
  from-literal: something "with" double-quotes
  from-param: something \"with\" double-quotes
kind: ConfigMap
metadata:
  labels:
    ksonnet.io/component: foo
  name: foo

Notice that the value from the parameter has a literal slash in the value. The value from a string literal does not.

What you expected to happen:

Double quotes in parameters should not be escaped.

How to reproduce it (as minimally and precisely as possible):

I have created an app which will show the difference in behavior between ks 0.11 vs. 0.12:
https://github.com/jessesuen/ksonnet-examples/tree/escape-bug/escape-bug

Anything else we need to know?:

Environment:

  • ksonnet version (use ks version): v0.12.0

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions