Please answer the questions below, it helps us to keep track of the issue. Please do not ignore it or your issue will be closed.
Note: If the bug is related to data, please attach an example SQL data.
Describe the bug
Exporting database connecctions from Linux does not import on MacOS
Which driver are you using and version of it:
Example: mysql 8.0
Which TablePlus build number are you using (the number on the about screen):
308
To Reproduce
Include steps to reproduce the behavior:
- Export some databases from a linux system,
- try to import it on macOS, heck maybe even linux itself.
- Even with the correct password, it fails.
Expected behavior
Inputting correct password should allow me to import
Screenshots
I had Claude reverse engineer it to me, and it explained the problem/resolution. For obvious reasons, I can't give you the input file to test.
Desktop (please complete the following information):
- OS: Archlinux
- Architecture: x86_64
- Version v1.6.8 308
- Not an AppImage. Installed directly from AUR. The PKGBUILD just pulls the most recent build .deb from tabeplus.
Additional context
This is all just vibe coded, but this the script that converted it to yaml properly. Also, it may or may not matter, but my connections use SSH Tunnels and are authenticated via ssh key.
#!/usr/bin/env python3
"""Decrypt a TablePlus .tableplusconnection export (RNCryptor v3) to YAML."""
import argparse, hashlib, hmac, json, sys, yaml
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
def decrypt(blob: bytes, password: str) -> str:
if blob[0] != 3 or blob[1] != 1:
sys.exit("not an RNCryptor v3 password-based payload")
enc_salt, hmac_salt, iv = blob[2:10], blob[10:18], blob[18:34]
ct, mac = blob[34:-32], blob[-32:]
pw = password.encode()
ek = hashlib.pbkdf2_hmac("sha1", pw, enc_salt, 10000, 32)
hk = hashlib.pbkdf2_hmac("sha1", pw, hmac_salt, 10000, 32)
if not hmac.compare_digest(hmac.new(hk, blob[:-32], hashlib.sha256).digest(), mac):
sys.exit("HMAC mismatch - wrong password or corrupt file")
d = Cipher(algorithms.AES(ek), modes.CBC(iv)).decryptor()
pt = d.update(ct) + d.finalize()
return pt[: -pt[-1]].decode("utf-8")
def parse(text: str) -> list:
# TablePlus emits "[" followed by ",\n{...}" per entry, so the first
# comma is stray and the document is not strictly valid JSON.
t = text.lstrip()
if t.startswith("[,"):
t = "[" + t[2:]
return json.loads(t)
ap = argparse.ArgumentParser()
ap.add_argument("infile")
ap.add_argument("-p", "--password", required=True)
ap.add_argument("-o", "--outfile", default="-")
ap.add_argument("--redact", action="store_true", help="blank out password fields")
a = ap.parse_args()
conns = parse(decrypt(open(a.infile, "rb").read(), a.password))
SECRET = ("DatabasePassword", "ServerPassword", "DatabaseKeyPassword")
if a.redact:
conns = [{k: ("<redacted>" if k in SECRET and v else v) for k, v in c.items()} for c in conns]
doc = yaml.dump({"connections": conns}, sort_keys=False, allow_unicode=True, default_flow_style=False)
out = sys.stdout if a.outfile == "-" else open(a.outfile, "w")
out.write("# Decrypted from %s (TablePlus / RNCryptor v3)\n" % a.infile)
out.write(doc)
Please answer the questions below, it helps us to keep track of the issue. Please do not ignore it or your issue will be closed.
Note: If the bug is related to data, please attach an example SQL data.
Describe the bug
Exporting database connecctions from Linux does not import on MacOS
Which driver are you using and version of it:
Example: mysql 8.0
Which TablePlus build number are you using (the number on the about screen):
308
To Reproduce
Include steps to reproduce the behavior:
Expected behavior
Inputting correct password should allow me to import
Screenshots
I had Claude reverse engineer it to me, and it explained the problem/resolution. For obvious reasons, I can't give you the input file to test.
Desktop (please complete the following information):
Additional context
This is all just vibe coded, but this the script that converted it to yaml properly. Also, it may or may not matter, but my connections use SSH Tunnels and are authenticated via ssh key.