Artifact 606f1a8ffc27a100c9ad3b8abd62311b88a4405e2b639df19b0931963d223076:
- File
tools/ca-bundle.sh
— part of check-in
[e91d80b36c]
at
2026-11-19 17:48:36
on branch input
— One reader for file inputs, and Mozilla's roots compiled in (ticket 2140960de4)
AGENTS.md and the other instruction files, models.json and the certificate bundle are now read through pic_input_read (src/input.c): bounded, regular files only, with an ownership check for the certificate bundle, so a build without a filesystem can supply them another way. When no system bundle exists pic falls back to Mozilla's root certificates compiled in from curl's cacert.pem (tools/ca-bundle.sh regenerates src/ca_bundle.inc); PIC_CA=builtin uses only those. The HTTP test checks the built-in roots load. (user: dmestas, size: 1392) [annotate] [blame] [check-ins using] [more...]
#!/bin/sh # Regenerates src/ca_bundle.inc: Mozilla's trusted root certificates (as curl # publishes them, https://curl.se/ca/cacert.pem), compiled into pic as the # fallback when no system bundle exists (a minimal host or a VM without a # userland). Needs curl. Usage: sh tools/ca-bundle.sh [CACERT_PEM] set -eu cd "$(dirname "$0")/.." tmp=$(mktemp -d "${TMPDIR:-/tmp}/pic-ca.XXXXXX") trap 'rm -rf -- "$tmp"' EXIT HUP INT TERM if [ $# -ge 1 ]; then cp "$1" "$tmp/ca.pem"; else curl -fsS -m 60 -o "$tmp/ca.pem" https://curl.se/ca/cacert.pem; fi sum=$(shasum -a 256 "$tmp/ca.pem" | cut -d' ' -f1) dated=$(sed -n 's/^## Certificate data from Mozilla as of: //p' "$tmp/ca.pem" | head -1) { printf '/* Generated by tools/ca-bundle.sh from https://curl.se/ca/cacert.pem (Mozilla roots as of\n' printf ' * %s; sha256 %s). Do not edit: regenerate. */\n' "$dated" "$sum" printf 'static const char *const builtin_anchors[] = {\n' awk '/-----BEGIN CERTIFICATE-----/ { inside = 1; printf " \"" } inside { printf "%s\\n", $0 } /-----END CERTIFICATE-----/ { inside = 0; printf "\",\n" }' "$tmp/ca.pem" printf '};\n' } > "$tmp/out" n=$(grep -c 'BEGIN CERTIFICATE' "$tmp/out") [ "$n" -gt 100 ] || { echo "ca-bundle: only $n certificates; refusing" >&2; exit 1; } mv "$tmp/out" src/ca_bundle.inc printf 'ca-bundle: %s certificates written to src/ca_bundle.inc\n' "$n"