From ebe5733f27301d24a80eae4e1962753687039fcd Mon Sep 17 00:00:00 2001 From: Daniel Jiang Date: Tue, 18 May 2021 14:54:58 +0800 Subject: [PATCH 1/2] Check user in security context before getting the ID This commit fix a potential nil pointer issue when trying to read User ID from security context Signed-off-by: Daniel Jiang --- src/controller/user/controller.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/controller/user/controller.go b/src/controller/user/controller.go index d646a61ea..1b3576b76 100644 --- a/src/controller/user/controller.go +++ b/src/controller/user/controller.go @@ -113,7 +113,7 @@ func (c *controller) Get(ctx context.Context, id int, opt *Option) (*models.User return nil, fmt.Errorf("can't find security context") } lsc, ok := sctx.(*local.SecurityContext) - if ok && lsc.User().UserID == id { + if ok && lsc.User() != nil && lsc.User().UserID == id { u.AdminRoleInAuth = lsc.User().AdminRoleInAuth } if opt != nil && opt.WithOIDCInfo { From 6ebcc955826d15e44faae61937498b75761a8b8d Mon Sep 17 00:00:00 2001 From: Daniel Jiang Date: Tue, 18 May 2021 15:29:44 +0800 Subject: [PATCH 2/2] Fix docker version in CI.yml Signed-off-by: Daniel Jiang --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 2833bb4d9..796a8654d 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -37,7 +37,7 @@ jobs: - name: setup Docker uses: docker-practice/actions-setup-docker@0.0.1 with: - docker_version: 18.09 + docker_version: 20.04 docker_channel: stable - uses: actions/checkout@v2 with: