Artifact 5efec61aa35bea35b3f59f95aad2b13f9a5ed0facc6735593fa7fa83d2a9c7a3:
- File
src/input.h
— 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: 978) [annotate] [blame] [check-ins using] [more...]
/* Inputs that are files by nature (input.c): AGENTS.md and the other * instruction files, models.json, the certificate bundle, and later skills * and prompt templates. They are read through this one function so a build * without a filesystem can supply them another way. */ #ifndef PIC_INPUT_H #define PIC_INPUT_H #include <stddef.h> enum { /* Refuse a file not owned by the user or root, or writable by others, * or in such a directory (errno EPERM): for the certificate bundle. */ PIC_INPUT_TRUSTED = 1, /* Over max: return the first max bytes and set *truncated, instead of * failing with EFBIG. */ PIC_INPUT_TRUNCATE = 2, }; /* The whole regular file at PATH (malloc'd, NUL-terminated, *len bytes), or * NULL with errno: ENOENT when it is missing (or not a regular file), EFBIG * when over MAX, EPERM when PIC_INPUT_TRUSTED refuses it. */ char *pic_input_read(const char *path, size_t max, int flags, size_t *len, int *truncated); #endif