Uploaded image for project: 'Bitbucket Cloud'
  1. Bitbucket Cloud
  2. BCLOUD-15844

Bug in authorization plugin

    XMLWordPrintable

Details

    Description

      Summary: using the Docker API for creating containers is not possible, which prevents us from moving our builds to Bitbucket Pipelines (hence blocker). An error occurs in the authorization plugin.

      As discussed here.

      Following minimal test in Pipelines configuration (bitbucket-pipelines.yml):

      #!yaml
      script:
        ...
        - "curl -X POST http://localhost:2375/containers/create -d '{\"image\":\"hello-world\", \"name\":\"hello_2\"}' -H 'Content-Type: application/json'"
      

      That leads to the following error when you look under the docker tab:

      2018/03/14 17:45:11 http: panic serving @: runtime error: invalid memory address or nil pointer dereference
      goroutine 5 [running]:
      net/http.(*conn).serve.func1(0xc42008c8c0)
          /usr/local/go/src/net/http/server.go:1697 +0xd0
      panic(0x6a5000, 0x880800)
          /usr/local/go/src/runtime/panic.go:491 +0x283
      bitbucket.com/bitbucketci/docker/pkg/authz/request.(*ContainerCreateBodyAuthorizer).Authz(0xc4200e2300, 0xc420348090, 0x29, 0x2a, 0x1)
          /go/src/bitbucket.com/bitbucketci/docker/pkg/authz/request/body_authorizer.go:25 +0xa6
      bitbucket.com/bitbucketci/docker/pkg/authz/request.(*Authorizer).Authz(0xc4200e2320, 0x0, 0x0, 0x0, 0x0, 0xc420352028, 0x4, 0xc420350020, 0x12, 0xc420348090, ...)
          /go/src/bitbucket.com/bitbucketci/docker/pkg/authz/request/authorizer.go:31 +0xd5
      bitbucket.com/bitbucketci/docker/pkg/authz/plugin.(*AuthzPlugin).AuthZReq(0xc4200e3240, 0x0, 0x0, 0x0, 0x0, 0xc420352028, 0x4, 0xc420350020, 0x12, 0xc420348090, ...)
          /go/src/bitbucket.com/bitbucketci/docker/pkg/authz/plugin/authz_plugin.go:90 +0x100
      bitbucket.com/bitbucketci/docker/vendor/github.com/docker/go-plugins-helpers/authorization.(*Handler).initMux.func1(0x0, 0x0, 0x0, 0x0, 0xc420352028, 0x4, 0xc420350020, 0x12, 0xc420348090, 0x29, ...)
          /go/src/bitbucket.com/bitbucketci/docker/vendor/github.com/docker/go-plugins-helpers/authorization/api.go:118 +0xa0
      bitbucket.com/bitbucketci/docker/vendor/github.com/docker/go-plugins-helpers/authorization.(*Handler).handle.func1(0x8572c0, 0xc42035a000, 0xc420346000)
          /go/src/bitbucket.com/bitbucketci/docker/vendor/github.com/docker/go-plugins-helpers/authorization/api.go:139 +0x144
      net/http.HandlerFunc.ServeHTTP(0xc420010af0, 0x8572c0, 0xc42035a000, 0xc420346000)
          /usr/local/go/src/net/http/server.go:1918 +0x44
      net/http.(*ServeMux).ServeHTTP(0xc42007af30, 0x8572c0, 0xc42035a000, 0xc420346000)
          /usr/local/go/src/net/http/server.go:2254 +0x130
      net/http.serverHandler.ServeHTTP(0xc420089380, 0x8572c0, 0xc42035a000, 0xc420346000)
          /usr/local/go/src/net/http/server.go:2619 +0xb4
      net/http.(*conn).serve(0xc42008c8c0, 0x8577c0, 0xc42005c340)
          /usr/local/go/src/net/http/server.go:1801 +0x71d
      created by net/http.(*Server).Serve
          /usr/local/go/src/net/http/server.go:2720 +0x288
      time="2018-03-14T17:45:11.730269200Z" level=warning msg="Unable to connect to plugin: /run/docker/plugins/pipelines.sock/AuthZPlugin.AuthZReq: Post http://%2Frun%2Fdocker%2Fplugins%2Fpipelines.sock/AuthZPlugin.AuthZReq: EOF, retrying in 1s"
      time="2018-03-14T17:45:12Z" level=info msg="Pipelines plugin request authorization." allowed=false method= plugin=pipelines uri=
      time="2018-03-14T17:45:12.731391033Z" level=error msg="AuthZRequest for POST /containers/create returned error: plugin pipelines failed with error: AuthZPlugin.AuthZReq: EOF\n{\"Allow\":false,\"Msg\":\"Command not supported.\"}\n"
      time="2018-03-14T17:45:12.731446791Z" level=error msg="Handler for POST /containers/create returned error: plugin pipelines failed with error: AuthZPlugin.AuthZReq: EOF\n{\"Allow\":false,\"Msg\":\"Command not supported.\"}\n"
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            dd4ef6f20873 Sander Verhagen
            Votes:
            26 Vote for this issue
            Watchers:
            28 Start watching this issue

            Dates

              Created:
              Updated: