commit 1e80ef7fb995058d0eb1995ed72413111a58e08a Author: Karsten Loesing karsten.loesing@gmx.net Date: Thu May 11 14:43:17 2017 +0200
Retain padding-counts lines when sanitizing descriptors.
Similar to other statistics lines, there's nothing particular sensitive in these new padding-counts lines that would reveal the bridge IP address or location. We can simply copy them over.
Implements #22216. --- CHANGELOG.md | 1 + .../bridgedescs/SanitizedBridgesWriter.java | 3 ++- .../bridgedescs/SanitizedBridgesWriterTest.java | 23 ++++++++++++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d23f01..13fade3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@
* Medium changes - Clean up files in recent/exit-lists/ again. + - Retain padding-counts lines in sanitized extra-info descriptors.
# Changes in version 1.1.2 - 2017-01-17 diff --git a/src/main/java/org/torproject/collector/bridgedescs/SanitizedBridgesWriter.java b/src/main/java/org/torproject/collector/bridgedescs/SanitizedBridgesWriter.java index beeb944..ae3db8f 100644 --- a/src/main/java/org/torproject/collector/bridgedescs/SanitizedBridgesWriter.java +++ b/src/main/java/org/torproject/collector/bridgedescs/SanitizedBridgesWriter.java @@ -1190,7 +1190,8 @@ public class SanitizedBridgesWriter extends CollecTorMain { || line.startsWith("cell-") || line.startsWith("entry-") || line.startsWith("exit-") - || line.startsWith("hidserv-")) { + || line.startsWith("hidserv-") + || line.startsWith("padding-counts ")) { scrubbed.append(line + "\n");
/* When we reach the signature, we're done. Write the sanitized diff --git a/src/test/java/org/torproject/collector/bridgedescs/SanitizedBridgesWriterTest.java b/src/test/java/org/torproject/collector/bridgedescs/SanitizedBridgesWriterTest.java index 44bf69b..3546a34 100644 --- a/src/test/java/org/torproject/collector/bridgedescs/SanitizedBridgesWriterTest.java +++ b/src/test/java/org/torproject/collector/bridgedescs/SanitizedBridgesWriterTest.java @@ -536,6 +536,29 @@ public class SanitizedBridgesWriterTest { }
@Test + public void testExtraInfoDescriptorPaddingCountsRetained() throws Exception { + this.defaultExtraInfoDescriptorBuilder.insertBeforeLineStartingWith( + "transport ", + Arrays.asList("padding-counts 2017-05-10 01:48:43 (86400 s) " + + "bin-size=10000 write-drop=10000 write-pad=10000 " + + "write-total=10000 read-drop=10000 read-pad=10000 " + + "read-total=70000 enabled-read-pad=0 enabled-read-total=0 " + + "enabled-write-pad=0 enabled-write-total=0 " + + "max-chanpad-timers=0")); + this.runTest(); + int foundPaddingCountsLines = 0; + if (!this.parsedExtraInfoDescriptors.isEmpty()) { + for (String line : this.parsedExtraInfoDescriptors.get(0)) { + if (line.startsWith("padding-counts ")) { + foundPaddingCountsLines++; + } + } + } + assertEquals("padding-counts line should have been retained.", 1, + foundPaddingCountsLines); + } + + @Test public void testExtraInfoDescriptorRouterSignatureLineSpace() throws Exception { this.defaultExtraInfoDescriptorBuilder.replaceLineStartingWith(