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

HADOOP-17311. ABFS: Logs should redact SAS signature #2422

Merged
merged 5 commits into from
Nov 25, 2020

Conversation

bilaharith
Copy link
Contributor

Masking SAS signatures from logs

HNS-OAuth

[INFO] Results:
[INFO]
[INFO] Tests run: 88, Failures: 0, Errors: 0, Skipped: 0
[INFO] Results:
[INFO]
[WARNING] Tests run: 459, Failures: 0, Errors: 0, Skipped: 66
[INFO] Results:
[INFO]
[WARNING] Tests run: 208, Failures: 0, Errors: 0, Skipped: 24

HNS-SharedKey

[INFO] Results:
[INFO]
[INFO] Tests run: 88, Failures: 0, Errors: 0, Skipped: 0
[INFO] Results:
[INFO]
[WARNING] Tests run: 459, Failures: 0, Errors: 0, Skipped: 24
[INFO] Results:
[INFO]
[WARNING] Tests run: 208, Failures: 0, Errors: 0, Skipped: 16

NonHNS-SharedKey

[INFO] Results:
[INFO]
[INFO] Tests run: 88, Failures: 0, Errors: 0, Skipped: 0
[INFO] Results:
[INFO]
[WARNING] Tests run: 459, Failures: 0, Errors: 0, Skipped: 247
[INFO] Results:
[INFO]
[WARNING] Tests run: 208, Failures: 0, Errors: 0, Skipped: 16

@bilaharith bilaharith force-pushed the dev/HADOOP-17311-sassig branch from 5e7f550 to 0e4dbc8 Compare October 29, 2020 10:18
@bilaharith bilaharith force-pushed the dev/HADOOP-17311-sassig branch from 0e4dbc8 to 8883b59 Compare October 29, 2020 10:20
@hadoop-yetus
Copy link

💔 -1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 1m 23s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s No case conflicting files found.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
+1 💚 0m 0s test4tests The patch appears to include 1 new or modified test files.
_ trunk Compile Tests _
+1 💚 mvninstall 31m 9s trunk passed
+1 💚 compile 0m 37s trunk passed with JDK Ubuntu-11.0.8+10-post-Ubuntu-0ubuntu118.04.1
+1 💚 compile 0m 31s trunk passed with JDK Private Build-1.8.0_265-8u265-b01-0ubuntu2~18.04-b01
+1 💚 checkstyle 0m 25s trunk passed
+1 💚 mvnsite 0m 38s trunk passed
+1 💚 shadedclient 16m 0s branch has no errors when building and testing our client artifacts.
+1 💚 javadoc 0m 31s trunk passed with JDK Ubuntu-11.0.8+10-post-Ubuntu-0ubuntu118.04.1
+1 💚 javadoc 0m 30s trunk passed with JDK Private Build-1.8.0_265-8u265-b01-0ubuntu2~18.04-b01
+0 🆗 spotbugs 1m 2s Used deprecated FindBugs config; considering switching to SpotBugs.
+1 💚 findbugs 1m 0s trunk passed
_ Patch Compile Tests _
+1 💚 mvninstall 0m 30s the patch passed
+1 💚 compile 0m 29s the patch passed with JDK Ubuntu-11.0.8+10-post-Ubuntu-0ubuntu118.04.1
+1 💚 javac 0m 29s the patch passed
+1 💚 compile 0m 25s the patch passed with JDK Private Build-1.8.0_265-8u265-b01-0ubuntu2~18.04-b01
+1 💚 javac 0m 25s the patch passed
+1 💚 checkstyle 0m 17s hadoop-tools/hadoop-azure: The patch generated 0 new + 2 unchanged - 1 fixed = 2 total (was 3)
+1 💚 mvnsite 0m 28s the patch passed
+1 💚 whitespace 0m 0s The patch has no whitespace issues.
+1 💚 shadedclient 14m 42s patch has no errors when building and testing our client artifacts.
+1 💚 javadoc 0m 25s the patch passed with JDK Ubuntu-11.0.8+10-post-Ubuntu-0ubuntu118.04.1
+1 💚 javadoc 0m 24s the patch passed with JDK Private Build-1.8.0_265-8u265-b01-0ubuntu2~18.04-b01
-1 ❌ findbugs 1m 0s /new-findbugs-hadoop-tools_hadoop-azure.html hadoop-tools/hadoop-azure generated 1 new + 0 unchanged - 0 fixed = 1 total (was 0)
_ Other Tests _
-1 ❌ unit 1m 27s /patch-unit-hadoop-tools_hadoop-azure.txt hadoop-azure in the patch passed.
+1 💚 asflicense 0m 33s The patch does not generate ASF License warnings.
75m 36s
Reason Tests
FindBugs module:hadoop-tools/hadoop-azure
Dead store to urlStr in org.apache.hadoop.fs.azurebfs.services.AbfsHttpOperation.toString() At AbfsHttpOperation.java:org.apache.hadoop.fs.azurebfs.services.AbfsHttpOperation.toString() At AbfsHttpOperation.java:[line 160]
Failed junit tests hadoop.fs.azure.TestBlobMetadata
hadoop.fs.azure.TestNativeAzureFileSystemFileNameCheck
hadoop.fs.azure.TestNativeAzureFileSystemOperationsMocked
hadoop.fs.azure.TestWasbFsck
hadoop.fs.azure.TestOutOfBandAzureBlobOperations
hadoop.fs.azure.TestNativeAzureFileSystemMocked
hadoop.fs.azure.TestNativeAzureFileSystemConcurrency
hadoop.fs.azure.TestNativeAzureFileSystemContractMocked
Subsystem Report/Notes
Docker ClientAPI=1.40 ServerAPI=1.40 base: https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-2422/2/artifact/out/Dockerfile
GITHUB PR #2422
Optional Tests dupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient findbugs checkstyle
uname Linux e20026339300 4.15.0-112-generic #113-Ubuntu SMP Thu Jul 9 23:41:39 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/bin/hadoop.sh
git revision trunk / f17e067
Default Java Private Build-1.8.0_265-8u265-b01-0ubuntu2~18.04-b01
Multi-JDK versions /usr/lib/jvm/java-11-openjdk-amd64:Ubuntu-11.0.8+10-post-Ubuntu-0ubuntu118.04.1 /usr/lib/jvm/java-8-openjdk-amd64:Private Build-1.8.0_265-8u265-b01-0ubuntu2~18.04-b01
Test Results https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-2422/2/testReport/
Max. process+thread count 439 (vs. ulimit of 5500)
modules C: hadoop-tools/hadoop-azure U: hadoop-tools/hadoop-azure
Console output https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-2422/2/console
versions git=2.17.1 maven=3.6.0 findbugs=4.1.3
Powered by Apache Yetus 0.13.0-SNAPSHOT https://yetus.apache.org

This message was automatically generated.

@@ -36,6 +36,7 @@
import org.codehaus.jackson.JsonParser;
import org.codehaus.jackson.JsonToken;
import org.codehaus.jackson.map.ObjectMapper;
import com.google.common.annotations.VisibleForTesting;
Copy link
Contributor

Choose a reason for hiding this comment

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

now all shaded I'm afraid. Making backporting harder already

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

LOG.warn(String.format("Unknown host name: %s. Retrying to resolve the host name...", httpOperation.getUrl().getHost()));
LOG.warn(String.format(
"Unknown host name: %s. Retrying to resolve the host name...",
httpOperation.getHost()));
Copy link
Contributor

Choose a reason for hiding this comment

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

While you are there

  • add a catch for UnknownHostException
  • move from String.format to Log.warn("unknown host {}", httpOperation,getHost()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

final AzureBlobFileSystem fs;
String msg = null;
try {
fs = getFileSystem();
Copy link
Contributor

Choose a reason for hiding this comment

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

use LambdaTestUtils.intercept(). Not only simpler, it will (correctly) fail if the rest operation didn't actually raise an exception

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

if (this.maskedUrlStr != null) {
return this.maskedUrlStr;
}
final String urlStr = url.toString();
Copy link
Contributor

Choose a reason for hiding this comment

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

This is complicated enough it could be pulled out into a static method, and so its handling fully tested in (new) Unit tests, as well as in the ITests.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Contributor

@snvijaya snvijaya left a comment

Choose a reason for hiding this comment

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

Please check comments.

return this.maskedUrlStr;
}
final String urlStr = url.toString();
final String qpStr = "sig=";
Copy link
Contributor

Choose a reason for hiding this comment

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

create a private static final string. - private static final String SIGNATURE_QUERY_PARAM_KEY = "sig=";

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

int idx = urlStrSecondPart.indexOf("&");
if (idx > -1) {
sb.append(urlStrSecondPart.substring(idx));
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Using string replace should be easier.

int sigStartIndex = urlStr.indexOf(SIGNATURE_QUERY_PARAM_KEY);
if (sigStartIndex == -1) {
  // no signature query param in the url
  return urlStr;
}

sigStartIndex += SIGNATURE_QUERY_PARAM_KEY.length();
int sigEndIndex = urlStr.indexOf("&", sigStartIndex);
String sigValue = (sigEndIndex == -1)
    ? urlStr.substring(sigStartIndex)
    : urlStr.substring(sigStartIndex, sigEndIndex);

return urlStr.replace(sigValue, "XXXX");

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@@ -58,6 +58,9 @@ public static void dumpHeadersToDebugLog(final String origin,
if (key.contains("Cookie")) {
values = "*cookie info*";
}
if (key.equals("sig")) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is a header called "sig" getting added when SAS ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The latency tracker sends all the query params through headers.

@bilaharith
Copy link
Contributor Author

Driver test results using accounts in Central India
mvn -T 1C -Dparallel-tests=abfs -Dscale -DtestsThreadCount=8 clean verify

HNS-OAuth

[INFO] Results:
[INFO]
[INFO] Tests run: 88, Failures: 0, Errors: 0, Skipped: 0
[INFO] Results:
[INFO]
[WARNING] Tests run: 459, Failures: 0, Errors: 0, Skipped: 66
[INFO] Results:
[INFO]
[WARNING] Tests run: 208, Failures: 0, Errors: 0, Skipped: 24

HNS-SharedKey

[INFO] Results:
[INFO]
[ERROR] Failures:
[ERROR] TestAbfsClientThrottlingAnalyzer.testManySuccessAndErrorsAndWaiting:171->fuzzyValidate:49 The actual value 9 is not within the expected range: [5.60, 8.40].
[INFO]
[ERROR] Tests run: 88, Failures: 1, Errors: 0, Skipped: 0
[INFO] Results:
[INFO]
[WARNING] Tests run: 459, Failures: 0, Errors: 0, Skipped: 24
[INFO] Results:
[INFO]
[WARNING] Tests run: 208, Failures: 0, Errors: 0, Skipped: 16

NonHNS-SharedKey

[INFO] Results:
[INFO]
[INFO] Tests run: 88, Failures: 0, Errors: 0, Skipped: 0
[INFO] Results:
[INFO]
[WARNING] Tests run: 459, Failures: 0, Errors: 0, Skipped: 247
[INFO] Results:
[INFO]
[WARNING] Tests run: 208, Failures: 0, Errors: 0, Skipped: 16

@@ -61,6 +64,8 @@

private final String method;
private final URL url;
private String maskedUrlStr;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Remove Str suffix

,"http://www.testurl.net?abc=xyz&sig=abcd"
,"http://www.testurl.net?abc=xyz&sig=XXXX");

testIfMaskedSuccessfully("Where sig query param is not present"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

query params ending mysig/*sig.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sig in other cases, like caps,
sig as suffix in the param names and values

@hadoop-yetus
Copy link

💔 -1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 2m 15s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s No case conflicting files found.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
+1 💚 0m 0s test4tests The patch appears to include 2 new or modified test files.
_ trunk Compile Tests _
+1 💚 mvninstall 38m 5s trunk passed
+1 💚 compile 0m 38s trunk passed with JDK Ubuntu-11.0.9+11-Ubuntu-0ubuntu1.18.04.1
+1 💚 compile 0m 33s trunk passed with JDK Private Build-1.8.0_272-8u272-b10-0ubuntu1~18.04-b10
+1 💚 checkstyle 0m 26s trunk passed
+1 💚 mvnsite 0m 40s trunk passed
+1 💚 shadedclient 19m 18s branch has no errors when building and testing our client artifacts.
+1 💚 javadoc 0m 31s trunk passed with JDK Ubuntu-11.0.9+11-Ubuntu-0ubuntu1.18.04.1
+1 💚 javadoc 0m 29s trunk passed with JDK Private Build-1.8.0_272-8u272-b10-0ubuntu1~18.04-b10
+0 🆗 spotbugs 1m 3s Used deprecated FindBugs config; considering switching to SpotBugs.
+1 💚 findbugs 1m 1s trunk passed
_ Patch Compile Tests _
+1 💚 mvninstall 0m 32s the patch passed
+1 💚 compile 0m 33s the patch passed with JDK Ubuntu-11.0.9+11-Ubuntu-0ubuntu1.18.04.1
+1 💚 javac 0m 33s the patch passed
+1 💚 compile 0m 27s the patch passed with JDK Private Build-1.8.0_272-8u272-b10-0ubuntu1~18.04-b10
+1 💚 javac 0m 27s the patch passed
-0 ⚠️ checkstyle 0m 18s /diff-checkstyle-hadoop-tools_hadoop-azure.txt hadoop-tools/hadoop-azure: The patch generated 21 new + 2 unchanged - 1 fixed = 23 total (was 3)
+1 💚 mvnsite 0m 31s the patch passed
+1 💚 whitespace 0m 0s The patch has no whitespace issues.
+1 💚 shadedclient 17m 50s patch has no errors when building and testing our client artifacts.
+1 💚 javadoc 0m 26s the patch passed with JDK Ubuntu-11.0.9+11-Ubuntu-0ubuntu1.18.04.1
+1 💚 javadoc 0m 24s the patch passed with JDK Private Build-1.8.0_272-8u272-b10-0ubuntu1~18.04-b10
-1 ❌ findbugs 0m 59s /new-findbugs-hadoop-tools_hadoop-azure.html hadoop-tools/hadoop-azure generated 2 new + 0 unchanged - 0 fixed = 2 total (was 0)
_ Other Tests _
-1 ❌ unit 1m 26s /patch-unit-hadoop-tools_hadoop-azure.txt hadoop-azure in the patch passed.
+1 💚 asflicense 0m 32s The patch does not generate ASF License warnings.
90m 13s
Reason Tests
FindBugs module:hadoop-tools/hadoop-azure
Dead store to urlStr in org.apache.hadoop.fs.azurebfs.services.AbfsHttpOperation.toString() At AbfsHttpOperation.java:org.apache.hadoop.fs.azurebfs.services.AbfsHttpOperation.toString() At AbfsHttpOperation.java:[line 162]
Possible null pointer dereference of httpOperation in org.apache.hadoop.fs.azurebfs.services.AbfsRestOperation.executeHttpOperation(int) on exception path Dereferenced at AbfsRestOperation.java:httpOperation in org.apache.hadoop.fs.azurebfs.services.AbfsRestOperation.executeHttpOperation(int) on exception path Dereferenced at AbfsRestOperation.java:[line 259]
Failed junit tests hadoop.fs.azure.TestBlobMetadata
hadoop.fs.azure.TestNativeAzureFileSystemFileNameCheck
hadoop.fs.azure.TestNativeAzureFileSystemOperationsMocked
hadoop.fs.azure.TestWasbFsck
hadoop.fs.azure.TestOutOfBandAzureBlobOperations
hadoop.fs.azure.TestNativeAzureFileSystemMocked
hadoop.fs.azure.TestNativeAzureFileSystemConcurrency
hadoop.fs.azure.TestNativeAzureFileSystemContractMocked
Subsystem Report/Notes
Docker ClientAPI=1.40 ServerAPI=1.40 base: https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-2422/4/artifact/out/Dockerfile
GITHUB PR #2422
Optional Tests dupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient findbugs checkstyle
uname Linux 031ce5aea57c 4.15.0-112-generic #113-Ubuntu SMP Thu Jul 9 23:41:39 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/bin/hadoop.sh
git revision trunk / deea5d8
Default Java Private Build-1.8.0_272-8u272-b10-0ubuntu1~18.04-b10
Multi-JDK versions /usr/lib/jvm/java-11-openjdk-amd64:Ubuntu-11.0.9+11-Ubuntu-0ubuntu1.18.04.1 /usr/lib/jvm/java-8-openjdk-amd64:Private Build-1.8.0_272-8u272-b10-0ubuntu1~18.04-b10
Test Results https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-2422/4/testReport/
Max. process+thread count 414 (vs. ulimit of 5500)
modules C: hadoop-tools/hadoop-azure U: hadoop-tools/hadoop-azure
Console output https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-2422/4/console
versions git=2.17.1 maven=3.6.0 findbugs=4.1.3
Powered by Apache Yetus 0.13.0-SNAPSHOT https://yetus.apache.org

This message was automatically generated.

@apache apache deleted a comment from hadoop-yetus Nov 2, 2020
@apache apache deleted a comment from hadoop-yetus Nov 2, 2020
@steveloughran
Copy link
Contributor

findbugs is pretty unhappy


Dead store to urlStr in org.apache.hadoop.fs.azurebfs.services.AbfsHttpOperation.toString() At AbfsHttpOperation.java:org.apache.hadoop.fs.azurebfs.services.AbfsHttpOperation.toString() At AbfsHttpOperation.java:[line 162]
--
  | Possible null pointer dereference of httpOperation in org.apache.hadoop.fs.azurebfs.services.AbfsRestOperation.executeHttpOperation(int) on exception path Dereferenced at AbfsRestOperation.java:httpOperation in org.apache.hadoop.fs.azurebfs.services.AbfsRestOperation.executeHttpOperation(int) on exception path Dereferenced at AbfsRestOperation.java:[line 259]

@hadoop-yetus

This comment has been minimized.

@hadoop-yetus

This comment has been minimized.

@bilaharith
Copy link
Contributor Author

The yetus run error is due to tests failing on the WASB side, which is not affected by the changes proposed here.
Link to HADOOP-17325.

The findbugs reported is also unrelated to the change in this PR.

@steveloughran
Copy link
Contributor

where did the findbugs error come from? do we need to fix/roll back that change?

@hadoop-yetus

This comment has been minimized.

@bilaharith
Copy link
Contributor Author

where did the findbugs error come from? do we need to fix/roll back that change?

This is fixed.

@steveloughran
Copy link
Contributor

thx. Trying to work out where that regression failing tests is coming from. as far as I'm concerned, consistent unit test failures are a block on anything new going in. All too easy to ignore and then accidentally add more regressions

Copy link
Contributor

@snvijaya snvijaya left a comment

Choose a reason for hiding this comment

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

Looks good.

@steveloughran steveloughran changed the title HADOOP-17311. ABFS: Masking SAS signatures from logs HADOOP-17311. ABFS: Logs should redact SAS signature Nov 25, 2020
@steveloughran steveloughran merged commit 3193d8c into apache:trunk Nov 25, 2020
asfgit pushed a commit that referenced this pull request Nov 25, 2020
Contributed by bilaharith.

Change-Id: Iff0ed4303ac5ce41b62bfda8150ee983dafa40be
jojochuang pushed a commit to jojochuang/hadoop that referenced this pull request May 23, 2023
…che#2422)

Contributed by bilaharith.

Change-Id: Iff0ed4303ac5ce41b62bfda8150ee983dafa40be
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.

4 participants