diff --git a/components.lock.json b/components.lock.json index 49d709e..75ce4c4 100644 --- a/components.lock.json +++ b/components.lock.json @@ -4,11 +4,11 @@ "components": { "EchoionApi": { "repository": "Void/EchoionApi", - "revision": "847308c16071d579bf75d60a66f45cad385da8dc", - "componentVersion": "2.0.0", + "revision": "e2503244b36281ccd7da7349727197c77dcbeb38", + "componentVersion": "2.0.1", "abiHash": "sha256:d50293d345a97e52f9844088bdd42277f566bc815a21b7636d3e053f06c6c113", - "sourceTreeHash": "git-sha1:cc2d424525291f8d3824444cc256d90099854e4d", - "artifactIdentity": "echoion-api-2.0.0-linux-x86_64" + "sourceTreeHash": "git-sha1:c674c0bcf291600d413f1ecdce6de75cb7c7fdac", + "artifactIdentity": "echoion-api-2.0.1-linux-x86_64" }, "EchoionHost": { "repository": "Void/EchoionHost", @@ -20,11 +20,11 @@ }, "EchoionCore": { "repository": "Void/EchoionCore", - "revision": "c2ec314eb9cc3b06f7dae7c01cd85be8a22bbfc5", - "componentVersion": "2.0.0", + "revision": "a6555d4c698d796bf1f8efcd4af1653d7240b043", + "componentVersion": "2.0.1", "abiHash": "sha256:9cb668e2a502dcfe02d145ed63635d63619732d77ff5749685834382705e8d21", - "sourceTreeHash": "git-sha1:7887ff0ee0be9a8b4f074eae025e758d0b318adf", - "artifactIdentity": "echoion-core-2.0.0-linux-x86_64" + "sourceTreeHash": "git-sha1:ad16aea45f04e28c2f531121bdc472a37f831a53", + "artifactIdentity": "echoion-core-2.0.1-linux-x86_64" }, "EchoionWeb": { "repository": "Void/EchoionWeb", diff --git a/config.example.json b/config.example.json index 9c5e5b8..1b5508b 100644 --- a/config.example.json +++ b/config.example.json @@ -152,6 +152,20 @@ "voteSkipThreshold": 0 }, + "licensing": { + "_section": "Short-lived signed lease from the separately deployed EchoionLicensing service. Production release configurations must set required=true.", + "required": false, + "serviceUrl": "https://license.example.com", + "productId": "echoion", + "_activationTokenEnv": "The environment variable contains the activation token; its value is never stored in config or logs.", + "activationTokenEnv": "ECHOION_LICENSE_TOKEN", + "refreshInterval": "6h", + "retryInterval": "5m", + "maximumLeaseLifetime": "24h", + "developmentMode": false, + "developmentKeys": [] + }, + "updates": { "_section": "Signed component updates for the runtime bundle, Core, and already-installed managed plugins", "enabled": true, @@ -173,7 +187,7 @@ "publicKeys": [], "allowUnsigned": false, "_bearerTokenEnv": "Environment variable name only; the token value is never stored in this file or returned to the web UI.", - "bearerTokenEnv": "" + "bearerTokenEnv": "ECHOION_LICENSE_TOKEN" } }, "runtime": { @@ -199,12 +213,23 @@ }, "logging": { - "_section": "Rolling process logs (the active file is archived on every start)", + "_section": "Process logs below the state directory. Split mode writes one exact-level file per severity plus optional all.log; all files rotate as one bounded snapshot.", "console": true, "level": "debug", + "splitByLevel": true, + "combined": true, + "_legacyFileName": "Used only when splitByLevel is false.", "fileName": "echoion.log", "maxFileSizeBytes": 10485760, - "maxFiles": 10 + "maxFiles": 10, + "_format": "pattern, json (JSON Lines), or logfmt", + "format": "pattern", + "pattern": "[{time}] [{level}] [{thread}] {file} - {message}", + "_mode": "async, immediate, or buffered", + "mode": "async", + "queueCapacity": 2048, + "_overflowPolicy": "block, drop-newest, or drop-oldest", + "overflowPolicy": "block" }, "advanced": { diff --git a/scripts/generate-release-manifest.py b/scripts/generate-release-manifest.py index ae61fed..a18d828 100755 --- a/scripts/generate-release-manifest.py +++ b/scripts/generate-release-manifest.py @@ -108,7 +108,11 @@ def collect_entries(root: Path) -> list[dict[str, object]]: def write_manifest( - root: Path, version: str, build_type: str, output: Path + root: Path, + version: str, + build_type: str, + build_signature: str, + output: Path, ) -> None: entries = collect_entries(root) regular_files = { @@ -144,6 +148,7 @@ def write_manifest( "schemaVersion": 2, "version": version, "buildType": build_type, + "buildSignature": build_signature, "executable": executable, "updater": updater, "core": core, @@ -176,6 +181,7 @@ def main() -> int: choices=("RelWithDebInfo",), default="RelWithDebInfo", ) + parser.add_argument("--build-signature") parser.add_argument("--output", type=Path) arguments = parser.parse_args() @@ -183,7 +189,20 @@ def main() -> int: parser.error("version must contain only letters, digits, dot, underscore, or dash") root = arguments.root.resolve(strict=True) output = arguments.output or root / "manifest.json" - write_manifest(root, arguments.version, arguments.build_type, output) + build_signature = arguments.build_signature or f"development:{arguments.version}" + if ( + not build_signature + or len(build_signature) > 256 + or any(character in build_signature for character in "\r\n\0") + ): + parser.error("build signature must be 1-256 characters without controls") + write_manifest( + root, + arguments.version, + arguments.build_type, + build_signature, + output, + ) return 0 diff --git a/scripts/generate-update-feed.py b/scripts/generate-update-feed.py index 7e28b9c..507d619 100755 --- a/scripts/generate-update-feed.py +++ b/scripts/generate-update-feed.py @@ -218,9 +218,15 @@ def main() -> None: or manifest.get("schemaVersion") != 2 or manifest.get("version") != arguments.version or manifest.get("buildType") != "RelWithDebInfo" + or not isinstance(manifest.get("buildSignature"), str) + or not manifest["buildSignature"] + or len(manifest["buildSignature"]) > 256 + or any( + character in manifest["buildSignature"] for character in "\r\n\0" + ) ): fail( - "release manifest schema/version/build type does not match the feed" + "release manifest schema/version/build type/signature does not match the feed" ) source_epoch = os.environ.get("SOURCE_DATE_EPOCH") @@ -267,6 +273,7 @@ def main() -> None: if manifest_path is not None: release["releaseManifestSha256"] = digest(manifest_path) release["buildType"] = manifest["buildType"] + release["buildSignature"] = manifest["buildSignature"] payload_document = { "schemaVersion": 1, diff --git a/scripts/release.sh b/scripts/release.sh index a04391a..c9d3712 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -332,6 +332,19 @@ if [[ -z ${SOURCE_DATE_EPOCH:-} ]]; then fi export SOURCE_DATE_EPOCH +source_revision=$(git -C "$source_dir" rev-parse HEAD) || + die "cannot determine release source revision" +lock_digest=$(sha256sum "$source_dir/components.lock.json") || + die "cannot hash components.lock.json" +lock_digest=${lock_digest%% *} +build_signature="echoion:${version}:${source_revision}:${lock_digest}" +license_root_key_id=${ECHOION_LICENSE_ROOT_KEY_ID:-} +license_root_public_key=${ECHOION_LICENSE_ROOT_PUBLIC_KEY:-} +if [[ -n $license_root_key_id || -n $license_root_public_key ]]; then + [[ -n $license_root_key_id && -n $license_root_public_key ]] || + die "both ECHOION_LICENSE_ROOT_KEY_ID and ECHOION_LICENSE_ROOT_PUBLIC_KEY are required" +fi + safe_remove_tree() { local path=$1 case $path in @@ -355,9 +368,16 @@ configure_args=( -DECHOION_REPRODUCIBLE_BUILD=ON "-DECHOION_RELEASE_VERSION=$version" "-DECHOION_RUNTIME_VERSION=$version" + "-DECHOION_BUILD_SIGNATURE=$build_signature" "-DECHOION_TOOLCHAIN_ABI=linux-x86_64-glibc-2.35-cxx26" "-DECHOION_COMPONENT_WORKSPACE=$component_workspace" ) +if [[ -n $license_root_key_id ]]; then + configure_args+=( + "-DECHOION_LICENSE_ROOT_KEY_ID=$license_root_key_id" + "-DECHOION_LICENSE_ROOT_PUBLIC_KEY=$license_root_public_key" + ) +fi for component_id in "${component_ids[@]}"; do configure_args+=( "-DCPM_${component_id}_SOURCE=$component_workspace/$component_id" @@ -583,6 +603,7 @@ python3 "$source_dir/scripts/generate-release-manifest.py" \ --root "$stage" \ --version "$version" \ --build-type RelWithDebInfo \ + --build-signature "$build_signature" \ --output "$stage/manifest.json" # Installer helpers are mutable prefix-level files and intentionally are not diff --git a/scripts/tests/test-release-archive.sh b/scripts/tests/test-release-archive.sh index 8b5c8f7..392c47f 100755 --- a/scripts/tests/test-release-archive.sh +++ b/scripts/tests/test-release-archive.sh @@ -15,7 +15,7 @@ install -m 0755 /bin/true "$stage/bin/echoiond" install -m 0755 /bin/true "$stage/bin/echoion-updater" install -m 0644 /bin/true "$stage/lib/Echoion.ts" printf '%s\n' \ - '{"schemaVersion":2,"version":"1.2.3","buildType":"RelWithDebInfo"}' \ + '{"schemaVersion":2,"version":"1.2.3","buildType":"RelWithDebInfo","buildSignature":"test:1.2.3"}' \ >"$stage/manifest.json" cat >"$stage/install.sh" <<'INSTALL' #!/bin/sh @@ -76,6 +76,7 @@ manifest = Path(sys.argv[3]) release = payload["releases"][0] assert payload["schemaVersion"] == 1 assert payload["releases"][0]["buildType"] == "RelWithDebInfo" +assert payload["releases"][0]["buildSignature"] == "test:1.2.3" assert payload["feedId"] == "echoion-test" assert payload["sequence"] == 42 assert release["component"] == "runtime" diff --git a/scripts/validate-release-manifest.py b/scripts/validate-release-manifest.py index f6bf4e8..38eaa55 100644 --- a/scripts/validate-release-manifest.py +++ b/scripts/validate-release-manifest.py @@ -103,6 +103,14 @@ def load_and_validate(root: Path, expected_version: str | None = None) -> dict: ) if manifest.get("buildType") != "RelWithDebInfo": raise ValueError("release manifest buildType must be RelWithDebInfo") + build_signature = manifest.get("buildSignature") + if ( + not isinstance(build_signature, str) + or not build_signature + or len(build_signature) > 256 + or any(character in build_signature for character in "\r\n\0") + ): + raise ValueError("release manifest has no valid build signature") entries = manifest.get("files") if not isinstance(entries, list):