Stufe 4c (#764): Bezeichner auf Englisch - Typen, Methoden, Felder, Parameter, Locals, Testnamen
Mit Roslyn umbenannt (Verweise folgen, Zeichenketten bleiben unberuehrt). Nicht umbenannt, weil gespeichert oder ueber die API gebunden (Stufe 4e): Properties, Record-Parameter, Enum-Member sowie die Parameter der Endpunkt-Handler (Routen-/Query-Bindung ueber den Namen). Die JSON-Felder anonymer Objekte bleiben ausdruecklich benannt (JsonFilter: pfad). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
837a634a22
commit
77062facc9
@@ -34,7 +34,7 @@ public sealed class SecretProtectorTests : IDisposable
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Ein_verschluesselter_Wert_laesst_sich_wieder_lesen()
|
||||
public void An_encrypted_value_can_be_read_again()
|
||||
{
|
||||
const string secret = "sk-or-v1-sehr-geheim-12345";
|
||||
|
||||
@@ -44,7 +44,7 @@ public sealed class SecretProtectorTests : IDisposable
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Der_verschluesselte_Wert_enthaelt_den_Klartext_nicht()
|
||||
public void The_encrypted_value_does_not_contain_the_plaintext()
|
||||
{
|
||||
const string secret = "sk-or-v1-sehr-geheim-12345";
|
||||
|
||||
@@ -55,14 +55,14 @@ public sealed class SecretProtectorTests : IDisposable
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Verschluesselte_Werte_sind_als_solche_erkennbar()
|
||||
public void Encrypted_values_are_recognisable_as_such()
|
||||
{
|
||||
SecretProtector.IsProtected(SecretProtector.Protect("geheim")).ShouldBeTrue();
|
||||
SecretProtector.IsProtected("klartext").ShouldBeFalse();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Mehrfaches_Verschluesseln_veraendert_nichts()
|
||||
public void Encrypting_repeatedly_changes_nothing()
|
||||
{
|
||||
// Important, because when saving it is not known whether a value was already
|
||||
// encrypted.
|
||||
@@ -74,7 +74,7 @@ public sealed class SecretProtectorTests : IDisposable
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Klartext_aus_alten_Konfigurationen_wird_unveraendert_gelesen()
|
||||
public void Plaintext_from_old_configurations_is_read_unchanged()
|
||||
{
|
||||
// Two reasons, not just one:
|
||||
//
|
||||
@@ -90,14 +90,14 @@ public sealed class SecretProtectorTests : IDisposable
|
||||
[Theory]
|
||||
[InlineData(null)]
|
||||
[InlineData("")]
|
||||
public void Leere_Werte_bleiben_leer(string? value)
|
||||
public void Empty_values_stay_empty(string? value)
|
||||
{
|
||||
SecretProtector.Protect(value).ShouldBe(value);
|
||||
SecretProtector.Unprotect(value).ShouldBe(value);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Ein_beschaedigter_Wert_wird_gemeldet_statt_stillschweigend_durchgereicht()
|
||||
public void A_damaged_value_is_reported_instead_of_silently_passed_on()
|
||||
{
|
||||
// After a change of user or machine the value is not readable here. Outputting it as
|
||||
// plain text would send an unusable key to the API.
|
||||
@@ -109,7 +109,7 @@ public sealed class SecretProtectorTests : IDisposable
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Umlaute_und_Sonderzeichen_ueberstehen_den_Vorgang()
|
||||
public void Umlauts_and_special_characters_survive_the_operation()
|
||||
{
|
||||
const string secret = "P@ssw0rt mit Grüßen & Ümlauten 🦀";
|
||||
|
||||
@@ -121,7 +121,7 @@ public sealed class SecretProtectorTests : IDisposable
|
||||
// ═══════════════════════════════════════════════════════════
|
||||
|
||||
[Fact]
|
||||
public void Neue_Werte_werden_im_plattformuebergreifenden_Format_geschrieben()
|
||||
public void New_values_are_written_in_the_cross_platform_format()
|
||||
{
|
||||
// The core of the port: under Linux the previous version returned the plain text
|
||||
// here. On a server that gets backed up, that was worse than nothing.
|
||||
@@ -131,7 +131,7 @@ public sealed class SecretProtectorTests : IDisposable
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Dieselbe_Eingabe_ergibt_zweimal_verschiedene_Ausgaben()
|
||||
public void The_same_input_gives_two_different_outputs()
|
||||
{
|
||||
// AES-GCM with a random nonce: identical values must not become identical
|
||||
// blocks, otherwise the configuration file reveals where the same password
|
||||
@@ -145,7 +145,7 @@ public sealed class SecretProtectorTests : IDisposable
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Ein_veraenderter_Block_wird_erkannt_und_nicht_entschluesselt()
|
||||
public void A_modified_block_is_recognised_and_not_decrypted()
|
||||
{
|
||||
// The purpose of the authentication in AES-GCM: a tampered block must
|
||||
// not yield half-guessed plain text.
|
||||
@@ -158,27 +158,27 @@ public sealed class SecretProtectorTests : IDisposable
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Ein_fremder_Schluessel_kann_den_Wert_nicht_lesen()
|
||||
public void A_foreign_key_cannot_read_the_value()
|
||||
{
|
||||
// Exactly the property that makes up the protection: the configuration file alone
|
||||
// is of no use on another machine, because the key does not travel along.
|
||||
var value = SecretProtector.Protect("sk-or-v1-geheim");
|
||||
|
||||
var fremd = Path.Combine(Path.GetTempPath(), "clawd-tests", Guid.NewGuid().ToString("N"));
|
||||
var foreign = Path.Combine(Path.GetTempPath(), "clawd-tests", Guid.NewGuid().ToString("N"));
|
||||
try
|
||||
{
|
||||
SecretKeyStore.UseDirectory(fremd);
|
||||
SecretKeyStore.UseDirectory(foreign);
|
||||
Should.Throw<SecretProtectionException>(() => SecretProtector.Unprotect(value));
|
||||
}
|
||||
finally
|
||||
{
|
||||
SecretKeyStore.UseDirectory(_keyDir);
|
||||
try { Directory.Delete(fremd, recursive: true); } catch { }
|
||||
try { Directory.Delete(foreign, recursive: true); } catch { }
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Der_Schluessel_wird_einmal_angelegt_und_dann_wiederverwendet()
|
||||
public void The_key_is_created_once_and_then_reused()
|
||||
{
|
||||
var first = SecretProtector.Protect("geheim");
|
||||
var keyBytes = File.ReadAllBytes(SecretKeyStore.KeyFilePath);
|
||||
@@ -198,7 +198,7 @@ public sealed class SecretProtectorTests : IDisposable
|
||||
/// </summary>
|
||||
[LinuxFact]
|
||||
[System.Runtime.Versioning.SupportedOSPlatform("linux")]
|
||||
public void Die_Schluesseldatei_ist_nur_fuer_den_Besitzer_lesbar()
|
||||
public void The_key_file_is_readable_by_the_owner_only()
|
||||
{
|
||||
SecretProtector.Protect("geheim");
|
||||
|
||||
@@ -207,7 +207,7 @@ public sealed class SecretProtectorTests : IDisposable
|
||||
}
|
||||
|
||||
[LinuxFact]
|
||||
public void Ein_DPAPI_Wert_aus_einer_Windows_Instanz_wird_mit_Begruendung_abgewiesen()
|
||||
public void A_DPAPI_value_from_a_Windows_instance_is_rejected_with_a_reason()
|
||||
{
|
||||
// The moving case. Passing it on as plain text would send an unusable
|
||||
// key to the API — the message must say what to do.
|
||||
@@ -246,7 +246,7 @@ public sealed class ConfigSecretsTests : IDisposable
|
||||
[InlineData("allowedTables", false)]
|
||||
[InlineData("smtpHost", false)]
|
||||
[InlineData("rootPath", false)]
|
||||
public void Nur_bekannte_Geheimnisfelder_werden_behandelt(string key, bool expected)
|
||||
public void Only_known_secret_fields_are_handled(string key, bool expected)
|
||||
{
|
||||
ConfigSecrets.IsSecretKey(key).ShouldBe(expected);
|
||||
}
|
||||
@@ -271,7 +271,7 @@ public sealed class ConfigSecretsTests : IDisposable
|
||||
};
|
||||
|
||||
[Fact]
|
||||
public void Geheimnisse_einer_Agentenkonfiguration_werden_verschluesselt()
|
||||
public void Secrets_of_an_agent_configuration_are_encrypted()
|
||||
{
|
||||
var agent = AgentWithSecrets();
|
||||
|
||||
@@ -300,7 +300,7 @@ public sealed class ConfigSecretsTests : IDisposable
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Nicht_geheime_Felder_bleiben_lesbar()
|
||||
public void Non_secret_fields_stay_readable()
|
||||
{
|
||||
var agent = AgentWithSecrets();
|
||||
|
||||
@@ -311,7 +311,7 @@ public sealed class ConfigSecretsTests : IDisposable
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Der_Rundlauf_stellt_die_Originalwerte_wieder_her()
|
||||
public void The_round_trip_restores_the_original_values()
|
||||
{
|
||||
var agent = AgentWithSecrets();
|
||||
|
||||
@@ -324,7 +324,7 @@ public sealed class ConfigSecretsTests : IDisposable
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Werte_aus_deserialisiertem_JSON_werden_ebenfalls_erfasst()
|
||||
public void Values_from_deserialised_JSON_are_captured_too()
|
||||
{
|
||||
// After deserialization the values sit in the dictionary as JsonElement,
|
||||
// not as string.
|
||||
@@ -342,7 +342,7 @@ public sealed class ConfigSecretsTests : IDisposable
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Der_Instanzschluessel_und_Telegram_Zugangsdaten_werden_erfasst()
|
||||
public void The_instance_key_and_Telegram_credentials_are_captured()
|
||||
{
|
||||
var config = new InstanceConfig
|
||||
{
|
||||
@@ -367,7 +367,7 @@ public sealed class ConfigSecretsTests : IDisposable
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Eine_Konfiguration_ohne_Telegram_stoert_nicht()
|
||||
public void A_configuration_without_Telegram_does_no_harm()
|
||||
{
|
||||
var config = new InstanceConfig { OpenRouterApiKey = "sk-test", TelegramClient = null };
|
||||
|
||||
@@ -375,7 +375,7 @@ public sealed class ConfigSecretsTests : IDisposable
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Leere_Geheimnisfelder_bleiben_leer()
|
||||
public void Empty_secret_fields_stay_empty()
|
||||
{
|
||||
var agent = new AgentConfig
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user