Browse Source

Seed the SDK live tests' vectors with their attachments

Sync now lists attachments with a stable URL, so the rotation test's before and after comparison holds with them.
Only the legacy attachments without a key of their own stay out: the SDK refuses to rotate a vault holding one.
pull/7963/head
Daniel García 2 days ago
parent
commit
970e9f372d
  1. 9
      tools/sdk-live-tests/seed_vector.py

9
tools/sdk-live-tests/seed_vector.py

@ -26,11 +26,12 @@ def main() -> int:
print("no master password") print("no master password")
return SKIP return SKIP
# Without attachments: the rotation test compares the vault before and after, and our sync gives each attachment # Without the legacy attachments that have no key of their own: the SDK refuses to rotate a vault holding one
# a link with a fresh download token every time (upstream's is the same on every sync). A vector's legacy # (`OldAttachments`), on any server.
# attachments, without a key of their own, would also make the SDK refuse to rotate at all.
for cipher in vector.get("vault", {}).get("ciphers", []): for cipher in vector.get("vault", {}).get("ciphers", []):
cipher.get("encrypted", {}).pop("attachments", None) encrypted = cipher.get("encrypted", {})
if encrypted.get("attachments"):
encrypted["attachments"] = [a for a in encrypted["attachments"] if a.get("key")] or None
credentials = base64.b64encode(f"{username}:{password}".encode()).decode() credentials = base64.b64encode(f"{username}:{password}".encode()).decode()
request = urllib.request.Request( request = urllib.request.Request(

Loading…
Cancel
Save