Public secure entry builds

The public secure path compiles the application's manifest-owned source closure, C hook and explicitly declared static native providers in fresh staging. It does not reuse an ordinary executable, bytecode bundle or package build cache. The initial target is optimized stock-allocation x86_64 Linux musl static PIE. Unsupported configuration, source/native imports, hook ownership or final-image checks fail before replacing a previous output.

The producer adds a retained input-closure marker and inspects the actual final ELF, each selected object, literal final-link inputs and pinned startup inventory. It rejects forbidden runtime capabilities, constructor arrays, dynamic loading, IFUNC, unsupported hardening and startup definitions. It uses the reviewed compiler/SDK and a private ordinary compiler cache. This trusts those build inputs; it does not run the Stage 2 exhaustive compiler-read/archive witnesses.

Application C helpers cannot define a name referenced or defined by the fixed runtime/module/startup objects. Generated startup may reference the selected hook and declared provider initializer/implementation symbols. Each must have exactly one strong ordinary function definition in its selected owned C objects. This prevents a strong application definition from interposing a weak libc dependency before the hook. The final startup inventory also binds getauxval to the pinned libc member/source.

The output pair is the executable and its distinct .secure-runtime.json runtime report. The report carries inline inventories, the exact image digest and provenance-unverified assurance. Per-image execution tests are initially empty, and both privileged qualification modes are not-run. The producer does not execute arbitrary application code during a build. It captures the running compiler's stamp and executable digest itself; callers cannot supply replacement compiler identity fields to the image producer.

The initial public route selects one named final application, or the workspace's only application when unambiguous. Its compiler-owned core output and runtime sources must be installed locally. It does not download a missing toolchain. Custom build tasks/lifecycle hooks, native dependency libraries, additional executable targets in the same package, test builds, watch, dry-run and no-bundle are unsupported. Build additional executables as separate ordinary packages.

Scoped static providers

A final application can declare reviewed public mechanisms without admitting the ordinary (sigil io) dependency graph:

(package
  name: "example"
  entry: '((example application) main)
  libraries:
    (list (library name: 'mechanisms
                   c-sources: '("native/mechanisms.c")
                   native-init: "example_initialize"))
  secure-native-providers:
    (list (secure-native-provider
            module: '(example mechanisms)
            library: 'mechanisms
            bindings: '((observe "example_observe" 0)))))

Use this declaration with an explicit secure production configuration. Ordinary builds reject it. Dependency declarations and bare native initializers remain unsupported. A provider module cannot replace core, secure-entry or any selected source module. Each provider selects a distinct final-package library, contained C sources/includes, a distinct initializer, and exact binding triples. There are at most 16 providers and 256 bindings per provider; the fixed runtime's remaining native slots also bound the combined table. Arity uses the existing native registration encoding, not a C parameter count.

Implement the initializer as void example_initialize(SigilVM *) and each implementation as Value example_observe(SigilVM *, int, Value *), with external linkage. Include <sigil/sigil.h>. The initializer begins exactly its declared module with sigil_begin_module, registers and exports exactly the declared bindings with sigil_module_register_native and sigil_module_export, then calls sigil_end_module. It must not modify another module or reuse another provider's cells/procedures. Generated prototypes are forced into each selected C input, with warnings treated as errors. A hook may share a provider's C input. Custom compiler/link flags and constructors remain refused.

The compiler constructs private noncallable descriptors from the closed contract and never loads or runs application C. After the hardened prologue, hook and fixed runtime initialization, the executable runs each initializer once before source units. It verifies actual module/cell identity, exact exports, linked function pointers, names and arities. Emitted references and application entry recheck those original bindings. A wrong registration exits before application entry. C remains trusted native code, not a sandbox.

Native calls belong in application procedure bodies. A provider cannot run during compiler expansion or source initialization. Imports, reexports and explicit source aliases retain descriptor authority. The existing secure subset still refuses an imported binding referenced only through a hygiene macro without an ordinary source publication; defining an explicit source alias gives that macro a retained original binding.

The runtime report binds the full provider contract, selected observed C hashes, owned object and function-code hashes into its module inventory and closure marker. It remains provenance-unverified. Passwords, PAM state and secret conversation endpoints stay native; the consumer reviews its exact mechanism surface and keeps authorization and lifecycle policy in Sigil. Typed launch plans remain the only admitted process-creation path. Unprivileged record, deadline, peer and descriptor fixtures do not qualify a real login service, privileged cgroup operations or installation.

Both ordinary and secure paths return a private completion token only after their terminal checks. The common wrapper validates that token before lowering the single build-completion latch. A swallowed exception or partial return cannot silently become a successful build.

Build outputs never receive privileged ownership or setuid permissions. A consumer must explicitly accept the runtime-report contract, verify the image binding and complete its required review/tests before installation. Real setuid-root/root-init qualification is a separate authorized step.