4.4 KiB
Security policy
Gram is maintained by one person, in the open. This page says how to report a security problem without exposing other users, and what I consider a security problem in the first place.
Supported versions
I fix security issues in the latest published 1.x minor release only (the @gram-lang/* npm packages, the gram CLI and the gram-lang VS Code extension all share one version number). A fix ships as a patch release of that minor; please upgrade to get it.
Reporting a vulnerability
Please do not open a public issue for a security problem, on any of the mirrors.
Send an e-mail to security@gram-lang.org with:
- the version of Gram and the tool involved (CLI, language server, VS Code extension, playground, a library package);
- what an attacker could achieve, and under which conditions;
- a minimal reproduction: a
.gramfile, a command, a URL, whatever triggers it.
The main repository lives on a self-hosted Forgejo (git.gram-lang.org), which has no private security advisories yet, so e-mail is the only private channel for now.
What you can expect from me:
- an acknowledgement within 7 days (I read this inbox myself, there is no team behind it);
- an assessment and, if confirmed, a fix plan within a few weeks, depending on severity;
- credit in the release notes and the changelog if you want it, once a fixed version is published.
Please give me a reasonable chance to ship a fix before disclosing the issue publicly.
Threat model
Gram compiles recipe files that sit on your own disk. It does not run a hosted service and keeps no user data. The realistic risks are about untrusted input reaching one of these places:
- HTML rendering of a recipe you did not write (a shared
.gramfile, a recipe imported from the web): the renderer, the playground, the VS Code preview andgram view. - The local preview server (
gram view --serve), which a malicious web page open in the same browser could try to reach. - Module resolution of
@usedirectives, which a crafted recipe could use to read files outside its project. - Network access by
gram import, which fetches the URL it is given and could be pointed at a machine on your local network.
Safeguards in place
- HTML escaping: every piece of recipe text the renderer writes into HTML (names, notes, comments, attributes) is escaped.
- Local preview server:
gram view --servelistens on127.0.0.1only, rejects any request whoseHostheader is not127.0.0.1:<port>orlocalhost:<port>(a DNS rebinding defence), accepts onlyGETandHEAD, and sends a strict Content Security Policy on each route (no remote resources, no framing by other sites). - VS Code preview: the webview runs under a Content Security Policy with
default-src 'none'and a per-load nonce on its only script. @useconfinement: a module path must be relative (./,../) or a project path (@/,@alias/) and must end in.gram; absolute paths, URLs and paths that resolve outside the project folder (the one holding.gram/) are refused, and so are backslashes and null bytes in a path.gram import: before each request, the host name is resolved and refused if it points to a private, loopback or link-local address; redirects are followed by hand and every hop is checked again, so a public URL cannot redirect, or re-resolve, to your local network.- AI provider keys: read from environment variables or from a
.envfile at the project root, whichgram configwrites with owner-only permissions (0600) and whichgram initadds to.gitignore. A key is never written to.gram/config.yaml, and it is only ever sent to the provider it belongs to.
Out of scope
- Symbolic links inside a project, including those of a cloned repository, are followed:
@useconfinement checks the path as written, not where a link points. Look at the links of a repository you did not write before you open it, as you would at its scripts. - The content of AI-imported recipes:
gram importasks a language model to turn a web page or a video into a.gramfile. The result can be wrong, incomplete or misleading (quantities, temperatures, allergens); read it before you cook from it. This is a quality issue, not a vulnerability. - Problems that need an attacker who can already write to your project files or run commands on your machine.