OCaml Weekly News
Hello
Here is the latest OCaml Weekly News, for the week of November 03 to 10, 2026.
Table of Contents
- neocaml 0.11
- OSEC-2026-30: OCaml runtime "ephemeron data is freed while still referenced"
- OSEC-2026-28: github.com/ocaml/ocaml.org: Unauthenticated arbitrary file read via path traversal in
/conferences/ocaml/** - OCaml 4.14.5 released
- rocq-typescript-extraction (experimental): Extract Rocq definitions to TypeScript ES modules
- Bisect_ppx, the coverage tool, moving to ocaml-ppx
- Blog post: From AST to CST
- Senior OCaml Engineer / Tech Lead – Elpe Open-Source Tool (SuperSafe Project) at OCamlPro
- Release of Alcotest 1.10 and dune-release 2.3
- Old CWN
neocaml 0.11
Tim McGilchrist announced
neocaml is a tree-sitter powered Emacs major mode for OCaml. We've done major work on adding new functionality and building new tree-sitter grammars. @bbatsov posted a nice summary of the work on https://batsov.com/articles/2026/11/05/neocaml-0-11-oxcaml-indentation-styles-and-odoc/
Checkout neocaml if you're not already using it. We'd love feedback on the new functionality. Thanks
OSEC-2026-30: OCaml runtime "ephemeron data is freed while still referenced"
Hannes Mehnert announced
Dear everyone,
a new advisory was published for the OCaml runtime. Below is the advisory, you can as well find it at https://github.com/ocaml/security-advisories and https://osv.dev/list?q=&ecosystem=opam
In OCaml 5, this is already fixed.
Best,
Hannes
id: OSEC-2026-30
modified: "2026-11-06T12:30:00Z"
published: "2026-11-06T12:30:00Z"
severity:
"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:L/VI:L/VA:H/SC:N/SI:N/SA:N/E:P"
severity_score: "7 (High)"
affected: "ocaml" {< "4.14.5"}
events: [
[
git "https://github.com/ocaml/ocaml" [
[fixed "da301a20833b765e268d677fe693d29fe51793ad"]
]
]
]
credits: [
[reporter "Igor Santos-Grueiro"]
[coordinator "Hannes Mehnert"]
[remediation_reviewer "Florian Angeletti"]
[remediation_developer "Gabriel Scherer"]
]
cwe: [ CWE-416 ]
Ephemeron data is freed while still referenced when the key is an
Infix_tag closure
Summary
In OCaml before 4.14.5, when the key of an ephemeron is a closure with
Infix_tag (a function of a mutually recursive group that is not the
first function), the mark phase does not keep the ephemeron's data
alive, although the key is alive. The clean phase does treat the key as
alive, so it leaves the data field filled. The sweep phase then frees
the data block. After a major collection the ephemeron's data field
still points to the freed block.
This looks like the part of
#7810 that PR
#9742 did not cover. PR
#9742 fixed the clean phase
and the minor collector. It did not change mark_ephe_aux.
Please note that the CVSS score high is under the conditions:
- if the application is using ephemerons,
- and if the application is available over the network,
- and if the attacker can find a way to exploit the memory safety
issue in an attack chain.
Reproduction
[@@@alert "-old_ephemeron_api"]
let infix n = let rec f () = n and g () = f () in g
let build key n =
let e = Ephemeron.K1.create () in
let w = Weak.create 1 in
let d = ref n in
Ephemeron.K1.set_key e key;
Ephemeron.K1.set_data e d;
Weak.set w 0 (Some d);
(e, w)
let run key =
let (e, w) = build key 1 in
Gc.full_major ();
Printf.printf "tag=%d weak=%b check_key=%b check_data=%b\n"
(Obj.tag (Obj.repr key)) (Weak.check w 0)
(Ephemeron.K1.check_key e) (Ephemeron.K1.check_data e);
ignore (Sys.opaque_identity key)
let () =
if Sys.argv.(1) = "infix" then run (infix 1) else run (ref 1)
Obj is used only to print the tag of the key. The program does not
read the
data after the collection.
Timeline
- 2026-10-04: initial report via email
- 2026-10-09: develop and committed the fix
- 2026-11-03: fix was reviewed and merged
- 2026-11-06: OCaml 4.14.5 released
OSEC-2026-28: github.com/ocaml/ocaml.org: Unauthenticated arbitrary file read via path traversal in /conferences/ocaml/**
Hannes Mehnert announced
Dear everyone,
a new advisory was published for the https://github.com/ocaml/ocaml.org website source code. Below is the advisory, you can as well find it at https://github.com/ocaml/security-advisories and https://osv.dev/list?q=&ecosystem=opam
Please note that according to the system administrator, the ocaml.org server is run inside a docker container where no secret material is present.
Best,
Hannes
id: OSEC-2026-28
modified: "2026-11-06T13:30:00Z"
published: "2026-11-06T13:30:00Z"
severity: "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N"
severity_score: "7.5 (High)"
events: [
[
git "https://github.com/ocaml/ocaml.org" [
[fixed "6b08ea625214fddcdd03cf990c004bc2dd77c17a"]
]
]
]
credits: [
[reporter "Sahil Kushwaha"]
[coordinator "Hannes Mehnert"]
[remediation_developer "Cuihtlauac Alvarado"]
]
cwe: [ CWE-22 ]
Unauthenticated arbitrary file read via path traversal in
/conferences/ocaml/**
GET /conferences/ocaml/<path> on ocaml.org concatenates the raw
request target onto OCAMLORG_V2_PATH (/v2) and serves it with
Dream.from_filesystem, bypassing the path validation that
Dream.static performs. An unauthenticated request containing ..
segments escapes /v2 and reads arbitrary files as the server process,
which runs as root in the container.
Please note that the live deployment of https://ocaml.org is in a dedicated Docker container which does not contain any secrets. Thus the vulnerability is in the ocaml.org source code, but there has been no impact for the live deployment.
Affected code
src/ocamlorg_web/lib/handler.ml:1544 (commit
ocaml/ocaml.org@31249f2d69fcb243284d3a6a2b91c0a4963f25b5):
let v2_asset req =
let</>? path =
try Some (Config.v2_path ^ Dream.target req) with _ -> None
in
let</>? () = if Sys.file_exists path then Some () else None in
Filename.(Dream.from_filesystem (dirname path) (basename path) req)
The route is public (src/ocamlorg_web/lib/router.ml:186):
Dream.get "/conferences/ocaml/**" Handler.v2_asset;
Config.v2_path is OCAMLORG_V2_PATH, set to /v2 in the production
image (Dockerfile:68). Dream.target is the request target as
received; nothing rejects . or .. components.
Timeline
- 2026-10-31 report via https://github.com/ocaml/security-advisories
- 2026-11-02 fixed via https://github.com/ocaml/ocaml.org/pull/3942 and deployed ocaml.org
OCaml 4.14.5 released
octachron announced
We have the pleasure of celebrating the birthdays of Marie Skłodowska-Curie and Lise Meitner by announcing the release of OCaml version 4.14.5.
This release is a safe collection of six security fixes, one pattern-matching miscompilation fix, and one configuration fix for the newest version of macOS. See the full Changes list below.
If we are using any previous 4.14 version of OCaml, we are advising you to switch to this new version.
Evaluating the end of the active maintenance of OCaml 4.14
As an important announcement, in January 2027, we will start evaluating if it would be reasonable to stop the active maintenance of the 4.14 branch between January and June 2027, taking in account that maintaining 4.14 is becoming more arduous each passing year.
If this evaluation does not reveal any major issues, we would stop the active maintenance of OCaml 4.14 between June 2027 and the end of 2027. OCaml 4.14 would still be available, and we would still try to keep the branch compatible with newer OSs and C compilers on a best effort basis.
In the meanwhile, do not hesitate to report any bugs on the OCaml issue tracker.
Happy hacking, Florian Angeletti for the OCaml team.
Installation Instructions
The base compiler can be installed as an opam switch with the following commands:
opam update opam switch create 4.14.5
The source code for the release candidate is also directly available on:
Changes in OCaml 4.14.5 (6 November 2026)
- Bug fixes:
- 15019, 15030, OSEC-2026-18:
Marshal.from_{string,bytes}: guard against overflow in the computation of the total data length. (Xavier Leroy, report by Akshay Singh, review by Nicolás Ojeda Bär and Antonin Décimo) - 15113, OSEC-2026-21:
Str.string_partial_match: make sure captured groups are valid. (Xavier Leroy, review by Nicolás Ojeda Bär and Edwin Török) - 15112, OSEC-2026-22:
Unix.map_file: protect against overflow when computing the data size. (Xavier Leroy and Nicolás Ojeda Bär, review by Nicolás Ojeda Bär and Edwin Török) - 15115, OSEC-2026-23: Fix multiple issues in demarshaling
(
Marshal.from_{channel,string,bytes}) (Xavier Leroy, review by Nicolás Ojeda Bär) - 15133, OSEC 2026-24: Multiple issues in command quoting on Windows (Xavier Leroy and Nicolás Ojeda Bär, review by Nicolás Ojeda Bär)
- 15233, OSEC-2026-30: ensure that ephemeron marking follows Infix pointers. (Gabriel Scherer, review by Florian Angeletti)
- 15185, 15187: fix a pattern-matching miscompilation on certain combinations of immediate ranges and redundant patterns (Gabriel Scherer, report by Alperer Keleş, review by Vincent Laviron and Florian Angeletti)
- 15067, 15071: Fix detection of functions available in the future on macOS. (Antonin Décimo, review by Nicolás Ojeda Bär and Damien Doligez)
- 15019, 15030, OSEC-2026-18:
- Internal Tools:
- 11100: Fix ocamltest to make sure failed tests are not counted as "unexpected error". (Damien Doligez, review by Sébastien Hinderer)
rocq-typescript-extraction (experimental): Extract Rocq definitions to TypeScript ES modules
Sora Morimoto announced
I am excited to share an experimental preview of rocq-typescript-extraction, a Rocq plugin that extracts Rocq definitions to TypeScript ES modules.
What is it?
Rocq (formerly Coq) has long supported extraction to OCaml, Haskell, and Scheme. This plugin adds a TypeScript backend, generating clean ES modules that can be imported and used directly from TypeScript/JavaScript code.
The generated code uses erasable TypeScript syntax (no namespace, enum, declare, or type assertions other than as const) and is checked under strict TypeScript settings (--strict --isolatedModules --verbatimModuleSyntax --erasableSyntaxOnly). It is intended to run under Bun or Node with type stripping.
Key capabilities
- Inductive types (as discriminated unions with a
tagproperty), records (as interfaces withreadonlyproperties), recursive functions, modules, and functors - Number and BigInt presets that map standard integers (
nat,positive,N,Z) to JavaScriptnumberorbigint - Recursive functions (including many mutually recursive ones) become loops with explicit stacks to avoid JavaScript call-stack limits on deep inputs
- Custom extraction directives (
Extract Inductive,Extract Constant, etc.) for mapping to existing TypeScript types or implementations - Separate extraction (one file per library with relative imports) or single-file extraction
The extraction is designed with performance in mind. The repository includes benchmarks (under bench/) that compare extracted code against handwritten JavaScript/TypeScript implementations across a range of workloads (sorting, persistent data structures, arithmetic, cryptography primitives from fiat-crypto, and more). The goal is that the extracted code should not have significant performance issues relative to carefully written handwritten equivalents, particularly when using the Number preset for values that fit in JavaScript’s safe integer range.
- Minimal example
Save this as
Tree.v:From TypeScriptExtraction Require Import Number. Inductive tree (A : Type) := Leaf | Node (l : tree A) (x : A) (r : tree A). Arguments Leaf {A}. Arguments Node {A}. Fixpoint size {A} (t : tree A) : nat := match t with Leaf => 0 | Node l _ r => S (size l + size r) end. TypeScript Extraction "tree.ts" size.Compile it:
opam exec -- rocq compile Tree.v
Then use the generated module from TypeScript:
import type { Tree } from "./tree.ts"; import { leaf, node, size } from "./tree.ts"; const t: Tree<string> = node(leaf, "a", node(leaf, "b", leaf)); size(t); // 2Use
From TypeScriptExtraction Require Import BigInt.for exactbigintarithmetic instead ofnumber. - Protecting boundaries with Zod
Because the generated types are ordinary TypeScript interfaces, you can pair them with runtime validators such as Zod to enforce invariants at untrusted boundaries (JSON, network, user input, etc.).
Rocq:
From TypeScriptExtraction Require Import Number. Record point := { px : nat; py : nat }. Definition swap (p : point) : point := {| px := py p; py := px p |}. TypeScript Extraction "point.ts" swap.Extracted TypeScript (
point.ts):export interface Point { readonly px: number; readonly py: number; } export const swap = (p: Point): Point => ({ px: p.py, py: p.px });Usage with Zod:
import * as z from "zod"; import { swap } from "./point"; import type { Point } from "./point"; const PointSchema = z.toZod<Point>()( z .strictObject({ px: z.number(), py: z.number(), }) .readonly() ); const untrustedJson = { px: 100, py: 200, }; const point = PointSchema.parse(untrustedJson); const result = swap(point); console.log(JSON.stringify(untrustedJson, null, 2)); console.log(JSON.stringify(result, null, 2));This keeps the trusted computational core (the extracted
swap) separate from boundary validation.There is also a short explanatory video demonstrating the workflow (defining and proving properties of a state machine in Rocq, extracting it, and using the result directly with React’s
useReducer) here:
Limitations & current status (experimental)
This is experimental. Please read the limitations carefully in the repository documentation before using it in a project:
- TypeScript reference (generated APIs, data representations, and limitations)
- Extraction guide
Documentation
- README (quick start)
- Extraction guide
- TypeScript reference
- Contributing (including benchmarks)
Source: https://github.com/smorimoto/rocq-typescript-extraction
Feedback, bug reports, and contributions are very welcome.
Bisect_ppx, the coverage tool, moving to ocaml-ppx
Anton Bachin announced
Dear community!
Bisect_ppx, the coverage tool, will henceforth be maintained by Nathan Rebours and the ocaml-ppx team, and is now moving to the ocaml-ppx org at
https://github.com/ocaml-ppx/bisect_ppx
ocaml-ppx is already the home of ppxlib, Bisect's major dependency, and of ocamlformat, which is used throughout Bisect's own test suite for normalization; Bisect always needs to stay in sync with both.
Thank you to the original author of the project, Xavier Clerc; Leonid Rozenberg for taking over and maintaining it after Xavier Clerc; and all the contributors over the years!
Happy testing!
Blog post: From AST to CST
Nicolas Ojeda Bar announced
Dear Community,
Recently at LexiFi, we re-engineered the parser for a home-grown language to produce a CST (concrete syntax tree) rather than an AST (abstract syntax tree). The goal was to use the CST as the basis for a pretty-printer.
While I was familiar with the CST approach in principle, I had never seen it implemented for a realistic language in practice, so I was not entirely sure how well it would work when we started the project.
Now that the project has turned out to be a success, we've written a short blog post to share some of the design choices we made and lessons we learned along the way, in the hope that others in the community might find it useful.
https://www.lexifi.com/blog/ocaml/template-language-cst/
Cheers, Nicolas
Senior OCaml Engineer / Tech Lead – Elpe Open-Source Tool (SuperSafe Project) at OCamlPro
OCamlPro announced
Location: Paris 6ème or Gif-sur-Yvette, up to 2 days/week remote
Contract: Fixed-term 3 years or CDI
Salary: Competitive, based on experience
At OCamlPro, we are looking for a Senior OCaml Engineer / Tech Lead to drive the development of Elpe, an open-source Nix alternative / competitor created by Pierre-Etienne Meunier, to be developed within the framework of the European research & innovation project SuperSafe.
This is a key technical leadership role running primarily over a 3-year timeline, combining open-source impact, team coordination, developer advocacy, and cross-functional company contributions.
About the Project: Elpe & SuperSafe
SuperSafe is a collaborative European initiative focused on high-assurance software security and safety (see https://super-stack.eu/). Within this consortium, Elpe is an open-source tool designed to replace Nix and NixPkgs within security sensitive projects. The source code is written in Rust (for the server) and OCaml (for the client) and is available here: https://nest.pijul.com/pmeunier/elpe/tree . Within the SuperSafe project, our goal is to transform the current prototype of Elpe into a robust, portable and powerful tool, to build a community of users and contributors in Europe, and to develop OCamlPro's commercial offering around Elpe.
You will lead the technical vision and hands-on implementation of Elpe according to the European project roadmap, collaborating closely with external partners across Europe as well as an internal project manager and several engineers at OCamlPro.
What You Will Do
- Lead Elpe’s Development (~60–70%):
- Steer technical architecture, code quality, and release cycles for Elpe.
- Mentor and coordinate a team of developers (internal engineers and external open-source contributors).
- Work closely with the dedicated Project Manager to align milestones and deliverables with the European SuperSafe consortium.
- Community Advocacy & Evangelism (~10–15%):
- Represent the project at major open-source and developer conferences (e.g., FOSDEM, Open Source Experience / OSXP, Cyber events, etc.).
- Engage with the broader software safety and security communities (writing blog posts, RFCs, documentation, answering issues).
- Internal Company Contributions (~15–20%):
- Bridge R&D work with our commercial and product teams (providing technical expertise for pre-sales, RFPs, or product demos).
- Contribute to OCamlPro’s general technical roadmap and cross-cutting engineering initiatives.
What We Are Looking For
- Strong OCaml and Rust Experience: Significant real-world experience building robust, maintainable systems or developer tooling in OCaml, and a working knowledge of Rust.
- Technical Leadership: Experience leading code reviews, architecting complex codebases, and mentoring junior/mid-level engineers.
- Open-Source Mindset: Familiarity with modern version control workflows (Git/GitLab/GitHub, and interest in Pijul) and open source practices (CI/CD, issue triage, RFC processes, documentation).
- Communication & Collaboration:
- Fluent English (written and spoken) for consortium meetings and public speaking at conferences.
- Fluent French (written and spoken) for collaboration within OCamlPro.
- Ability to translate deep technical concepts to non-technical stakeholders (sales team, clients, project partners).
- Bonus Points:
- Hands-on familiarity with Nix, Nixpkgs, Guix, or build systems / package managers in general.
- Background in static analysis, formal methods, compiler design, or security tooling.
- Prior experience working on EU-funded research projects (Horizon Europe, etc.).
- Active involvement in the OCaml ecosystem (opam packages, compiler contributions, or tooling).
What We Offer
- Direct impact on a strategic, high-visibility open-source European initiative.
- A supportive engineering culture valuing correctness, typed functional programming, and open standards.
- Budget and travel support for conferences (FOSDEM, OSXP, etc.).
How to Apply
Please send your resume, along with a link to your GitHub/GitLab profile or recent OCaml/Rust projects, to contact@ocamlpro.com with the subject [Senior OCaml Lead - Elpe].
Feel free to reach out via DM here on Discuss if you have any questions before applying!
Release of Alcotest 1.10 and dune-release 2.3
Thomas Gazagnaire announced
Hi everyone,
I'm happy to announce the (about to be) release of alcotest 1.10.0 and dune-release 2.3.0. Those two releases contain years of backlog for those two projects, so I'm pretty excited they are finally going out!
You can use them by doing:
opam install dune-release.2.3.0 # https://github.com/ocaml/opam-repository/pull/31135 opam pin add alcotest.1.10.0 --dev
I am particularly thankful for the 24 alcotest contributors and 13 dune-release contributors listed on the respective release pages.
Here are a few highlights:
- dune-release now works on Windows (well… at least
distribandchecknow work and are tested in the CI) finishing the work @emillon started in 2021 and follows.gitattributesexclusions when generating release archives (thanks to @jjb)! - alcotest finally got a few highly-requested features;
- a bunch of combinators to write tests:
suite,testand …group! Yes nested tests are now possible without a breaking API change (from @CraigFe's initial RFC, with API inputs from @yawaramin and @mjambon); - every failing test now prints the file and line of your test (inspired by @dbuenzli's B0_testing);
- test suites can now carry tags (that can be filtered on the command-line), extending the pre-existing
quick/slowarbitrary distinction (also from @CraigFe's RFC, but the final implementation and API is quite different to remain backward compatible) ; - a new opt-in mode to generate JUnit XML files, from unmodified test suites (just set
ALCOTEST_JUNIT=1in your CI environment) (inspired by @Khady's junit_alcotest idea) ; - and wasm_of_ocaml support (from @hhugo and @mefyl)
- a bunch of combinators to write tests:
There are a few breaking changes: Alcotest now requires at least OCaml 4.14 and code that extend (like plugins) but for most users the change should be fairly transparent. Any weird breakage is a bug! Please report those!
Read more (including an example on how to use tags and JUnit reports to work better with flaky tests) on my blog.
Old CWN
If you happen to miss a CWN, you can send me a message and I'll mail it to you, or go take a look at the archive or the RSS feed of the archives.
If you also wish to receive it every week by mail, you may subscribe to the caml-list.