diff --git a/go.mod b/go.mod index ad6039f6f..7d043ce7f 100644 --- a/go.mod +++ b/go.mod @@ -7,9 +7,9 @@ require ( github.com/DATA-DOG/go-sqlmock v1.5.2 github.com/Masterminds/semver/v3 v3.2.1 github.com/Masterminds/sprig/v3 v3.2.3 - github.com/adhocore/gronx v1.8.0 - github.com/alicebob/miniredis/v2 v2.31.1 - github.com/aws/aws-sdk-go v1.50.37 + github.com/adhocore/gronx v1.8.1 + github.com/alicebob/miniredis/v2 v2.32.1 + github.com/aws/aws-sdk-go v1.51.0 github.com/buildkite/yaml v0.0.0-20181016232759-0caa5f0796e3 github.com/drone/envsubst v1.0.3 github.com/gin-gonic/gin v1.9.1 @@ -23,7 +23,7 @@ require ( github.com/hashicorp/go-cleanhttp v0.5.2 github.com/hashicorp/go-multierror v1.1.1 github.com/hashicorp/go-retryablehttp v0.7.5 - github.com/hashicorp/vault/api v1.12.0 + github.com/hashicorp/vault/api v1.12.1 github.com/joho/godotenv v1.5.1 github.com/lib/pq v1.10.9 github.com/microcosm-cc/bluemonday v1.0.26 @@ -33,7 +33,7 @@ require ( github.com/sirupsen/logrus v1.9.3 github.com/spf13/afero v1.11.0 github.com/urfave/cli/v2 v2.27.1 - go.starlark.net v0.0.0-20240311180835-efac67204ba7 + go.starlark.net v0.0.0-20240314022150-ee8ed142361c golang.org/x/crypto v0.21.0 golang.org/x/oauth2 v0.18.0 golang.org/x/sync v0.6.0 @@ -57,7 +57,6 @@ require ( github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect - github.com/fatih/color v1.10.0 // indirect github.com/gabriel-vasile/mimetype v1.4.2 // indirect github.com/ghodss/yaml v1.0.0 // indirect github.com/gin-contrib/sse v0.1.0 // indirect @@ -83,7 +82,8 @@ require ( github.com/imdario/mergo v0.3.11 // indirect github.com/jackc/pgpassfile v1.0.0 // indirect github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect - github.com/jackc/pgx/v5 v5.4.3 // indirect + github.com/jackc/pgx/v5 v5.5.4 // indirect + github.com/jackc/puddle/v2 v2.2.1 // indirect github.com/jinzhu/inflection v1.0.0 // indirect github.com/jinzhu/now v1.1.5 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect @@ -91,8 +91,7 @@ require ( github.com/klauspost/cpuid/v2 v2.2.4 // indirect github.com/kr/text v0.2.0 // indirect github.com/leodido/go-urn v1.2.4 // indirect - github.com/mattn/go-colorable v0.1.8 // indirect - github.com/mattn/go-isatty v0.0.19 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-sqlite3 v1.14.17 // indirect github.com/mitchellh/copystructure v1.0.0 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect @@ -111,14 +110,14 @@ require ( github.com/twitchyliquid64/golang-asm v0.15.1 // indirect github.com/ugorji/go/codec v1.2.11 // indirect github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect - github.com/yuin/gopher-lua v1.1.0 // indirect + github.com/yuin/gopher-lua v1.1.1 // indirect golang.org/x/arch v0.3.0 // indirect golang.org/x/net v0.22.0 // indirect golang.org/x/sys v0.18.0 // indirect golang.org/x/text v0.14.0 // indirect golang.org/x/time v0.5.0 // indirect google.golang.org/appengine v1.6.7 // indirect - google.golang.org/protobuf v1.32.0 // indirect + google.golang.org/protobuf v1.33.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect k8s.io/klog/v2 v2.110.1 // indirect diff --git a/go.sum b/go.sum index 1cac891fb..7493cb0e0 100644 --- a/go.sum +++ b/go.sum @@ -2,7 +2,6 @@ github.com/Bose/minisentinel v0.0.0-20200130220412-917c5a9223bb h1:ZVN4Iat3runWO github.com/Bose/minisentinel v0.0.0-20200130220412-917c5a9223bb/go.mod h1:WsAABbY4HQBgd3mGuG4KMNTbHJCPvx9IVBHzysbknss= github.com/DATA-DOG/go-sqlmock v1.5.2 h1:OcvFkGmslmlZibjAjaHm3L//6LiuBgolP7OputlJIzU= github.com/DATA-DOG/go-sqlmock v1.5.2/go.mod h1:88MAG/4G7SMwSE3CeA0ZKzrT5CiOU3OJ+JlNzwDqpNU= -github.com/DmitriyVTitov/size v1.5.0/go.mod h1:le6rNI4CoLQV1b9gzp1+3d7hMAD/uu2QcJ+aYbNgiU0= github.com/FZambia/sentinel v1.0.0 h1:KJ0ryjKTZk5WMp0dXvSdNqp3lFaW1fNFuEYfrkLOYIc= github.com/FZambia/sentinel v1.0.0/go.mod h1:ytL1Am/RLlAoAXG6Kj5LNuw/TRRQrv2rt2FT26vP5gI= github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI= @@ -16,17 +15,17 @@ github.com/PuerkitoBio/purell v1.1.1 h1:WEQqlqaGbrPkxLJWfBwQmfEAE1Z7ONdDLqrN38tN github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M= github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= -github.com/adhocore/gronx v1.8.0 h1:BHgzaGyS7zPmuMVqiIxyAwvKpwAX+bR7bCxDVacfhuo= -github.com/adhocore/gronx v1.8.0/go.mod h1:7oUY1WAU8rEJWmAxXR2DN0JaO4gi9khSgKjiRypqteg= +github.com/adhocore/gronx v1.8.1 h1:F2mLTG5sB11z7vplwD4iydz3YCEjstSfYmCrdSm3t6A= +github.com/adhocore/gronx v1.8.1/go.mod h1:7oUY1WAU8rEJWmAxXR2DN0JaO4gi9khSgKjiRypqteg= github.com/alicebob/gopher-json v0.0.0-20180125190556-5a6b3ba71ee6/go.mod h1:SGnFV6hVsYE877CKEZ6tDNTjaSXYUk6QqoIK6PrAtcc= github.com/alicebob/gopher-json v0.0.0-20200520072559-a9ecdc9d1d3a h1:HbKu58rmZpUGpz5+4FfNmIU+FmZg2P3Xaj2v2bfNWmk= github.com/alicebob/gopher-json v0.0.0-20200520072559-a9ecdc9d1d3a/go.mod h1:SGnFV6hVsYE877CKEZ6tDNTjaSXYUk6QqoIK6PrAtcc= github.com/alicebob/miniredis/v2 v2.11.1/go.mod h1:UA48pmi7aSazcGAvcdKcBB49z521IC9VjTTRz2nIaJE= -github.com/alicebob/miniredis/v2 v2.31.1 h1:7XAt0uUg3DtwEKW5ZAGa+K7FZV2DdKQo5K/6TTnfX8Y= -github.com/alicebob/miniredis/v2 v2.31.1/go.mod h1:UB/T2Uztp7MlFSDakaX1sTXUv5CASoprx0wulRT6HBg= +github.com/alicebob/miniredis/v2 v2.32.1 h1:Bz7CciDnYSaa0mX5xODh6GUITRSx+cVhjNoOR4JssBo= +github.com/alicebob/miniredis/v2 v2.32.1/go.mod h1:AqkLNAfUm0K07J28hnAyyQKf/x0YkCY/g5DCtuL01Mw= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= -github.com/aws/aws-sdk-go v1.50.37 h1:gnAf6eYPSTb4QpVwugtWFqD07QXOoX7LewRrtLUx3lI= -github.com/aws/aws-sdk-go v1.50.37/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk= +github.com/aws/aws-sdk-go v1.51.0 h1:EA6GlEYMT3ouCO+v+oTWzKB/vcoHD2T9H9qulRx3lPg= +github.com/aws/aws-sdk-go v1.51.0/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk= github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuPk= github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd30/FjWUq4= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= @@ -62,8 +61,8 @@ github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cu github.com/drone/envsubst v1.0.3 h1:PCIBwNDYjs50AsLZPYdfhSATKaRg/FJmDc2D6+C2x8g= github.com/drone/envsubst v1.0.3/go.mod h1:N2jZmlMufstn1KEqvbHjw40h1KyTmnVzHcSc9bFiJ2g= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/fatih/color v1.10.0 h1:s36xzo75JdqLaaWoiEHk767eHiwo0598uUxyfiPkDsg= -github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= +github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= +github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= github.com/gabriel-vasile/mimetype v1.4.2 h1:w5qFW6JKBz9Y393Y4q372O9A7cUSequkh1Q7OhCmWKU= github.com/gabriel-vasile/mimetype v1.4.2/go.mod h1:zApsH/mKG4w07erKIaJPFiX0Tsq9BFQgN3qGY5GnNgA= github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= @@ -94,7 +93,6 @@ github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= -github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= @@ -146,8 +144,8 @@ github.com/hashicorp/go-sockaddr v1.0.2 h1:ztczhD1jLxIRjVejw8gFomI1BQZOe2WoVOu0S github.com/hashicorp/go-sockaddr v1.0.2/go.mod h1:rB4wwRAUzs07qva3c5SdrY/NEtAUjGlgmH/UkBUC97A= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= -github.com/hashicorp/vault/api v1.12.0 h1:meCpJSesvzQyao8FCOgk2fGdoADAnbDu2WPJN1lDLJ4= -github.com/hashicorp/vault/api v1.12.0/go.mod h1:si+lJCYO7oGkIoNPAN8j3azBLTn9SjMGS+jFaHd1Cck= +github.com/hashicorp/vault/api v1.12.1 h1:WzGN4X5jrJdNO39g6Sa55djNio3I9DxEBOTmCZE7tm0= +github.com/hashicorp/vault/api v1.12.1/go.mod h1:1pqP/sErScodde+ybJCyP+ONC4jzEg7Dmawg/QLWo1k= github.com/huandu/xstrings v1.3.3 h1:/Gcsuc1x8JVbJ9/rlye4xZnVAbEkGauT8lbebqcQws4= github.com/huandu/xstrings v1.3.3/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= github.com/imdario/mergo v0.3.11 h1:3tnifQM4i+fbajXKBHXWEH+KvNHqojZ778UH75j3bGA= @@ -156,8 +154,10 @@ github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsI github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a h1:bbPeKD0xmW/Y25WS6cokEszi5g+S0QxI/d45PkRi7Nk= github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM= -github.com/jackc/pgx/v5 v5.4.3 h1:cxFyXhxlvAifxnkKKdlxv8XqUf59tDlYjnV5YYfsJJY= -github.com/jackc/pgx/v5 v5.4.3/go.mod h1:Ig06C2Vu0t5qXC60W8sqIthScaEnFvojjj9dSljmHRA= +github.com/jackc/pgx/v5 v5.5.4 h1:Xp2aQS8uXButQdnCMWNmvx6UysWQQC+u1EoizjguY+8= +github.com/jackc/pgx/v5 v5.5.4/go.mod h1:ez9gk+OAat140fv9ErkZDYFWmXLfV+++K0uAOiwgm1A= +github.com/jackc/puddle/v2 v2.2.1 h1:RhxXJtFG022u4ibrCSMSiu5aOq1i77R3OHKNJj77OAk= +github.com/jackc/puddle/v2 v2.2.1/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4= github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ= @@ -187,12 +187,11 @@ github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/matryer/is v1.2.0 h1:92UTHpy8CDwaJ08GqLDzhhuixiBUUD1p3AU6PHddz4A= github.com/matryer/is v1.2.0/go.mod h1:2fLPjFQM9rhQ15aVEtbuwhJinnOqrmgXPNdZsdwlWXA= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= -github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8= -github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= -github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-sqlite3 v1.14.17 h1:mCRHCLDUBXgpKAqIKsaAaAsrAlbkeomtRFKXh2L6YIM= github.com/mattn/go-sqlite3 v1.14.17/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg= github.com/microcosm-cc/bluemonday v1.0.26 h1:xbqSvqzQMeEHCqMi64VAs4d8uy6Mequs3rQ0k/Khz58= @@ -273,10 +272,10 @@ github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9dec github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/yuin/gopher-lua v0.0.0-20190206043414-8bfc7677f583/go.mod h1:gqRgreBUhTSL0GeU64rtZ3Uq3wtjOa/TB2YfrtkCbVQ= github.com/yuin/gopher-lua v0.0.0-20191213034115-f46add6fdb5c/go.mod h1:gqRgreBUhTSL0GeU64rtZ3Uq3wtjOa/TB2YfrtkCbVQ= -github.com/yuin/gopher-lua v1.1.0 h1:BojcDhfyDWgU2f2TOzYK/g5p2gxMrku8oupLDqlnSqE= -github.com/yuin/gopher-lua v1.1.0/go.mod h1:GBR0iDaNXjAgGg9zfCvksxSRnQx76gclCIb7kdAd1Pw= -go.starlark.net v0.0.0-20240311180835-efac67204ba7 h1:xH7OJPtjgdj/xXykge/wGPAAqik97FbEVJR55lEY0tQ= -go.starlark.net v0.0.0-20240311180835-efac67204ba7/go.mod h1:MrdO7XaMF3dE3MzuP6mrG0EB3NC7rLWSiEcu9Ii50g8= +github.com/yuin/gopher-lua v1.1.1 h1:kYKnWBjvbNP4XLT3+bPEwAXJx262OhaHDWDVOPjL46M= +github.com/yuin/gopher-lua v1.1.1/go.mod h1:GBR0iDaNXjAgGg9zfCvksxSRnQx76gclCIb7kdAd1Pw= +go.starlark.net v0.0.0-20240314022150-ee8ed142361c h1:roAjH18hZcwI4hHStHbkXjF5b7UUyZ/0SG3hXNN1SjA= +go.starlark.net v0.0.0-20240314022150-ee8ed142361c/go.mod h1:YKMCv9b1WrfWmeqdV5MAuEHWsu5iC+fe6kYl2sQjdI8= golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= golang.org/x/arch v0.3.0 h1:02VY4/ZcO/gBOH6PUaoiptASxtXU10jazRCP865E97k= golang.org/x/arch v0.3.0/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= @@ -318,8 +317,6 @@ golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190204203706-41f3e6584952/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -365,8 +362,8 @@ google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6 google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= -google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= diff --git a/secret/vault/create_test.go b/secret/vault/create_test.go index bcb41b60a..129b0e487 100644 --- a/secret/vault/create_test.go +++ b/secret/vault/create_test.go @@ -52,6 +52,13 @@ func TestVault_Create_Org(t *testing.T) { sec.SetType("org") sec.SetImages([]string{"foo", "bar"}) sec.SetEvents([]string{"foo", "bar"}) + sec.SetAllowCommand(true) + sec.SetAllowSubstitution(true) + sec.SetAllowEvents(library.NewEventsFromMask(1)) + sec.SetCreatedAt(1563474077) + sec.SetCreatedBy("octocat") + sec.SetUpdatedAt(1563474079) + sec.SetUpdatedBy("octocat2") type args struct { version string @@ -136,6 +143,13 @@ func TestVault_Create_Repo(t *testing.T) { sec.SetType("repo") sec.SetImages([]string{"foo", "bar"}) sec.SetEvents([]string{"foo", "bar"}) + sec.SetAllowCommand(true) + sec.SetAllowSubstitution(true) + sec.SetAllowEvents(library.NewEventsFromMask(3)) + sec.SetCreatedAt(1563474077) + sec.SetCreatedBy("octocat") + sec.SetUpdatedAt(1563474079) + sec.SetUpdatedBy("octocat2") type args struct { version string @@ -221,6 +235,13 @@ func TestVault_Create_Shared(t *testing.T) { sec.SetType("shared") sec.SetImages([]string{"foo", "bar"}) sec.SetEvents([]string{"foo", "bar"}) + sec.SetAllowCommand(false) + sec.SetAllowSubstitution(false) + sec.SetAllowEvents(library.NewEventsFromMask(1)) + sec.SetCreatedAt(1563474077) + sec.SetCreatedBy("octocat") + sec.SetUpdatedAt(1563474079) + sec.SetUpdatedBy("octocat2") type args struct { version string diff --git a/secret/vault/get_test.go b/secret/vault/get_test.go index 66f582727..2c811e9fd 100644 --- a/secret/vault/get_test.go +++ b/secret/vault/get_test.go @@ -52,6 +52,13 @@ func TestVault_Get_Org(t *testing.T) { want.SetType("org") want.SetImages([]string{"foo", "bar"}) want.SetEvents([]string{"foo", "bar"}) + want.SetAllowCommand(true) + want.SetAllowSubstitution(true) + want.SetAllowEvents(library.NewEventsFromMask(1)) + want.SetCreatedAt(1563474077) + want.SetCreatedBy("octocat") + want.SetUpdatedAt(1563474079) + want.SetUpdatedBy("octocat2") type args struct { version string @@ -136,6 +143,13 @@ func TestVault_Get_Repo(t *testing.T) { want.SetType("repo") want.SetImages([]string{"foo", "bar"}) want.SetEvents([]string{"foo", "bar"}) + want.SetAllowCommand(true) + want.SetAllowSubstitution(true) + want.SetAllowEvents(library.NewEventsFromMask(3)) + want.SetCreatedAt(1563474077) + want.SetCreatedBy("octocat") + want.SetUpdatedAt(1563474079) + want.SetUpdatedBy("octocat2") type args struct { version string @@ -220,6 +234,13 @@ func TestVault_Get_Shared(t *testing.T) { want.SetType("shared") want.SetImages([]string{"foo", "bar"}) want.SetEvents([]string{"foo", "bar"}) + want.SetAllowCommand(false) + want.SetAllowSubstitution(false) + want.SetAllowEvents(library.NewEventsFromMask(1)) + want.SetCreatedAt(1563474077) + want.SetCreatedBy("octocat") + want.SetUpdatedAt(1563474079) + want.SetUpdatedBy("octocat2") type args struct { version string diff --git a/secret/vault/list_test.go b/secret/vault/list_test.go index 127a127a2..3a6c2ab60 100644 --- a/secret/vault/list_test.go +++ b/secret/vault/list_test.go @@ -67,6 +67,13 @@ func TestVault_List_Org(t *testing.T) { sec.SetType("org") sec.SetImages([]string{"foo", "bar"}) sec.SetEvents([]string{"foo", "bar"}) + sec.SetAllowCommand(true) + sec.SetAllowSubstitution(true) + sec.SetAllowEvents(library.NewEventsFromMask(1)) + sec.SetCreatedAt(1563474077) + sec.SetCreatedBy("octocat") + sec.SetUpdatedAt(1563474079) + sec.SetUpdatedBy("octocat2") want := []*library.Secret{sec} @@ -198,6 +205,13 @@ func TestVault_List_Repo(t *testing.T) { sec.SetType("repo") sec.SetImages([]string{"foo", "bar"}) sec.SetEvents([]string{"foo", "bar"}) + sec.SetAllowCommand(true) + sec.SetAllowSubstitution(true) + sec.SetAllowEvents(library.NewEventsFromMask(3)) + sec.SetCreatedAt(1563474077) + sec.SetCreatedBy("octocat") + sec.SetUpdatedAt(1563474079) + sec.SetUpdatedBy("octocat2") want := []*library.Secret{sec} @@ -314,6 +328,13 @@ func TestVault_List_Shared(t *testing.T) { sec.SetType("shared") sec.SetImages([]string{"foo", "bar"}) sec.SetEvents([]string{"foo", "bar"}) + sec.SetAllowCommand(false) + sec.SetAllowSubstitution(false) + sec.SetAllowEvents(library.NewEventsFromMask(1)) + sec.SetCreatedAt(1563474077) + sec.SetCreatedBy("octocat") + sec.SetUpdatedAt(1563474079) + sec.SetUpdatedBy("octocat2") want := []*library.Secret{sec} diff --git a/secret/vault/testdata/v1/org.json b/secret/vault/testdata/v1/org.json index f73f1769e..bfae2f798 100644 --- a/secret/vault/testdata/v1/org.json +++ b/secret/vault/testdata/v1/org.json @@ -16,7 +16,14 @@ "org": "foo", "repo": "*", "type": "org", - "value": "baz" + "value": "baz", + "allow_command": true, + "allow_substitution": true, + "allow_events": 1, + "created_at": 1563474077, + "created_by": "octocat", + "updated_at": 1563474079, + "updated_by": "octocat2" }, "wrap_info": null, "warnings": null, diff --git a/secret/vault/testdata/v1/repo.json b/secret/vault/testdata/v1/repo.json index f0ef1d417..a4b983696 100644 --- a/secret/vault/testdata/v1/repo.json +++ b/secret/vault/testdata/v1/repo.json @@ -4,19 +4,20 @@ "renewable": false, "lease_duration": 2764800, "data": { - "events": [ - "foo", - "bar" - ], - "images": [ - "foo", - "bar" - ], + "events": ["foo", "bar"], + "images": ["foo", "bar"], "name": "baz", "org": "foo", "repo": "bar", "type": "repo", - "value": "foob" + "value": "foob", + "allow_command": true, + "allow_substitution": true, + "allow_events": 3, + "created_at": 1563474077, + "created_by": "octocat", + "updated_at": 1563474079, + "updated_by": "octocat2" }, "wrap_info": null, "warnings": null, diff --git a/secret/vault/testdata/v1/shared.json b/secret/vault/testdata/v1/shared.json index 6d070ae6f..e070dff61 100644 --- a/secret/vault/testdata/v1/shared.json +++ b/secret/vault/testdata/v1/shared.json @@ -4,19 +4,20 @@ "renewable": false, "lease_duration": 2764800, "data": { - "events": [ - "foo", - "bar" - ], - "images": [ - "foo", - "bar" - ], + "events": ["foo", "bar"], + "images": ["foo", "bar"], "name": "baz", "org": "foo", "team": "bar", "type": "shared", - "value": "foob" + "value": "foob", + "allow_command": false, + "allow_substitution": false, + "allow_events": 1, + "created_at": 1563474077, + "created_by": "octocat", + "updated_at": 1563474079, + "updated_by": "octocat2" }, "wrap_info": null, "warnings": null, diff --git a/secret/vault/testdata/v2/org.json b/secret/vault/testdata/v2/org.json index 8aabdab2c..0ae9c8bd1 100644 --- a/secret/vault/testdata/v2/org.json +++ b/secret/vault/testdata/v2/org.json @@ -5,19 +5,20 @@ "renewable": false, "data": { "data": { - "events": [ - "foo", - "bar" - ], - "images": [ - "foo", - "bar" - ], + "events": ["foo", "bar"], + "images": ["foo", "bar"], "name": "bar", "org": "foo", "repo": "*", "type": "org", - "value": "baz" + "value": "baz", + "allow_command": true, + "allow_substitution": true, + "allow_events": 1, + "created_at": 1563474077, + "created_by": "octocat", + "updated_at": 1563474079, + "updated_by": "octocat2" }, "metadata": { "created_time": "2020-08-14T15:43:44.3462581Z", diff --git a/secret/vault/testdata/v2/repo.json b/secret/vault/testdata/v2/repo.json index bec309b84..29b3e7569 100644 --- a/secret/vault/testdata/v2/repo.json +++ b/secret/vault/testdata/v2/repo.json @@ -5,19 +5,20 @@ "renewable": false, "data": { "data": { - "events": [ - "foo", - "bar" - ], - "images": [ - "foo", - "bar" - ], + "events": ["foo", "bar"], + "images": ["foo", "bar"], "name": "baz", "org": "foo", "repo": "bar", "type": "repo", - "value": "foob" + "value": "foob", + "allow_command": true, + "allow_substitution": true, + "allow_events": 3, + "created_at": 1563474077, + "created_by": "octocat", + "updated_at": 1563474079, + "updated_by": "octocat2" }, "metadata": { "created_time": "2020-08-14T15:43:44.3462581Z", diff --git a/secret/vault/testdata/v2/shared.json b/secret/vault/testdata/v2/shared.json index ffb6c84f0..961da3c6b 100644 --- a/secret/vault/testdata/v2/shared.json +++ b/secret/vault/testdata/v2/shared.json @@ -5,19 +5,20 @@ "renewable": false, "data": { "data": { - "events": [ - "foo", - "bar" - ], - "images": [ - "foo", - "bar" - ], + "events": ["foo", "bar"], + "images": ["foo", "bar"], "name": "baz", "org": "foo", "team": "bar", "type": "shared", - "value": "foob" + "value": "foob", + "allow_command": false, + "allow_substitution": false, + "allow_events": 1, + "created_at": 1563474077, + "created_by": "octocat", + "updated_at": 1563474079, + "updated_by": "octocat2" }, "metadata": { "created_time": "2020-08-14T15:43:44.3462581Z", diff --git a/secret/vault/update.go b/secret/vault/update.go index 9082b2ff4..5655dcb9d 100644 --- a/secret/vault/update.go +++ b/secret/vault/update.go @@ -49,6 +49,10 @@ func (c *client) Update(ctx context.Context, sType, org, name string, s *library vault.Data["events"] = s.GetEvents() } + if s.GetAllowEvents().ToDatabase() != 0 { + vault.Data["allow_events"] = s.GetAllowEvents().ToDatabase() + } + if s.Images != nil { vault.Data["images"] = s.GetImages() } @@ -61,6 +65,10 @@ func (c *client) Update(ctx context.Context, sType, org, name string, s *library vault.Data["allow_command"] = s.GetAllowCommand() } + if s.AllowSubstitution != nil { + vault.Data["allow_substitution"] = s.GetAllowSubstitution() + } + // validate the secret err = database.SecretFromLibrary(secretFromVault(vault)).Validate() if err != nil { diff --git a/secret/vault/update_test.go b/secret/vault/update_test.go index c17c2c936..94f247c7e 100644 --- a/secret/vault/update_test.go +++ b/secret/vault/update_test.go @@ -67,6 +67,13 @@ func TestVault_Update_Org(t *testing.T) { sec.SetType("org") sec.SetImages([]string{"foo", "bar"}) sec.SetEvents([]string{"foo", "bar"}) + sec.SetAllowCommand(true) + sec.SetAllowSubstitution(true) + sec.SetAllowEvents(library.NewEventsFromMask(1)) + sec.SetCreatedAt(1563474077) + sec.SetCreatedBy("octocat") + sec.SetUpdatedAt(1563474079) + sec.SetUpdatedBy("octocat2") type args struct { version string @@ -167,6 +174,13 @@ func TestVault_Update_Repo(t *testing.T) { sec.SetType("repo") sec.SetImages([]string{"foo", "bar"}) sec.SetEvents([]string{"foo", "bar"}) + sec.SetAllowCommand(true) + sec.SetAllowSubstitution(true) + sec.SetAllowEvents(library.NewEventsFromMask(3)) + sec.SetCreatedAt(1563474077) + sec.SetCreatedBy("octocat") + sec.SetUpdatedAt(1563474079) + sec.SetUpdatedBy("octocat2") type args struct { version string @@ -267,6 +281,13 @@ func TestVault_Update_Shared(t *testing.T) { sec.SetType("shared") sec.SetImages([]string{"foo", "bar"}) sec.SetEvents([]string{"foo", "bar"}) + sec.SetAllowCommand(false) + sec.SetAllowSubstitution(false) + sec.SetAllowEvents(library.NewEventsFromMask(1)) + sec.SetCreatedAt(1563474077) + sec.SetCreatedBy("octocat") + sec.SetUpdatedAt(1563474079) + sec.SetUpdatedBy("octocat2") type args struct { version string diff --git a/secret/vault/vault.go b/secret/vault/vault.go index dab603db0..d9f3d79b5 100644 --- a/secret/vault/vault.go +++ b/secret/vault/vault.go @@ -8,6 +8,7 @@ import ( "time" "github.com/aws/aws-sdk-go/service/sts/stsiface" + "github.com/go-vela/types/constants" "github.com/go-vela/types/library" "github.com/hashicorp/vault/api" "github.com/pkg/errors" @@ -157,6 +158,7 @@ func secretFromVault(vault *api.Secret) *library.Secret { } } + // set allow_events if found in Vault secret v, ok = data["allow_events"] if ok { maskJSON, ok := v.(json.Number) @@ -166,6 +168,35 @@ func secretFromVault(vault *api.Secret) *library.Secret { s.SetAllowEvents(library.NewEventsFromMask(mask)) } } + } else { + // if not found, convert events to allow_events + // this happens when vault secret has not been updated since before v0.23 + events, ok := data["events"] + if ok { + allowEventsMask := int64(0) + + for _, element := range events.([]interface{}) { + event, ok := element.(string) + if ok { + switch event { + case constants.EventPush: + allowEventsMask |= constants.AllowPushBranch + case constants.EventPull: + allowEventsMask |= constants.AllowPullOpen | constants.AllowPullReopen | constants.AllowPullSync + case constants.EventComment: + allowEventsMask |= constants.AllowCommentCreate | constants.AllowCommentEdit + case constants.EventDeploy: + allowEventsMask |= constants.AllowDeployCreate + case constants.EventTag: + allowEventsMask |= constants.AllowPushTag + case constants.EventSchedule: + allowEventsMask |= constants.AllowSchedule + } + } + } + + s.SetAllowEvents(library.NewEventsFromMask(allowEventsMask)) + } } // set images if found in Vault secret @@ -252,6 +283,15 @@ func secretFromVault(vault *api.Secret) *library.Secret { if ok { s.SetAllowSubstitution(substitution) } + } else { + // set allow_substitution to allow_command value if not found in Vault secret + cmd, ok := data["allow_command"] + if ok { + command, ok := cmd.(bool) + if ok { + s.SetAllowSubstitution(command) + } + } } // set created_at if found in Vault secret diff --git a/secret/vault/vault_test.go b/secret/vault/vault_test.go index 8893d5c3c..cec5d02c8 100644 --- a/secret/vault/vault_test.go +++ b/secret/vault/vault_test.go @@ -105,6 +105,27 @@ func TestVault_secretFromVault(t *testing.T) { }, } + // test vault secret from pre-v0.23 release + inputLegacy := &api.Secret{ + Data: map[string]interface{}{ + "data": map[string]interface{}{ + "events": []interface{}{"push", "tag", "deployment"}, + "images": []interface{}{"foo", "bar"}, + "name": "bar", + "org": "foo", + "repo": "*", + "team": "foob", + "type": "org", + "value": "baz", + "allow_command": true, + "created_at": json.Number("1563474077"), + "created_by": "octocat", + "updated_at": json.Number("1563474079"), + "updated_by": "octocat2", + }, + }, + } + want := new(library.Secret) want.SetOrg("foo") want.SetRepo("*") @@ -112,8 +133,8 @@ func TestVault_secretFromVault(t *testing.T) { want.SetName("bar") want.SetValue("baz") want.SetType("org") - want.SetEvents([]string{"foo", "bar"}) - want.SetAllowEvents(library.NewEventsFromMask(1)) + want.SetEvents([]string{"push", "tag", "deployment"}) + want.SetAllowEvents(library.NewEventsFromMask(8195)) want.SetImages([]string{"foo", "bar"}) want.SetAllowCommand(true) want.SetAllowSubstitution(true) @@ -132,6 +153,7 @@ func TestVault_secretFromVault(t *testing.T) { }{ {"v1", args{secret: inputV1}}, {"v2", args{secret: inputV2}}, + {"legacy", args{secret: inputLegacy}}, } for _, tt := range tests { @@ -221,8 +243,8 @@ func TestVault_AccurateSecretFields(t *testing.T) { // helper function to return a test Vault secret data. func testVaultSecretData() map[string]interface{} { return map[string]interface{}{ - "events": []interface{}{"foo", "bar"}, - "allow_events": json.Number("1"), + "events": []interface{}{"push", "tag", "deployment"}, + "allow_events": json.Number("8195"), "images": []interface{}{"foo", "bar"}, "name": "bar", "org": "foo",