Skip to content

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

Closed

Description

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategorizes issue or PR as related to a bug.locked - please file new issue/PRAssist humans wanting to comment on an old issue or PR with locked comments.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions