mirror of
https://github.com/apple/foundationdb.git
synced 2025-05-14 09:58:50 +08:00
Fix unresolved merge conflicts
This commit is contained in:
parent
e2a3fedfc7
commit
5169616b16
@ -1393,7 +1393,7 @@ const EncryptCipherRandomSalt encryptSalt = deterministicRandom()->randomUInt64(
|
||||
|
||||
Standalone<StringRef> getBaseCipher() {
|
||||
Standalone<StringRef> baseCipher = makeString(AES_256_KEY_LENGTH);
|
||||
generateRandomData(mutateString(baseCipher), baseCipher.size());
|
||||
deterministicRandom()->randomBytes(mutateString(baseCipher), baseCipher.size());
|
||||
return baseCipher;
|
||||
}
|
||||
|
||||
@ -1413,7 +1413,7 @@ BlobGranuleCipherKeysCtx getCipherKeysCtx(Arena& arena) {
|
||||
cipherKeysCtx.headerCipherKey.baseCipher = StringRef(arena, encryptBaseCipher);
|
||||
|
||||
cipherKeysCtx.ivRef = makeString(AES_256_IV_LENGTH, arena);
|
||||
generateRandomData(mutateString(cipherKeysCtx.ivRef), AES_256_IV_LENGTH);
|
||||
deterministicRandom()->randomBytes(mutateString(cipherKeysCtx.ivRef), AES_256_IV_LENGTH);
|
||||
|
||||
return cipherKeysCtx;
|
||||
}
|
||||
|
@ -5957,7 +5957,7 @@ ACTOR static Future<Void> commitDummyTransaction(Reference<TransactionState> trS
|
||||
} else {
|
||||
tr.trState->skipTenantPrefixAndIdResolution = true;
|
||||
tr.trState->tenantId = trState->tenantId;
|
||||
TEST(true); // Commit of a dummy transaction in tenant keyspace
|
||||
CODE_PROBE(true, "Commit of a dummy transaction in tenant keyspace");
|
||||
}
|
||||
tr.setOption(FDBTransactionOptions::CAUSAL_WRITE_RISKY);
|
||||
tr.setOption(FDBTransactionOptions::LOCK_AWARE);
|
||||
@ -6149,7 +6149,8 @@ ACTOR static Future<Void> tryCommit(Reference<TransactionState> trState,
|
||||
applyTenantPrefix(req, locationInfo.tenantEntry.prefix);
|
||||
tenantPrefix = locationInfo.tenantEntry.prefix;
|
||||
}
|
||||
TEST(trState->skipTenantPrefixAndIdResolution); // Tenant prefix/id resolution skipped for dummy transaction
|
||||
CODE_PROBE(trState->skipTenantPrefixAndIdResolution,
|
||||
"Tenant prefix/id resolution skipped for dummy transaction");
|
||||
req.tenantInfo = trState->getTenantInfo();
|
||||
startTime = now();
|
||||
state Optional<UID> commitID = Optional<UID>();
|
||||
|
@ -162,7 +162,7 @@ bool TokenCacheImpl::validateAndAdd(double currentTime, StringRef token, Network
|
||||
Arena arena;
|
||||
authz::jwt::TokenRef t;
|
||||
if (!authz::jwt::parseToken(arena, t, token)) {
|
||||
TEST(true); // Token can't be parsed
|
||||
CODE_PROBE(true, "Token can't be parsed");
|
||||
TraceEvent(SevWarn, "InvalidToken")
|
||||
.detail("From", peer)
|
||||
.detail("Reason", "ParseError")
|
||||
@ -171,31 +171,31 @@ bool TokenCacheImpl::validateAndAdd(double currentTime, StringRef token, Network
|
||||
}
|
||||
auto key = FlowTransport::transport().getPublicKeyByName(t.keyId);
|
||||
if (!key.present()) {
|
||||
TEST(true); // Token referencing non-existing key
|
||||
CODE_PROBE(true, "Token referencing non-existing key");
|
||||
TRACE_INVALID_PARSED_TOKEN("UnknownKey", t);
|
||||
return false;
|
||||
} else if (!t.expiresAtUnixTime.present()) {
|
||||
TEST(true); // Token has no expiration time
|
||||
CODE_PROBE(true, "Token has no expiration time");
|
||||
TRACE_INVALID_PARSED_TOKEN("NoExpirationTime", t);
|
||||
return false;
|
||||
} else if (double(t.expiresAtUnixTime.get()) <= currentTime) {
|
||||
TEST(true); // Expired token
|
||||
CODE_PROBE(true, "Expired token");
|
||||
TRACE_INVALID_PARSED_TOKEN("Expired", t);
|
||||
return false;
|
||||
} else if (!t.notBeforeUnixTime.present()) {
|
||||
TEST(true); // Token has no not-before field
|
||||
CODE_PROBE(true, "Token has no not-before field");
|
||||
TRACE_INVALID_PARSED_TOKEN("NoNotBefore", t);
|
||||
return false;
|
||||
} else if (double(t.notBeforeUnixTime.get()) > currentTime) {
|
||||
TEST(true); // Tokens not-before is in the future
|
||||
CODE_PROBE(true, "Tokens not-before is in the future");
|
||||
TRACE_INVALID_PARSED_TOKEN("TokenNotYetValid", t);
|
||||
return false;
|
||||
} else if (!t.tenants.present()) {
|
||||
TEST(true); // Token with no tenants
|
||||
CODE_PROBE(true, "Token with no tenants");
|
||||
TRACE_INVALID_PARSED_TOKEN("NoTenants", t);
|
||||
return false;
|
||||
} else if (!authz::jwt::verifyToken(token, key.get())) {
|
||||
TEST(true); // Token with invalid signature
|
||||
CODE_PROBE(true, "Token with invalid signature");
|
||||
TRACE_INVALID_PARSED_TOKEN("InvalidSignature", t);
|
||||
return false;
|
||||
} else {
|
||||
@ -227,7 +227,7 @@ bool TokenCacheImpl::validate(TenantNameRef name, StringRef token) {
|
||||
|
||||
auto& entry = cachedEntry.get();
|
||||
if (entry->expirationTime < currentTime) {
|
||||
TEST(true); // Read expired token from cache
|
||||
CODE_PROBE(true, "Found expired token in cache");
|
||||
TraceEvent(SevWarn, "InvalidToken").detail("From", peer).detail("Reason", "ExpiredInCache");
|
||||
return false;
|
||||
}
|
||||
@ -239,7 +239,7 @@ bool TokenCacheImpl::validate(TenantNameRef name, StringRef token) {
|
||||
}
|
||||
}
|
||||
if (!tenantFound) {
|
||||
TEST(true); // Valid token doesn't reference tenant
|
||||
CODE_PROBE(true, "Valid token doesn't reference tenant");
|
||||
TraceEvent(SevWarn, "TenantTokenMismatch").detail("From", peer).detail("Tenant", name.toString());
|
||||
return false;
|
||||
}
|
||||
|
@ -314,7 +314,7 @@ ACTOR Future<BlobGranuleCipherKeysCtx> getLatestGranuleCipherKeys(Reference<Blob
|
||||
cipherKeysCtx.headerCipherKey = BlobGranuleCipherKey::fromBlobCipherKey(systemCipherKeys.cipherHeaderKey, *arena);
|
||||
|
||||
cipherKeysCtx.ivRef = makeString(AES_256_IV_LENGTH, *arena);
|
||||
generateRandomData(mutateString(cipherKeysCtx.ivRef), AES_256_IV_LENGTH);
|
||||
deterministicRandom()->randomBytes(mutateString(cipherKeysCtx.ivRef), AES_256_IV_LENGTH);
|
||||
|
||||
if (BG_ENCRYPT_COMPRESS_DEBUG) {
|
||||
TraceEvent(SevDebug, "GetLatestGranuleCipherKey")
|
||||
|
@ -46,7 +46,8 @@ struct CreateTenantWorkload : TestWorkload {
|
||||
|
||||
ACTOR static Future<Void> _setup(CreateTenantWorkload* self, Database db) {
|
||||
try {
|
||||
TenantMapEntry entry = wait(TenantAPI::createTenant(db.getReference(), self->tenant));
|
||||
Optional<TenantMapEntry> entry = wait(TenantAPI::createTenant(db.getReference(), self->tenant));
|
||||
ASSERT(entry.present());
|
||||
} catch (Error& e) {
|
||||
TraceEvent(SevError, "TenantCreationFailed").error(e);
|
||||
if (e.code() == error_code_actor_cancelled) {
|
||||
|
@ -98,7 +98,7 @@ TEST_CASE("/CompressionUtils/noCompression") {
|
||||
Arena arena;
|
||||
const int size = deterministicRandom()->randomInt(512, 1024);
|
||||
Standalone<StringRef> uncompressed = makeString(size);
|
||||
generateRandomData(mutateString(uncompressed), size);
|
||||
deterministicRandom()->randomBytes(mutateString(uncompressed), size);
|
||||
|
||||
Standalone<StringRef> compressed = CompressionUtils::compress(CompressionFilter::NONE, uncompressed, arena);
|
||||
ASSERT_EQ(compressed.compare(uncompressed), 0);
|
||||
@ -116,7 +116,7 @@ TEST_CASE("/CompressionUtils/gzipCompression") {
|
||||
Arena arena;
|
||||
const int size = deterministicRandom()->randomInt(512, 1024);
|
||||
Standalone<StringRef> uncompressed = makeString(size);
|
||||
generateRandomData(mutateString(uncompressed), size);
|
||||
deterministicRandom()->randomBytes(mutateString(uncompressed), size);
|
||||
|
||||
Standalone<StringRef> compressed = CompressionUtils::compress(CompressionFilter::GZIP, uncompressed, arena);
|
||||
ASSERT_NE(compressed.compare(uncompressed), 0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user