Is @mastra/core safe?
- Node.js shell/command execution
- Node.js filesystem read
- Node.js filesystem write/delete
What to do: Nothing here argues against installing it. Grant the capabilities it lists only if you expect the tool to need them.
@mastra/core is an npm package analyzed by SkillTotal's deterministic static scanner. The scan found no malicious indicators. It can: filesystem read, filesystem write, network egress and shell execution — capabilities are what the code can do, not a verdict on intent. Risk score 0/100 (low).
@mastra/ core 1.85.0
Get notified when this component changes
Change alerts aren't live yet. Leave your email and we'll let you know when they launch. We use it only for this and delete it on request.
Automated static-analysis result. It can contain false positives and false negatives, and is not a claim about the intent of @mastra/core's authors. Report a false positive.
Behavioral traits
How this component maps to the CSA agentic threat model. Descriptive — it never affects the risk score.
Findings (4)
The component can run operating-system commands or spawn processes.
let child_process = require("child_process");import { execFile } from "child_process";import { execFile } from "child_process";exec(cwd, args) {let child_process = require("child_process");exec(cwd, args) {let child_process = require("child_process");import { exec } from "child_process";let child_process = require("child_process");async spawn(command, options = {}) {throw new Error(`${this.constructor.name} must implement spawn()`);async spawn(command, options = {}) {import { execFileSync } from "child_process";async spawn(command, options = {}) {throw new Error(`${this.constructor.name} must implement spawn()`);async spawn(command, options = {}) {import type { execa as execaType } from 'execa';Why it matters: Powerful and often legitimate — confirm the commands aren't built from untrusted input.
Fix: Confirm the command and its arguments are fully controlled and not derived from untrusted input; prefer execFile with an argument array.
The component reads files from disk.
const content = await (0, fs_promises.readFile)(file, "utf-8");
return JSON.parse(await (0, fs_promises.readFile)(path, "utf8"));
const globalJsonContent = fs.readFileSync(GLOBAL_PROVIDER_REGISTRY_JSON(), "utf-8");
if (fs.existsSync(localJsonPath)) shouldCopyJson = globalJsonContent !== fs.readFileSync(localJsonPath, "utf-8");
const globalDtsContent = fs.readFileSync(GLOBAL_PROVIDER_TYPES_DTS(), "utf-8");
if (fs.existsSync(localDtsPath)) shouldCopyDts = globalDtsContent !== fs.readFileSync(localDtsPath, "utf-8");
const timestamp = fs.readFileSync(CACHE_FILE(), "utf-8").trim();
const content = fs.readFileSync(jsonPath, "utf-8");
const content = fs.readFileSync(filePath, "utf-8");
const globalJsonContent = fs.default.readFileSync(GLOBAL_PROVIDER_REGISTRY_JSON(), "utf-8");
if (fs.default.existsSync(localJsonPath)) shouldCopyJson = globalJsonContent !== fs.default.readFileSync(localJsonPath, "utf-8");
const globalDtsContent = fs.default.readFileSync(GLOBAL_PROVIDER_TYPES_DTS(), "utf-8");
if (fs.default.existsSync(localDtsPath)) shouldCopyDts = globalDtsContent !== fs.default.readFileSync(localDtsPath, "utf-8");
const timestamp = fs.default.readFileSync(CACHE_FILE(), "utf-8").trim();
const content = fs.default.readFileSync(jsonPath, "utf-8");
const content = fs.default.readFileSync(filePath, "utf-8");
const parsed = JSON.parse((0, fs.readFileSync)(cursorPath, "utf-8"));
return r.fs.readFile(r.fsPath, options);
const content = await srcR.fs.readFile(srcR.fsPath);
return options?.encoding ? await fs_promises.readFile(absolutePath, { encoding: options.encoding }) : await fs_promises.readFile(absolutePath);current = Number.parseInt((0, fs.readFileSync)(OOM_SCORE_ADJ_PATH, "utf8"), 10);
existingProfile = await fs_promises.readFile(userProvidedPath, "utf-8");
const content = await fs_promises.readFile(markerPath, "utf-8");
return (await fs_promises.default.readFile(filePath, "utf-8")).split("\n")[lineNumber - 1]?.trim() ?? null;fileContent = await fs_promises.default.readFile(absolutePath, "utf-8");
Why it matters: Usually legitimate, but worth confirming it can't be steered into reading sensitive files.
Fix: Confirm which files are read and that paths cannot be influenced by untrusted input to reach sensitive locations.
The component writes or deletes files on disk.
(0, fs.unlinkSync)(fullPath);
(0, fs.unlinkSync)(fullPath);
await (0, fs_promises.unlink)(leasePath).catch(() => {});if ((await this.#readLease(leasePath))?.owner === owner) await (0, fs_promises.unlink)(leasePath).catch(() => {});await (0, fs_promises.writeFile)(candidatePath, JSON.stringify(lockRecord), { flag: "wx" });await (0, fs_promises.unlink)(candidatePath).catch(() => {});if (this.#sameLeaseMutationLock(heldLock, lockRecord)) await (0, fs_promises.unlink)(lockPath).catch(() => {});await (0, fs_promises.writeFile)(candidatePath, JSON.stringify(owner), { flag: "wx" });await (0, fs_promises.unlink)(candidatePath).catch(() => {});await (0, fs_promises.rm)(ownerDirectory, {await (0, fs_promises.rm)(ownerDirectory, {await (0, fs_promises.unlink)(isolatedPath).catch(() => {});await (0, fs_promises.unlink)(recoveryPath).catch(() => {});await (0, fs_promises.rm)(`${recoveryPath}.owners`, {if (this.#sameLeaseMutationLock(current, expected)) await (0, fs_promises.unlink)(lockPath).catch(() => {});await (0, fs_promises.writeFile)(tempPath, JSON.stringify(value), { flag: "wx" });await (0, fs_promises.unlink)(tempPath).catch(() => {});if (sameIdentity(await fileIdentity(this.socketPath).catch(() => void 0), identity)) await (0, fs_promises.unlink)(this.socketPath).catch(() => {});await (0, fs_promises.unlink)(privatePath).catch(() => {});await (0, fs_promises.unlink)(lockPath).catch(() => {});if (sameIdentity(await fileIdentity(lockPath).catch(() => void 0), lockIdentity)) await (0, fs_promises.unlink)(lockPath).catch(() => {});fs.writeFileSync(tempPath, content, encoding);
fs.unlinkSync(tempPath);
fs.unlinkSync(GLOBAL_PROVIDER_REGISTRY_JSON());
fs.unlinkSync(GLOBAL_PROVIDER_TYPES_DTS());
Why it matters: Usually legitimate, but worth confirming the paths can't be controlled by untrusted input.
Fix: Confirm which files are written/deleted and that paths cannot be influenced by untrusted input.
The component makes outbound network requests.
import { ServerResponse } from 'http';import { ServerResponse as ServerResponse_2 } from 'node:http';import { ServerResponse } from 'node:http';import { ServerResponse as ServerResponse_2 } from 'http';import { ServerResponse } from 'node:http';import { ServerResponse as ServerResponse_2 } from 'http';import { ServerResponse } from 'node:http';import { ServerResponse as ServerResponse_2 } from 'http';import { ServerResponse } from 'node:http';import { ServerResponse as ServerResponse_2 } from 'http';const response = await this.#fetch(url, {const response = await this.#fetch(url, {const response = await fetch(versionUrl, { signal: controller.signal });const response = await fetch(versionUrl, { signal: controller.signal });return ((input, init) => fetch(input, {const response = await fetch(currentUrl, perHopInit("manual"));return await fetch(currentUrl, perHopInit("follow"));const response = await fetch(url, {return ((input, init) => fetch(input, {const response = await fetch(currentUrl, perHopInit("manual"));return await fetch(currentUrl, perHopInit("follow"));const response = await fetch(url, {const response = await fetch(urlText);
const response = await fetch(urlText);
return ((input, init) => fetch(input, {Why it matters: Usually legitimate, but confirm the destinations are expected and no sensitive data leaves.
Fix: Confirm the destination hosts are expected and that no sensitive data is sent off-host.
How attackers abuse these capabilities
Interactive labs on the attack class behind the rules above. They show the technique, not anything found in @mastra/core.
Maintain @mastra/core?
The free Claude Code plugin scans each npm, PyPI or MCP package with this report's open-source engine before the install command runs. It runs on your machine and needs no account.
Check your own component
Run the same evidence-backed scan on any MCP server, agent skill, or package.
Scan your own componentHow we determine this: deterministic static analysis (regex + AST), evidence-anchored, no code execution. Methodology →