# Security

> Every safety measure the framework takes — the release hardened flag by flag, every debug build under the sanitizers, two static analysers, what its tests reach, the shipped binary read back, the supply chain pinned, secrets kept out of the repository — what each one protects against, what it costs, and what is not done.

Source: https://omardev29.github.io/rmp-docs/framework/security.html

A game is a program that reads files and takes input from people who did not write it, and the language it is written in lets a mistake in memory become a crash, or worse. The framework cannot make that impossible. What it can do is make a release harder to exploit, catch the mistakes in development where they happen instead of where they crash, keep what the build depends on from changing under it, and keep secrets out of the repository. This page is every measure it takes, what each one protects against, what it costs — measured, where the framework measured it — and where it lives. The last section says plainly what is not done.

## At a glance

| Measure | Where it applies | In a game made with `rmp new` |
|---|---|---|
| [The release, hardened](https://omardev29.github.io/rmp-docs/framework/security.html#release) | every desktop release: Linux and the BSDs, macOS and Windows in part | yes: it is the same `CMakeLists.txt` |
| [Library checks in debug](https://omardev29.github.io/rmp-docs/framework/security.html#debug-checks) | every debug build on the desktop | yes |
| [AddressSanitizer and UndefinedBehaviorSanitizer](https://omardev29.github.io/rmp-docs/framework/security.html#sanitizers) | every debug build of the framework on the desktop | off until `[dev] sanitize` lists them |
| [Static analysis](https://omardev29.github.io/rmp-docs/framework/security.html#analysis) | the framework's own code: `rmp lint`, `rmp test`, the lint and tidy jobs | no: the framework's code is checked before a game gets it |
| [What the tests reach](https://omardev29.github.io/rmp-docs/framework/security.html#coverage) | the framework's own code: `rmp test coverage`, the coverage job; the deep tests, the deep job | no: it measures the framework's tests |
| [The shipped binary, read back](https://omardev29.github.io/rmp-docs/framework/security.html#binaries) | every release job in CI | yes: the same workflows |
| [The supply chain, pinned](https://omardev29.github.io/rmp-docs/framework/security.html#supply-chain) | CI | yes, at the pins the game was made with |
| [Secrets, signing, installing](https://omardev29.github.io/rmp-docs/framework/security.html#secrets) | the `.toml`, the Android job, the installer | yes |

## The release, hardened

The binary a player runs is compiled and linked so that a memory bug in it is harder to turn into anything worse than a crash. Release builds only: a debug build has the [sanitizers](https://omardev29.github.io/rmp-docs/framework/security.html#sanitizers) instead, which find the bug rather than blunt it.

Every flag was measured before it went in, because a release is kept as small as it can be, and the rule is that a flag costing more than 3% of the stripped binary is not used. PIE is the one exception, taken on purpose; [below](https://omardev29.github.io/rmp-docs/framework/security.html#pie) is why.

### What each flag protects against, and what it costs

Measured on `linux-x64-glibc` as CI builds it — zig's compiler, link-time optimisation, stripped — where the game is 1,149,120 bytes with none of these flags, and 352,524 after UPX packs it:

| Flag, and what it does | Cost |
|---|---|
| `-U_FORTIFY_SOURCE` `-D_FORTIFY_SOURCE=3`  The C library checks the size of the buffer that `memcpy`, `strcpy`, `sprintf` and their kind write into, wherever the compiler can work it out, and stops the program instead of writing past it. | +3.6 KB (+0.32%) |
| `-fstack-protector-strong`  A guard value between a function's local arrays and its return address, checked before it returns: a write past a local buffer that reaches the return address stops the program instead of sending it somewhere else. | +20.2 KB (+1.80%) |
| `-fstack-clash-protection`  A large allocation on the stack touches it page by page, so it cannot step over the guard page into another region of memory. | +0.3 KB (+0.03%) |
| `-Wl,-z,relro` `-Wl,-z,now`  Every library function is resolved when the program starts, and the table of their addresses is then made read-only, so a stray write cannot redirect a call. | nothing: zig's linker writes both already |
| `-Wl,-z,noexecstack`  The stack is not executable, so code written onto it cannot run. | nothing: zig's linker writes it already |
| `-D_GLIBCXX_ASSERTIONS`  `-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_FAST`  The C++ standard library's cheap checks: an index past the end of a container, or the first element of an empty one, stops the program instead of reading what follows. One define for libc++, one for libstdc++; each library ignores the other's. | +2.9 KB (+0.25%), with zig's libc++ |
| All of the above, together | +22.7 KB (+2.03%): 1,172,400 bytes, 357,056 packed |
| `-fPIE` `-pie`  The executable is position-independent, so it is loaded at a different address on every run: [PIE](https://omardev29.github.io/rmp-docs/framework/security.html#pie). | +61.9 KB (+5.52%) |

Fortify is level 3 where the compiler has `__builtin_dynamic_object_size` — which lets it check buffers whose size is only known while the game runs — and `-D_FORTIFY_SOURCE=2` where it does not. `-U_FORTIFY_SOURCE` comes first because Ubuntu's gcc defines it already, and a second definition would be a warning. It is used only where the C library is glibc: musl ignores it, and the BSDs' C libraries have their own.

On `linux-x64-musl` the same flags cost +19.4 KB (+1.72%) together. The releases that Ubuntu's gcc builds — `linux-riscv64-glibc` and the DRM pair — had every one of them already, since that gcc turns them on by default, except the C++ library's checks: `_GLIBCXX_ASSERTIONS` costs +8.0 KB (+0.72%) there.

Every flag is first tried on the toolchain at hand, and one it does not take is left out rather than breaking the build. A release configure says what it got; on Linux with glibc:

`=== RELEASE HARDENING: stack-protector-strong, C++ library bounds checks, FORTIFY_SOURCE=3, stack-clash-protection, -Wl,-z,relro, -Wl,-z,now, -Wl,-z,noexecstack, pie ===`

What the linker made of them is not taken on trust either: CI reads it back [out of the binary](https://omardev29.github.io/rmp-docs/framework/security.html#binaries).

### PIE, over the rule

Without PIE the executable sits at the same address on every run. The system's address randomisation still moves the libraries, the stack and the heap, but not the game's own code, which is the code an exploit most wants to find. So a Linux or BSD release is linked position-independent, at +5.5%, and the 3% rule gives way.

Most of the cost is one table: 58.5 KB of the 61.9 is `.rela.dyn`, a relocation for every pointer the loader has to fix when it places the program. The linker can pack those (`DT_RELR`, `-z pack-relative-relocs`), but the packed form needs glibc 2.36, and the oldest glibc a release supports, `[linux] glibc`, is 2.28. So they ship unpacked.

PIE is CMake's `POSITION_INDEPENDENT_CODE`, which gives gcc and clang `-fPIE` to compile and `-pie` to link. It is on by default, and `-DRMP_RELEASE_PIE=OFF` turns it off for a build directory — to measure what it costs, not to ship.

### On the other platforms

The flags above are what a Linux or BSD release gets. Elsewhere, the platform already does part of it, and the rest is chosen to fit:

macOS

The stack protector and the C++ library's checks. PIE and a stack that is not executable are the platform's own and always on. The cost was not measured on a Mac; the figures above come from the same compiler on Linux.

Windows

With MinGW, which builds `windows-x64` in CI: `-Wl,--dynamicbase` (the executable is loaded at a random address), `-Wl,--nxcompat` (data is not executable) and `-Wl,--high-entropy-va` (the random address is drawn from the whole 64-bit space). They are the linker's defaults already, and are asked for anyway where the linker takes them. The stack protector is not used there, because with MinGW it can mean shipping `libssp-0.dll` next to the game, and nothing checks for that. With MSVC, which builds `windows-arm64`: its defaults, `/GS`, `/DYNAMICBASE`, `/NXCOMPAT` and `/HIGHENTROPYVA`, the same protections. Control Flow Guard, `/guard:cf`, is not used: it could not be measured.

Web

Nothing: a WebAssembly module has no executable stack and no loader to randomise. The browser runs it in its sandbox.

Android

The NDK compiles with `-fstack-protector-strong` and `-D_FORTIFY_SOURCE=2` by itself, and Android has required PIE since 5.0.

iOS

PIE and the stack protector are Xcode's defaults.

### What a release weighs

With all of it in, these are the sizes of the framework's own demo game, each as its release job measured it: unpacked, as the linker wrote it, and packed, after UPX, for the releases that are packed. `tools/size_budget.txt` holds them, and every release is [held to its line](https://omardev29.github.io/rmp-docs/framework/security.html#size-budget). A game's own sizes are its own.

| Binary | Unpacked, bytes | Packed, bytes |
|---|---|---|
| `linux-x64-glibc` | 1,384,712 | 453,528 |
| `linux-arm64-glibc` | 1,271,376 | 415,768 |
| `linux-riscv64-glibc` | 1,032,080 | — |
| `linux-x64-musl` | 1,381,440 | 453,108 |
| `linux-x64-glibc-drm` | 955,080 | 386,300 |
| `linux-arm64-glibc-drm` | 860,984 | — |
| `windows-x64` | 2,375,168 | — |
| `windows-arm64` | 1,376,768 | — |
| `macos` | 2,090,696 | — |
| `freebsd-x64` | 991,456 | — |
| `freebsd-arm64` | 888,688 | — |
| `openbsd-x64` | 1,083,064 | — |
| `openbsd-arm64` | 1,052,136 | — |
| `netbsd-x64` | 1,176,656 | — |
| `web` | 574,669 | — |
| `android/arm64-v8a` | 1,107,728 | — |
| `android/armeabi-v7a` | 817,720 | — |
| `android/x86` | 1,211,840 | — |
| `android/x86_64` | 1,213,976 | — |

The OpenBSD arm64 line is worked out from an older measurement rather than read off a build, as its comment in the file says, and is held to the same rule until a run replaces it.

## Every debug build, under the sanitizers

A test asserts what it can see, and a mistake in memory or in arithmetic often gives it nothing to see: a read one past the end that finds a zero, a use of freed memory that still holds the old value, a signed overflow that wraps to a harmless number. So every debug build of the framework on the desktop — the library, every example, every test — runs under AddressSanitizer and UndefinedBehaviorSanitizer, because the framework's own `.toml` says `sanitize = ["address", "undefined"]`. They are compiled in, and each report stops the program at the line that did it, with the stack that got there.

AddressSanitizer

A read or a write past a buffer — on the heap, on the stack or in a global — a use after free or after return, a double free, and a global that reads another file's global before that one was initialised.

LeakSanitizer

Memory nobody freed, reported when the program exits. It is part of AddressSanitizer where the runtime turns it on by itself, which is Linux, and it is left to that; asking for it on macOS stops every program.

UndefinedBehaviorSanitizer

A signed overflow, a shift past the width of its type, a float converted to an integer it does not fit, a misaligned or null access, a virtual call on an object of the wrong type.

### The flags

With clang, the framework's development compiler, and with gcc, which names `float-cast-overflow` because its `undefined` does not include it:

```text
clang:
  -fsanitize=address,undefined
  -fno-sanitize-recover=all
  -fno-omit-frame-pointer
  -fsanitize-ignorelist=cmake/sanitize_ignore.txt
gcc:
  -fsanitize=address,undefined,float-cast-overflow
  -fno-sanitize-recover=all
  -fno-omit-frame-pointer
```

`-fno-sanitize-recover=all` makes every report the end of the run, and `-fno-omit-frame-pointer` keeps the stack in a report readable. What was applied is defined, for code that has to allow for it — a timing test, say:

```text
-DRMP_SANITIZE=1            any of them
-DRMP_SANITIZE_ADDRESS=1    AddressSanitizer
-DRMP_SANITIZE_UNDEFINED=1  UndefinedBehaviorSanitizer
```

With MSVC, which has AddressSanitizer and nothing else: `/fsanitize=address` to compile and `/INCREMENTAL:NO` to link, which it requires, and the run-time checks (`/RTC1`) taken out of the debug flags, which it cannot be combined with.

The runtimes' own options are set in `cmake/sanitizer_hooks.c`, linked into every instrumented program: AddressSanitizer also checks use after return and the order globals are initialised in, and both sanitizers stop at the first report and print the stack. The environment still wins — `ASAN_OPTIONS`, `UBSAN_OPTIONS`, `LSAN_OPTIONS` — so one run can be changed while chasing one report.

LeakSanitizer can be told to ignore memory a system library keeps for the life of the process. The rule for that list is that a line names a system library by its file name, seen leaking in a real run, and never anything of the framework's or the game's; a test refuses a line that could match the framework's code, and a leak planted in a function of the framework's own has to be reported through the list. The list is empty.

The clang builds would also skip what `cmake/sanitize_ignore.txt` lists, each line with its reason, and the list may only name vendored code. It is empty. It held one line, which turned every sanitizer off for the Tiled reader over one null-pointer member access in its `OFFSET_OF`, and that hid a parser that read past the end of a map cut short and leaked on every refusal; cute_tiled is patched instead (`thirdparty/cute_tiled/PATCHES.md`) and fuzzed under the sanitizers like the framework's own code.

### Whether they really run

A compiler that accepts `-fsanitize=address` is not one that can run it: Ubuntu's clang takes the flag and then has no runtime to link, and a runtime can link and still refuse to start. So `cmake/sanitize.cmake` builds a small program with the flags and runs it, in C++ and in C. The C++ one makes a virtual call, which is what UndefinedBehaviorSanitizer's type check needs from its runtime. When the build is cross-compiled, linking is the most it can know. A probe that ran is remembered against the compilers, the flags and the hooks it ran with; one that failed is never remembered, so installing the runtime is seen by the next configure.

When the probe cannot run them together, each that runs on its own is kept; one that does not run at all is a warning, and the debug build goes on without it — a condition of the machine, not a mistake in the `.toml`. Unless the environment requires them, as CI does wherever a debug build is a gate: there the configure fails, because a gate that quietly stopped instrumenting passes by not looking.

```shell
RMP_REQUIRE_SANITIZERS=1 cmake --preset debug
```

A configure that got them says so:

`=== SANITIZERS: address, undefined ===`

To measure what they cost, one build directory can go without them: `-DRMP_SANITIZE=OFF`.

```shell
cmake --preset debug -DRMP_SANITIZE=OFF
```

They are never applied to the web, Android or iOS builds: the web build is a release, and Android and iOS build through their own projects, which do not read `[dev]`.

### NetBSD

NetBSD's GCC 10.5 ships an UndefinedBehaviorSanitizer runtime without its C++ half, so the type check of virtual calls cannot link there. The probe sees it, and the build keeps every other check with `-fno-sanitize=vptr`, and says so in a warning, rather than dropping the sanitizer whole.

NetBSD also gives every program address randomisation unless the program's ELF note says otherwise, and its AddressSanitizer will not start with it. So every sanitized program there gets `paxctl +a` after it is linked, and the probe gets it before it runs. A NetBSD without `paxctl` does not get AddressSanitizer.

### The library checks, in every debug build

Independently of the sanitizers, every debug build on the desktop — the framework's and a game's — gets two more checks that need no runtime. Android's and iOS's debug builds are made by their own projects, and get neither.

- `-D_GLIBCXX_ASSERTIONS` and `-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE`: the standard library checks `operator[]`, `front()` and `back()`, and in libc++ the extensive set, which goes further than the release's fast one.
- `-ftrivial-auto-var-init=pattern`, where the compiler has it (gcc 12 and later, clang): a local variable nobody initialised is filled with a pattern that crashes when it is used, instead of a zero that happens to work.

Fortify is not among them: it needs optimisation, and a debug build has none.

### What they cost

AddressSanitizer is the expensive one. The framework's unit tests take 5.5 seconds without it and 18.6 with it, 3.4 times as long, and the framework's `.toml` puts its memory at two to three times; UndefinedBehaviorSanitizer is cheap. The examples played from a script say the same from the other side: a frame of raylib's software renderer, unoptimised and instrumented, is slow enough that the build that plays them compiles the renderer's three files at `-O2`, still instrumented, and Pong's script then plays in 17 seconds instead of 85 — [Testing](https://omardev29.github.io/rmp-docs/framework/testing.html#examples) says why the pictures stay the same. None of it reaches a release.

### A report fails the run

A sanitized program prints its report and exits with an error, and LeakSanitizer reports after the program's last line of its own, when it exits. So the checks that boot a game do not stop at the markers it prints: `rmp test smoke` and `rmp test render` fail on a sanitizer's report anywhere in the output, with the first forty lines of it, and on any exit status but 0 — `a sanitizer reported the run above (exit …)`. Every example booted by `rmp test examples`, and every one it [plays from a script](https://omardev29.github.io/rmp-docs/framework/testing.html#e2e), is held to its exit status the same way. So is every other start of a game in the tools and the workflows — a release started from another folder, the musl build on Alpine, the DRM build on its virtual display, the RISC-V build under emulation — but the iOS simulator's, [below](https://omardev29.github.io/rmp-docs/framework/security.html#not-done); a test fails one that throws the status away. [Testing](https://omardev29.github.io/rmp-docs/framework/testing.html#sanitize) has the runs these checks are part of, and the second one with gcc, `rmp test sanitize`.

And the arrangement is itself tested: `tests/sanitize_test.cpp` holds the defines to what the compiler says it instrumented, and runs `tests/sanitizer_canary.cpp`, a program that leaks, overflows a buffer or overflows an integer on request, and each one has to be caught.

### In a game

A game made with `rmp new` starts with `sanitize = []`: off, so that a fresh clone on a compiler without the runtimes builds without a warning to explain. Turn them on when you want your own game's mistakes found where they happen instead of where they crash:

```toml
[dev]
sanitize = ["address", "undefined"]
```

Those two are the ones that work on a game as it is, with the system's own libraries left uninstrumented. [`[dev] sanitize`](https://omardev29.github.io/rmp-docs/reference/configuration.html#dev-sanitize) refuses the others by name, each with its reason — `thread`, `memory`, `leak`, `hwaddress`, `integer`, `implicit-conversion` and `fuzzer`:

```toml
[dev]
sanitize = ["address", "thread"]
```

```text
  raylib_multiplatform.toml:2: sanitize = ["address", "thread"]
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  configure: error: [dev] sanitize: 'thread' is refused -- ThreadSanitizer has to see every library the game runs, the system's audio and GL drivers included, or it reports races that are not there -- and it cannot be combined with address.
                    Use "address" and "undefined", or [] for none.
```

It also refuses what a platform cannot give: `undefined` with `[dev] compiler = "msvc"`, any sanitizer with `"mingw"`, whose GCC ships no runtime, and `address` on OpenBSD, whose clang has none.

## Static analysis

The sanitizers find what a run reaches. These read the framework's code without running it, on every push, and none of them costs the shipped game anything.

clang-tidy, with the Clang Static Analyzer

`rmp lint` runs clang-tidy with the framework's `.clang-tidy` over `src/`, `tests/` and `examples/`: the `bugprone` checks, the static analyzer's path-by-path search for null dereferences, leaks and uses of freed memory, the performance and portability checks, and the checks that hold [the style guide](https://omardev29.github.io/rmp-docs/guidelines/index.html). It reads the C as well: the resource packer every desktop release runs, the plain C example and the sanitizer hooks. A file with no compile command is a failure, never a guess at its flags. Each file is read by a clang-tidy of its own, as many at once as the machine has processors — or as `CMAKE_BUILD_PARALLEL_LEVEL` says, when it is set — the costliest first, so the run does not end on one processor while the others wait. On every push it runs in the framework's `tidy` job, beside the others.

The debt, which only shrinks

What the code still owes the style guide is written down in `tools/lint_debt.txt`, a line per check and file with the number of warnings left. A warning it does not owe fails, a count that grows fails, and a count higher than what is left fails too, so every fix lowers it for good. Every line in it is one check, `custom-rmp-raw-pointer`: a raw pointer where the guide wants a reference, a span or a handle.

cppcheck

A second analyser, with its own value-flow analysis rather than clang's, over `src/rmp/` and the headers it includes: `rmp test cppcheck`. The rule is zero findings. One that is not a bug is suppressed on the line before it, with the reason after a `;`; a suppression with no reason fails, and so does one that no longer matches anything, so an excuse cannot outlive what it excused. A few are suppressed in the script itself, by check or by file, each with its reason, and that list only shrinks.

The compiler's own warnings

`-Wall` and `-Wextra` on every target built from the framework's sources and the game's, and never on raylib or `thirdparty/`, whose headers are included as system headers so that their warnings do not bury ours. MSVC keeps its own default level. `-DRMP_WERROR=ON` makes every one an error: the framework's unit tests, its lint job and the gcc run pass it. A game is never made to, because a newer compiler on its author's machine must not stop a build that worked the day before.

No raw pointer in the API

`rmp test pointers` has clang read every public header and fails on a raw pointer or a C string in any declaration a game can name: a pointer cannot say whether it may be null, who owns it or how long it lives. The few pointers a game cannot reach are listed in `tools/pointer_ratchet.txt`, each with its reason, and that list only shrinks. [Pointers and RAII](https://omardev29.github.io/rmp-docs/guidelines/pointers-and-raii.html) says what the API hands out instead.

Nothing owned by hand

`rmp test ownership` fails on a bare `new`, `delete`, `malloc` or `free` in the framework, and on a raylib `Load…`/`Unload…` call outside the files that own what it makes, in the framework or in an example — the two shapes a leak and a double free take. The files that must keep such a call are listed with the reason, and the list only shrinks.

## What the tests reach

The sanitizers and the analysers judge the code a run reaches and the code they read; neither says how much of the framework the tests run at all. `rmp test coverage` measures it, line by line, with clang's source-based coverage over the unit tests, the headless layout test and the one test that drives the real desktop runner. Two lists hold what it measured, and each moves one way: `tools/coverage_floor.txt`, the share of each file of `src/rmp/` the tests run, which only rises, and `tools/untested_api.txt`, the public functions no test calls, which only shrinks — a new function arrives with its test. Both are gates in the framework's `coverage` job, inside the build image they were measured in, and a release of the framework waits for it. [Testing](https://omardev29.github.io/rmp-docs/framework/testing.html#coverage) has the detail.

Coverage says which lines ran, not whether a test would notice them wrong, and a test checks only the inputs somebody thought of. The deep tests look for the rest — fuzzing, properties checked against generated input, and mutation testing, which changes the code to see whether a test fails — in the framework's `deep` job on every push and in a longer search at night; [Testing](https://omardev29.github.io/rmp-docs/framework/testing.html#ci) says where each one runs, and [below](https://omardev29.github.io/rmp-docs/framework/security.html#not-done) how little of the framework they reach yet.

## The shipped binary, read back

A flag the toolchain silently ignored is a flag that was never there, and a build machine is not a player's machine. So CI reads what matters out of the binary it ships, with `tools/binary_check.py` and a few scripts beside it, which need nothing but Python's standard library or a shell. A game's CI runs the same steps.

How a Linux release was linked

`binary_check.py elf`, in every Linux release job, before UPX packs the binary: RELRO, BIND_NOW and a stack that is not executable, read from its program headers and dynamic section; and, given `--pie` whenever the build's cache says `-DRMP_RELEASE_PIE` was on, that it is position-independent. With `--musl` it also reads what the musl build asks the system for: its loader has to be musl's and the one library it names musl's C library — or it is static and names neither.

What a Windows `.exe` imports

`binary_check.py windows` reads the import table and the delay-load table, and fails on any DLL that is not part of every Windows 10: a compiler runtime the player would have to install, named with how to link it in instead. With `--require-icon` it also wants the icon.

Which macOS each slice needs

`binary_check.py macos` reads the minimum macOS out of every slice of the universal binary and fails on one that asks for more than the build was told.

Which glibc a Linux release needs

`tools/glibc_check.sh` reads the glibc version every symbol the binary imports asks for, and fails on one newer than `[linux] glibc`: the failure it prevents is a game that runs on the machine that built it and on no older distribution. It holds the x64 and arm64 releases to that floor and the riscv64 one to its own; the DRM pair link their distribution's graphics libraries directly, and their floor is reported rather than held.

That an Android release is a release

`tools/android_release_check.py` reads the compile commands Gradle used for the release bundle and fails on a file of the game or the framework compiled at `-O0`, with `_DEBUG`, or without `RMP_PRODUCTION_BUILD`.

### The size budget

Every release job holds the binary it ships to its line in `tools/size_budget.txt`, unpacked and packed: within 1.5% either way it passes in silence; past that it passes with a warning that names the new size, on the run's summary page as well as in its log; past 10% it fails. A binary that grew is a growth nobody wrote down, and one that shrank leaves a line that would hide the next growth. Growing is allowed — it is written down, in the commit that does it. A game starts with no budget, and its jobs print the line to write when it wants one.

## The supply chain, pinned

A green run should mean the same in six months as today, and a build should not depend on a download succeeding.

The build image, by digest

The Linux, web and Android builds, the lint job and the framework's own jobs — clang-tidy, the examples and their scripts, the coverage, the deep tests, the new game, the documentation — run inside `ghcr.io/omardev29/raylib-build`, named by its `sha256` digest in `thirdparty/FROZEN_VERSIONS.md` and in every workflow that runs in it — `ci.yml`, `web-backends.yml` and `deep.yml` — and in the development container, `.devcontainer/devcontainer.json`; `tools/versions_check.sh` reads every workflow and the container and fails if any two disagree, or if `:latest` appears outside the canary. Inside the image it also compares every pinned tool with the image's own manifest. The image is built in [its own repository](https://github.com/omardev29/raylib-build-image), each architecture on a runner of that architecture, checked there inside the image it built, and published only then.

The Alpine image, by digest

The Alpine the musl build is started on is an image of the framework's own, `ghcr.io/omardev29/raylib-run-alpine`, pinned and checked the same way.

Nothing from Docker Hub

A test reads every image every workflow names and fails on one that does not come from `ghcr.io`. A digest makes an image look frozen; it is still a download from a registry with anonymous rate limits.

Every action, by commit

Every GitHub Action a workflow uses is named by the full commit it resolves to, with the tag in a comment beside it: a tag can be moved, a commit cannot. A test of the framework reads every `uses:` in its workflows and fails on one that is not a full commit, or does not say which version that commit is — and runs the same check on a workflow that names a tag and one that pins a commit without its version, which it has to refuse.

Every download, by checksum

Every file a job fetches by address — zig and UPX outside the image, Ninja and XcodeGen on macOS, Mesa and UPX on Windows — is checked against a `sha256` kept in the repository before it is used. Inside the image, a script that finds its tool at the wrong version fails instead of fetching it. Pillow, which the Windows jobs install to make the icon, comes with `pip --require-hashes`, so no other file is accepted. There are exceptions, and [What is pinned](https://omardev29.github.io/rmp-docs/publishing/ci.html#what-is-pinned) lists them: the BSD jobs install from their system's package mirror, which has nothing to pin to, the job that boots DRM installs a kernel module from Ubuntu's archive, and the web test the libraries its browser needs.

The test tools, by hash

The Python test tools the image carries are installed from a requirements file that pins every package and the hash of every file, and their versions are pinned in `thirdparty/FROZEN_VERSIONS.md` and compared with the image's manifest.

Every licence, on record

`rmp test config` fails on a vendored component whose licence is copyleft, non-commercial or unknown, and on one under a licence that asks for changes to be marked that is neither pinned unmodified by its `sha256` nor marked modified with its patches written down. [Licences](https://omardev29.github.io/rmp-docs/framework/licences.html) has the whole record.

The canary

Pinning stops the world from breaking a build, and also hides that the world moved. Every Monday the framework's repository runs the same workflows against the floating versions — the newest build image, runners, Xcode and Mesa — to find what the next bump will break before anyone needs it. [The canary](https://omardev29.github.io/rmp-docs/publishing/ci.html#the-canary) has the detail; a game never runs it.

## Secrets, signing, installing

### No secret in the repository

The `.toml` is committed with the game, so it holds no secret: every key, password and token CI needs is a GitHub secret, set in the repository's settings. [Secrets and variables](https://omardev29.github.io/rmp-docs/publishing/ci.html#secrets-and-variables) lists them, and every one is optional.

Two values in it look like keys, and neither is a secret, because each ends up inside the game anyone can download:

- [`[resources] rres_password`](https://omardev29.github.io/rmp-docs/reference/configuration.html#resources-rres_password) encrypts a release's resource pack. It keeps casual unpacking of the game's assets inconvenient, and nothing more.
- [`[save] encrypt`](https://omardev29.github.io/rmp-docs/reference/configuration.html#save-encrypt) seals a save with a key derived from `[project] name`. That stops a text editor, not a determined player.

### The Android release, signed

The Android job builds the release App Bundle on every run. With no upload key in the repository's secrets it signs it with a throwaway key, made fresh on every run and never reused, says so in a warning, and checks the bundle's signer is that key; the bundle is renamed `-NOT-FOR-PLAY.aab` and uploaded under a name a release never attaches. With the upload key, it checks the signature verifies with no signer errors, that the signer is not the throwaway key, and — when the repository variable `ANDROID_SIGNER_CN` names it — that it is that key. [Signing](https://omardev29.github.io/rmp-docs/publishing/google-play.html#signing) says how to set it up.

### The installer

The one-line installer never uses `sudo` and never installs a package. On Linux, macOS and the BSDs it writes only in your home folder: the framework in `~/.local/share/rmp`, the `rmp` command in `~/.local/bin`, and a line in your shell's startup file, only if that folder is not on your `PATH` already. On Windows it runs as yourself, with no administrator, in `%LOCALAPPDATA%` and your own user `PATH`. What a build still needs — CMake, Ninja, a compiler — is printed at the end with the command for your system, for you to run. [Where it puts things](https://omardev29.github.io/rmp-docs/getting-started/install.html#where-it-puts-things) has the detail.

It is written for `curl … | sh`, where the shell runs it as it arrives: all of it is one function, called on its last line, so a download cut short runs nothing. And the copy this site serves is the framework's, byte for byte as it is at the commit these pages document — with the line endings each file is checked out with — which the site's own build checks on every run.

## What is not done

At the commit these pages document, these do not exist:

- **Two public functions not held by a property.** Every public function of `include/rmp/` is held to the deep tests' rules on generated input but two: [`rmp::app::quit()`](https://omardev29.github.io/rmp-docs/reference/namespaces/rmp-app.html#quit) and [`rmp::app::quit_requested()`](https://omardev29.github.io/rmp-docs/reference/namespaces/rmp-app.html#quit_requested), which live in the one file the property tests cannot link, the runner's. They are on `tests/property/waivers.txt`, a list that only shrinks. Every reader is fuzzed: the save file, the LDtk and Tiled maps, Aseprite sheets, the resource pack and the names the loaders are given.
- **No reading of how a Windows, macOS or BSD release was linked.** The BSD releases are hardened like Linux's, Fortify aside, and the Windows ones by their linker's defaults, and nothing reads it back out of the binary: `binary_check.py windows` reads what an `.exe` imports, not how it was linked. Control Flow Guard is not used.
- **No exit status from the iOS simulator.** The boot there, which a repository switches on, reads the game's markers and not how it exited.
- **No measurement of the hardening's cost on macOS or the BSDs.** The figures above are Linux's.
