mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-10 08:16:15 +02:00
Also obfuscate the number of memory roots
This commit is contained in:
parent
fc02b1b3ee
commit
5c56570726
1 changed files with 16 additions and 2 deletions
|
@ -478,15 +478,29 @@ static void performOp(TunnelLogger * logger, ref<Store> store,
|
||||||
Roots roots = store->findRoots();
|
Roots roots = store->findRoots();
|
||||||
logger->stopWork();
|
logger->stopWork();
|
||||||
size_t total_length = 0;
|
size_t total_length = 0;
|
||||||
for (auto & root : roots)
|
bool hasMemoryLink;
|
||||||
total_length += root.second.size();
|
for (auto & [target, links] : roots) {
|
||||||
|
hasMemoryLink = false;
|
||||||
|
for (auto & link : links) {
|
||||||
|
if (link.rfind("{memory:", 0) == 0) {
|
||||||
|
if (hasMemoryLink) continue;
|
||||||
|
++total_length;
|
||||||
|
hasMemoryLink = true;
|
||||||
|
} else {
|
||||||
|
++total_length;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
to << total_length;
|
to << total_length;
|
||||||
int n = 0;
|
int n = 0;
|
||||||
for (auto & [target, links] : roots) {
|
for (auto & [target, links] : roots) {
|
||||||
|
bool hasMemoryLink = false;
|
||||||
for (auto & link : links) {
|
for (auto & link : links) {
|
||||||
// Obfuscate 'memory' roots as they expose information about other users,
|
// Obfuscate 'memory' roots as they expose information about other users,
|
||||||
if (link.rfind("{memory:", 0) == 0) {
|
if (link.rfind("{memory:", 0) == 0) {
|
||||||
|
if (hasMemoryLink) continue;
|
||||||
to << fmt("{memory:%d}", n++) << target;
|
to << fmt("{memory:%d}", n++) << target;
|
||||||
|
hasMemoryLink = true;
|
||||||
} else {
|
} else {
|
||||||
to << link << target;
|
to << link << target;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue