Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
simplesamlphp
Manage
Activity
Members
Labels
Plan
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Perun
Perun ProxyIdP
v1
simplesamlphp
Commits
d909040e
Commit
d909040e
authored
7 years ago
by
John Maguire
Browse files
Options
Downloads
Patches
Plain Diff
Remove sensitive data from logs during LDAP filters
parent
b9f92f33
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
modules/ldap/lib/Auth/Process/BaseFilter.php
+10
-2
10 additions, 2 deletions
modules/ldap/lib/Auth/Process/BaseFilter.php
tests/modules/ldap/lib/Auth/Process/BaseFilterTest.php
+20
-0
20 additions, 0 deletions
tests/modules/ldap/lib/Auth/Process/BaseFilterTest.php
with
30 additions
and
2 deletions
modules/ldap/lib/Auth/Process/BaseFilter.php
+
10
−
2
View file @
d909040e
...
@@ -280,7 +280,7 @@ abstract class sspmod_ldap_Auth_Process_BaseFilter extends SimpleSAML_Auth_Proce
...
@@ -280,7 +280,7 @@ abstract class sspmod_ldap_Auth_Process_BaseFilter extends SimpleSAML_Auth_Proce
' Referrals: '
.
(
$referrals
?
'Yes'
:
'No'
)
.
' Referrals: '
.
(
$referrals
?
'Yes'
:
'No'
)
.
' Timeout: '
.
$timeout
.
' Timeout: '
.
$timeout
.
' Username: '
.
$username
.
' Username: '
.
$username
.
' Password: '
.
str_repeat
(
'*'
,
strlen
(
$password
)
)
' Password: '
.
(
empty
(
$password
)
?
''
:
'********'
)
);
);
// Connect to the LDAP server to be queried during processing
// Connect to the LDAP server to be queried during processing
...
@@ -300,8 +300,16 @@ abstract class sspmod_ldap_Auth_Process_BaseFilter extends SimpleSAML_Auth_Proce
...
@@ -300,8 +300,16 @@ abstract class sspmod_ldap_Auth_Process_BaseFilter extends SimpleSAML_Auth_Proce
* @param mixed $value
* @param mixed $value
* @return string
* @return string
*/
*/
p
rotected
function
var_export
(
$value
)
p
ublic
function
var_export
(
$value
)
{
{
// Remove sensitive data
foreach
(
$value
as
$key
=>
&
$val
)
{
if
(
$key
===
'ldap.password'
)
{
$val
=
empty
(
$val
)
?
''
:
'********'
;
}
}
unset
(
$val
);
$export
=
var_export
(
$value
,
true
);
$export
=
var_export
(
$value
,
true
);
$lines
=
explode
(
"
\n
"
,
$export
);
$lines
=
explode
(
"
\n
"
,
$export
);
foreach
(
$lines
as
&
$line
)
{
foreach
(
$lines
as
&
$line
)
{
...
...
This diff is collapsed.
Click to expand it.
tests/modules/ldap/lib/Auth/Process/BaseFilterTest.php
0 → 100644
+
20
−
0
View file @
d909040e
<?php
class
sspmod_ldap_Auth_Process_BaseFilter_Test
extends
PHPUnit_Framework_TestCase
{
public
function
testVarExportHidesLdapPassword
()
{
$stub
=
$this
->
getMockBuilder
(
'sspmod_ldap_Auth_Process_BaseFilter'
)
->
disableOriginalConstructor
()
->
getMockForAbstractClass
();
$this
->
assertEquals
(
"array ( 'ldap.hostname' => 'ldap://172.17.101.32', 'ldap.port' => 389, 'ldap.password' => '********', )"
,
$stub
->
var_export
(
array
(
'ldap.hostname'
=>
'ldap://172.17.101.32'
,
'ldap.port'
=>
389
,
'ldap.password'
=>
'password'
,
))
);
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment