-
Notifications
You must be signed in to change notification settings - Fork 612
pg_hba_rule: Validate userinput in postgresql::server #1376
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
Conversation
postgresql::backup::pg_dump is a classthat may have no external impact to Forge modules. postgresql::server is a classBreaking changes to this file WILL impact these 39 modules (exact match):
Breaking changes to this file MAY impact these 17 modules (near match):postgresql::server::config is a classthat may have no external impact to Forge modules. postgresql::server::config_entry is a typeBreaking changes to this file WILL impact these 6 modules (exact match):Breaking changes to this file MAY impact these 1 modules (near match):postgresql::server::default_privileges is a typethat may have no external impact to Forge modules. postgresql::server::grant is a typeBreaking changes to this file WILL impact these 2 modules (exact match):Breaking changes to this file MAY impact these 1 modules (near match):postgresql::server::passwd is a classthat may have no external impact to Forge modules. postgresql::server::pg_hba_rule is a typeBreaking changes to this file WILL impact these 14 modules (exact match):Breaking changes to this file MAY impact these 4 modules (near match):postgresql::server::role is a typeBreaking changes to this file WILL impact these 22 modules (exact match):
Breaking changes to this file MAY impact these 6 modules (near match):postgresql::validate_db_connection is a typeBreaking changes to this file WILL impact these 3 modules (exact match):Breaking changes to this file MAY impact these 2 modules (near match):This module is declared in 70 of 579 indexed public
|
3f5a38e
to
22cc951
Compare
@david22swan I rebased this one as well. |
@bastelfreak Look's like this one has a few syntax failures |
22cc951
to
d5c7241
Compare
@david22swan should be good to go now |
f92c6e9
to
fb4500b
Compare
fb4500b
to
1e58644
Compare
Hash[String, Hash] $pg_hba_rules = {}, | ||
Hash[String, Hash] $roles = {}, | ||
Hash[String, Any] $config_entries = {}, | ||
Postgresql::Pg_hba_rules $pg_hba_rules = {}, |
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.
Given the default value is an empty Hash…
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.
empty hashes should still pass. types for hashes only match when there's data in it ( that's why we recommend at vox pupuli that the default value should always be an empty hash, not undef). I added a spec test for empty hashes. let's see if it passes or if I wrote bullshit :D
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.
Ooops, read to fast: here we have Postgresql::Pg_hba_rules
which is a Hash[String, Struct]
and should accept an empty Hash.
I was speaking about Postgresql::Pg_hba_rule
(no s
) which is a Struct and should validate that all non-optional members are set.
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.
An empty hash also gets evaluated with the data type. Therefor all keys must be optional (keys! not values!) to allow passing an empty Struct.
Optional['description'] => String,
...
types/pg_hba_rule.pp
Outdated
description => String, | ||
type => Postgresql::Pg_hba_rule_type, | ||
database => String, | ||
user => String, | ||
Optional[address] => Optional[Postgresql::Pg_hba_rule_address], | ||
auth_method => String, | ||
Optional[auth_option] => Optional[String], | ||
order => Variant[String,Integer], | ||
target => Stdlib::Absolutepath, | ||
postgresql_version => String, |
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.
…all keys should be Optional I guess.
47900d2
to
73f90f6
Compare
b333eeb
to
d18a9f1
Compare
# @see https://github.com/puppetlabs/puppetlabs-postgresql/blob/main/manifests/server/pg_hba_rule.pp | ||
type Postgresql::Pg_hba_rule = Struct[{ | ||
Optional[description] => String, | ||
type => Postgresql::Pg_hba_rule_type, |
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.
Also optional - to be more precise: If an empty hash is OK, all keys must be Optional.
5d7a536
to
1e84c7d
Compare
@david22swan can you take a look again please? :) |
1e84c7d
to
8293666
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.
LGTM
Look's like a good change :) |
No description provided.