Skip to content

Commit

Permalink
api: auth: fix nil deref
Browse files Browse the repository at this point in the history
By pulling in the fixes from c/common.  Add regression tests to make
sure it's not happening another time.  The error messages are not
ideal and should probably be optimized in the `/auth` endpoints directly
but it's already an improvement over a nil deref.

Signed-off-by: Valentin Rothberg <[email protected]>
  • Loading branch information
vrothberg committed Apr 12, 2023
1 parent 0a588e7 commit b4cfc72
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 6 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ require (
github.com/containernetworking/cni v1.1.2
github.com/containernetworking/plugins v1.2.0
github.com/containers/buildah v1.30.0
github.com/containers/common v0.52.0
github.com/containers/common v0.52.1-0.20230411124844-19b624d9a20d
github.com/containers/conmon v2.0.20+incompatible
github.com/containers/image/v5 v5.25.0
github.com/containers/libhvee v0.0.2
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,8 @@ github.com/containernetworking/plugins v1.2.0 h1:SWgg3dQG1yzUo4d9iD8cwSVh1VqI+bP
github.com/containernetworking/plugins v1.2.0/go.mod h1:/VjX4uHecW5vVimFa1wkG4s+r/s9qIfPdqlLF4TW8c4=
github.com/containers/buildah v1.30.0 h1:mdp2COGKFFEZNEGP8VZ5ITuUFVNPFoH+iK2sSesNfTA=
github.com/containers/buildah v1.30.0/go.mod h1:lyMLZIevpAa6zSzjRl7z4lFJMCMQLFjfo56YIefaB/U=
github.com/containers/common v0.52.0 h1:S5GApgpNEGBuPhDHTFgMc55y5gsuxHcQeElvUpO5kp4=
github.com/containers/common v0.52.0/go.mod h1:dNJJVNBu1wJtAH+vFIMXV+fQHBdEVNmNP3ImjbKper4=
github.com/containers/common v0.52.1-0.20230411124844-19b624d9a20d h1:vwGEGW7uQtnTCS5qoiMsts7fn7wPRjbHiAC00Cbc22E=
github.com/containers/common v0.52.1-0.20230411124844-19b624d9a20d/go.mod h1:dNJJVNBu1wJtAH+vFIMXV+fQHBdEVNmNP3ImjbKper4=
github.com/containers/conmon v2.0.20+incompatible h1:YbCVSFSCqFjjVwHTPINGdMX1F6JXHGTUje2ZYobNrkg=
github.com/containers/conmon v2.0.20+incompatible/go.mod h1:hgwZ2mtuDrppv78a/cOBNiCm6O0UMWGx1mu7P00nu5I=
github.com/containers/image/v5 v5.25.0 h1:TJ0unmalbU+scd0i3Txap2wjGsAnv06MSCwgn6bsizk=
Expand Down
11 changes: 11 additions & 0 deletions test/apiv2/60-auth.at
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,15 @@ t POST /v1.40/auth username=$REGISTRY_USERNAME password=$REGISTRY_PASSWORD serve
.Status="Login Succeeded" \
.IdentityToken=""

# No username -> error
t POST /v1.40/auth password=$REGISTRY_PASSWORD serveraddress=localhost:$REGISTRY_PORT/ \
500 \
.message~'.* cannot prompt for username without stdin'


# No password -> error
t POST /v1.40/auth username=$REGISTRY_USERNAME serveraddress=https://localhost:$REGISTRY_PORT/ \
500 \
.message~'.* reading password: inappropriate ioctl for device'

stop_registry
7 changes: 6 additions & 1 deletion vendor/github.com/containers/common/pkg/auth/auth.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ github.com/containers/buildah/pkg/rusage
github.com/containers/buildah/pkg/sshagent
github.com/containers/buildah/pkg/util
github.com/containers/buildah/util
# github.com/containers/common v0.52.0
# github.com/containers/common v0.52.1-0.20230411124844-19b624d9a20d
## explicit; go 1.18
github.com/containers/common/libimage
github.com/containers/common/libimage/define
Expand Down

0 comments on commit b4cfc72

Please sign in to comment.