diff options
author | Jakub Guzik <jakubmguzik@gmail.com> | 2021-03-19 00:09:18 +0100 |
---|---|---|
committer | Jakub Guzik <jakubmguzik@gmail.com> | 2021-03-19 00:09:29 +0100 |
commit | aa2d6e6e6c7434058c4b1a46d4354391ed4d96d0 (patch) | |
tree | d52ba042d287135d4ca14f4619413316c9fea7e4 /test/apiv2/30-volumes.at | |
parent | 5d9b07096b49877608250c7d51e0ee35b9d502c7 (diff) | |
download | podman-aa2d6e6e6c7434058c4b1a46d4354391ed4d96d0.tar.gz podman-aa2d6e6e6c7434058c4b1a46d4354391ed4d96d0.tar.bz2 podman-aa2d6e6e6c7434058c4b1a46d4354391ed4d96d0.zip |
Fix volumes and networks list/prune filters in http api
This is the continuation work started in #9711. It turns out
that list/prune commands for volumes in libpod/compat api have
very dangerous error handling when broken filter input is supplied.
Problem also affects network list/prune in libpod. This commit
unifies filter handling across libpod/compat api and adds sanity
apiv2 testcases.
Signed-off-by: Jakub Guzik <jakubmguzik@gmail.com>
Diffstat (limited to 'test/apiv2/30-volumes.at')
-rw-r--r-- | test/apiv2/30-volumes.at | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/apiv2/30-volumes.at b/test/apiv2/30-volumes.at index 1a40b3cdf..18ff31100 100644 --- a/test/apiv2/30-volumes.at +++ b/test/apiv2/30-volumes.at @@ -86,14 +86,34 @@ t DELETE libpod/volumes/foo1 404 \ .message~.* \ .response=404 +#compat api list volumes sanity checks +t GET volumes?filters='garb1age}' 500 \ + .cause="invalid character 'g' looking for beginning of value" +t GET volumes?filters='{"label":["testl' 500 \ + .cause="unexpected end of JSON input" + +#libpod api list volumes sanity checks +t GET libpod/volumes/json?filters='garb1age}' 500 \ + .cause="invalid character 'g' looking for beginning of value" +t GET libpod/volumes/json?filters='{"label":["testl' 500 \ + .cause="unexpected end of JSON input" + # Prune volumes - bad filter input t POST volumes/prune?filters='garb1age}' 500 \ .cause="invalid character 'g' looking for beginning of value" +t POST libpod/volumes/prune?filters='garb1age}' 500 \ + .cause="invalid character 'g' looking for beginning of value" ## Prune volumes with label matching 'testlabel1=testonly' t POST libpod/volumes/prune?filters='{"label":["testlabel1=testonly"]}' 200 t GET libpod/volumes/json?filters='{"label":["testlabel1=testonly"]}' 200 length=0 +## Prune volumes with label illformed label +t POST volumes/prune?filters='{"label":["tes' 500 \ + .cause="unexpected end of JSON input" +t POST libpod/volumes/prune?filters='{"label":["tes' 500 \ + .cause="unexpected end of JSON input" + ## Prune volumes with label matching 'testlabel' t POST libpod/volumes/prune?filters='{"label":["testlabel"]}' 200 t GET libpod/volumes/json?filters='{"label":["testlabel"]}' 200 length=0 |