Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
8c442509
Commit
8c442509
authored
Jun 21, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
94b95f5d
176164d3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
2 deletions
+21
-2
changelogs/unreleased/sanitize_rake_ldap_check_output.yml
changelogs/unreleased/sanitize_rake_ldap_check_output.yml
+5
-0
lib/system_check/ldap_check.rb
lib/system_check/ldap_check.rb
+7
-2
spec/tasks/gitlab/check_rake_spec.rb
spec/tasks/gitlab/check_rake_spec.rb
+9
-0
No files found.
changelogs/unreleased/sanitize_rake_ldap_check_output.yml
0 → 100644
View file @
8c442509
---
title
:
Sanitize LDAP output in Rake tasks
merge_request
:
28427
author
:
type
:
fixed
lib/system_check/ldap_check.rb
View file @
8c442509
...
...
@@ -33,8 +33,13 @@ module SystemCheck
$stdout
.
puts
"LDAP users with access to your GitLab server (only showing the first
#{
limit
}
results)"
users
=
adapter
.
users
(
adapter
.
config
.
uid
,
'*'
,
limit
)
users
.
each
do
|
user
|
$stdout
.
puts
"
\t
DN:
#{
user
.
dn
}
\t
#{
adapter
.
config
.
uid
}
:
#{
user
.
uid
}
"
if
should_sanitize?
$stdout
.
puts
"
\t
User output sanitized. Found
#{
users
.
length
}
users of
#{
limit
}
limit."
else
users
.
each
do
|
user
|
$stdout
.
puts
"
\t
DN:
#{
user
.
dn
}
\t
#{
adapter
.
config
.
uid
}
:
#{
user
.
uid
}
"
end
end
end
rescue
Net
::
LDAP
::
ConnectionRefusedError
,
Errno
::
ECONNREFUSED
=>
e
...
...
spec/tasks/gitlab/check_rake_spec.rb
View file @
8c442509
...
...
@@ -96,6 +96,15 @@ describe 'check.rake' do
subject
end
it
'sanitizes output'
do
user
=
double
(
dn:
'uid=fake_user1'
,
uid:
'fake_user1'
)
allow
(
adapter
).
to
receive
(
:users
).
and_return
([
user
])
stub_env
(
'SANITIZE'
,
'true'
)
expect
{
subject
}.
to
output
(
/User output sanitized/
).
to_stdout
expect
{
subject
}.
not_to
output
(
'fake_user1'
).
to_stdout
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment