Skip to content

Fix panic with GRANT/REVOKE in CONNECT, CREATE, EXECUTE or TEMPORARY #401

Merged
alamb merged 3 commits into
apache:mainfrom
evgenyx00:grant_revoke_unreachable
Feb 8, 2022
Merged

Fix panic with GRANT/REVOKE in CONNECT, CREATE, EXECUTE or TEMPORARY #401
alamb merged 3 commits into
apache:mainfrom
evgenyx00:grant_revoke_unreachable

Conversation

@evgenyx00
Copy link
Copy Markdown
Contributor

The list of allowed keywords in parse_grant_permission are grater than the match arms.
Therefore this can lead for a panic while using sqlparser on default arm(unreachable)

Copy link
Copy Markdown
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @evgenyx00

Comment thread src/parser.rs Outdated
Keyword::CREATE => Ok(Action::Create),
Keyword::EXECUTE => Ok(Action::Execute),
Keyword::TEMPORARY => Ok(Action::Temporary),
// This will cover all future added keywords to parse_grant_permission and unhandled in this match
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Comment thread tests/sqlparser_common.rs
@alamb alamb changed the title inconsistency between parse_grant_permission and match arms Fix panic with GRANT/REVOKE in CONNECT, CREATE, EXECUTE or TEMPORARY Feb 8, 2022
@coveralls
Copy link
Copy Markdown

coveralls commented Feb 8, 2022

Pull Request Test Coverage Report for Build 1813238611

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 22 of 29 (75.86%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.02%) to 90.551%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/parser.rs 17 24 70.83%
Totals Coverage Status
Change from base Build 1813164500: 0.02%
Covered Lines: 7015
Relevant Lines: 7747

💛 - Coveralls

@alamb alamb merged commit 8a3544a into apache:main Feb 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants