diff options
| author | Shulhan <ms@kilabit.info> | 2023-09-27 00:01:22 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2023-09-27 00:54:10 +0700 |
| commit | d1b393b0d4ca75c8d81d051a332597b7aa3f0ab0 (patch) | |
| tree | 68adc1e0bfee5c6e2056110dc094cb520a5b969a /awwan.go | |
| parent | 59968a1665735990187c05547faab3c5310c4be1 (diff) | |
| download | awwan-d1b393b0d4ca75c8d81d051a332597b7aa3f0ab0.tar.xz | |
all: make .Vars, .Val, and .Vals panic if values is empty
This is to prevent copying or executing command with value that are
not defined or typo which make the result empty and may result in
undefined behaviour.
For example if we have "app_dir = /data/app" and command in the script
that remove that directory recursively,
sudo rm -r {{.Val "::app_dir}}/bin
will result removing "/bin" entirely.
Diffstat (limited to 'awwan.go')
| -rw-r--r-- | awwan.go | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -209,7 +209,7 @@ func (aww *Awwan) Local(req *Request) (err error) { if len(req.Content) == 0 { req.script, err = NewScript(ses, req.scriptPath) } else { - req.script, err = ParseScript(ses, req.Content) + req.script, err = ParseScript(ses, req.scriptPath, req.Content) } if err != nil { return fmt.Errorf("%s: %w", logp, err) @@ -288,7 +288,7 @@ func (aww *Awwan) Play(req *Request) (err error) { if len(req.Content) == 0 { req.script, err = NewScript(ses, req.scriptPath) } else { - req.script, err = ParseScript(ses, req.Content) + req.script, err = ParseScript(ses, req.scriptPath, req.Content) } if err != nil { return fmt.Errorf("%s: %w", logp, err) |
