mirror of
https://github.com/openai/codex.git
synced 2026-09-15 12:08:01 +00:00
## Why Windows release packages need the voice helper and native audio libraries. Realtime TLS connections on fresh Windows installations also need platform certificate validation so Windows can retrieve missing trusted roots on demand. ## What changed - Build and sign the voice helper and audio DLLs for Windows x64 and ARM64, bundle a pinned Microsoft CRT DLL, and verify signatures and runtime receipts before packaging. - Add verified, pinned Cygwin and native build tools plus MSVC linker, compiler, and path handling fixes for the Windows Bazel builds. - Include voice resources in primary release archives and WinGet packages. Preserve WinGet executable names, update manifest hashes, and recognize the package root through matching entrypoint metadata. Keep Python runtime wheels voice-free to preserve their existing Windows support floor. - Use Windows platform TLS validation for realtime WebSockets when no custom CA bundle is configured, preserving custom CA behavior. ## Testing Add coverage for build-input integrity and unsafe paths, signed Windows runtime assembly, WinGet file and hash preservation, package discovery, and TLS trust selection, untrusted certificate rejection, and hostname validation. GitOrigin-RevId: 423da35872fa5549d69fd4ca97d922bb49599386
65 lines
2.4 KiB
Python
65 lines
2.4 KiB
Python
"""Stage verified voice libraries and seal their public-release receipt."""
|
|
|
|
import argparse
|
|
import json
|
|
from pathlib import Path
|
|
import shutil
|
|
|
|
from package_runtime import runtime_files
|
|
from runtime import digest
|
|
|
|
|
|
def stage(source: Path, destination: Path, target: str) -> None:
|
|
if target not in {
|
|
"aarch64-apple-darwin",
|
|
"x86_64-apple-darwin",
|
|
"aarch64-unknown-linux-gnu",
|
|
"x86_64-unknown-linux-gnu",
|
|
"aarch64-pc-windows-msvc",
|
|
"x86_64-pc-windows-msvc",
|
|
}:
|
|
raise ValueError("unsupported public release voice runtime target")
|
|
source = source.resolve(strict=True)
|
|
files = runtime_files(source, target)
|
|
destination.mkdir()
|
|
try:
|
|
for relative, expected in files.items():
|
|
copied = destination / relative
|
|
copied.parent.mkdir(parents=True, exist_ok=True)
|
|
shutil.copy2(source / relative, copied)
|
|
if digest(copied) != expected:
|
|
raise ValueError("runtime changed while staging release inputs")
|
|
except BaseException:
|
|
shutil.rmtree(destination)
|
|
raise
|
|
|
|
|
|
def seal(root: Path, target: str) -> None:
|
|
root = root.resolve(strict=True)
|
|
manifest_path = root / "runtime.json"
|
|
manifest = json.loads(manifest_path.read_text(encoding="utf-8"))
|
|
if manifest.get("developmentOnly") is not True or manifest.get("target") != target:
|
|
raise ValueError("expected an unsealed development receipt for this target")
|
|
for record in manifest["libraries"]:
|
|
record["sha256"] = digest(root / record["path"])
|
|
manifest["developmentOnly"] = False
|
|
manifest["distribution"] = "publicRelease"
|
|
manifest_path.chmod(manifest_path.stat().st_mode | 0o200)
|
|
manifest_path.write_text(json.dumps(manifest, indent=2) + "\n", encoding="utf-8")
|
|
runtime_files(root, target, public_release=True)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
parser = argparse.ArgumentParser(description=__doc__)
|
|
parser.add_argument("operation", choices=("stage", "seal"))
|
|
parser.add_argument("--target", required=True)
|
|
parser.add_argument("--source", type=Path)
|
|
parser.add_argument("--output", type=Path, required=True)
|
|
args = parser.parse_args()
|
|
if args.operation == "stage":
|
|
if args.source is None:
|
|
parser.error("stage requires --source")
|
|
stage(args.source, args.output, args.target)
|
|
else:
|
|
seal(args.output, args.target)
|