building-with-medusa

Warn

Audited by Runlayer on Feb 22, 2026

Risk Level: MEDIUM
Scan Summary
Max Score
78%
Files
14
Flagged
10
Chunks
28
Flagged Files (10)
reference/custom-modules.mdHIGH
78.3%

Malicious tool definition detected

Tool: reference/custom-modules.md [1/2] Description: # Custom Modules ## Contents - [When to Create a Custom Module](#when-to-create-a-custom-module) - [Module Structure](#module-structure) - [Creating a Custom Module - Implementation Checklist](#creating-a-custom-module---implementation-checklist) - [Step 1: Create the Data Model](#step-1-create-the-data-model) - [Step 2: Create the Service](#step-2-create-the-service) - [Step 3: Export Module Definition](#step-3-export-module-definition) - [St

Tool: reference/custom-modules.md [2/2] Description: Medusa application starts.

reference/module-links.mdHIGH
78.3%

Malicious tool definition detected

Tool: reference/module-links.md [1/2] Description: # Module Links ## Contents - [When to Use Links](#when-to-use-links) - [Implementing Module Links - Workflow Checklist](#implementing-module-links---workflow-checklist) - [Step 1: Defining a Link](#step-1-defining-a-link) - [Step 2: Link Configuration Options](#step-2-link-configuration-options) - [List Links (One-to-Many)](#list-links-one-to-many) - [Delete Cascades](#delete-cascades) - [Step 3: Sync Links (Run Migrations)](#step-3-sync-links-r

reference/scheduled-jobs.mdHIGH
78.3%

Tool passed security scan

Malicious tool definition detected

Tool: reference/scheduled-jobs.md [2/2] Description: } } ``` ### 3.

reference/subscribers-and-events.mdHIGH
78.3%

Malicious tool definition detected

Retrieve the full entity data using services or query: ```typescript // src/subscribers/order-placed.ts import { SubscriberArgs, type SubscriberConfig } from "@medusajs/framework" export default async function orderPlacedHandler({ event: { data }, container, }: SubscriberArgs<{ id: string }>) { const logger = container.resolve("logger") const query = container.resolve("query") // data.id contains the order ID logger.info(`Handling order.placed event for order: ${data.id}`) // Retrieve full order

For long-running tasks, consider: - Queuing the task for background processing - Using scheduled jobs instead - Breaking the work into smaller steps ```typescript // ✅ GOOD: Quick operation export default async function orderPlacedHandler({ event: { data }, container, }: SubscriberArgs<{ id: string }>) { const notificationService = container.resolve("notification") // Quick: Queue email for sending await notificationService.createNotifications({ to: "customer@example.com", template: "order-confi

reference/troubleshooting.mdHIGH
78.3%

Malicious tool definition detected

If custom prefix, add authentication middleware: ```typescript export default defineMiddlewares({ routes: [ { matcher: "/custom/admin*", middlewares: [authenticate("user", ["session", "bearer", "api-key"])], }, ], }) ``` 3. For optional auth, check if `auth_context` exists: ```typescript const userId = req.auth_context?.actor_id if (!userId) { // Handle unauthenticated case } ``` ## General Debugging Tips ### Enable Debug Logging ```bash # Set log level to debug LOG_LEVEL=debug npx medusa develo

reference/workflows.mdHIGH
78.3%

Malicious tool definition detected

Create these tasks in your todo list: - Define the input type for your workflow - Create step function (one mutation per step) - Add compensation function to steps for rollback - Create workflow composition function - Follow workflow composition rules (no async, no arrow functions, etc.) - Return WorkflowResponse with results - Test idempotency (workflow can be retried safely) - **CRITICAL: Run build to validate implementation** (catches type errors and issues) ## Basic Workflow Structure **File

Tool: reference/workflows.md [2/3] Description: { const { items } = req.body // Execute the workflow once for each item for (const item of items) { await myWorkflow(req.scope) .run({ item }) } res.status(200).send({ success: true }) } // Workflow definition - processes a single item const myWorkflow = createWorkflow( "hello-world", function (input: WorkflowInput) { step1(input.item) }) ``` **Alternative 2: Use `transform` for Array Operations (Prepare step inputs)** When you need to iterate over

SKILL.mdHIGH
73.5%

Tool passed security scan

Malicious tool definition detected

Tool: SKILL.md [2/3] Description: ] Bypassing workflows for mutations - [ ] Setting `fields` explicitly with `req.queryConfig` - [ ] Skipping migrations after creating module links **Type Safety:** - [ ] Forgetting `MedusaRequest<SchemaType>` type argument - [ ] Using `MedusaRequest` instead of `AuthenticatedMedusaRequest` for protected routes - [ ] Not exporting Zod inferred type from middlewares - [ ] Adding `.linkable()` to data models - [ ] Using dashes in module names (must be camelCase) **

reference/authentication.mdMEDIUM
55.3%

Tool passed security scan

reference/api-routes.mdMEDIUM
53.5%

Tool passed security scan

reference/querying-data.mdMEDIUM
53.4%

Tool passed security scan

Passed Files (4)Click to expand
reference/frontend-integration.mdOK
19.8%

Tool passed security scan

reference/data-models.mdOK
8.2%

Tool passed security scan

reference/workflow-hooks.mdOK
5.8%

Tool passed security scan

reference/error-handling.mdOK
3.8%

Tool passed security scan

Audit Metadata
Max File Score
78%
Classification
UNKNOWN_SERVER
Files Scanned
14
Files Flagged
10
Chunks Analyzed
28
Analyzed
Feb 22, 2026, 04:41 AM
Security Audit — runlayer — building-with-medusa