Repository navigation
fix(deed, arrival-pack): v8 chora id end to end; cite the Zig proxy issue #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| #!/usr/bin/env bash | ||
| # SPDX-License-Identifier: MPL-2.0 | ||
| # | ||
| # uuid-v8.sh DOMAIN NAME — the ADR-008 profile C UUIDv8 of NAME in DOMAIN, | ||
| # the same on every machine and equal to standards `scripts/uuid-v8.js c`: | ||
| # the first 16 bytes of SHA-256(DOMAIN ":" NAME), the version nibble set to 8 | ||
| # and the variant to 10xx. A repo's chora id is the profile C id of its birth | ||
| # path in the domain chora-registry (standards A1 rules V8 and V9, A7 J11); an | ||
| # id minted before V9 keeps its gv-clade-index id and is never reminted. | ||
| # SHA-256 comes from sha256sum, shasum or openssl, whichever is installed first. | ||
| # | ||
| # Exit: 0 printed; 2 usage, a DOMAIN that is empty or holds ":", or no | ||
| # SHA-256 tool (it never guesses). | ||
| set -euo pipefail | ||
| [ $# -eq 2 ] || { echo "usage: uuid-v8.sh DOMAIN NAME" >&2; exit 2; } | ||
|
Check failure on line 15 in scripts/uuid-v8.sh
|
||
| [[ "$1" =~ ^[!-9\;-~]+$ ]] \ | ||
| || { echo "uuid-v8.sh: DOMAIN must be non-empty printable ASCII without ':'" >&2; exit 2; } | ||
|
|
||
| sha256() { | ||
| if command -v sha256sum >/dev/null 2>&1; then sha256sum | ||
| elif command -v shasum >/dev/null 2>&1; then shasum -a 256 | ||
| elif command -v openssl >/dev/null 2>&1; then openssl dgst -sha256 -r | ||
| else echo "uuid-v8.sh: needs sha256sum, shasum or openssl" >&2; return 2 | ||
| fi | ||
| } | ||
| h="$(printf '%s:%s' "$1" "$2" | sha256)" || exit 2 | ||
| [[ "$h" =~ ^[0-9a-f]{64} ]] || { echo "uuid-v8.sh: the SHA-256 tool printed '$h'" >&2; exit 2; } | ||
| printf '%s-%s-8%s-%x%s-%s\n' "${h:0:8}" "${h:8:4}" "${h:13:3}" \ | ||
| $(( (16#${h:16:1} & 3) | 8 )) "${h:17:3}" "${h:20:12}" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| #!/usr/bin/env bash | ||
| # SPDX-License-Identifier: MPL-2.0 | ||
| # Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath) <j.d.a.jewell@open.ac.uk> | ||
| # | ||
| # uuid5-url.sh NAME — the UUIDv5 of NAME in the RFC 9562 URL namespace, the | ||
| # same on every machine: equal to `uuidgen --sha1 --namespace @url --name NAME` | ||
| # (util-linux), which macOS's uuidgen cannot compute (it has no --sha1). | ||
| # | ||
| # RFC 9562 §5.5: SHA-1 over the namespace's 16 bytes followed by NAME's bytes, | ||
| # truncated to 16 bytes, the version nibble set to 5 and the variant to 10xx. | ||
| # SHA-1 comes from sha1sum, shasum or openssl, whichever is installed first. | ||
| # | ||
| # Exit: 0 printed; 2 usage, or no SHA-1 tool (it never guesses). | ||
| set -euo pipefail | ||
| [ $# -eq 1 ] || { echo "usage: uuid5-url.sh NAME" >&2; exit 2; } | ||
|
Check failure on line 15 in scripts/uuid5-url.sh
|
||
|
|
||
| sha1() { | ||
| if command -v sha1sum >/dev/null 2>&1; then sha1sum # NOSONAR shell:S4790: RFC 9562 mandates SHA-1 for UUIDv5 | ||
| elif command -v shasum >/dev/null 2>&1; then shasum -a 1 # NOSONAR shell:S4790: RFC 9562 mandates SHA-1 for UUIDv5 | ||
| elif command -v openssl >/dev/null 2>&1; then openssl dgst -sha1 -r # NOSONAR shell:S4790: RFC 9562 mandates SHA-1 for UUIDv5 | ||
| else echo "uuid5-url.sh: needs sha1sum, shasum or openssl" >&2; return 2 | ||
| fi | ||
| } | ||
| # 6ba7b811-9dad-11d1-80b4-00c04fd430c8, the URL namespace (RFC 9562 §6.6). | ||
| h="$( { printf '\x6b\xa7\xb8\x11\x9d\xad\x11\xd1\x80\xb4\x00\xc0\x4f\xd4\x30\xc8' | ||
| printf '%s' "$1"; } | sha1 )" || exit 2 | ||
| [[ "$h" =~ ^[0-9a-f]{40} ]] || { echo "uuid5-url.sh: the SHA-1 tool printed '$h'" >&2; exit 2; } | ||
| printf '%s-%s-5%s-%x%s-%s\n' "${h:0:8}" "${h:8:4}" "${h:13:3}" \ | ||
| $(( (16#${h:16:1} & 3) | 8 )) "${h:17:3}" "${h:20:12}" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,10 +4,12 @@ | |
| //! DNS over HTTPS (RFC 8484), HTTP/1.1 over TLS, built directly on | ||
| //! std.crypto.tls.Client and std.http's response-head parser. | ||
| //! | ||
| //! Why not std.http.Client: in Zig 0.17.0 its HTTPS-through-CONNECT-proxy | ||
| //! path does not start TLS inside the tunnel, so the request (here: the DNS | ||
| //! query) leaves the proxy in cleartext. That was verified by observation | ||
| //! (see SECURITY.md). This transport opens its own connection, optionally | ||
| //! Why not std.http.Client: in Zig 0.17.0, 0.17.1 and master (47ff97b) its | ||
| //! HTTPS-through-CONNECT-proxy path does not start TLS inside the tunnel, so | ||
| //! the request (here: the DNS query) leaves the proxy in cleartext. That was | ||
| //! verified by observation (docs/architecture/THREAT-MODEL.adoc, "Findings | ||
| //! made along the way"). Upstream: codeberg.org/ziglang/zig issue 35294, fix | ||
| //! in pull 36484. This transport opens its own connection, optionally | ||
| //! through an HTTP CONNECT proxy, and always performs TLS end to end with | ||
| //! certificate and host-name verification against the configured bundle. | ||
| //! | ||
|
|
@@ -116,7 +118,7 @@ | |
| } | ||
|
|
||
| fn exchangeThunk(ptr: *anyopaque, gpa: Allocator, query: []u8) anyerror![]u8 { | ||
| const self: *DohTransport = @ptrCast(@alignCast(ptr)); | ||
|
Check failure on line 121 in src/stub/doh.zig
|
||
| return self.exchange(gpa, query); | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.