Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/containers/{id}/archive should report 403 if the PUT call fails #12420

Closed
xatier opened this issue Nov 26, 2021 · 1 comment · Fixed by #12431
Closed

/containers/{id}/archive should report 403 if the PUT call fails #12420

xatier opened this issue Nov 26, 2021 · 1 comment · Fixed by #12431
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Comments

@xatier
Copy link
Contributor

xatier commented Nov 26, 2021

Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)

/kind bug

Description

This is related to #12419 , with the same context from nektos/act#303 .

When the PUT API call failed to upload the tar ball into the container, it should report 403 to indicate the error.

Steps to reproduce the issue:

  1. create some random tarball, called act.tar.
  2. Run the script.
set -x

#{"Image": "docker.io/catthehacker/ubuntu:act-latest", "Entrypoint": ["/usr/bin/tail", "-f", "/dev/null"]}
ID=$(curl -Ss -H 'Content-Type: application/json' \
    --unix-socket /run/user/1000/podman/podman.sock \
    -X POST \
    -d '
{
  "Entrypoint": [
    "/usr/bin/tail",
    "-f",
    "/dev/null"
  ],
  "HostConfig": {
    "Mounts": [
      {
        "Source": "act-CI-build-env",
        "Target": "/var/run/act",
        "Type": "volume"
      }
    ]
  },
  "Image": "catthehacker/ubuntu:act-latest"
}' \
    'http://localhost/v1.40/containers/create?name=act-CI-build' \
    | jq -r .Id)


curl -Ss -H 'Content-Type: application/json' \
    --unix-socket /run/user/1000/podman/podman.sock \
    -X POST \
    "http://localhost/v1.40/containers/$ID/start"


curl -vvv -H 'Content-Type: application/json' \
    --unix-socket /run/user/1000/podman/podman.sock \
    -X PUT \
    -T act.tar \
    "http://localhost/v1.40/containers/$ID/archive?noOverwriteDirNonDir=true&path=%2Fvar%2Frun%2Fact%2F"

Describe the results you received:

... omitted

++ curl -vvv -H 'Content-Type: application/json' --unix-socket /run/user/1000/podman/podman.sock -X PUT -T act.tar 'http://localhost/v1.40/containers/a54a2c5a58aaa4075c0dfc40b6339d07527bd87315b8c35eff2509360d0ab1fa/archive?noOverwriteDirNonDir=true&path=%2Fvar%2Frun%2Fact%2F'
*   Trying /run/user/1000/podman/podman.sock:0...
* Connected to localhost (/run/user/1000/podman/podman.sock) port 80 (#0)
> PUT /v1.40/containers/a54a2c5a58aaa4075c0dfc40b6339d07527bd87315b8c35eff2509360d0ab1fa/archive?noOverwriteDirNonDir=true&path=%2Fvar%2Frun%2Fact%2F HTTP/1.1
> Host: localhost
> User-Agent: curl/7.79.1
> Accept: */*
> Content-Type: application/json
> Content-Length: 10240
> Expect: 100-continue
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 100 Continue
* We are completely uploaded and fine
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Api-Version: 1.40
< Libpod-Api-Version: 3.4.2
< Server: Libpod/3.4.2 (linux)
< X-Reference-Id: 0xc0000113d8
< Date: Fri, 26 Nov 2021 08:26:30 GMT
< Content-Length: 0
< 
* Connection #0 to host localhost left intact
* 

Describe the results you expected:

podman-docker API should return HTTP/1.1 403 if the PUT operation failed.

Additional information you deem important (e.g. issue happens only occasionally):

same as in #12419

@openshift-ci openshift-ci bot added the kind/bug Categorizes issue or PR as related to a bug. label Nov 26, 2021
@xatier
Copy link
Contributor Author

xatier commented Nov 26, 2021

Looks like we emit a 200 before even checking copyFunc()'s error 😄

https://github.com/containers/podman/blob/47eaf23039/pkg/api/handlers/compat/containers_archive.go#L125-L139

@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 21, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant