fix: rfc4716_blob within the complexity limit (quality ratchet)
driver / standard (pull_request) Successful in 18s
driver / lint (pull_request) Successful in 16s
driver / types (pull_request) Successful in 1m19s
driver / test (3.12) (pull_request) Successful in 1m12s
driver / test (3.13) (pull_request) Successful in 1m9s
driver / lowest (pull_request) Successful in 33s
driver / build (pull_request) Successful in 33s
driver / security (pull_request) Successful in 1m30s
CI / driver (pull_request) Successful in 3m16s
driver / publish (pull_request) Skipped

The RFC 4716 body moves into _rfc4716_body; rfc4716_blob only tells the
two key forms apart. main's ratchet job failed on complexity 11.
This commit is contained in:
Christian Manivong committed 2026-11-01 00:53:10 +01:00
1 parent 403899916f
commit a88e02ea56
1 file changed
+10 -5
+10 -5
View File
@@ -44,9 +44,18 @@ def rfc4716_blob(text: str) -> str | None:
"""The base64 of a public key, in OMV's RFC 4716 form or OpenSSH's one line."""
lines = [line.strip() for line in text.strip().splitlines()]
if lines and lines[0].startswith("---- BEGIN SSH2 PUBLIC KEY"):
return _rfc4716_body(lines[1:])
words = text.split()
if len(words) >= 2 and words[0].startswith(("ssh-", "ecdsa-", "sk-")):
return words[1]
return None
def _rfc4716_body(lines: list[str]) -> str | None:
"""The base64 between the headers and the END line; None without an END line."""
body: list[str] = []
header = False
for line in lines[1:]:
for line in lines:
if line.startswith("---- END SSH2 PUBLIC KEY"):
return "".join(body) or None
if header or ":" in line:
@@ -54,10 +63,6 @@ def rfc4716_blob(text: str) -> str | None:
continue
body.append(line)
return None
words = text.split()
if len(words) >= 2 and words[0].startswith(("ssh-", "ecdsa-", "sk-")):
return words[1]
return None
def _holds(keys: list[str] | None, blob: str | None) -> bool: