-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Several statements were missing the DefaultDatabase method #8187
Several statements were missing the DefaultDatabase method #8187
Conversation
163c577
to
c74d939
Compare
@nathanielc let me know what you think about the test I put in place as a temporary "future proof" step. It's not ideal, but should allows us to ship this bug fix while we work on a stronger interface solution in the code base. |
I think we also need to consider statements with a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are 15 statements that are listed as exempt that should not be listed. See my internal comments for more details
c704a8a
to
b8f3b25
Compare
@nathanielc can you re-review this and let me know if you have any outstanding concerns based on the other PR's that have been filed to support this? Thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are still a few exempt statements that shouldn't be exempt as they specify a database.
influxql/ast_test.go
Outdated
"ShowDiagnosticsStatement", | ||
"ShowFieldKeysStatement", | ||
"ShowGrantsForUserStatement", | ||
"ShowMeasurementsStatement", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one has a database
Line 2860 in b8f3b25
Database string |
influxql/ast_test.go
Outdated
"ShowContinuousQueriesStatement", | ||
"ShowDatabasesStatement", | ||
"ShowDiagnosticsStatement", | ||
"ShowFieldKeysStatement", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one too
Line 3281 in b8f3b25
Database string |
"GrantAdminStatement", | ||
"KillQueryStatement", | ||
"RevokeAdminStatement", | ||
"SelectStatement", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this one is handled separately but it has a default database for sure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually it has the potential to have multiple databases, so it doesn't have a DefaultDatabase
, which is why it is enforced at the iterator level.
influxql/ast_test.go
Outdated
"CreateDatabaseStatement", | ||
"CreateUserStatement", | ||
"DeleteSeriesStatement", | ||
"DeleteStatement", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't this statement also allow specifying a database.
83b9ff7
to
9e6c989
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found several more the have statements that are not supposed to be exempt.
exemptStatements := []string{ | ||
"CreateDatabaseStatement", | ||
"CreateUserStatement", | ||
"DeleteSeriesStatement", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this one can have a database. There don't appear to be any docs on DeleteSeries so not 100% sure but the type has a source
Line 2689 in 9e6c989
Sources Sources |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can have multiple sources, so the iterators have to handle security. DefaultDatabase would not be appropriate for this one.
"DeleteSeriesStatement", | ||
"DropDatabaseStatement", | ||
"DropMeasurementStatement", | ||
"DropSeriesStatement", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
Line 2658 in 9e6c989
Sources Sources |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here. If you have multiple sources, DefaultDatabase is the wrong mechanism to use.
influxql/ast_test.go
Outdated
"ShowDiagnosticsStatement", | ||
"ShowGrantsForUserStatement", | ||
"ShowQueriesStatement", | ||
"ShowRetentionPoliciesStatement", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one has a database here
Line 2987 in 9e6c989
Database string |
influxql/ast_test.go
Outdated
"ShowGrantsForUserStatement", | ||
"ShowQueriesStatement", | ||
"ShowRetentionPoliciesStatement", | ||
"ShowSeriesStatement", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And this one here
Line 2598 in 9e6c989
Database string |
influxql/ast_test.go
Outdated
"ShowShardsStatement", | ||
"ShowStatsStatement", | ||
"ShowSubscriptionsStatement", | ||
"ShowTagKeysStatement", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And this one here
Line 3152 in 9e6c989
Database string |
influxql/ast_test.go
Outdated
"ShowStatsStatement", | ||
"ShowSubscriptionsStatement", | ||
"ShowTagKeysStatement", | ||
"ShowTagValuesStatement", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And here
Line 3225 in 9e6c989
Database string |
9462803
to
d3e5861
Compare
d3e5861
to
9060a2a
Compare
Security depends on the default database context being present for some statements. These statements were missing that check:
Required for all non-trivial PRs