From 565a7d0b9624525968a00de231e3098e79fb761b Mon Sep 17 00:00:00 2001 From: Gert Drapers <1533850+gertd@users.noreply.github.com> Date: Sun, 8 Sep 2024 11:01:27 +0200 Subject: [PATCH 1/6] upd go-directory with check response context property --- go.mod | 32 +++++++++++++-------------- go.sum | 68 +++++++++++++++++++++++++++++----------------------------- 2 files changed, 50 insertions(+), 50 deletions(-) diff --git a/go.mod b/go.mod index 1414ad6..f738897 100644 --- a/go.mod +++ b/go.mod @@ -3,12 +3,12 @@ module github.com/aserto-dev/go-edge-ds go 1.22 require ( - github.com/Masterminds/semver/v3 v3.2.1 - github.com/aserto-dev/aserto-grpc v0.2.5 + github.com/Masterminds/semver/v3 v3.3.0 + github.com/aserto-dev/aserto-grpc v0.2.6 github.com/aserto-dev/azm v0.1.15 github.com/aserto-dev/errors v0.0.11 - github.com/aserto-dev/go-directory v0.31.11 - github.com/bufbuild/protovalidate-go v0.6.3 + github.com/aserto-dev/go-directory v0.31.12-0.20240908085919-a60c0ba4a828 + github.com/bufbuild/protovalidate-go v0.6.5 github.com/go-http-utils/headers v0.0.0-20181008091004-fed159eddc2a github.com/gonvenience/ytbx v1.4.4 github.com/google/uuid v1.6.0 @@ -17,11 +17,11 @@ require ( github.com/panmari/cuckoofilter v1.0.6 github.com/pkg/errors v0.9.1 github.com/rs/zerolog v1.33.0 - github.com/samber/lo v1.46.0 + github.com/samber/lo v1.47.0 github.com/stretchr/testify v1.9.0 - go.etcd.io/bbolt v1.3.10 + go.etcd.io/bbolt v1.3.11 golang.org/x/sync v0.8.0 - google.golang.org/grpc v1.65.0 + google.golang.org/grpc v1.66.0 google.golang.org/protobuf v1.34.2 ) @@ -38,9 +38,9 @@ require ( github.com/gonvenience/term v1.0.2 // indirect github.com/gonvenience/text v1.0.7 // indirect github.com/gonvenience/wrap v1.2.0 // indirect - github.com/google/cel-go v0.20.1 // indirect + github.com/google/cel-go v0.21.0 // indirect github.com/gorilla/mux v1.8.1 // indirect - github.com/grpc-ecosystem/grpc-gateway/v2 v2.21.0 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect github.com/lucasb-eyer/go-colorful v1.2.0 // indirect @@ -55,13 +55,13 @@ require ( github.com/stoewer/go-strcase v1.3.0 // indirect github.com/texttheater/golang-levenshtein v1.0.1 // indirect github.com/virtuald/go-ordered-json v0.0.0-20170621173500-b18e6e673d74 // indirect - golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa // indirect - golang.org/x/net v0.28.0 // indirect - golang.org/x/sys v0.24.0 // indirect - golang.org/x/term v0.23.0 // indirect - golang.org/x/text v0.17.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240812133136-8ffd90a71988 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240812133136-8ffd90a71988 // indirect + golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e // indirect + golang.org/x/net v0.29.0 // indirect + golang.org/x/sys v0.25.0 // indirect + golang.org/x/term v0.24.0 // indirect + golang.org/x/text v0.18.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index ac4b31b..7059c6f 100644 --- a/go.sum +++ b/go.sum @@ -4,25 +4,25 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v1.4.0 h1:kuoIxZQy2WRRk1pttg9asf+WVv6tWQuBNVmK8+nqPr0= github.com/BurntSushi/toml v1.4.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= -github.com/Masterminds/semver/v3 v3.2.1 h1:RN9w6+7QoMeJVGyfmbcgs28Br8cvmnucEXnY0rYXWg0= -github.com/Masterminds/semver/v3 v3.2.1/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ= +github.com/Masterminds/semver/v3 v3.3.0 h1:B8LGeaivUe71a5qox1ICM/JLl0NqZSW5CHyL+hmvYS0= +github.com/Masterminds/semver/v3 v3.3.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM= github.com/antlr4-go/antlr/v4 v4.13.1 h1:SqQKkuVZ+zWkMMNkjy5FZe5mr5WURWnlpmOuzYWrPrQ= github.com/antlr4-go/antlr/v4 v4.13.1/go.mod h1:GKmUxMtwp6ZgGwZSva4eWPC5mS6vUAmOABFgjdkM7Nw= -github.com/aserto-dev/aserto-grpc v0.2.5 h1:SZ4RaUjqvI9E4tlxa0xuatlgkaOYwFojJ0tAs4DL5Yk= -github.com/aserto-dev/aserto-grpc v0.2.5/go.mod h1:dGcAac+jwA1skVGyD/EIOFBBwQjL4zjmB67fSu00eAg= +github.com/aserto-dev/aserto-grpc v0.2.6 h1:h64MYALF5zLm2sSKcLEtyXyrJvZSxfqTOmQ1j/J44kI= +github.com/aserto-dev/aserto-grpc v0.2.6/go.mod h1:Vki74KINVfnwtJ8QGzRm+xHNjsJ2KUWFtXhezJK9DEg= github.com/aserto-dev/azm v0.1.15 h1:vIBW8s2K+MluvG/lh3pboPvmkvoueiC2c9CAsIvWR2o= github.com/aserto-dev/azm v0.1.15/go.mod h1:gMdMvXNcdvlzDXjEG3Tt0vLCarTAVeROa2T48FwkOD4= github.com/aserto-dev/errors v0.0.11 h1:CXo+Uwmh09doG2HvL1SC8Fnne8f9VPrGyEQPtogAfyY= github.com/aserto-dev/errors v0.0.11/go.mod h1:T1YQOtcxpgBriPTn5HXJkD/QukYz5YojYOIzGMo0ybM= -github.com/aserto-dev/go-directory v0.31.11 h1:3MtLwvnMS5U8Rq3w4n1y/+/WBmvEoBLIQFETuWfXPGs= -github.com/aserto-dev/go-directory v0.31.11/go.mod h1:IDJ4/uoU1NX3rylZt7Zjsv1LdaIX4duoy2EQj3ahLuA= +github.com/aserto-dev/go-directory v0.31.12-0.20240908085919-a60c0ba4a828 h1:VlmyC21TrS778m5Z8GGokK9/JuWO5MxkbGPRSweljjs= +github.com/aserto-dev/go-directory v0.31.12-0.20240908085919-a60c0ba4a828/go.mod h1:fnswCqVA0MxGdYU2doUwW9z5FHlRpphdyEclJ/S5adU= github.com/aserto-dev/header v0.0.8 h1:T052WblWFZ/5Mg3MphHylE3sZobdIQpdj5cP3sPMhL8= github.com/aserto-dev/header v0.0.8/go.mod h1:wmWm+omABTWf6QRRmw9yOdvgTstk/vYDqIA1duR8Pus= github.com/aserto-dev/logger v0.0.5 h1:l8KY2YJgf8zAx0E9tvdKfeg7qIvDZAN7JK2fIPU0AeU= github.com/aserto-dev/logger v0.0.5/go.mod h1:mY1VO/RSATnTb0e4oQw6yR/jGUBG/TEeF73Mqe5h304= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= -github.com/bufbuild/protovalidate-go v0.6.3 h1:wxQyzW035zM16Binbaz/nWAzS12dRIXhZdSUWRY7Fv0= -github.com/bufbuild/protovalidate-go v0.6.3/go.mod h1:J4PtwP9Z2YAGgB0+o+tTWEDtLtXvz/gfhFZD8pbzM/U= +github.com/bufbuild/protovalidate-go v0.6.5 h1:WucDKXIbK22WjkO8A8J6Yyxxy0jl91Oe9LSMduq3YEE= +github.com/bufbuild/protovalidate-go v0.6.5/go.mod h1:LHDiGCWSM3GagZEnyEZ1sPtFwi6Ja4tVTi/DCc+iDFI= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= @@ -39,8 +39,8 @@ github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymF github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/envoyproxy/protoc-gen-validate v1.0.4 h1:gVPz/FMfvh57HdSJQyvBtF00j8JU4zdyUgIUNhlgg0A= -github.com/envoyproxy/protoc-gen-validate v1.0.4/go.mod h1:qys6tmnRsYrQqIhm2bvKZH4Blx/1gTIZ2UKVY1M+Yew= +github.com/envoyproxy/protoc-gen-validate v1.1.0 h1:tntQDh69XqOCOZsDz0lVJQez/2L6Uu2PdjCQwWCJ3bM= +github.com/envoyproxy/protoc-gen-validate v1.1.0/go.mod h1:sXRDRVmzEbkM7CVcM06s9shE/m23dg3wzjl0UWqJ2q4= github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= github.com/go-http-utils/headers v0.0.0-20181008091004-fed159eddc2a h1:v6zMvHuY9yue4+QkG/HQ/W67wvtQmWJ4SDo9aK/GIno= @@ -72,8 +72,8 @@ github.com/gonvenience/wrap v1.2.0 h1:CwAoa60QIBVmQn/aUregAbk9FstEr17k9vCYpKF972 github.com/gonvenience/wrap v1.2.0/go.mod h1:iNijaTmFD8+ORmNp9iS+dSBcCJrmIwwyoYLUngToGdk= github.com/gonvenience/ytbx v1.4.4 h1:jQopwyaLsVGuwdxSiN4WkXjsEaFNPJ3V4lUj7eyEpzo= github.com/gonvenience/ytbx v1.4.4/go.mod h1:w37+MKCPcCMY/jpPNmEklD4xKqrOAVBO6kIWW2+uI6M= -github.com/google/cel-go v0.20.1 h1:nDx9r8S3L4pE61eDdt8igGj8rf5kjYR3ILxWIpWNi84= -github.com/google/cel-go v0.20.1/go.mod h1:kWcIzTsPX0zmQ+H3TirHstLLf9ep5QTsZBN9u4dOYLg= +github.com/google/cel-go v0.21.0 h1:cl6uW/gxN+Hy50tNYvI691+sXxioCnstFzLp2WO4GCI= +github.com/google/cel-go v0.21.0/go.mod h1:rHUlWCcBKgyEk+eV03RPdZUekPp6YcJwV0FxuUksYxc= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= @@ -86,8 +86,8 @@ github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY= github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ= github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 h1:UH//fgunKIs4JdUbpDl1VZCDaL56wXCB/5+wF6uHfaI= github.com/grpc-ecosystem/go-grpc-middleware v1.4.0/go.mod h1:g5qyo/la0ALbONm6Vbp88Yd8NsDy6rZz+RcrMPxvld8= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.21.0 h1:CWyXh/jylQWp2dtiV33mY4iSSp6yf4lmn+c7/tN+ObI= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.21.0/go.mod h1:nCLIt0w3Ept2NwF8ThLmrppXsfT07oC8k0XNDxd8sVU= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0 h1:asbCHRVmodnJTuQ3qamDwqVOIjwqUPTYmYuemVOx+Ys= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0/go.mod h1:ggCgvZ2r7uOoQjOyu2Y1NhHmEPPzzuhWgcza5M1Ji1I= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= @@ -145,8 +145,8 @@ github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99 github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8= github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= -github.com/samber/lo v1.46.0 h1:w8G+oaCPgz1PoCJztqymCFaKwXt+5cCXn51uPxExFfQ= -github.com/samber/lo v1.46.0/go.mod h1:RmDH9Ct32Qy3gduHQuKJ3gW1fMHAnE/fAzQuf6He5cU= +github.com/samber/lo v1.47.0 h1:z7RynLwP5nbyRscyvcD043DWYoOcYRv3mV8lBeqOCLc= +github.com/samber/lo v1.47.0/go.mod h1:RmDH9Ct32Qy3gduHQuKJ3gW1fMHAnE/fAzQuf6He5cU= github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 h1:n661drycOFuPLCN3Uc8sB6B/s6Z4t2xvBgU1htSHuq8= github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= @@ -173,8 +173,8 @@ github.com/virtuald/go-ordered-json v0.0.0-20170621173500-b18e6e673d74 h1:JwtAtb github.com/virtuald/go-ordered-json v0.0.0-20170621173500-b18e6e673d74/go.mod h1:RmMWU37GKR2s6pgrIEB4ixgpVCt/cf7dnJv3fuH1J1c= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -go.etcd.io/bbolt v1.3.10 h1:+BqfJTcCzTItrop8mq/lbzL8wSGtj94UO/3U31shqG0= -go.etcd.io/bbolt v1.3.10/go.mod h1:bK3UQLPJZly7IlNmV7uVHJDxfe5aK9Ll93e/74Y9oEQ= +go.etcd.io/bbolt v1.3.11 h1:yGEzV1wPz2yVCLsD8ZAiGHhHVlczyC9d1rP43/VCRJ0= +go.etcd.io/bbolt v1.3.11/go.mod h1:dksAq7YMXoljX0xu6VF5DMZGbhYYoLUalEiSySYAS4I= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= @@ -183,8 +183,8 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa h1:ELnwvuAXPNtPk1TJRuGkI9fDTwym6AYBu0qzT8AcHdI= -golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa/go.mod h1:akd2r19cwCdwSwWeIdzYQGa/EZZyqcOdwWiwj5L5eKQ= +golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e h1:I88y4caeGeuDQxgdoFPUq097j7kNfw6uvuiNxUBfcBk= +golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e/go.mod h1:akd2r19cwCdwSwWeIdzYQGa/EZZyqcOdwWiwj5L5eKQ= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= @@ -199,8 +199,8 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= -golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= +golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= +golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -218,14 +218,14 @@ golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= -golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/term v0.23.0 h1:F6D4vR+EHoL9/sWAWgAR1H2DcHr4PareCbAaCo1RpuU= -golang.org/x/term v0.23.0/go.mod h1:DgV24QBUrK6jhZXl+20l6UWznPlwAHm1Q1mGHtydmSk= +golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= +golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/term v0.24.0 h1:Mh5cbb+Zk2hqqXNO7S1iTjEphVL+jb8ZWaqh/g+JWkM= +golang.org/x/term v0.24.0/go.mod h1:lOBK/LVxemqiMij05LGJ0tzNr8xlmwBRJ81PX6wVLH8= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= -golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= +golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= @@ -246,17 +246,17 @@ google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7 google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto/googleapis/api v0.0.0-20240812133136-8ffd90a71988 h1:+/tmTy5zAieooKIXfzDm9KiA3Bv6JBwriRN9LY+yayk= -google.golang.org/genproto/googleapis/api v0.0.0-20240812133136-8ffd90a71988/go.mod h1:4+X6GvPs+25wZKbQq9qyAXrwIRExv7w0Ea6MgZLZiDM= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240812133136-8ffd90a71988 h1:V71AcdLZr2p8dC9dbOIMCpqi4EmRl8wUwnJzXXLmbmc= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240812133136-8ffd90a71988/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= +google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 h1:hjSy6tcFQZ171igDaN5QHOw2n6vx40juYbC/x67CEhc= +google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:qpvKtACPCQhAdu3PyQgV4l3LMXZEtft7y8QcarRsp9I= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 h1:pPJltXNxVzT4pK9yD8vR9X75DaWYYmLGMsEvBfFQZzQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= -google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= -google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= +google.golang.org/grpc v1.66.0 h1:DibZuoBznOxbDQxRINckZcUvnCEvrW9pcWIE2yF9r1c= +google.golang.org/grpc v1.66.0/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= From a87b6bbdfbd1af4f68be327b0e5433a6ac2f4427 Mon Sep 17 00:00:00 2001 From: Gert Drapers <1533850+gertd@users.noreply.github.com> Date: Wed, 11 Sep 2024 12:45:48 +0200 Subject: [PATCH 2/6] add context to check response --- go.mod | 3 +++ go.sum | 2 -- pkg/directory/v3/reader.go | 34 +++++++++++++++++++++++++++++++--- pkg/ds/check.go | 32 ++++++++++++++++++++++++++++++++ 4 files changed, 66 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index f738897..8d09f36 100644 --- a/go.mod +++ b/go.mod @@ -2,6 +2,9 @@ module github.com/aserto-dev/go-edge-ds go 1.22 +replace github.com/aserto-dev/azm => ../azm +replace github.com/aserto-dev/go-directory => ../go-directory + require ( github.com/Masterminds/semver/v3 v3.3.0 github.com/aserto-dev/aserto-grpc v0.2.6 diff --git a/go.sum b/go.sum index 7059c6f..1fac9ee 100644 --- a/go.sum +++ b/go.sum @@ -10,8 +10,6 @@ github.com/antlr4-go/antlr/v4 v4.13.1 h1:SqQKkuVZ+zWkMMNkjy5FZe5mr5WURWnlpmOuzYW github.com/antlr4-go/antlr/v4 v4.13.1/go.mod h1:GKmUxMtwp6ZgGwZSva4eWPC5mS6vUAmOABFgjdkM7Nw= github.com/aserto-dev/aserto-grpc v0.2.6 h1:h64MYALF5zLm2sSKcLEtyXyrJvZSxfqTOmQ1j/J44kI= github.com/aserto-dev/aserto-grpc v0.2.6/go.mod h1:Vki74KINVfnwtJ8QGzRm+xHNjsJ2KUWFtXhezJK9DEg= -github.com/aserto-dev/azm v0.1.15 h1:vIBW8s2K+MluvG/lh3pboPvmkvoueiC2c9CAsIvWR2o= -github.com/aserto-dev/azm v0.1.15/go.mod h1:gMdMvXNcdvlzDXjEG3Tt0vLCarTAVeROa2T48FwkOD4= github.com/aserto-dev/errors v0.0.11 h1:CXo+Uwmh09doG2HvL1SC8Fnne8f9VPrGyEQPtogAfyY= github.com/aserto-dev/errors v0.0.11/go.mod h1:T1YQOtcxpgBriPTn5HXJkD/QukYz5YojYOIzGMo0ybM= github.com/aserto-dev/go-directory v0.31.12-0.20240908085919-a60c0ba4a828 h1:VlmyC21TrS778m5Z8GGokK9/JuWO5MxkbGPRSweljjs= diff --git a/pkg/directory/v3/reader.go b/pkg/directory/v3/reader.go index 6b1aa31..08e512d 100644 --- a/pkg/directory/v3/reader.go +++ b/pkg/directory/v3/reader.go @@ -6,8 +6,10 @@ import ( dsc3 "github.com/aserto-dev/go-directory/aserto/directory/common/v3" dsr3 "github.com/aserto-dev/go-directory/aserto/directory/reader/v3" "github.com/aserto-dev/go-directory/pkg/derr" + "github.com/aserto-dev/go-directory/pkg/prop" "github.com/aserto-dev/go-edge-ds/pkg/bdb" "github.com/aserto-dev/go-edge-ds/pkg/ds" + "github.com/pkg/errors" "github.com/bufbuild/protovalidate-go" "github.com/go-http-utils/headers" @@ -17,6 +19,7 @@ import ( "google.golang.org/grpc" grpcmd "google.golang.org/grpc/metadata" "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/types/known/structpb" ) type Reader struct { @@ -311,26 +314,51 @@ func (s *Reader) GetRelations(ctx context.Context, req *dsr3.GetRelationsRequest return resp, err } +func setContextWithReason(err error) *structpb.Struct { + return &structpb.Struct{ + Fields: map[string]*structpb.Value{ + prop.Reason: structpb.NewStringValue(err.Error()), + }, + } +} + // Check, if subject is permitted to access resource (object). func (s *Reader) Check(ctx context.Context, req *dsr3.CheckRequest) (*dsr3.CheckResponse, error) { resp := &dsr3.CheckResponse{} if err := s.Validate(req); err != nil { - return resp, derr.ErrProtoValidate.Msg(err.Error()) + resp.Check = false + resp.Context = setContextWithReason(err) + return resp, nil } check := ds.Check(req) if err := check.Validate(s.store.MC()); err != nil { - return resp, err + resp.Check = false + + if err := errors.Unwrap(err); err != nil { + resp.Context = setContextWithReason(err) + return resp, nil + } + + resp.Context = setContextWithReason(err) + return resp, nil } err := s.store.DB().View(func(tx *bolt.Tx) error { + if err := check.RelationIdentifiersExist(ctx, tx); err != nil { + return err + } + var err error resp, err = check.Exec(ctx, tx, s.store.MC()) return err }) + if err != nil { + resp.Context = setContextWithReason(err) + } - return resp, err + return resp, nil } // CheckPermission, check if subject is permitted to access resource (object). diff --git a/pkg/ds/check.go b/pkg/ds/check.go index 1ff0273..d8b4a25 100644 --- a/pkg/ds/check.go +++ b/pkg/ds/check.go @@ -10,6 +10,7 @@ import ( dsc3 "github.com/aserto-dev/go-directory/aserto/directory/common/v3" dsr3 "github.com/aserto-dev/go-directory/aserto/directory/reader/v3" + "github.com/aserto-dev/go-directory/pkg/derr" "github.com/samber/lo" bolt "go.etcd.io/bbolt" @@ -40,3 +41,34 @@ func getRelations(ctx context.Context, tx *bolt.Tx) graph.RelationReader { }), nil } } + +func (i *check) RelationIdentifiersExist(ctx context.Context, tx *bolt.Tx) error { + if exists := i.relationIdentifierExist( + ctx, tx, bdb.RelationsSubPath, + ObjectIdentifier(&dsc3.ObjectIdentifier{ObjectType: i.SubjectType, ObjectId: i.SubjectId}).Key(), + ); !exists { + return derr.ErrObjectNotFound.Msgf("subject %s:%s", i.SubjectType, i.SubjectId) + } + + if exists := i.relationIdentifierExist( + ctx, tx, bdb.RelationsObjPath, + ObjectIdentifier(&dsc3.ObjectIdentifier{ObjectType: i.ObjectType, ObjectId: i.ObjectId}).Key(), + ); !exists { + return derr.ErrObjectNotFound.Msgf("object %s:%s", i.ObjectType, i.ObjectId) + } + + return nil +} + +func (i *check) relationIdentifierExist(ctx context.Context, tx *bolt.Tx, path bdb.Path, keyFilter string) bool { + scan, err := bdb.NewScanIterator[dsc3.Relation](ctx, tx, path, bdb.WithPageSize(1), bdb.WithKeyFilter(keyFilter)) + if err != nil { + return false + } + + if scan.Next() { + return true + } + + return false +} From e71ac8e39e4e977f346546f42bb1eb15e1f7affe Mon Sep 17 00:00:00 2001 From: Gert Drapers <1533850+gertd@users.noreply.github.com> Date: Wed, 11 Sep 2024 12:55:18 +0200 Subject: [PATCH 3/6] upd go-directory, azm deps --- go.mod | 5 +++-- go.sum | 2 -- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index 8d09f36..6463f02 100644 --- a/go.mod +++ b/go.mod @@ -3,14 +3,15 @@ module github.com/aserto-dev/go-edge-ds go 1.22 replace github.com/aserto-dev/azm => ../azm + replace github.com/aserto-dev/go-directory => ../go-directory require ( github.com/Masterminds/semver/v3 v3.3.0 github.com/aserto-dev/aserto-grpc v0.2.6 - github.com/aserto-dev/azm v0.1.15 + github.com/aserto-dev/azm v0.1.16-0.20240911105403-fadfae668c86 github.com/aserto-dev/errors v0.0.11 - github.com/aserto-dev/go-directory v0.31.12-0.20240908085919-a60c0ba4a828 + github.com/aserto-dev/go-directory v0.31.12-0.20240911105251-5f39873b6d53 github.com/bufbuild/protovalidate-go v0.6.5 github.com/go-http-utils/headers v0.0.0-20181008091004-fed159eddc2a github.com/gonvenience/ytbx v1.4.4 diff --git a/go.sum b/go.sum index 1fac9ee..5ffdfda 100644 --- a/go.sum +++ b/go.sum @@ -12,8 +12,6 @@ github.com/aserto-dev/aserto-grpc v0.2.6 h1:h64MYALF5zLm2sSKcLEtyXyrJvZSxfqTOmQ1 github.com/aserto-dev/aserto-grpc v0.2.6/go.mod h1:Vki74KINVfnwtJ8QGzRm+xHNjsJ2KUWFtXhezJK9DEg= github.com/aserto-dev/errors v0.0.11 h1:CXo+Uwmh09doG2HvL1SC8Fnne8f9VPrGyEQPtogAfyY= github.com/aserto-dev/errors v0.0.11/go.mod h1:T1YQOtcxpgBriPTn5HXJkD/QukYz5YojYOIzGMo0ybM= -github.com/aserto-dev/go-directory v0.31.12-0.20240908085919-a60c0ba4a828 h1:VlmyC21TrS778m5Z8GGokK9/JuWO5MxkbGPRSweljjs= -github.com/aserto-dev/go-directory v0.31.12-0.20240908085919-a60c0ba4a828/go.mod h1:fnswCqVA0MxGdYU2doUwW9z5FHlRpphdyEclJ/S5adU= github.com/aserto-dev/header v0.0.8 h1:T052WblWFZ/5Mg3MphHylE3sZobdIQpdj5cP3sPMhL8= github.com/aserto-dev/header v0.0.8/go.mod h1:wmWm+omABTWf6QRRmw9yOdvgTstk/vYDqIA1duR8Pus= github.com/aserto-dev/logger v0.0.5 h1:l8KY2YJgf8zAx0E9tvdKfeg7qIvDZAN7JK2fIPU0AeU= From 7f17ce902e33879d79946ceff178b01db7af461a Mon Sep 17 00:00:00 2001 From: Gert Drapers <1533850+gertd@users.noreply.github.com> Date: Wed, 11 Sep 2024 13:07:49 +0200 Subject: [PATCH 4/6] use go get *@check-reason --- go.mod | 5 ++--- go.sum | 4 ++++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 6463f02..4766d25 100644 --- a/go.mod +++ b/go.mod @@ -2,9 +2,8 @@ module github.com/aserto-dev/go-edge-ds go 1.22 -replace github.com/aserto-dev/azm => ../azm - -replace github.com/aserto-dev/go-directory => ../go-directory +// replace github.com/aserto-dev/azm => ../azm +// replace github.com/aserto-dev/go-directory => ../go-directory require ( github.com/Masterminds/semver/v3 v3.3.0 diff --git a/go.sum b/go.sum index 5ffdfda..79ccb1f 100644 --- a/go.sum +++ b/go.sum @@ -10,8 +10,12 @@ github.com/antlr4-go/antlr/v4 v4.13.1 h1:SqQKkuVZ+zWkMMNkjy5FZe5mr5WURWnlpmOuzYW github.com/antlr4-go/antlr/v4 v4.13.1/go.mod h1:GKmUxMtwp6ZgGwZSva4eWPC5mS6vUAmOABFgjdkM7Nw= github.com/aserto-dev/aserto-grpc v0.2.6 h1:h64MYALF5zLm2sSKcLEtyXyrJvZSxfqTOmQ1j/J44kI= github.com/aserto-dev/aserto-grpc v0.2.6/go.mod h1:Vki74KINVfnwtJ8QGzRm+xHNjsJ2KUWFtXhezJK9DEg= +github.com/aserto-dev/azm v0.1.16-0.20240911105403-fadfae668c86 h1:9bv3ci22qfQfja5UktY4e76GyuzixBDNakB9nKWC7LQ= +github.com/aserto-dev/azm v0.1.16-0.20240911105403-fadfae668c86/go.mod h1:QieJsIAR+krBFVQQeU4d5uBNQY5fjeQq3M9jhrXYHfU= github.com/aserto-dev/errors v0.0.11 h1:CXo+Uwmh09doG2HvL1SC8Fnne8f9VPrGyEQPtogAfyY= github.com/aserto-dev/errors v0.0.11/go.mod h1:T1YQOtcxpgBriPTn5HXJkD/QukYz5YojYOIzGMo0ybM= +github.com/aserto-dev/go-directory v0.31.12-0.20240911105251-5f39873b6d53 h1:I6mNCar1slygs/KKCAzvePFVqujSYpxoCmELNQKhNa8= +github.com/aserto-dev/go-directory v0.31.12-0.20240911105251-5f39873b6d53/go.mod h1:fnswCqVA0MxGdYU2doUwW9z5FHlRpphdyEclJ/S5adU= github.com/aserto-dev/header v0.0.8 h1:T052WblWFZ/5Mg3MphHylE3sZobdIQpdj5cP3sPMhL8= github.com/aserto-dev/header v0.0.8/go.mod h1:wmWm+omABTWf6QRRmw9yOdvgTstk/vYDqIA1duR8Pus= github.com/aserto-dev/logger v0.0.5 h1:l8KY2YJgf8zAx0E9tvdKfeg7qIvDZAN7JK2fIPU0AeU= From 4997276427fa664fdbe9b5bb18b52f46b2cf8df2 Mon Sep 17 00:00:00 2001 From: Gert Drapers <1533850+gertd@users.noreply.github.com> Date: Thu, 12 Sep 2024 12:16:48 +0200 Subject: [PATCH 5/6] upd go-directory & azm deps --- go.mod | 4 ++-- go.sum | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 4766d25..fefd9c0 100644 --- a/go.mod +++ b/go.mod @@ -8,9 +8,9 @@ go 1.22 require ( github.com/Masterminds/semver/v3 v3.3.0 github.com/aserto-dev/aserto-grpc v0.2.6 - github.com/aserto-dev/azm v0.1.16-0.20240911105403-fadfae668c86 + github.com/aserto-dev/azm v0.1.17-0.20240912101548-36472d1964dc github.com/aserto-dev/errors v0.0.11 - github.com/aserto-dev/go-directory v0.31.12-0.20240911105251-5f39873b6d53 + github.com/aserto-dev/go-directory v0.31.12-0.20240912101324-b22fec59953f github.com/bufbuild/protovalidate-go v0.6.5 github.com/go-http-utils/headers v0.0.0-20181008091004-fed159eddc2a github.com/gonvenience/ytbx v1.4.4 diff --git a/go.sum b/go.sum index 79ccb1f..352c673 100644 --- a/go.sum +++ b/go.sum @@ -12,10 +12,14 @@ github.com/aserto-dev/aserto-grpc v0.2.6 h1:h64MYALF5zLm2sSKcLEtyXyrJvZSxfqTOmQ1 github.com/aserto-dev/aserto-grpc v0.2.6/go.mod h1:Vki74KINVfnwtJ8QGzRm+xHNjsJ2KUWFtXhezJK9DEg= github.com/aserto-dev/azm v0.1.16-0.20240911105403-fadfae668c86 h1:9bv3ci22qfQfja5UktY4e76GyuzixBDNakB9nKWC7LQ= github.com/aserto-dev/azm v0.1.16-0.20240911105403-fadfae668c86/go.mod h1:QieJsIAR+krBFVQQeU4d5uBNQY5fjeQq3M9jhrXYHfU= +github.com/aserto-dev/azm v0.1.17-0.20240912101548-36472d1964dc h1:7v6/ZBnNccHogp4qYX+Q8Ib8fMKtuF0rOGRUAjnDibU= +github.com/aserto-dev/azm v0.1.17-0.20240912101548-36472d1964dc/go.mod h1:GCWBtqhC07emV84G9FkraYXYpuzId5EVT7+QzOSm2n8= github.com/aserto-dev/errors v0.0.11 h1:CXo+Uwmh09doG2HvL1SC8Fnne8f9VPrGyEQPtogAfyY= github.com/aserto-dev/errors v0.0.11/go.mod h1:T1YQOtcxpgBriPTn5HXJkD/QukYz5YojYOIzGMo0ybM= github.com/aserto-dev/go-directory v0.31.12-0.20240911105251-5f39873b6d53 h1:I6mNCar1slygs/KKCAzvePFVqujSYpxoCmELNQKhNa8= github.com/aserto-dev/go-directory v0.31.12-0.20240911105251-5f39873b6d53/go.mod h1:fnswCqVA0MxGdYU2doUwW9z5FHlRpphdyEclJ/S5adU= +github.com/aserto-dev/go-directory v0.31.12-0.20240912101324-b22fec59953f h1:Nvk70erG/cTB2hOUwc54E4ctlTMdcGzcXLLFd4SAfao= +github.com/aserto-dev/go-directory v0.31.12-0.20240912101324-b22fec59953f/go.mod h1:fnswCqVA0MxGdYU2doUwW9z5FHlRpphdyEclJ/S5adU= github.com/aserto-dev/header v0.0.8 h1:T052WblWFZ/5Mg3MphHylE3sZobdIQpdj5cP3sPMhL8= github.com/aserto-dev/header v0.0.8/go.mod h1:wmWm+omABTWf6QRRmw9yOdvgTstk/vYDqIA1duR8Pus= github.com/aserto-dev/logger v0.0.5 h1:l8KY2YJgf8zAx0E9tvdKfeg7qIvDZAN7JK2fIPU0AeU= From 9fe750f450c156b5cbd22768763ecb81656efdf9 Mon Sep 17 00:00:00 2001 From: Gert Drapers <1533850+gertd@users.noreply.github.com> Date: Sat, 14 Sep 2024 19:43:26 +0200 Subject: [PATCH 6/6] review feedback and dep upd --- go.mod | 10 +++++----- go.sum | 24 ++++++++++-------------- pkg/ds/check.go | 14 +++++--------- 3 files changed, 20 insertions(+), 28 deletions(-) diff --git a/go.mod b/go.mod index fefd9c0..403ed2e 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/aserto-dev/go-edge-ds -go 1.22 +go 1.22.0 // replace github.com/aserto-dev/azm => ../azm // replace github.com/aserto-dev/go-directory => ../go-directory @@ -8,9 +8,9 @@ go 1.22 require ( github.com/Masterminds/semver/v3 v3.3.0 github.com/aserto-dev/aserto-grpc v0.2.6 - github.com/aserto-dev/azm v0.1.17-0.20240912101548-36472d1964dc + github.com/aserto-dev/azm v0.1.17 github.com/aserto-dev/errors v0.0.11 - github.com/aserto-dev/go-directory v0.31.12-0.20240912101324-b22fec59953f + github.com/aserto-dev/go-directory v0.31.13 github.com/bufbuild/protovalidate-go v0.6.5 github.com/go-http-utils/headers v0.0.0-20181008091004-fed159eddc2a github.com/gonvenience/ytbx v1.4.4 @@ -24,7 +24,7 @@ require ( github.com/stretchr/testify v1.9.0 go.etcd.io/bbolt v1.3.11 golang.org/x/sync v0.8.0 - google.golang.org/grpc v1.66.0 + google.golang.org/grpc v1.66.2 google.golang.org/protobuf v1.34.2 ) @@ -58,7 +58,7 @@ require ( github.com/stoewer/go-strcase v1.3.0 // indirect github.com/texttheater/golang-levenshtein v1.0.1 // indirect github.com/virtuald/go-ordered-json v0.0.0-20170621173500-b18e6e673d74 // indirect - golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e // indirect + golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect golang.org/x/net v0.29.0 // indirect golang.org/x/sys v0.25.0 // indirect golang.org/x/term v0.24.0 // indirect diff --git a/go.sum b/go.sum index 352c673..f8df477 100644 --- a/go.sum +++ b/go.sum @@ -10,16 +10,12 @@ github.com/antlr4-go/antlr/v4 v4.13.1 h1:SqQKkuVZ+zWkMMNkjy5FZe5mr5WURWnlpmOuzYW github.com/antlr4-go/antlr/v4 v4.13.1/go.mod h1:GKmUxMtwp6ZgGwZSva4eWPC5mS6vUAmOABFgjdkM7Nw= github.com/aserto-dev/aserto-grpc v0.2.6 h1:h64MYALF5zLm2sSKcLEtyXyrJvZSxfqTOmQ1j/J44kI= github.com/aserto-dev/aserto-grpc v0.2.6/go.mod h1:Vki74KINVfnwtJ8QGzRm+xHNjsJ2KUWFtXhezJK9DEg= -github.com/aserto-dev/azm v0.1.16-0.20240911105403-fadfae668c86 h1:9bv3ci22qfQfja5UktY4e76GyuzixBDNakB9nKWC7LQ= -github.com/aserto-dev/azm v0.1.16-0.20240911105403-fadfae668c86/go.mod h1:QieJsIAR+krBFVQQeU4d5uBNQY5fjeQq3M9jhrXYHfU= -github.com/aserto-dev/azm v0.1.17-0.20240912101548-36472d1964dc h1:7v6/ZBnNccHogp4qYX+Q8Ib8fMKtuF0rOGRUAjnDibU= -github.com/aserto-dev/azm v0.1.17-0.20240912101548-36472d1964dc/go.mod h1:GCWBtqhC07emV84G9FkraYXYpuzId5EVT7+QzOSm2n8= +github.com/aserto-dev/azm v0.1.17 h1:Mw+kEaiJWKlWmu+GEZCPQJND5V2K9xUJWVkhm4by4sE= +github.com/aserto-dev/azm v0.1.17/go.mod h1:YSphPu2v3mdPaQ0wHOwFbHaoZoiP78mm+UGjhOH9zWI= github.com/aserto-dev/errors v0.0.11 h1:CXo+Uwmh09doG2HvL1SC8Fnne8f9VPrGyEQPtogAfyY= github.com/aserto-dev/errors v0.0.11/go.mod h1:T1YQOtcxpgBriPTn5HXJkD/QukYz5YojYOIzGMo0ybM= -github.com/aserto-dev/go-directory v0.31.12-0.20240911105251-5f39873b6d53 h1:I6mNCar1slygs/KKCAzvePFVqujSYpxoCmELNQKhNa8= -github.com/aserto-dev/go-directory v0.31.12-0.20240911105251-5f39873b6d53/go.mod h1:fnswCqVA0MxGdYU2doUwW9z5FHlRpphdyEclJ/S5adU= -github.com/aserto-dev/go-directory v0.31.12-0.20240912101324-b22fec59953f h1:Nvk70erG/cTB2hOUwc54E4ctlTMdcGzcXLLFd4SAfao= -github.com/aserto-dev/go-directory v0.31.12-0.20240912101324-b22fec59953f/go.mod h1:fnswCqVA0MxGdYU2doUwW9z5FHlRpphdyEclJ/S5adU= +github.com/aserto-dev/go-directory v0.31.13 h1:mgmMVh0eNEIbTPNve7jk7vEf2P+YNzgKGqXW6MI7WeY= +github.com/aserto-dev/go-directory v0.31.13/go.mod h1:6XfBPyXAwaqv0CCj8OJrNU7EhA6uhmM7MWr0SM05lF4= github.com/aserto-dev/header v0.0.8 h1:T052WblWFZ/5Mg3MphHylE3sZobdIQpdj5cP3sPMhL8= github.com/aserto-dev/header v0.0.8/go.mod h1:wmWm+omABTWf6QRRmw9yOdvgTstk/vYDqIA1duR8Pus= github.com/aserto-dev/logger v0.0.5 h1:l8KY2YJgf8zAx0E9tvdKfeg7qIvDZAN7JK2fIPU0AeU= @@ -187,8 +183,8 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e h1:I88y4caeGeuDQxgdoFPUq097j7kNfw6uvuiNxUBfcBk= -golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e/go.mod h1:akd2r19cwCdwSwWeIdzYQGa/EZZyqcOdwWiwj5L5eKQ= +golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= +golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= @@ -239,8 +235,8 @@ golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.24.0 h1:J1shsA93PJUEVaUSaay7UXAyE8aimq3GW0pjlolpa24= -golang.org/x/tools v0.24.0/go.mod h1:YhNqVBIfWHdzvTLs0d8LCuMhkKUgSUKldakyV7W/WDQ= +golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE= +golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -259,8 +255,8 @@ google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyac google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= -google.golang.org/grpc v1.66.0 h1:DibZuoBznOxbDQxRINckZcUvnCEvrW9pcWIE2yF9r1c= -google.golang.org/grpc v1.66.0/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= +google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo= +google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/pkg/ds/check.go b/pkg/ds/check.go index d8b4a25..82e4217 100644 --- a/pkg/ds/check.go +++ b/pkg/ds/check.go @@ -43,17 +43,17 @@ func getRelations(ctx context.Context, tx *bolt.Tx) graph.RelationReader { } func (i *check) RelationIdentifiersExist(ctx context.Context, tx *bolt.Tx) error { - if exists := i.relationIdentifierExist( + if i.relationIdentifierExist( ctx, tx, bdb.RelationsSubPath, ObjectIdentifier(&dsc3.ObjectIdentifier{ObjectType: i.SubjectType, ObjectId: i.SubjectId}).Key(), - ); !exists { + ) { return derr.ErrObjectNotFound.Msgf("subject %s:%s", i.SubjectType, i.SubjectId) } - if exists := i.relationIdentifierExist( + if i.relationIdentifierExist( ctx, tx, bdb.RelationsObjPath, ObjectIdentifier(&dsc3.ObjectIdentifier{ObjectType: i.ObjectType, ObjectId: i.ObjectId}).Key(), - ); !exists { + ) { return derr.ErrObjectNotFound.Msgf("object %s:%s", i.ObjectType, i.ObjectId) } @@ -66,9 +66,5 @@ func (i *check) relationIdentifierExist(ctx context.Context, tx *bolt.Tx, path b return false } - if scan.Next() { - return true - } - - return false + return scan.Next() }