Skip to content

Do not reveal sensitive Data #1597

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions REFERENCE.md
Original file line number Diff line number Diff line change
@@ -3319,7 +3319,7 @@ Default value: `'none'`

##### <a name="-postgresql--server--pg_hba_rule--auth_option"></a>`auth_option`

Data type: `Optional[String]`
Data type: `Optional[Variant[Sensitive[String], String]]`

For certain auth_method settings there are extra options that can be passed. Consult the PostgreSQL pg_hba.conf documentation for
further details.
@@ -4844,7 +4844,7 @@ Struct[{
user => String,
Optional[address] => Optional[Postgresql::Pg_hba_rule_address],
auth_method => String,
Optional[auth_option] => Optional[String],
Optional[auth_option] => Optional[Variant[Sensitive[String], String]],
Optional[order] => Variant[String,Integer],
Optional[target] => Stdlib::Absolutepath,
Optional[postgresql_version] => String,
3 changes: 2 additions & 1 deletion manifests/server/instance/service.pp
Original file line number Diff line number Diff line change
@@ -59,7 +59,8 @@
require => Service["postgresqld_instance_${name}"],
before => Anchor["postgresql::server::service::end::${name}"],
}
Postgresql::Server::Database <| title == $default_database |> -> Postgresql_conn_validator["validate_service_is_running_instance_${name}"]
Postgresql::Server::Database <| title == $default_database |>
-> Postgresql_conn_validator["validate_service_is_running_instance_${name}"]
}
}

2 changes: 1 addition & 1 deletion manifests/server/pg_hba_rule.pp
Original file line number Diff line number Diff line change
@@ -30,7 +30,7 @@
String[1] $auth_method,
Optional[Postgresql::Pg_hba_rule_address] $address = undef,
String[1] $description = 'none',
Optional[String] $auth_option = undef,
Optional[Variant[Sensitive[String], String]] $auth_option = undef,
Variant[String, Integer] $order = 150,
Stdlib::Absolutepath $target = $postgresql::server::pg_hba_conf_path,
String $postgresql_version = $postgresql::server::_version
24 changes: 24 additions & 0 deletions spec/defines/server/pg_hba_rule_spec.rb
Original file line number Diff line number Diff line change
@@ -80,6 +80,30 @@ class { 'postgresql::server': }
end
end

context 'test template 3 with sensitive Data' do
let :pre_condition do
<<-MANIFEST
class { 'postgresql::server': }
MANIFEST
end

let :params do
{
type: 'host',
database: 'all',
user: 'all',
address: '0.0.0.0/0',
auth_method: 'ldap',
auth_option: sensitive('foo=bar'),
target: target
}
end

it do
expect(subject).to contain_concat__fragment('pg_hba_rule_test').with(content: sensitive(%r{host\s+all\s+all\s+0\.0\.0\.0/0\s+ldap\s+foo=bar}))
end
end

context 'validation' do
context 'validate supported auth_method' do
let :pre_condition do
2 changes: 1 addition & 1 deletion templates/pg_hba_rule.conf.epp
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@
String[1] $user,
Optional[Postgresql::Pg_hba_rule_address] $address,
String[1] $auth_method,
Optional[String] $auth_option,
Optional[Variant[Sensitive[String], String]] $auth_option,
| -%>
# Rule Name: <%= $name %>
# Description: <%= $description %>
2 changes: 1 addition & 1 deletion types/pg_hba_rule.pp
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@
user => String,
Optional[address] => Optional[Postgresql::Pg_hba_rule_address],
auth_method => String,
Optional[auth_option] => Optional[String],
Optional[auth_option] => Optional[Variant[Sensitive[String], String]],
Optional[order] => Variant[String,Integer],
Optional[target] => Stdlib::Absolutepath,
Optional[postgresql_version] => String,