From 06d6537bf94d7b41206a24fc24c9688c68e21346 Mon Sep 17 00:00:00 2001 From: AgentC Date: Fri, 20 Nov 2026 12:51:51 -0500 Subject: [PATCH 1/5] Draft Mica and Mica-and-Beryl launch posts for review --- ...mica-amber-v2-apps-no-longer-link-pcre2.md | 102 ++++++++++++++++++ blog/2026/11/20/meet-mica-and-beryl.md | 70 ++++++++++++ blog/posts.yml | 22 ++++ 3 files changed, 194 insertions(+) create mode 100644 blog/2026/11/20/meet-mica-amber-v2-apps-no-longer-link-pcre2.md create mode 100644 blog/2026/11/20/meet-mica-and-beryl.md diff --git a/blog/2026/11/20/meet-mica-amber-v2-apps-no-longer-link-pcre2.md b/blog/2026/11/20/meet-mica-amber-v2-apps-no-longer-link-pcre2.md new file mode 100644 index 0000000..1391053 --- /dev/null +++ b/blog/2026/11/20/meet-mica-amber-v2-apps-no-longer-link-pcre2.md @@ -0,0 +1,102 @@ +# Meet Mica: Amber V2 apps no longer link PCRE2 + +Make a new Amber app, add a model, build it, and ask your computer what the +finished program needs in order to run. Until today, the list included +libpcre2, a C library for regular expressions, whether or not your own code +ever used one. + +As of today it does not. Amber `2.0.0-beta.11`, Grant `0.24.0`, +asset_pipeline `0.38.0` and Amber CLI `2.0.11`, all released on November 20, +2026, produce a default application that links no PCRE2. This is also where +we introduce Mica, the member of the crew who made removing it worth doing. + +## What changed today + +Amber took regular expressions off its request path in beta.10. In beta.11, +Grant and asset_pipeline follow: the fixed patterns they used internally, for +jobs like reading an import map or finding the imports in a JavaScript file, +are now small hand-written checks. Each one reads its input once, from start +to finish, and is tested to accept and reject the same inputs the old pattern +did. + +The result is easy to check. An app made with `amber new -d sqlite` shows no +`libpcre2` in `otool -L` or `ldd` and no `pcre2_` symbol in `nm`, before and +after `amber generate scaffold` adds a Grant model. Amber CLI's CI runs that +check on macOS and Linux, next to a small control program that does use +`Regex` and must show PCRE2, so the check cannot pass by looking in the wrong +place. + +A freshly generated beta.11 app is 3,948,720 bytes, which is 31,760 bytes +more than beta.10, and it links no PCRE2. + +Your own regular expressions still work. Using `Regex` in your code, or a +feature that takes a pattern, links PCRE2 again, and the +[beta.11 release notes](/releases) list each of those features. + +## Why Mica exists + +I wanted the Amberverse to rely on its own pieces. Mica is the crew member +who reads: she parses what comes into an application, to published +standards, carrying years of lessons learned from real security failures. +She is calm, precise and a little bookish, which is what you want from the +part of your app that meets untrusted input first. + +Regular expressions are a good example of why that matters. An engine that +backtracks, as PCRE2 does, can be handed a pattern and a piece of text that +together take an enormous amount of work to search. On a web server, that is +a request that ties up the server far longer than it should, and enough of +them at once can take it down. + +## Mica's regex engine + +Mica's regex engine is written in pure Crystal, with no C library underneath. +It is built so that the time a search takes grows in step with the length of +the text, however the pattern is written. Every search also carries a work +budget and a deadline. If a hostile pattern or a hostile input reaches either +one, the search stops with an error instead of holding the request open. + +To keep that promise, Mica leaves out the few features that require +unbounded backtracking, such as backreferences and lookaround. Its +documentation lists a rewrite for each one. + +Patterns written directly in your source code can take a build-time path: +Mica prepares them when the app is compiled. Those static patterns compile +in about 0.03x of PCRE2's time and allocate 0 bytes per search. + +## How fast it is + +We did not want to trade speed for safety, so the bar was PCRE2 with its JIT +compiler turned on, which is how Crystal runs it. Over 479 benchmark cases in +21 groups, Mica's geometric-mean times (a typical case, so no single outlier +decides the result) compare like this: + +| Measure | Mica | PCRE2-JIT | Mica's share of the time | +|---|---|---|---| +| Search with fresh text | 32.6 µs | 72.0 µs | 0.454x | +| Compile a pattern | 3.03 µs | 4.55 µs | 0.665x | +| First search of a new pattern | 31.5 µs | 82.8 µs | 0.381x | +| First regex work after an app starts | 154.7 µs | 322.1 µs | 0.480x | + +All 21 groups are at or under PCRE2-JIT on all four measures. + +## What is not done yet + +Today these numbers come from calling Mica directly. Crystal's own `Regex` +still runs on PCRE2, so your existing patterns do not get this speed yet. +Making `Regex` run on Mica, so existing code gets it without changes, is the +next milestone. + +The group results are averages, and some single cases are still slower than +PCRE2-JIT. We are working through them one at a time. + +Mica's code, including the regex engine and its benchmarks, is public at +[github.com/amberframework/mica](https://github.com/amberframework/mica). +The regex engine is still under review there and is not yet part of a tagged +Mica release. + +To try the regex-free default app, install Amber CLI 2.0.11 and run +`amber new`. Your app is now 31,760 bytes heavier and one C library lighter. + +- [See current releases and dates](/releases) +- [Read Mica's code](https://github.com/amberframework/mica) +- [Meet the whole crew](/characters) diff --git a/blog/2026/11/20/meet-mica-and-beryl.md b/blog/2026/11/20/meet-mica-and-beryl.md new file mode 100644 index 0000000..45c3230 --- /dev/null +++ b/blog/2026/11/20/meet-mica-and-beryl.md @@ -0,0 +1,70 @@ +# Meet Mica and Beryl, Amber's security crew + +Every request that reaches your application is a stranger at the door. Before +your code does anything useful with it, two questions need good answers: +what exactly is this, and who sent it? + +Amber's crew now has a member for each question. Mica reads what comes in. +Beryl decides who gets in and what they may do once they are inside. + +Like Amber, Grant and Gemma, they are characters that name a responsibility, +so you can tell who owns a concern before you learn every package name. They +are not spokespeople, and they do not approve claims; the maintainers do. + +## Mica reads everything + +Mica is security's professional face: calm, exact and a little bookish, with +round reading glasses and a satchel of books. Parsing is reading, and she +reads to published standards, carrying years of lessons from real security +failures. + +Her code is here today. Mica is a pure-Crystal parsing library with no C +parsing libraries underneath. Her released versions read XML 1.0 and 1.1 +without libxml2: a streaming reader, a document model, a builder and XPath. +Every parse runs in time that grows in step with its input, under a work +budget and a deadline, and it never fetches anything from the network or the +file system while it reads. + +Her regex engine is public and under review in the same repository, and it +is the reason Amber V2 apps can leave PCRE2 behind. +[Mica's launch post](/blog/2026/11/20/meet-mica-amber-v2-apps-no-longer-link-pcre2) +has the details and the numbers. + +## Beryl decides who gets in + +Beryl is the cloak and dagger. She rides a black motorcycle, wears a +full-face helmet that is the source of her abilities, and keeps her face to +herself most of the time. Her accent color is heliodor gold, and Mica's +glasses are the same gold, which tells you these two work together. + +Beryl owns the side of security that makes decisions: + +- **Policies.** Authentication and authorization, written as named policies + that read like plain statements and are enforced at each step of a request. +- **Supply chain.** Dependencies, CI actions, images and toolchains pinned + and checked by hash. +- **Secrets.** Kept out of source code and handed to the app by Mo, the + secrets broker, named for her black cat. +- **Disclosure.** A private way to report a flaw, and advisories once a fix + ships. + +To be plain about where she stands: Beryl is a design in progress, and her +code is not public yet. Part of her job is already in the releases, though. +Apps generated by Amber CLI 2.0.11 pin Amber, Grant and asset_pipeline by +commit, and `amber new` checks each one's checksum in `shard.lock`. That is +Beryl's habit, written down before Beryl herself arrived. + +## Why two of them + +Reading input carefully and deciding what to allow are different skills, +and they fail in different ways. A parser that guesses lets a malformed +request through; a policy that guesses lets the wrong person through. Giving +each job its own owner keeps both of them strict. + +So when a request knocks, Mica will read it cover to cover, and Beryl will +ask to see some ID. + +- [Read Mica's launch post](/blog/2026/11/20/meet-mica-amber-v2-apps-no-longer-link-pcre2) +- [Read Mica's code](https://github.com/amberframework/mica) +- [See current releases and dates](/releases) +- [Meet the whole crew](/characters) diff --git a/blog/posts.yml b/blog/posts.yml index a7ce594..db4f043 100644 --- a/blog/posts.yml +++ b/blog/posts.yml @@ -1,3 +1,25 @@ +title: "Meet Mica: Amber V2 Apps No Longer Link PCRE2" +file: blog/2026/11/20/meet-mica-amber-v2-apps-no-longer-link-pcre2.md +image: characters/amber-hero-original-studio.webp +date: Nov 20, 2026 +author: Amber maintainers +profile: https://github.com/amberframework +category: Release +character: Amber +character_image: characters/amber-id-original-studio.webp +summary: Amber 2.0.0-beta.11, Grant 0.24.0, asset_pipeline 0.38.0 and Amber CLI 2.0.11 make a default app that links no PCRE2, and Mica brings a pure-Crystal regex engine with a work budget and deadline on every search. +--- +title: "Meet Mica and Beryl, Amber's Security Crew" +file: blog/2026/11/20/meet-mica-and-beryl.md +image: characters/amber-hero-inviting-studio.webp +date: Nov 20, 2026 +author: Amber maintainers +profile: https://github.com/amberframework +category: Security +character: Amber +character_image: characters/amber-id-original-studio.webp +summary: Mica reads everything that comes into an Amber app; Beryl decides who gets in and what they may do. Meet the two crew members who share security. +--- title: "Amber V2 Schemas Are Contracts the Framework Actually Enforces" file: blog/2026/08/13/amber-v2-executable-schema-contracts.md image: characters/amber-hero-original-studio.webp From ac58d2941e9ddfe329cb8bba5f0119a33cac43fc Mon Sep 17 00:00:00 2001 From: AgentC Date: Fri, 20 Nov 2026 13:02:44 -0500 Subject: [PATCH 2/5] Report everyday and hang-prone patterns separately in the Mica post --- ...mica-amber-v2-apps-no-longer-link-pcre2.md | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/blog/2026/11/20/meet-mica-amber-v2-apps-no-longer-link-pcre2.md b/blog/2026/11/20/meet-mica-amber-v2-apps-no-longer-link-pcre2.md index 1391053..a24de54 100644 --- a/blog/2026/11/20/meet-mica-amber-v2-apps-no-longer-link-pcre2.md +++ b/blog/2026/11/20/meet-mica-amber-v2-apps-no-longer-link-pcre2.md @@ -66,18 +66,23 @@ in about 0.03x of PCRE2's time and allocate 0 bytes per search. ## How fast it is We did not want to trade speed for safety, so the bar was PCRE2 with its JIT -compiler turned on, which is how Crystal runs it. Over 479 benchmark cases in -21 groups, Mica's geometric-mean times (a typical case, so no single outlier -decides the result) compare like this: +compiler turned on, which is how Crystal runs it. The benchmark has 479 cases +in 21 groups. 112 of them are patterns built to make a regex engine hang, and +PCRE2 struggles there, so we report everyday patterns on their own. These are +geometric-mean times (a typical case, so no single outlier decides the result) +over the 367 everyday patterns: -| Measure | Mica | PCRE2-JIT | Mica's share of the time | +| Measure | Mica | PCRE2-JIT | Mica is | |---|---|---|---| -| Search with fresh text | 32.6 µs | 72.0 µs | 0.454x | -| Compile a pattern | 3.03 µs | 4.55 µs | 0.665x | -| First search of a new pattern | 31.5 µs | 82.8 µs | 0.381x | -| First regex work after an app starts | 154.7 µs | 322.1 µs | 0.480x | - -All 21 groups are at or under PCRE2-JIT on all four measures. +| Search with fresh text | 101.3 µs | 153.5 µs | 1.5× as fast | +| Compile a pattern | 3.2 µs | 4.6 µs | 1.4× as fast | +| First search of a new pattern | 49.9 µs | 122.5 µs | 2.5× as fast | +| First regex work after an app starts | 212.5 µs | 409.0 µs | 1.9× as fast | + +On Amber's own patterns (routes, logs, CSV, templates) a search is 1.35× as +fast, 556 µs against 750 µs. On the 112 hang-prone patterns Mica is 7× as fast +and always stops on time. All 21 groups are at or under PCRE2-JIT on all four +measures, though some single patterns are still slower. ## What is not done yet From 1f37d54d412766b9f5800b65dbb0d7aefbfbddb3 Mon Sep 17 00:00:00 2001 From: AgentC Date: Sat, 21 Nov 2026 06:12:05 -0500 Subject: [PATCH 3/5] Link the Mica v0.2.0 release in the Mica post --- .../11/20/meet-mica-amber-v2-apps-no-longer-link-pcre2.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/blog/2026/11/20/meet-mica-amber-v2-apps-no-longer-link-pcre2.md b/blog/2026/11/20/meet-mica-amber-v2-apps-no-longer-link-pcre2.md index a24de54..bdae3f1 100644 --- a/blog/2026/11/20/meet-mica-amber-v2-apps-no-longer-link-pcre2.md +++ b/blog/2026/11/20/meet-mica-amber-v2-apps-no-longer-link-pcre2.md @@ -96,8 +96,9 @@ PCRE2-JIT. We are working through them one at a time. Mica's code, including the regex engine and its benchmarks, is public at [github.com/amberframework/mica](https://github.com/amberframework/mica). -The regex engine is still under review there and is not yet part of a tagged -Mica release. +The regex engine ships in +[Mica v0.2.0](https://github.com/amberframework/mica/releases/tag/v0.2.0), +released November 21, 2026. To try the regex-free default app, install Amber CLI 2.0.11 and run `amber new`. Your app is now 31,760 bytes heavier and one C library lighter. From 024fa327076e1666d26aae5c3d44f045088b2617 Mon Sep 17 00:00:00 2001 From: AgentC Date: Sun, 22 Nov 2026 21:24:55 -0500 Subject: [PATCH 4/5] Bring the Mica post up to round 11 and add what shipped since Regex numbers now come from Mica's round 11 run (merged at f0bb0f6, in Mica v0.2.0): 1.36x as fast as PCRE2-JIT on Amber's 26 process-cold cases, every group at or under PCRE2-JIT on all four measures. A new section covers Mica as crystal-alpha's default Regex and YAML engine, YAML parsing, gzip without libz and Beryl's hashes and ciphers. --- ...mica-amber-v2-apps-no-longer-link-pcre2.md | 99 +++++++++++++++---- 1 file changed, 79 insertions(+), 20 deletions(-) diff --git a/blog/2026/11/20/meet-mica-amber-v2-apps-no-longer-link-pcre2.md b/blog/2026/11/20/meet-mica-amber-v2-apps-no-longer-link-pcre2.md index bdae3f1..3eb5df0 100644 --- a/blog/2026/11/20/meet-mica-amber-v2-apps-no-longer-link-pcre2.md +++ b/blog/2026/11/20/meet-mica-amber-v2-apps-no-longer-link-pcre2.md @@ -61,46 +61,105 @@ documentation lists a rewrite for each one. Patterns written directly in your source code can take a build-time path: Mica prepares them when the app is compiled. Those static patterns compile -in about 0.03x of PCRE2's time and allocate 0 bytes per search. +24× as fast as PCRE2 (159.3 ns against 3.86 µs). ## How fast it is We did not want to trade speed for safety, so the bar was PCRE2 with its JIT -compiler turned on, which is how Crystal runs it. The benchmark has 479 cases -in 21 groups. 112 of them are patterns built to make a regex engine hang, and -PCRE2 struggles there, so we report everyday patterns on their own. These are -geometric-mean times (a typical case, so no single outlier decides the result) -over the 367 everyday patterns: +compiler turned on, which is how Crystal runs it. + +The number we watch most is Amber's own: 26 patterns from Amber's routes, +logs, markdown, CSV, templates, identifiers and contact fields, each +searching 64 KiB of text in a freshly started program. There Mica is 1.36× +as fast as PCRE2-JIT: 70.38 µs against 95.86 µs, or 0.734 of PCRE2-JIT's +time. None of the 26 measured slower than PCRE2-JIT. + +The full benchmark has 479 cases, sorted into groups by where the patterns +come from, and every group is at or under PCRE2-JIT's time on all four +measures. 112 of the cases are patterns built to make a regex engine hang, +and PCRE2 struggles there, so we report everyday patterns on their own. +These are geometric-mean times (a typical case, so no single outlier decides +the result). + +The 263 everyday patterns of the rebar benchmark suite: | Measure | Mica | PCRE2-JIT | Mica is | |---|---|---|---| -| Search with fresh text | 101.3 µs | 153.5 µs | 1.5× as fast | -| Compile a pattern | 3.2 µs | 4.6 µs | 1.4× as fast | -| First search of a new pattern | 49.9 µs | 122.5 µs | 2.5× as fast | -| First regex work after an app starts | 212.5 µs | 409.0 µs | 1.9× as fast | +| Search with a compiled pattern | 63.91 µs | 113.32 µs | 1.77× as fast | +| Compile a pattern | 3.16 µs | 4.60 µs | 1.46× as fast | +| First search of a new pattern | 43.97 µs | 101.17 µs | 2.30× as fast | +| First regex work after an app starts | 172.51 µs | 340.34 µs | 1.97× as fast | -On Amber's own patterns (routes, logs, CSV, templates) a search is 1.35× as -fast, 556 µs against 750 µs. On the 112 hang-prone patterns Mica is 7× as fast -and always stops on time. All 21 groups are at or under PCRE2-JIT on all four -measures, though some single patterns are still slower. +The 104 patterns Amber itself uses: -## What is not done yet +| Measure | Mica | PCRE2-JIT | Mica is | +|---|---|---|---| +| Search with a compiled pattern | 557.03 µs | 741.63 µs | 1.33× as fast | +| Compile a pattern | 2.00 µs | 4.07 µs | 2.0× as fast | +| First search of a new pattern | 49.89 µs | 197.33 µs | 4.0× as fast | +| First regex work after an app starts | 210.91 µs | 552.64 µs | 2.62× as fast | + +On the 112 hang-prone patterns, a search is 8.8× as fast (330.1 ns against +2.91 µs), and Mica always stops on time. + +## What shipped since + +This post first went out on November 20. Two days later, more of the stack +is Crystal of our own. + +**Mica runs `Regex` and `YAML` by default.** In crystal-alpha, from +1.21.0-incremental-6 and in 1.21.0-incremental-8, the current release, +Crystal's own `Regex` and `YAML` run on Mica's engines. Your existing +patterns get Mica's speed without a code change, and a program links neither +PCRE2 nor libyaml. A regex literal that needs backtracking stops the build +with a message that names the fix: rewrite the pattern, or build with +`-Duse_pcre2` to keep PCRE2. `-Duse_libyaml` does the same for YAML. + +**YAML parsing is 1.5 to 1.9× as fast as libyaml.** On a corpus of 19 real +files (Kubernetes manifests, GitHub Actions workflows, shard files and +Amber's own configuration), reading YAML events is 1.84× as fast as libyaml +through Crystal's standard `YAML` API, and building values is 1.61× as fast. +Mica passes all 402 cases of the YAML test suite, and 6,000,000 generated +documents parsed the same as libyaml, with 0 disagreements. Writing YAML is +1.26× as fast per file, though the largest file, a 2.1 MB manifest, writes +1.16× slower. + +**Gzip without libz.** Mica now compresses and decompresses gzip itself. +Over 93 cases, decompressing is 1.09× as fast as zlib in one call and 1.12× +as fast streamed, though 19 single cases are still up to 1.21× slower in one +call. Compressing is 1.29× as fast as zlib at the default level, with output +within 0.03% of zlib's size. Amber's compression pipe, Grant and +asset_pipeline use it, and an app built with `-Dwithout_zlib` links no libz +at all while still serving gzipped pages. That work is merged and comes with +the next releases. + +**Beryl's cryptography is at least as fast as OpenSSL.** Beryl, the crew +member who decides who gets in, is the other half of security. Her hashes +and MACs (MD5, SHA-1, the SHA-2 family and their HMACs) are at least as fast +as OpenSSL 4.1.0 in all 42 measurements on an Apple M1 Max, from 1.0× to +2.62× as fast. Her authenticated ciphers (ChaCha20-Poly1305, +XChaCha20-Poly1305, AES-128-GCM and AES-256-GCM, sealing and opening) are at +least as fast in all 32 measurements, from 1.035× to 2.01× as fast. Before +this work, the same ciphers were up to 55.64× slower. Amber's signed and +encrypted cookies now run on Beryl, so an app built with `-Dwithout_openssl` +links no OpenSSL; that change is also merged and comes with the next Amber +release. Beryl's own repository is not public yet. -Today these numbers come from calling Mica directly. Crystal's own `Regex` -still runs on PCRE2, so your existing patterns do not get this speed yet. -Making `Regex` run on Mica, so existing code gets it without changes, is the -next milestone. +## What is not done yet The group results are averages, and some single cases are still slower than PCRE2-JIT. We are working through them one at a time. +Stock Crystal still runs `Regex` on PCRE2. On it, you can use Mica's engine +directly from the `mica` shard. + Mica's code, including the regex engine and its benchmarks, is public at [github.com/amberframework/mica](https://github.com/amberframework/mica). The regex engine ships in [Mica v0.2.0](https://github.com/amberframework/mica/releases/tag/v0.2.0), released November 21, 2026. -To try the regex-free default app, install Amber CLI 2.0.11 and run +To try the regex-free default app, install Amber CLI 2.0.11 or later and run `amber new`. Your app is now 31,760 bytes heavier and one C library lighter. - [See current releases and dates](/releases) From fdfe9b3a44f44240761fcb8dcccccba03df92d63 Mon Sep 17 00:00:00 2001 From: AgentC Date: Sun, 22 Nov 2026 21:30:36 -0500 Subject: [PATCH 5/5] Say which Beryl and Mica copies Amber carries today The Beryl and gzip speed figures come from code newer than the copies vendored into Amber, Grant and asset_pipeline; the post now says so. --- .../meet-mica-amber-v2-apps-no-longer-link-pcre2.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/blog/2026/11/20/meet-mica-amber-v2-apps-no-longer-link-pcre2.md b/blog/2026/11/20/meet-mica-amber-v2-apps-no-longer-link-pcre2.md index 3eb5df0..51ad71c 100644 --- a/blog/2026/11/20/meet-mica-amber-v2-apps-no-longer-link-pcre2.md +++ b/blog/2026/11/20/meet-mica-amber-v2-apps-no-longer-link-pcre2.md @@ -129,9 +129,11 @@ Over 93 cases, decompressing is 1.09× as fast as zlib in one call and 1.12× as fast streamed, though 19 single cases are still up to 1.21× slower in one call. Compressing is 1.29× as fast as zlib at the default level, with output within 0.03% of zlib's size. Amber's compression pipe, Grant and -asset_pipeline use it, and an app built with `-Dwithout_zlib` links no libz -at all while still serving gzipped pages. That work is merged and comes with -the next releases. +asset_pipeline carry pinned copies of Mica's gzip, and an app built with +`-Dwithout_zlib` links no libz at all while still serving gzipped pages. +That work is merged and comes with the next releases. Their copies were +taken just before these last speed gains, which reach them with the next +copy. **Beryl's cryptography is at least as fast as OpenSSL.** Beryl, the crew member who decides who gets in, is the other half of security. Her hashes @@ -143,7 +145,9 @@ least as fast in all 32 measurements, from 1.035× to 2.01× as fast. Before this work, the same ciphers were up to 55.64× slower. Amber's signed and encrypted cookies now run on Beryl, so an app built with `-Dwithout_openssl` links no OpenSSL; that change is also merged and comes with the next Amber -release. Beryl's own repository is not public yet. +release. Amber's copy of Beryl was taken before this speed work, which +reaches Amber when it takes a newer copy. Beryl's own repository is not +public yet. ## What is not done yet