fix(functions): harden Rust secret submissions

This commit is contained in:
Yang Cen
2026-08-27 23:03:27 +08:00
parent 2562e117b2
commit a0bb1f7597
4 changed files with 243 additions and 97 deletions
@@ -753,6 +753,7 @@ def test_secret_values_are_validated_before_remote_request(
"x" * _MAX_FUNCTION_SECRET_VALUE_BYTES,
"é" * (_MAX_FUNCTION_SECRET_VALUE_BYTES // len("é".encode("utf-8"))),
],
ids=["ascii", "multibyte"],
)
def test_secret_value_accepts_exact_utf8_byte_limit(value):
submission = json.loads(normalize_score._submission_json({"API_TOKEN": value}))
@@ -766,6 +767,7 @@ def test_secret_value_accepts_exact_utf8_byte_limit(value):
"x" * (_MAX_FUNCTION_SECRET_VALUE_BYTES + 1),
"é" * (_MAX_FUNCTION_SECRET_VALUE_BYTES // len("é".encode("utf-8")) + 1),
],
ids=["ascii", "multibyte"],
)
def test_secret_value_rejects_over_utf8_byte_limit_before_json_construction(
monkeypatch, value