fix: ensure updater outputs are world-readable

This commit is contained in:
2026-01-19 19:11:02 +01:00
parent 2316af824d
commit 979e35d680

View File

@@ -14,6 +14,7 @@ def atomic_replace(src_path: str, dst_path: str) -> None:
tmp = dst_path + ".tmp" tmp = dst_path + ".tmp"
shutil.copyfile(src_path, tmp) shutil.copyfile(src_path, tmp)
os.replace(tmp, dst_path) os.replace(tmp, dst_path)
os.chmod(dst_path, 0o644)
def download_maxmind_mmdb() -> None: def download_maxmind_mmdb() -> None:
if not LICENSE_KEY: if not LICENSE_KEY:
@@ -86,6 +87,7 @@ def update_nren_asns() -> None:
f.write(f"{a}\n") f.write(f"{a}\n")
tmp_path = f.name tmp_path = f.name
os.replace(tmp_path, out_txt) os.replace(tmp_path, out_txt)
os.chmod(out_txt, 0o644)
def write_meta(): def write_meta():
meta = { meta = {
@@ -95,6 +97,7 @@ def write_meta():
} }
with open(os.path.join(OUT_DIR, "metadata.json"), "w") as f: with open(os.path.join(OUT_DIR, "metadata.json"), "w") as f:
json.dump(meta, f, indent=2) json.dump(meta, f, indent=2)
os.chmod(os.path.join(OUT_DIR, "metadata.json"), 0o644)
def main(): def main():
os.makedirs(OUT_DIR, exist_ok=True) os.makedirs(OUT_DIR, exist_ok=True)