Skip to content

Commit

Permalink
Don’t allow entire env to runtime.env moustaches
Browse files Browse the repository at this point in the history
It’s just not necessary and potentially insecure. Home is all we need RN, let’s wait for use cases
  • Loading branch information
mxcl committed Apr 13, 2023
1 parent 1d0c1ff commit 906007f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/hooks/usePantry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,11 @@ function expand_env_obj(env_: PlainObject, pkg: Package, deps: Installation[]):
return "0"
} else if (isString(value)) {
const mm = useMoustaches()
const obj = Object.entries(Deno.env.toObject()).map(([key, value]) => ({ from: `env.${key}`, to: value }))
const home = Path.home().string
const obj = [
{ from: 'env.HOME', to: home }, // historic, should be removed at v1
{ from: 'home', to: home }
]
obj.push(...mm.tokenize.all(pkg, deps))
return mm.apply(value, obj)
} else if (isNumber(value)) {
Expand Down

0 comments on commit 906007f

Please sign in to comment.