Skip to content

output file is able to outside of output directory #527

Open
@loynoir

Description

@loynoir

Story

Not a use case.
But just as a jsonnet starter, wonder what is I set output key begins with "/" and "..".
Seems there are two different logic.

  1. "/" is chroot-jail alike
  2. ".." is NOT chroot-jail alike

Don't know if it is a bug or a feature. So here I am.

Reproduce

$ cat foo.jsonnet 
{
  "a.json": {
    "a": 42
  },
  "/tmp/b.json": {
    "a": 42
  },
  "../c.json": {
    "a": 42
  }
}

Actual

'../c.json' is outside of 'dist'

$ jsonnet -c -m dist foo.jsonnet
dist/../c.json
dist//tmp/b.json
dist/a.json
$ tree
.
├── c.json
├── dist
│   ├── a.json
│   └── tmp
│       └── b.json
└── foo.jsonnet

Expected

'../c.json' is within of 'dist'

$ jsonnet -c -m dist foo.jsonnet
dist/c.json
dist//tmp/b.json
dist/a.json
$ tree
.
├── dist
│   ├── c.json
│   ├── a.json
│   └── tmp
│       └── b.json
└── foo.jsonnet

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions