Skip to main content

Security assurance case

What you can expect from bestax lists what each package does and doesn't do that matters to your security. This page is the case that those expectations hold: what we defend against, where trust changes hands, the design principles the controls follow, and how the common implementation weaknesses are countered. Every control it names lives in the public repository, where you can check it.

The case covers the published packages and the pipeline that builds and publishes them. It doesn't cover the app you build with them, which needs a threat model of its own, or GitHub and npm themselves. It also assumes the maintainer's own GitHub and npm accounts aren't compromised. The controls below narrow what one stolen credential can do, but whoever holds the maintainer's account can change the controls too.

Threat model​

Hostile props or model output reaching the components​

An app passes the components text, URLs and data, and some of that came from its users or from a model. Whoever controls that input wants script running in the app's page (cross-site scripting), a link that runs code or leads somewhere it shouldn't, or an image that leaks data just by loading. A model's reply is the sharpest case, since a prompt injection can make it say anything.

The answer is at two boundaries: your app and the component libraries, and model output and the Markdown renderer.

A compromised dependency or GitHub Action​

A hijacked release of a package we depend on, or a tag moved on an action we use, wants its code to run somewhere useful: at install on a contributor's machine, in a CI job that holds a credential, or inside a published bestax package, where every app that installs it runs it.

The answer is in how dependencies and actions come in: fail-safe defaults, pinned inputs and a small attack surface, with the checks that run to catch what gets past them.

A stolen or misused publish credential​

Someone holding a token that can publish wants a rogue release under a bestax name, which apps would pick up on their next install.

The answer is at CI and the registries.

Malicious pull requests, issues or comments aimed at the AI automation​

This repository runs AI agents that read issues, pull requests and comments, and some of them hold credentials or run a pull request's code. An attacker writes text meant to steer an agent (prompt injection), or code meant to run in a job that holds a secret, to get write access to the repository or a credential out of it.

The answer is at pull request code and credentialed jobs.

A CLI doing more than it was asked​

The CLIs run on a developer's machine with that developer's permissions. A bug, or a file crafted to exploit one, could make a CLI run a command, read a file or empty a directory nobody meant it to.

The answer is at the CLIs and your machine.

Trust boundaries​

Your app and the component libraries​

Props are your code's input to ours, and the libraries trust them as your code. They render props as React elements, so React escapes text and attribute values, and their source never turns a string into HTML (dangerouslySetInnerHTML, innerHTML) or into code (eval, new Function). They make no network requests of their own and store nothing in the browser.

What crosses this boundary unchecked is a URL. An href or src you pass is rendered as given, so checking one that came from a user or a model is your app's job, on your side of the boundary. A dangerouslySetInnerHTML you pass yourself goes through too, as it would on any element.

Model output and the Markdown renderer​

bestax-ai's Markdown treats its content as untrusted, and its parser is the boundary. A reply reaches the page only as React elements and text: raw HTML renders as the characters it was written as, and every link and image address passes checkUrl before it becomes an href or a src. That check reads the address with the URL parser the browser uses, refuses javascript, vbscript, data, file and blob whatever allowedProtocols says, drops relative addresses unless your allowUrl admits them, and renders an address only when it resolves to exactly the URL the checks saw. Images stay links unless you set showImages. The Security section of its API page has the rules, and its tests try each one, including schemes hidden behind character references and control characters.

A reply can also be built to freeze the tab. The parser caps how deep blocks and inlines nest, and a test that counts the parser's work holds the inputs that once made it grow with the square of their length to linear growth.

The CLIs and your machine​

create-bestax, bestax-migrate and bestax-mcp run with your permissions, so what each may touch is part of its contract:

  • create-bestax writes the project directory you name. It empties one that isn't empty only when you say so, and never the directory you're standing in or one that holds it. The only commands it runs are --immediate's install and dev server, built from a fixed set of package managers.
  • bestax-migrate writes the source files under the paths you name, the nearest package.json, and a new module beside an HTML page, never over a file already there. It starts no processes.
  • bestax-mcp only reads: its own index, and the version of bestax-bulma installed in your project, which it uses only when it's a plain version string because it quotes that version back to a model.

SECURITY.md has the detail for each.

CI and the registries​

npm releases are published by the publish job in ci.yml. It authenticates with OIDC trusted publishing: npm trusts that workflow in this repository, and each run mints a short-lived token, so there's no long-lived npm token to steal. Each release it publishes carries npm provenance, a signed statement of the commit and the run that built it, which npm audit signatures checks. The MCP Registry listing is published with a GitHub OIDC token too, from a workflow of its own that npm's trusted publisher doesn't name, so code running there can't publish to npm. SECURITY.md's supply-chain section covers the other places bestax is published, including how the Codemod Registry listing authenticates.

Pull request code and credentialed jobs​

A pull request's code, and the text of any issue, pull request or comment, is untrusted, and some workflows have to run that code or read that text to review or fix it. .github/CLAUDE.md is the contract for this boundary: what each job is exposed to, the defenses accepted as the answer, and the changes that count as widening it. Two of its defenses are worth knowing from outside the workflow files. The agents that act on an issue or a comment (claude-fix, claude-repro, @claude and @bestaxbot) refuse an item the inbound security scan flagged until a maintainer clears it, and the automation never merges a pull request: a person does.

Secure design principles​

Least privilege​

  • Workflow permissions start at nothing. Each workflow sets a top-level permissions: that grants nothing or only reads, so a write scope is granted job by job. The publish job in ci.yml, for instance, keeps its GITHUB_TOKEN read-only and holds id-token: write because npm's OIDC exchange needs it.
  • Credentials arrive late. The GitHub App token that pushes the release commit and creates the GitHub release is scoped to this repository, lasts an hour, and is minted only after the install and build steps have run, so the code those steps run can't reach it. The checkout leaves no credential in .git/config for them either.
  • Agents get the tools their job needs. A session that reads untrusted text runs with a tool allowlist, which .github/CLAUDE.md treats as a confinement boundary that only widens by an argued decision (rule 2). The jobs that run a model session run under harden-runner's egress block too, which narrows where a step can send data without bounding it, as rule 10 there says.

Separation of privilege​

  • The release is split by what each part can reach. In supply-chain.yml, the jobs that generate SBOMs run pnpm install and third-party actions and hold no write token, the job that signs them can mint an OIDC token and write nothing, and the job that attaches them to the release holds contents: write and checks out and installs nothing. The MCP Registry and Codemod Registry publish from workflows of their own, because npm's trusted publisher names ci.yml and a token minted anywhere else can't publish to npm.
  • What the split doesn't cover. The publish job holds id-token: write from its first step, so its install and build run in a job that can mint a token npm will accept. The frozen lockfile, the blocked install scripts and the release-age cooldown below are the main defenses between a compromised build dependency and that token.

Fail-safe defaults​

  • Dependencies can't run code at install. pnpm blocks every dependency's install and postinstall scripts unless allowBuilds in pnpm-workspace.yaml grants one, and a grant needs a review marker with a reason.
  • New versions wait. minimumReleaseAge refuses a version until it has been public for a few days, since a hijacked release is usually caught and pulled within hours. An exception needs a marker saying why, and one with a review date fails CI once that date arrives, so a temporary exception can't quietly become permanent.
  • Verdicts fail closed. A run of the inbound security scan that can't reach a clean verdict, crashed or unreadable included, labels the item for review. Its daily budget fails the other way on purpose: past the limit, or when the count can't be read, an item goes unscanned rather than wedging every new one.
  • The components' defaults are the safe ones. Markdown drops relative links and loads no images until you opt in, and a refused address renders as text. create-bestax, run with -y or without a terminal and no --overwrite, stops at a directory that isn't empty instead of emptying it.

Complete mediation​

  • Every address is checked where it's used. Markdown checks each link and image address as it renders, after the browser's URL parser has read it, so a scheme hidden behind a character reference or a control character is caught.
  • Trust decisions are made fresh. The automation's trusted-labeler gates re-check a user's role against the live GitHub API on each run, rather than trusting what the triggering event says.

Input validation with allowlists​

  • Markdown's schemes are an allowlist, http, https and mailto unless you set your own, with a blocklist on top that no setting lifts.
  • create-bestax checks every flag's value before anything on disk changes, and its --immediate commands come from a fixed set of package managers.
  • bestax-mcp accepts the one value it reads from your project, the installed library's version, only as a plain version string, since it repeats that value to a model.
  • The telemetry endpoint (validate.ts) accepts only the fields and values it knows, rejects a payload with anything else, and caps the size of a request's body.

Pinned inputs​

  • Actions are pinned to a full commit SHA, never a tag that can move, with one SHA per action across the workflows (rule 1 in .github/CLAUDE.md).
  • The lockfile is frozen. Builds and releases install with pnpm install --frozen-lockfile, so what ships is what the reviewed lockfile resolves.
  • Tools a workflow downloads are pinned too. The mcp-publisher binary is checked against the digest its workflow commits (SHA-256), and the codemod CLI installs with npm ci from a committed lockfile.

Economy of mechanism and a small attack surface​

  • Few runtime dependencies. bestax-ai installs nothing of its own, and a test fails on any runtime dependency. bestax-charts declares none either, taking Recharts as a peer your app installs, and bestax-bulma depends only on Bulma.
  • The Markdown parser is our own, so the code that handles a model's reply is code this repository tests and reviews.
  • The CLIs keep to what they're for. Only create-bestax starts a process, for --immediate. Apart from what that install fetches, the CLIs' only network request is the telemetry event you opt into, and bestax-mcp makes none at all.

Open design​

The workflows, the contract they're held to, every answer on the OpenSSF Best Practices questionnaire, and the weekly Scorecard results are public. None of these controls relies on staying secret.

Common weaknesses and their controls​

Each weakness below names where it could arise in bestax and what counters it.

Cross-site scripting (CWE-79)​

Where: text, props or a model's reply rendered into the page.

React escapes text and attribute values, and the libraries' source never builds HTML from a string. A bestax-ai test fails if its source ever uses dangerouslySetInnerHTML, innerHTML or an HTML parser. Markdown renders raw HTML as text and refuses javascript: and its kind, and CodeBlock renders a highlighter's tokens as text. A URL you pass to the other components is yours to check.

OS command injection (CWE-78)​

Where: create-bestax's --immediate, which runs its commands through a shell.

The command is <pm> install or <pm> run dev, where <pm> comes from a fixed set of package managers (npm when the CLI can't tell which one ran it), and the project path is the directory the command runs in, not part of the command (run-command.ts). The Codemod Registry wrapper hands its parameters to bestax-migrate as environment variables rather than templating them into the shell line, so the shell never parses them as code.

Code injection (CWE-94)​

Where: anything that runs a string as code.

The published packages' source calls no eval, new Function or Node vm. bestax-migrate reads a page's scripts as text and never runs them, and bestax-mcp parses the installed library's package.json as JSON and never requires it. CodeQL scans the source for this class of bug.

Path traversal (CWE-22)​

Where: bestax-migrate reading the files an HTML page references.

It doesn't open a stylesheet or script whose path leaves the page's folder: one a ../ takes out of it, or a percent-encoded one that decodes to a path from the root, on another drive or on a network share. The check reads the path as written, so a symbolic link inside the folder is followed, even to a file outside it. It writes a page's module beside the page and never over a file already there.

Hard-coded credentials (CWE-798)​

Where: the release pipeline.

No credential is in the source. npm publishing and the MCP Registry use OIDC tokens minted per run, and the secrets that remain, such as the release App's private key, live in GitHub's secret store rather than the repository.

CSV formula injection (CWE-1236)​

Where: useDataTable's CSV export.

toCSV puts a ' in front of a field a spreadsheet would read as the start of a formula, unless it's a plain number, and a test holds it to that.

Uncontrolled resource consumption (CWE-400)​

Where: a model's reply built to freeze the tab.

Markdown caps nesting, and a test that counts the parser's work keeps the inputs that once grew with the square of their length to linear growth.

Prompt injection (CWE-1427)​

Where: what bestax-mcp tells a model, and the repository's own AI automation.

bestax-mcp answers from its own index and takes nothing from your project but a plain version string. The automation is held to the workflow trust boundary.

Untrusted components in the supply chain (CWE-829, CWE-1357)​

Where: dependencies and GitHub Actions.

Actions are pinned to a commit SHA, the lockfile is frozen, install scripts are blocked, and new versions wait out the release-age cooldown. Socket reviews each pull request's dependency changes. Each release carries npm provenance, and supply-chain.yml generates SBOMs for each release, signs them with Sigstore and attaches them to its GitHub release.

Checks that run​

These are the automated checks behind the case, beside the test suites that hold the behavior above:

  • CodeQL. GitHub's code scanning, in its default setup, scans the JavaScript and TypeScript source and the workflow files.
  • OpenSSF Scorecard. scorecard.yml scores the repository's supply-chain posture each week and publishes the result.
  • The dependency audit. CI fails on a known high-severity advisory in the dependency tree (pnpm audit --audit-level=high), and dependency review blocks a pull request that adds a dependency with one.
  • The provenance check. After each release, and each week, supply-chain.yml checks the published packages' registry signatures and provenance attestations.
  • Socket. The Socket GitHub App reviews each pull request's dependency changes for malware, install scripts and obfuscated code.

How the repository is protected day to day, and how to check what you install, is in the Security guide.