-
Notifications
You must be signed in to change notification settings - Fork 723
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PDI-18988]:Fixed Username and Password exposed in cleartext on Serve…
…r logs when adding or importing Hadoop Cluster
- Loading branch information
1 parent
08fb160
commit 65147a6
Showing
5 changed files
with
88 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<artifactId>pentaho-platform-ce-parent</artifactId> | ||
<groupId>pentaho</groupId> | ||
<version>9.4.0.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>pentaho-tomcat-logs</artifactId> | ||
<version>9.4.0.0-SNAPSHOT</version> | ||
<packaging>jar</packaging> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.apache.tomcat</groupId> | ||
<artifactId>tomcat-catalina</artifactId> | ||
<version>${tomcat.version}</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
</project> |
44 changes: 44 additions & 0 deletions
44
tomcat-logs/src/main/java/org/pentaho/tomcat/logvalve/FilteredAccessLogValve.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/*! | ||
* | ||
* This program is free software; you can redistribute it and/or modify it under the | ||
* terms of the GNU General Public License, version 2 as published by the Free Software | ||
* Foundation. | ||
* | ||
* You should have received a copy of the GNU General Public License along with this | ||
* program; if not, you can obtain a copy at http://www.gnu.org/licenses/gpl-2.0.html | ||
* or from the Free Software Foundation, Inc., | ||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
* | ||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; | ||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
* See the GNU General Public License for more details. | ||
* | ||
* | ||
* Copyright (c) 2022 Hitachi Vantara. All rights reserved. | ||
* | ||
*/ | ||
|
||
package org.pentaho.tomcat.logvalve; | ||
|
||
import java.io.CharArrayWriter; | ||
import java.io.IOException; | ||
import org.apache.catalina.valves.AccessLogValve; | ||
|
||
/** | ||
* This class makes sure that the passwords visible in the tomcat server access logs are masked | ||
* | ||
* @author samhithavootkoor | ||
*/ | ||
public class FilteredAccessLogValve extends AccessLogValve { | ||
|
||
@Override | ||
public void log( CharArrayWriter message ) { | ||
try ( CharArrayWriter caw = new CharArrayWriter() ) { | ||
// Mask the user password | ||
caw.write( message.toString().replaceAll( "j_password=[^&^ ]*", "j_password=***" ) ); | ||
super.log( caw ); | ||
} catch ( IOException e ) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
} |