-
Notifications
You must be signed in to change notification settings - Fork 409
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
Validate database and collection names for SQLite handler #2868
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #2868 +/- ##
==========================================
- Coverage 76.56% 75.44% -1.12%
==========================================
Files 390 391 +1
Lines 21419 21594 +175
==========================================
- Hits 16399 16292 -107
- Misses 4098 4346 +248
- Partials 922 956 +34
... and 18 files with indirect coverage changes
Flags with carried forward coverage won't be shown. Click here to find out more. |
@noisersup this pull request has merge conflicts. |
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.
The name validation on the contract level enforces more code related to error handling, although it seems like the most reasonable approach.
@@ -59,6 +59,8 @@ func (h *Handler) MsgDropDatabase(ctx context.Context, msg *wire.OpMsg) (*wire.O | |||
switch { | |||
case err == nil: | |||
res.Set("dropped", dbName) | |||
case backends.ErrorCodeIs(err, backends.ErrorCodeDatabaseNameIsInvalid): | |||
// nothing? |
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 guess we can decide based on what MongoDB does for dropping invalid names, right?
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.
Yeah, a test would be needed there, but that's not super important
) Co-authored-by: Dmitry <dmitry.eremenko@ferretdb.io> Co-authored-by: Alexey Palazhchenko <alexey.palazhchenko@ferretdb.io> Closes FerretDB#2749.
Description
Closes #2749.
This PR is a part of the issue, database validation will be handled in second PR.
TODO
insert
andupdate
test casesReadiness checklist
task all
, and it passed.@FerretDB/core
), Labels, Project and project's Sprint fields.