Skip to content
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

Filter HTTP Basic Authorisation Credential in Update Audit Log #1622

Open
wants to merge 33 commits into
base: master
Choose a base branch
from

Conversation

maggarwal13
Copy link
Contributor

No description provided.

# Conflicts:
#	whois-api/src/main/java/net/ripe/db/whois/api/apiKey/BearerTokenExtractor.java
#	whois-api/src/main/java/net/ripe/db/whois/api/rest/WhoisServletDeployer.java
#	whois-api/src/test/java/net/ripe/db/whois/api/ApiKeyAuthServerDummy.java
#	whois-api/src/test/java/net/ripe/db/whois/api/rest/WhoisRestApiKeyAuthTestIntegration.java
#	whois-api/src/test/java/net/ripe/db/whois/api/rest/WhoisSearchServiceTestIntegration.java
#	whois-update/src/main/resources/templates/notification.vm
#	whois-update/src/test/java/net/ripe/db/whois/update/handler/response/ResponseFactoryTest.java
"delete: adsf\n";

assertThat(PasswordFilter.filterPasswordsInContents(input), containsString("" +
"Header: Authorization=Basic FILTERED\n" +
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are two spaces in the output, but the regex doesn't appear to include any spaces in the matching group?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed one space

@eshryane eshryane changed the title Filter basic auth audit logs Filter HTTP Basic Authorisation Credential in Update Audit Log Jan 9, 2025
private static String replaceBasicAuthHeader(final Matcher matcher) {
final StringBuilder result = new StringBuilder();
while (matcher.find()) {
matcher.appendReplacement(result, String.format("%s%s", StringUtils.substringBefore(matcher.group(0), matcher.group(1)),"FILTERED"));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The regex is still matching a space? Can you use (.*) as the group in the pattern instead?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants