Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 32 additions & 4 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,38 @@ without the fix (127 tests, up from 123).
not exist here, and so returned the fallback grade for the wrong reason. The
same defect is in the upstream contractile copy.

Not fixed in this cycle, with reasons rather than silence: the deed's
`:parent-pin` / `:template-commit` names a commit that no longer exists in
`hyperpolymath/rsr-template-repo`, so `check-variant-drift.sh` cannot be run
at all (see `docs/reports/VERIFICATION.adoc`); base-image digest pinning and
Three findings from the review of the C ABI pull request
(`hyperpolymath/zig-dnssec`#5) were still open on `main`, and one more turned
up while checking them. Each new or tightened test fails against the code it
now guards:

* The C ABI emptied the caller's text buffer only after its first argument
checks, so a NULL exchange function, NULL trace, NULL verdict pointer or
unparseable trace left a previous answer readable after a non-OK status,
although `zig_dnssec.h` says text is "set to the empty string first". Every
entry point now resets the verdict and the text before checking anything.
* `Abi.Foreign.validateTrace` handed its ABI-v1 verdict buffer to whatever
`libzig_dnssec` was loaded without comparing ABI versions; it now returns
`BrokenContract` on a mismatch before calling the library.
* `formatRr` wrote an empty NSEC3 salt as an empty field rather than `-`
(RFC 5155 §3.3), so an NSEC3 answer with the salt RFC 9276 recommends was
not parseable presentation format.
* NSEC and NSEC3 type bitmaps were enumerated into a 128-entry buffer, and
`TypeBitmap.fill` dropped every type past it without saying so: a bitmap
setting more types printed as valid but incomplete presentation format.
`fill` is replaced by `TypeBitmap.iterator`, which the formatter streams,
so no type can be lost.
* The user and maintainer quick starts, and `build/guix.scm`'s synopsis,
still described the template: recipes that do not exist (`stapeln-run`,
`stapeln-export`), unwired ones (`install`, `run`) and "Rsr Template Repo".
They now give only the wired commands.

`check-variant-drift.sh` was recorded here as unrunnable because the deed's
parent pin is not in `rsr-template-repo`. The pin is this repository's own
root commit, whose tree is the deed's `:template-tree`; run against it, the
gate passes (`docs/reports/VERIFICATION.adoc`).

Not fixed in this cycle, with reasons rather than silence: base-image digest pinning and
the container build stages' user model are left to the estate-wide pinning
decision because no registry or container engine is reachable from here to
verify either; and the negative-cache-TTL bound above has no test, because no
Expand Down
8 changes: 4 additions & 4 deletions build/guix.scm
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
(native-inputs (map spec->input (list "git" "bash" "coreutils" "nss-certs" "just" "mise"
"shellcheck" "chez-scheme" "gmp" "gcc-toolchain" "zig")))
(home-page "https://github.com/hyperpolymath/zig-dnssec")
(synopsis "Rhodium Standard Repository template")
(description "The estate's repository template: the RSR layout, an Idris2 ABI
seam with a Zig FFI, CI gates, and the provisioning set (launcher, Justfile,
mise, Guix, setup and AI-assisted installation guides).")
(synopsis "Experimental pure-Zig DNSSEC validator and DoH stub client")
(description "Experimental pure-Zig DNS wire-format codec and DNSSEC validator
with a DNS-over-HTTPS stub client: authenticates answers from an untrusted
upstream resolver to a configured trust anchor. Not independently reviewed.")
(license license:mpl2.0))
88 changes: 22 additions & 66 deletions docs/onboarding/QUICKSTART-MAINTAINER.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@

== Overview

This guide covers packaging, deploying, and maintaining zig-dnssec for
distribution on your platform.
This guide covers building and packaging zig-dnssec for distribution on your
platform. zig-dnssec is a library with one command-line tool, `dnssec-stub`, and a
C ABI (`libzig_dnssec` and `zig_dnssec.h`). It has no configuration file, and
`just install` and per-instance deployment are not wired. Only the paths below are.

== Runtime Dependencies
== Build Dependencies

Zig 0.17.0, `just` (1.42 or later), and Idris2 0.7.0 for the ABI model checks that `just test` runs.

Expand All @@ -23,7 +25,15 @@ cd zig-dnssec
just build
----

Output: `zig-out/`
Output, under `zig-out/`:

* `bin/dnssec-stub`: the CLI (its exit status is the verdict: 0 secure,
1 insecure, 2 bogus, 3 indeterminate, 4 usage or transport error)
* `lib/libzig_dnssec` (static and shared) and `include/zig_dnssec.h`, from
`zig build ffi`

For a release build use `zig build -Doptimize=ReleaseSafe`; package those files
directly, since there is no install recipe.

== Packaging

Expand All @@ -34,89 +44,35 @@ Output: `zig-out/`
guix build -f build/guix.scm
----

=== Container (Stapeln)
This packages the source tree under `share/zig-dnssec/`.

[source,bash]
----
just stapeln-export # Generates Containerfile
podman build -t zig-dnssec .
----

=== Manual Package
=== Container

[source,bash]
----
just install --prefix=/usr/local
just container-build
----

Files installed:

[cols="1,2"]
|===
| Path | Contents

| `$PREFIX/bin/`
| Executables

| `$PREFIX/share/zig-dnssec/`
| Data files, assets

| `$PREFIX/share/doc/zig-dnssec/`
| Documentation

| `$PREFIX/share/applications/`
| .desktop file (Linux, if GUI)

| `$PREFIX/share/man/man1/`
| Man pages
|===

== Configuration

Default config location: `$XDG_CONFIG_HOME/zig-dnssec/config.toml`

Fallback: `$HOME/.config/zig-dnssec/config.toml`

== Health Checks

[source,bash]
----
just doctor # Full diagnostic
just run --version # Version check
just run --selftest # Built-in self-test
----
This builds `build/container/Containerfile` and tags the image
`ghcr.io/hyperpolymath/zig-dnssec:latest`. `CT_REGISTRY` and `CT_TAG` override
the registry and tag. `just container-push` publishes the same reference.

== Updating

[source,bash]
----
git pull
just build
just install --prefix=/usr/local
just test
----

Or via OPSM: `opsm update zig-dnssec`

== Security Notes

* License: MPL-2.0 (code) / CC-BY-SA-4.0 (docs)
* All dependencies SHA-pinned
* `panic-attacker` scan results: link:INSTALL-SECURITY-REPORT.adoc[]
* OpenSSF Scorecard: see badge in README

== Multi-Instance Deployment

For deploying multiple instances (e.g., different users or tenants):

[source,bash]
----
just install --prefix=/opt/zig-dnssec-instance1 --config=/etc/zig-dnssec/instance1.toml
just install --prefix=/opt/zig-dnssec-instance2 --config=/etc/zig-dnssec/instance2.toml
----

Each instance has isolated config, data, and logs.
* Experimental and not independently reviewed: see the warning in the README

== Reporting Issues

* Upstream: https://github.com/hyperpolymath/zig-dnssec/issues
* With diagnostic: `just help-me` (pre-fills context)
125 changes: 34 additions & 91 deletions docs/onboarding/QUICKSTART-USER.adoc
Original file line number Diff line number Diff line change
@@ -1,125 +1,68 @@
// SPDX-License-Identifier: CC-BY-SA-4.0
// Copyright (c) Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk>
// Template: QUICKSTART-USER.adoc — 5-minute path to working software
// Replace zig-dnssec, Rsr Template Repo — See README.adoc for details., just run, Rsr Template Repo started successfully. with actuals
= zig-dnssec — Quick Start for Users
:toc:
:toclevels: 2

== What is zig-dnssec?

Rsr Template Repo — See README.adoc for details.
Experimental pure-Zig DNS wire-format codec and DNSSEC validator with a
DNS-over-HTTPS stub client: it authenticates answers from an untrusted upstream
resolver to a configured trust anchor.

== Prerequisites

Before you begin, ensure you have:

* **just** — task runner (https://github.com/casey/just[install guide])
* Platform-specific requirements listed below

[cols="1,3"]
|===
| Platform | Additional Requirements

| Linux
| See README.adoc
It is a library with one command-line tool, `dnssec-stub`, which asks a
DNS-over-HTTPS resolver and validates the answer. There is no installer and no
configuration file, and `just install` is not wired. It is experimental and not
independently reviewed; read the warning in the link:../../README.adoc[README]
before relying on it.

| macOS
| See README.adoc

| Windows
| See README.adoc
|===
== Prerequisites

== Install
* Zig 0.17.0: enough for `zig build`, `zig build test` and the CLI
* Idris2 0.7.0 as well, for `just build` and `just test`, which also check the
Idris2 model of the C ABI
* *just*, the task runner (https://github.com/casey/just[install guide])

=== Option 1: Standard Install (recommended)
== Build and test

[source,bash]
----
# Clone and set up
git clone https://github.com/hyperpolymath/zig-dnssec.git
cd zig-dnssec
just setup
----

The setup script will:

* Detect your platform and shell
* Install missing dependencies (with your permission)
* Configure the application
* Offer install location choices
* Run a self-diagnostic to verify everything works

=== Option 2: Container (via Stapeln)

[source,bash]
----
just stapeln-run
----

=== Option 3: Portable (no system changes)

[source,bash]
----
just install --portable --prefix=./zig-dnssec-portable
----

== First Run

[source,bash]
----
just run
----

Expected output:

[source]
----
Rsr Template Repo started successfully.
zig build # dnssec-stub, into zig-out/bin/
zig build ffi # libzig_dnssec and zig_dnssec.h, into zig-out/lib and include
zig build test # Zig only
just test # Zig and the Idris2 model
----

== Self-Diagnostic
To use the library from your own Zig project, follow "Using it" in the
link:../../README.adoc[README].

If something isn't working:
== Run dnssec-stub

[source,bash]
----
just doctor
./zig-out/bin/dnssec-stub --doh https://cloudflare-dns.com/dns-query example.com. A
zig build run -- --doh https://cloudflare-dns.com/dns-query example.com. A # build and run
----

This checks all dependencies, permissions, paths, and connectivity.
If it finds issues, it will suggest fixes.
It prints `verdict=<v> reason=<r> at=<name> rcode=<rc>`, then the answer records
for a secure or insecure verdict. The exit status is the verdict: 0 secure,
1 insecure, 2 bogus, 3 indeterminate, 4 usage or transport error. Run it with no
arguments for the full option list.

To attempt automatic repair:
== Container

[source,bash]
----
just heal
just container-build
----

== Get Help

* **In-app**: `just run --help`
* **Guided tour**: `just tour`
* **Report a problem**: `just help-me` (pre-fills diagnostic context)
* **Wiki**: https://github.com/hyperpolymath/zig-dnssec/wiki

== Uninstall

[source,bash]
----
just uninstall
----

You will be asked:

1. Which uninstall tier (Bennett reversible, parameter-based, standard, or secure)
2. Whether to include or exclude your data
3. Whether to clear caches and LLM models
This builds `ghcr.io/hyperpolymath/zig-dnssec:latest` from
`build/container/Containerfile`.

== Next Steps
== Get help

* Read the link:README.adoc[README] for full feature overview
* Read the link:EXPLAINME.adoc[EXPLAINME] for architecture and design decisions
* Try `just tour` for a guided walkthrough
* Report a problem: https://github.com/hyperpolymath/zig-dnssec/issues
* Security issues: see link:../../.github/SECURITY.md[the security policy]
45 changes: 28 additions & 17 deletions docs/reports/VERIFICATION.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -250,23 +250,34 @@ response.

== Findings outside this code

* *The repo deed's template pin cannot be fetched, so the variant-drift gate
cannot be run.* `(provenance :template-commit)` and `(variant :parent-pin)`
both name `3100d46b9cfee83317018f1e8244b2fafa9da660`, and
`:template-branch` names `init/repo-init`. Neither exists in
`hyperpolymath/rsr-template-repo`: the commit returns HTTP 422 from the
commits API and is reachable from no branch, and the branch is gone (the
parent carries only `main` and two work branches, `main` last pushed
2026-10-27). `scripts/check-variant-drift.sh` takes a parent checkout at
that pin as its argument, so the gate is *unrunnable*, not failing. Run
against the parent's current `main` instead it reports 137 lines of drift,
which measures fourteen days of parent evolution since the 2026-10-13 mint
mixed with this repo's real divergence, and is not actionable either way.
Re-pointing the pin at today's parent tip and rewriting the path lists to
make the gate green would certify convergence that has not been
demonstrated, so it is left for the estate owner: either re-publish the pin
or re-derive the contract deliberately. `check-template-conformance.sh` T3
asserts the same unfetchable commit and inherits the problem.
* *The repo deed's template pin is not in the template repository, but the
variant-drift gate can still be run, and passes (TESTED).*
`(provenance :template-commit)` and `(variant :parent-pin)` both name
`3100d46b9cfee83317018f1e8244b2fafa9da660`, and `:template-branch` names
`init/repo-init`. Neither exists in `hyperpolymath/rsr-template-repo`: the
commit returns HTTP 422 from its commits API and the branch is gone. The
commit is, however, this repository's own root commit ("Initial commit",
the GitHub template copy), and its tree is `2c01b6f0627133f0ed2544e1edd07ed49602e117`,
exactly the deed's `(provenance :template-tree)`. A checkout of it is
therefore the parent at the pin, identified by tree hash rather than by
where the commit is stored. It needs the root commit locally, so a shallow
clone (CI's default checkout) runs `git fetch --unshallow` first:
+
----
git fetch --unshallow # only in a shallow clone
git worktree add ../parent-pin 3100d46b9cfee83317018f1e8244b2fafa9da660
Comment thread
hyperpolymath marked this conversation as resolved.
Resolved
bash scripts/check-variant-drift.sh ../parent-pin .
----
+
This passes ("spine convergent … modulo declared variant paths"), and a
control that edits one undeclared file is reported as drift. Run against
the parent's current `main` instead it reports drift that mixes the
parent's evolution since the 2026-10-13 mint with this repo's divergence,
which is a different question. Still for the estate owner: the deed names a
commit and branch the template repository no longer serves, so tools that
fetch the pin from the parent (and `check-template-conformance.sh` T3) see
it as missing; either the template republishes it or the mint records the
tree hash as the identity to check.
* *Zig 0.17.0 `std.http.Client` + CONNECT proxy sends HTTPS requests in cleartext*
(`docs/developer/ZIG-STD-SURVEY.adoc`). Worth an upstream report.
* *RFC 8080 §6*: the example signatures carry Labels=3 for a two-label owner, which a
Expand Down
Loading
Loading