Skip to content
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

pgwire: use datadriven-based testing for HBA configs #43709

Merged
merged 1 commit into from
Jan 3, 2020

Conversation

knz
Copy link
Contributor

@knz knz commented Jan 3, 2020

(I'm currently working on #31113 and updating this test makes my life easier.)

This patch introduces a datadriven test runner for HBA config tests.
It also replaces the previous TestHBA by more exhaustive datadriven
input files, with comments that better explain the narrative of the
test.

Release note: None

@knz knz requested a review from maddyblue January 3, 2020 10:48
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@knz knz force-pushed the 20190103-hba-datadriven branch from 4a79fc8 to b7b1b54 Compare January 3, 2020 11:23
This patch introduces a datadriven test runner for HBA config tests.
It also replaces the previous `TestHBA` by more exhaustive datadriven
input files, with comments that better explain the narrative of the
test.

Release note: None
@knz
Copy link
Contributor Author

knz commented Jan 3, 2020

Thank you!

bors r+

craig bot pushed a commit that referenced this pull request Jan 3, 2020
43701: sqlsmith: add support for interleaved tables r=mjibson a=mjibson

This commit adds interleaved table support to sqlsmith. When running
with the rand-tables configuration, there's a 50% chance of all tables
but the first one to get interleaved into a random other table.

Release note: None

43709: pgwire: use datadriven-based testing for HBA configs r=knz a=knz

(I'm currently working on #31113 and updating this test makes my life easier.)

This patch introduces a datadriven test runner for HBA config tests.
It also replaces the previous `TestHBA` by more exhaustive datadriven
input files, with comments that better explain the narrative of the
test.

Release note: None

43710: pgwire: improve some HBA error messages r=knz a=knz

First commit from #43709.

Before:

```
> set cluster setting server.host_based_authentication.configuration = 'host db all 0.0.0.0/32 cert';
ERROR: database must be specified as all
```

```
> set cluster setting server.host_based_authentication.configuration = 'host all all myhost cert';
ERROR: host addresses not supported
```

```
> set cluster setting server.host_based_authentication.configuration = 'host all all 0.0.0.0/32 sdfsf';
ERROR: unknown auth method "sdfsdf"
```

After:
```
> set cluster setting server.host_based_authentication.configuration = 'host db all 0.0.0.0/32 cert';
ERROR: unimplemented: per-database HBA rules are not supported
SQLSTATE: 0A000
HINT: You have attempted to use a feature that is not yet implemented.
--
Use the special value 'all' (without quotes) to match all databases.
```

```
> set cluster setting server.host_based_authentication.configuration = 'host all all myhost cert';
ERROR: unimplemented: hostname-based HBA rules are not supported
SQLSTATE: 0A000
HINT: You have attempted to use a feature that is not yet implemented.
--
List the numeric CIDR notation instead, for example: 127.0.0.1/8.
```

```
> set cluster setting server.host_based_authentication.configuration = 'host all all 0.0.0.0/32 sdfsdf'
ERROR: unimplemented: unknown auth method "sdfsdf"
SQLSTATE: 0A000
HINT: You have attempted to use a feature that is not yet implemented.
--
Supported methods: cert, cert-password, password
```

Release note (sql change): CockroachDB will now provide more
descriptive error messages and a error hint when an unsupported rule
is provided via `server.host_based_authentication.configuration`.

43711: pgwire: split the authentication code in its own files r=knz a=knz

First two commits from #43709 and #43710.

This patch splits the pgwire authentication in its own files
and adds missing explanatory comments.

No functional changes.

43713: pgwire/hba: fix a bug in the parsing logic r=knz a=knz

Release note (bug fix): There was a bug in the parsing logic for
server.host_based_authentication.configuration, where both
single-character strings, and quoted strings containing spaces and
separated by commas were not properly parsed. This would cause
e.g. rules for usernames consisting of a single characters, or
usernames containing spaces, to apply improperly.

Co-authored-by: Jordan Lewis <[email protected]>
Co-authored-by: Raphael 'kena' Poss <[email protected]>
@craig
Copy link
Contributor

craig bot commented Jan 3, 2020

Build succeeded

@craig craig bot merged commit af7facf into cockroachdb:master Jan 3, 2020
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