Skip to content

Commit 91d2ebb

Browse files
author
Mike Massonnet
committed
[security] Sensitive type for gitlab_rails
LDAP crendentials can be passed through gitlab_rails, which will appear in clear in Puppetdb for the class attributes. This commit permits to hide from the class attributes inside PuppetDB, but still renders the password visible inside PuppetDB with the generated content of the template.
1 parent 34aba9e commit 91d2ebb

3 files changed

Lines changed: 12 additions & 5 deletions

File tree

REFERENCE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ Default value: `undef`
419419

420420
##### <a name="-gitlab--gitlab_rails"></a>`gitlab_rails`
421421

422-
Data type: `Optional[Hash]`
422+
Data type: `Variant[Optional[Hash],Sensitive[Hash]]`
423423

424424
Hash of 'gitlab_pages' config parameters.
425425

manifests/init.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@
165165
Optional[Hash] $gitlab_ci = undef,
166166
Optional[Hash] $gitlab_kas = undef,
167167
Optional[Hash] $gitlab_pages = undef,
168-
Optional[Hash] $gitlab_rails = undef,
168+
Variant[Optional[Hash],Sensitive[Hash]] $gitlab_rails = undef,
169169
Optional[Hash] $gitlab_sshd = undef,
170170
Optional[Hash] $grafana = undef,
171171
Optional[Hash] $high_availability = undef,

templates/gitlab.rb.erb

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,21 @@ roles <%= decorate(@roles) %>
6363
git_data_dirs(<%= decorate(@git_data_dirs) %>)
6464

6565
<%- end -%>
66-
<%- if @gitlab_rails -%>
66+
<%-
67+
if @gitlab_rails
68+
if @gitlab_rails.is_a?(Puppet::Pops::Types::PSensitiveType::Sensitive)
69+
gitlab_rails = @gitlab_rails.unwrap
70+
else
71+
gitlab_rails = @gitlab_rails
72+
end
73+
-%>
6774

6875
############################
6976
# gitlab.yml configuration #
7077
############################
7178

72-
<%- @gitlab_rails.keys.sort.each do |k| -%>
73-
gitlab_rails['<%= k -%>'] = <%= decorate(@gitlab_rails[k]) %>
79+
<%- gitlab_rails.keys.sort.each do |k| -%>
80+
gitlab_rails['<%= k -%>'] = <%= decorate(gitlab_rails[k]) %>
7481
<%- end end -%>
7582
<%- if @user -%>
7683

0 commit comments

Comments
 (0)