Skip to content

Commit 29a6af8

Browse files
authored
Merge pull request #42 from ConductorOne/ggreer/escape
Escape role and user names so that any roles or users with special characters don't cause syncs to fail.
2 parents a572931 + 4d3494b commit 29a6af8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+6105
-1922
lines changed

.gon-arm64.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"source": ["./dist/macos-arm64_darwin_arm64/baton-snowflake"],
2+
"source": ["./dist/macos-arm64_darwin_arm64_v8.0/baton-snowflake"],
33
"bundle_id": "com.conductorone.baton-snowflake",
44
"apple_id": {
55
"username" : "justin.gallardo@conductorone.com"

.goreleaser.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ builds:
3636
hooks:
3737
post:
3838
- gon .gon-arm64.json
39-
- mv dist/baton-snowflake-darwin-arm64.signed.zip dist/macos-arm64_darwin_arm64/baton-snowflake
39+
- mv dist/baton-snowflake-darwin-arm64.signed.zip dist/macos-arm64_darwin_arm64_v8.0/baton-snowflake
4040
archives:
4141
- id: linux-archive
4242
builds:

go.mod

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/conductorone/baton-snowflake
33
go 1.22.1
44

55
require (
6-
github.com/conductorone/baton-sdk v0.2.51
6+
github.com/conductorone/baton-sdk v0.2.55
77
github.com/golang-jwt/jwt v3.2.2+incompatible
88
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0
99
github.com/spf13/viper v1.19.0
@@ -14,7 +14,6 @@ require (
1414
require (
1515
filippo.io/age v1.1.1 // indirect
1616
filippo.io/edwards25519 v1.1.0 // indirect
17-
github.com/allegro/bigcache/v3 v3.1.0 // indirect
1817
github.com/aws/aws-sdk-go-v2 v1.26.1 // indirect
1918
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.2 // indirect
2019
github.com/aws/aws-sdk-go-v2/config v1.27.11 // indirect
@@ -37,10 +36,12 @@ require (
3736
github.com/benbjohnson/clock v1.3.5 // indirect
3837
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
3938
github.com/deckarep/golang-set/v2 v2.6.0 // indirect
39+
github.com/dolthub/maphash v0.1.0 // indirect
4040
github.com/doug-martin/goqu/v9 v9.19.0 // indirect
4141
github.com/dustin/go-humanize v1.0.1 // indirect
4242
github.com/envoyproxy/protoc-gen-validate v1.0.4 // indirect
4343
github.com/fsnotify/fsnotify v1.7.0 // indirect
44+
github.com/gammazero/deque v0.2.1 // indirect
4445
github.com/glebarez/go-sqlite v1.22.0 // indirect
4546
github.com/go-jose/go-jose/v3 v3.0.3 // indirect
4647
github.com/go-ole/go-ole v1.3.0 // indirect
@@ -53,6 +54,7 @@ require (
5354
github.com/lufia/plan9stats v0.0.0-20240408141607-282e7b5d6b74 // indirect
5455
github.com/magiconair/properties v1.8.7 // indirect
5556
github.com/mattn/go-isatty v0.0.20 // indirect
57+
github.com/maypok86/otter v1.2.4 // indirect
5658
github.com/mitchellh/mapstructure v1.5.0 // indirect
5759
github.com/ncruces/go-strftime v0.1.9 // indirect
5860
github.com/pelletier/go-toml/v2 v2.2.2 // indirect

go.sum

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4
66
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
77
github.com/DATA-DOG/go-sqlmock v1.5.0 h1:Shsta01QNfFxHCfpW6YH2STWB0MudeXXEWMr20OEh60=
88
github.com/DATA-DOG/go-sqlmock v1.5.0/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM=
9-
github.com/allegro/bigcache/v3 v3.1.0 h1:H2Vp8VOvxcrB91o86fUSVJFqeuz8kpyyB02eH3bSzwk=
10-
github.com/allegro/bigcache/v3 v3.1.0/go.mod h1:aPyh7jEvrog9zAwx5N7+JUQX5dZTSGpxF1LAR4dr35I=
119
github.com/aws/aws-sdk-go-v2 v1.26.1 h1:5554eUqIYVWpU0YmeeYZ0wU64H2VLBs8TlhRB2L+EkA=
1210
github.com/aws/aws-sdk-go-v2 v1.26.1/go.mod h1:ffIFB97e2yNsv4aTSGkqtHnppsIJzw7G7BReUZ3jCXM=
1311
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.2 h1:x6xsQXGSmW6frevwDA+vi/wqhp1ct18mVXYN08/93to=
@@ -52,8 +50,8 @@ github.com/benbjohnson/clock v1.3.5/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZx
5250
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
5351
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
5452
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
55-
github.com/conductorone/baton-sdk v0.2.51 h1:YKvf3LtSWWRIPnOYgc+fOtEuNIjVcrkYs99y8j461qU=
56-
github.com/conductorone/baton-sdk v0.2.51/go.mod h1:CYyNk1kPIEgZmc3Z16TmpS1l3KbkNSjyJk16KuQw+JM=
53+
github.com/conductorone/baton-sdk v0.2.55 h1:9X99Xk/495UhoSi3xpcsmf55kApPK8+jegRsUpEpHio=
54+
github.com/conductorone/baton-sdk v0.2.55/go.mod h1:s8Cj7lufoHVNz4cFM6etem0yjJgorl42jMhHrfM2sFA=
5755
github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
5856
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
5957
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@@ -62,6 +60,8 @@ github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8Yc
6260
github.com/deckarep/golang-set/v2 v2.6.0 h1:XfcQbWM1LlMB8BsJ8N9vW5ehnnPVIw0je80NsVHagjM=
6361
github.com/deckarep/golang-set/v2 v2.6.0/go.mod h1:VAky9rY/yGXJOLEDv3OMci+7wtDpOF4IN+y82NBOac4=
6462
github.com/denisenkom/go-mssqldb v0.10.0/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU=
63+
github.com/dolthub/maphash v0.1.0 h1:bsQ7JsF4FkkWyrP3oCnFJgrCUAFbFf3kOl4L/QxPDyQ=
64+
github.com/dolthub/maphash v0.1.0/go.mod h1:gkg4Ch4CdCDu5h6PMriVLawB7koZ+5ijb9puGMV50a4=
6565
github.com/doug-martin/goqu/v9 v9.19.0 h1:PD7t1X3tRcUiSdc5TEyOFKujZA5gs3VSA7wxSvBx7qo=
6666
github.com/doug-martin/goqu/v9 v9.19.0/go.mod h1:nf0Wc2/hV3gYK9LiyqIrzBEVGlI8qW3GuDCEobC4wBQ=
6767
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
@@ -76,6 +76,8 @@ github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHk
7676
github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
7777
github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA=
7878
github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM=
79+
github.com/gammazero/deque v0.2.1 h1:qSdsbG6pgp6nL7A0+K/B7s12mcCY/5l5SIUpMOl+dC0=
80+
github.com/gammazero/deque v0.2.1/go.mod h1:LFroj8x4cMYCukHJDbxFCkT+r9AndaJnFMuZDV34tuU=
7981
github.com/glebarez/go-sqlite v1.22.0 h1:uAcMJhaA6r3LHMTFgP0SifzgXg46yJkgxqyuyec+ruQ=
8082
github.com/glebarez/go-sqlite v1.22.0/go.mod h1:PlBIdHe0+aUEFn+r2/uthrWq4FxbzugL0L8Li6yQJbc=
8183
github.com/go-jose/go-jose/v3 v3.0.3 h1:fFKWeig/irsp7XD2zBxvnmA/XaRWp5V3CBsZXJF7G7k=
@@ -146,6 +148,8 @@ github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D
146148
github.com/mattn/go-sqlite3 v1.14.7/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
147149
github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU=
148150
github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
151+
github.com/maypok86/otter v1.2.4 h1:HhW1Pq6VdJkmWwcZZq19BlEQkHtI8xgsQzBVXJU0nfc=
152+
github.com/maypok86/otter v1.2.4/go.mod h1:mKLfoI7v1HOmQMwFgX4QkRk23mX6ge3RDvjdHOWG4R4=
149153
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
150154
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
151155
github.com/ncruces/go-strftime v0.1.9 h1:bY0MQC28UADQmHmaF5dgpLmImcShSi2kHU9XLdhx/f4=

pkg/snowflake/account_role.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ func (c *Client) ListAccountRoles(ctx context.Context, offset, limit int) ([]Acc
9999

100100
func (c *Client) ListAccountRoleGrantees(ctx context.Context, roleName string, offset, limit int) ([]AccountRoleGrantee, *http.Response, error) {
101101
queries := []string{
102-
fmt.Sprintf("SHOW GRANTS OF ROLE %s;", roleName),
102+
fmt.Sprintf("SHOW GRANTS OF ROLE \"%s\";", roleName),
103103
c.paginateLastQuery(offset, limit),
104104
}
105105

@@ -158,7 +158,7 @@ func (c *Client) GetAccountRole(ctx context.Context, roleName string) (*AccountR
158158

159159
func (c *Client) GrantAccountRole(ctx context.Context, roleName, userName string) (*http.Response, error) {
160160
queries := []string{
161-
fmt.Sprintf("GRANT ROLE %s TO USER %s;", roleName, userName),
161+
fmt.Sprintf("GRANT ROLE \"%s\" TO USER \"%s\";", roleName, userName),
162162
}
163163

164164
req, err := c.PostStatementRequest(ctx, queries)
@@ -171,7 +171,7 @@ func (c *Client) GrantAccountRole(ctx context.Context, roleName, userName string
171171

172172
func (c *Client) RevokeAccountRole(ctx context.Context, roleName, userName string) (*http.Response, error) {
173173
queries := []string{
174-
fmt.Sprintf("REVOKE ROLE %s FROM USER %s;", roleName, userName),
174+
fmt.Sprintf("REVOKE ROLE \"%s\" FROM USER \"%s\";", roleName, userName),
175175
}
176176

177177
req, err := c.PostStatementRequest(ctx, queries)

pkg/snowflake/user.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ func (c *Client) ListUsers(ctx context.Context, offset, limit int) ([]User, *htt
159159

160160
func (c *Client) GetUser(ctx context.Context, username string) (*User, *http.Response, error) {
161161
queries := []string{
162-
fmt.Sprintf("DESCRIBE USER %s;", username),
162+
fmt.Sprintf("DESCRIBE USER \"%s\";", username),
163163
}
164164

165165
req, err := c.PostStatementRequest(ctx, queries)

vendor/github.com/allegro/bigcache/v3/.codecov.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.

vendor/github.com/allegro/bigcache/v3/.gitignore

Lines changed: 0 additions & 11 deletions
This file was deleted.

vendor/github.com/allegro/bigcache/v3/README.md

Lines changed: 0 additions & 204 deletions
This file was deleted.

0 commit comments

Comments
 (0)