> ## Documentation Index
> Fetch the complete documentation index at: https://loadwise.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Security checker

> loadwise sec: input reaching sensitive operations, credentials, configuration, row scopes and dependency advisories.

`loadwise sec` reports code paths where input or missing scope can expose data. Findings are review prompts with a location, a rule ID, an impact level, a generic fix example and, where it is safe, a source-based fix.

```sh theme={null}
npx loadwise sec                      # tsconfig.json or jsconfig.json in the current folder
npx loadwise sec -p tsconfig.json --json
npx loadwise sec src/orders.ts        # explicit files
npx loadwise sec --staged             # only findings on staged lines
npx loadwise sec deps --online        # known-vulnerable packages in the lockfile
npx loadwise sec polyglot src/        # ast-grep rules for Python, Go, Java, C#, Rust
npx loadwise sec dockerfile Dockerfile # only inspect the named Dockerfile
```

Run `loadwise sec deps --help`, `loadwise sec polyglot --help`, or `loadwise sec dockerfile --help` for the options specific to those checks.

It accepts the source-check flags of `loadwise perf`, including `--format`, `--min-impact`, `--baseline`, `--write-baseline`, `--loadwise-config`, `--workspace`, `--policy`, `--json`, `--include-contextual`, `--ignore`, `--fail-on`, `--fix` with `--yes` or `--only` and `--no-comments` or `--no-format`, `--staged` and `--changed-since`. `--engine auto` (the default) and `--engine js` both run TypeScript 6. `--engine native` (alias `--native`) runs TypeScript 7. The two engines can differ in coverage, so rerun with `--engine js` when comparing findings or investigating an unexpected result. Rules that need a package's types stay silent until it is installed. Test, fixture, mock, example and story files are contextual (`Test or example source.`). `--fail-on contract` enforces no security rule by default. `--fix --yes` leaves ValidationPipe whitelisting for individual review because it can strip undecorated DTO properties.

## Rules

* [`angular-bypass-security-trust`](https://loadwise.mintlify.site/rules/security/angular-bypass-security-trust) (high): DomSanitizer.bypassSecurityTrust\* is called on a dynamic value, which turns off Angular's built-in sanitization.
* [`auth-route-without-rate-limit`](https://loadwise.mintlify.site/rules/security/auth-route-without-rate-limit) (medium): A login, signup or password-reset route has no rate limiter.
* [`bcrypt-low-cost`](https://loadwise.mintlify.site/rules/security/bcrypt-low-cost) (medium): A bcrypt password hash uses a work factor below the recommended minimum.
* [`client-env-secret-exposed`](https://loadwise.mintlify.site/rules/security/client-env-secret-exposed) (critical): A secret-named env variable is read under a browser prefix (NEXT\_PUBLIC\_, VITE\_, REACT\_APP\_...), so the build ships it to every visitor.
* [`code-injection`](https://loadwise.mintlify.site/rules/security/code-injection) (critical): Request-controlled input becomes source code evaluated by the application.
* [`command-injection`](https://loadwise.mintlify.site/rules/security/command-injection) (critical): Request-controlled input reaches a shell command string.
* [`committed-secret`](https://loadwise.mintlify.site/rules/security/committed-secret) (critical): A tracked file contains a value that appears to be a credential.
* [`compose-hardcoded-secret`](https://loadwise.mintlify.site/rules/security/compose-hardcoded-secret) (high): A Docker Compose service supplies a secret as a literal environment value.
* [`cookie-missing-security-flags`](https://loadwise.mintlify.site/rules/security/cookie-missing-security-flags) (high): A sensitive cookie is set without the expected security attributes.
* [`cors-credentials-any-origin`](https://loadwise.mintlify.site/rules/security/cors-credentials-any-origin) (high): A credentialed CORS response allows arbitrary origins.
* [`cors-origin-regex-unanchored`](https://loadwise.mintlify.site/rules/security/cors-origin-regex-unanchored) (medium): A CORS origin regex also accepts look-alike hosts.
* [`database-error-in-response`](https://loadwise.mintlify.site/rules/security/database-error-in-response) (medium): An HTTP response includes a raw database error message.
* [`discarded-signature-verification-result`](https://loadwise.mintlify.site/rules/security/discarded-signature-verification-result) (high): A standalone call discards the result of Node.js synchronous signature verification.
* [`dockerfile-add-remote-url`](https://loadwise.mintlify.site/rules/security/dockerfile-add-remote-url) (medium): A Dockerfile ADD instruction retrieves a resource from a remote URL.
* [`dockerfile-runs-as-root`](https://loadwise.mintlify.site/rules/security/dockerfile-runs-as-root) (medium): The final image selects root or inherits an unverified base-image user.
* [`dockerfile-secret-in-build`](https://loadwise.mintlify.site/rules/security/dockerfile-secret-in-build) (high): A Dockerfile exposes a secret through a build argument or environment variable.
* [`dockerfile-unpinned-base-image`](https://loadwise.mintlify.site/rules/security/dockerfile-unpinned-base-image) (low): A Dockerfile uses a base image reference that can change between builds.
* [`dom-xss-sink`](https://loadwise.mintlify.site/rules/security/dom-xss-sink) (high): Untrusted or dynamic HTML reaches innerHTML, outerHTML, insertAdjacentHTML, document.write or createContextualFragment (DOM XSS).
* [`drizzle-scope-unverified`](https://loadwise.mintlify.site/rules/security/drizzle-scope-unverified) (high): A Drizzle operation lacks the row scope required by the declared policy.
* [`drizzle-sql-raw-dynamic`](https://loadwise.mintlify.site/rules/security/drizzle-sql-raw-dynamic) (critical): A dynamic SQL fragment reaches Drizzle without parameter binding.
* [`error-stack-in-response`](https://loadwise.mintlify.site/rules/security/error-stack-in-response) (medium): An HTTP response includes an internal error stack.
* [`escape-replace-incomplete`](https://loadwise.mintlify.site/rules/security/escape-replace-incomplete) (medium): A hand-written string escape replaces only the first match, or escapes a delimiter without escaping backslashes first.
* [`express-cookie-auth-missing-csrf`](https://loadwise.mintlify.site/rules/security/express-cookie-auth-missing-csrf) (high): Cookie-based session or auth is paired with state-changing routes without CSRF protection or `sameSite: "strict"`.
* [`express-missing-helmet`](https://loadwise.mintlify.site/rules/security/express-missing-helmet) (low): The Express or NestJS server starts without helmet security headers middleware (contextual: a proxy may set them).
* [`frontend-storage-secret-token`](https://loadwise.mintlify.site/rules/security/frontend-storage-secret-token) (medium): A token, JWT, password or API key is stored in localStorage or sessionStorage, readable by any script on the page.
* [`graphql-batching-unbounded`](https://loadwise.mintlify.site/rules/security/graphql-batching-unbounded) (medium): GraphQL query batching is enabled without a batch size, query depth, or cost/complexity limit.
* [`graphql-introspection-enabled`](https://loadwise.mintlify.site/rules/security/graphql-introspection-enabled) (medium): A GraphQL server explicitly enables schema introspection.
* [`graphql-query-depth-unbounded`](https://loadwise.mintlify.site/rules/security/graphql-query-depth-unbounded) (medium): A GraphQL server accepts queries of any depth.
* [`hardcoded-secret`](https://loadwise.mintlify.site/rules/security/hardcoded-secret) (critical): The source supplies a literal credential or cryptographic secret.
* [`insecure-cipher`](https://loadwise.mintlify.site/rules/security/insecure-cipher) (medium): A cryptographic operation selects an insecure cipher or mode.
* [`insecure-deserialization`](https://loadwise.mintlify.site/rules/security/insecure-deserialization) (critical): Request data is deserialized by a library that can rebuild and run functions from it.
* [`insecure-random-for-secret`](https://loadwise.mintlify.site/rules/security/insecure-random-for-secret) (high): A sensitive token or secret uses a non-cryptographic random source.
* [`js-yaml-unsafe-schema`](https://loadwise.mintlify.site/rules/security/js-yaml-unsafe-schema) (high): A resolved js-yaml loader enables JavaScript-specific YAML constructors.
* [`jsx-javascript-url`](https://loadwise.mintlify.site/rules/security/jsx-javascript-url) (high): In React 18 and older or Preact, a URL search parameter or location hash starts a JSX href, action or iframe src (javascript: XSS).
* [`jwt-decode-for-auth`](https://loadwise.mintlify.site/rules/security/jwt-decode-for-auth) (high): Authentication uses decoded JWT claims without verifying the token signature.
* [`jwt-none-algorithm`](https://loadwise.mintlify.site/rules/security/jwt-none-algorithm) (critical): JWT signing or verification allows an unsigned token.
* [`jwt-sign-without-expiry`](https://loadwise.mintlify.site/rules/security/jwt-sign-without-expiry) (medium): A signed JWT has no explicit expiration.
* [`jwt-verify-without-algorithms`](https://loadwise.mintlify.site/rules/security/jwt-verify-without-algorithms) (high): JWT verification does not restrict the accepted signing algorithms.
* [`jwt-weak-secret-literal`](https://loadwise.mintlify.site/rules/security/jwt-weak-secret-literal) (high): JWT signing or verification uses a short (\< 32 chars) or weak literal secret susceptible to brute-force forgery.
* [`knex-raw-dynamic-text`](https://loadwise.mintlify.site/rules/security/knex-raw-dynamic-text) (critical): A dynamic SQL fragment reaches Knex without parameter binding.
* [`kubernetes-privileged-container`](https://loadwise.mintlify.site/rules/security/kubernetes-privileged-container) (high): A Kubernetes workload explicitly requests a privileged container.
* [`kysely-scope-unverified`](https://loadwise.mintlify.site/rules/security/kysely-scope-unverified) (high): A Kysely read lacks the row scope required by the declared policy.
* [`ldap-filter-injection`](https://loadwise.mintlify.site/rules/security/ldap-filter-injection) (high): Request data reaches an LDAP search filter without RFC 4515 filter escaping or a filter builder.
* [`mass-assignment`](https://loadwise.mintlify.site/rules/security/mass-assignment) (high): An unfiltered request body reaches a persistence operation.
* [`mysql-dynamic-query-text`](https://loadwise.mintlify.site/rules/security/mysql-dynamic-query-text) (critical): Dynamic SQL text reaches a MySQL client without parameter binding.
* [`nest-validation-without-whitelist`](https://loadwise.mintlify.site/rules/security/nest-validation-without-whitelist) (medium): A NestJS ValidationPipe permits properties outside the validated DTO.
* [`next-image-any-remote-host`](https://loadwise.mintlify.site/rules/security/next-image-any-remote-host) (medium): A Next.js images.remotePatterns entry sets hostname '\*\*', so the image optimizer fetches and serves any host (open proxy).
* [`nosql-operator-injection`](https://loadwise.mintlify.site/rules/security/nosql-operator-injection) (high): Request data can introduce query operators into a NoSQL filter.
* [`open-redirect`](https://loadwise.mintlify.site/rules/security/open-redirect) (medium): An HTTP redirect destination is controlled by request data.
* [`password-hash-in-response`](https://loadwise.mintlify.site/rules/security/password-hash-in-response) (high): A response returns a user record that still holds its password hash.
* [`path-traversal`](https://loadwise.mintlify.site/rules/security/path-traversal) (high): Request data controls a filesystem path without a recognized containment check.
* [`pg-dynamic-query-text`](https://loadwise.mintlify.site/rules/security/pg-dynamic-query-text) (medium): Dynamic SQL text reaches the PostgreSQL client without parameter binding.
* [`plaintext-password-storage`](https://loadwise.mintlify.site/rules/security/plaintext-password-storage) (critical): A password is stored or written without being hashed.
* [`postmessage-missing-origin-check`](https://loadwise.mintlify.site/rules/security/postmessage-missing-origin-check) (medium): postMessage targets '\*', or a window message listener reads event.data without checking origin or source.
* [`prisma-raw-unsafe-dynamic`](https://loadwise.mintlify.site/rules/security/prisma-raw-unsafe-dynamic) (critical): Dynamic SQL text reaches an unsafe Prisma raw-query method.
* [`prisma-scope-unverified`](https://loadwise.mintlify.site/rules/security/prisma-scope-unverified) (high): A Prisma operation lacks the row scope required by the declared policy.
* [`prototype-pollution`](https://loadwise.mintlify.site/rules/security/prototype-pollution) (high): Request data can supply keys to a write or merge that can modify an object prototype.
* [`raw-content-disposition-filename`](https://loadwise.mintlify.site/rules/security/raw-content-disposition-filename) (medium): Request data is interpolated into a raw Content-Disposition filename parameter.
* [`react-dangerously-set-inner-html`](https://loadwise.mintlify.site/rules/security/react-dangerously-set-inner-html) (high): dangerouslySetInnerHTML receives HTML that is not a constant or sanitized.
* [`reflected-xss-response`](https://loadwise.mintlify.site/rules/security/reflected-xss-response) (low): An HTML response reflects request data without recognized escaping.
* [`regex-catastrophic-backtracking`](https://loadwise.mintlify.site/rules/security/regex-catastrophic-backtracking) (high): A regular expression that can backtrack exponentially or in polynomial time runs on request input.
* [`regex-from-input`](https://loadwise.mintlify.site/rules/security/regex-from-input) (medium): Request input supplies a regular expression pattern without recognized escaping.
* [`request-selected-executable`](https://loadwise.mintlify.site/rules/security/request-selected-executable) (high): Request input selects the program at a resolved process-launch API.
* [`secret-compared-non-constant-time`](https://loadwise.mintlify.site/rules/security/secret-compared-non-constant-time) (medium): A secret is compared with an operation that can vary in timing with its contents.
* [`secret-in-log`](https://loadwise.mintlify.site/rules/security/secret-in-log) (high): A log statement can expose a credential, token, or other secret.
* [`secret-in-url-query`](https://loadwise.mintlify.site/rules/security/secret-in-url-query) (medium): A password, token or API key is passed in a URL query string.
* [`sequelize-dynamic-query-text`](https://loadwise.mintlify.site/rules/security/sequelize-dynamic-query-text) (critical): Dynamic SQL text reaches Sequelize without parameter binding.
* [`server-action-missing-auth`](https://loadwise.mintlify.site/rules/security/server-action-missing-auth) (high): An exported Next.js Server Action performs work without verifying authentication or session state.
* [`ssrf-redirect-bypass`](https://loadwise.mintlify.site/rules/security/ssrf-redirect-bypass) (high): An outbound HTTP request with a dynamic URL does not disable redirects, allowing SSRF allowlist bypasses.
* [`ssrf-request-url`](https://loadwise.mintlify.site/rules/security/ssrf-request-url) (high): Request data controls the destination of a server-side network request.
* [`storage-object-public-acl`](https://loadwise.mintlify.site/rules/security/storage-object-public-acl) (high): A storage upload makes the object publicly readable.
* [`template-autoescape-disabled`](https://loadwise.mintlify.site/rules/security/template-autoescape-disabled) (medium): A template engine is configured to render values without HTML escaping.
* [`template-injection`](https://loadwise.mintlify.site/rules/security/template-injection) (critical): Request data is interpreted as template source rather than a template value.
* [`template-raw-html-binding`](https://loadwise.mintlify.site/rules/security/template-raw-html-binding) (medium): A Vue or Svelte template inserts a dynamic value as raw HTML.
* [`tls-verification-disabled`](https://loadwise.mintlify.site/rules/security/tls-verification-disabled) (high): A TLS client skips certificate or server hostname verification.
* [`trust-boundary-violation`](https://loadwise.mintlify.site/rules/security/trust-boundary-violation) (medium): Request data is stored in application-wide state that later requests trust.
* [`typeorm-dynamic-query-text`](https://loadwise.mintlify.site/rules/security/typeorm-dynamic-query-text) (critical): A dynamic SQL fragment reaches TypeORM without parameter binding.
* [`upload-client-filename`](https://loadwise.mintlify.site/rules/security/upload-client-filename) (medium): A file upload is stored under the original name supplied by the client.
* [`vm-sandbox-escape`](https://loadwise.mintlify.site/rules/security/vm-sandbox-escape) (critical): Node `vm` or `vm2` executes dynamic code or an untrusted context, risking sandbox escape and host RCE.
* [`vue-v-html-unsanitized`](https://loadwise.mintlify.site/rules/security/vue-v-html-unsanitized) (high): A Vue render function binds unsanitized dynamic HTML to innerHTML.
* [`weak-hash`](https://loadwise.mintlify.site/rules/security/weak-hash) (medium): A request credential is hashed with MD5 or SHA-1.
* [`weak-password-hash`](https://loadwise.mintlify.site/rules/security/weak-password-hash) (high): A password is hashed with an algorithm unsuitable for password storage.
* [`webhook-body-without-verification`](https://loadwise.mintlify.site/rules/security/webhook-body-without-verification) (high): A Stripe webhook writes request-body data before visible signature verification.
* [`xml-external-entities`](https://loadwise.mintlify.site/rules/security/xml-external-entities) (medium): An XML parser allows processing of external entities.
* [`xpath-injection`](https://loadwise.mintlify.site/rules/security/xpath-injection) (high): Request data is concatenated into an XPath expression.
* [`zip-slip-extraction`](https://loadwise.mintlify.site/rules/security/zip-slip-extraction) (high): An archive entry controls an extraction path without a recognized containment check.

`committed-secret`, `compose-hardcoded-secret` and the `dockerfile-` rules read project files rather than TypeScript: `loadwise sec -p <tsconfig>` scans the project folder (not explicit source files) with `git ls-files`, so ignored files are skipped; outside a git repository it walks the folder and never opens `.env*` files. `.env.example`, `.env.sample` and `.env.template` are checked for token formats only, and placeholder values (`changeme`, `example`, `your-...`, `${...}`, test or dummy values) and default credentials for a local service are not reported or are contextual. Rules that moved from the performance checker kept their ids, and `loadwise perf --ignore` still accepts them.

## Polyglot source checks

`npx loadwise sec polyglot src/` accepts directories or individual `.py`, `.go`, `.java`, `.cs` and `.rs` files and needs the optional ast-grep binary. These are syntactic patterns without taint tracking: confirm that untrusted input can reach the call. They are not `--ignore` rule ids of the TypeScript source checks.

* [`csharp-binaryformatter-request-deserialization`](https://loadwise.mintlify.site/rules/security/csharp-binaryformatter-request-deserialization) (high): Legacy BinaryFormatter.Deserialize consumes an ASP.NET Core request stream.
* [`csharp-ef-from-sql-raw`](https://loadwise.mintlify.site/rules/security/csharp-ef-from-sql-raw) (high): FromSqlRaw or ExecuteSqlRaw receives a concatenated or interpolated string, risking SQL injection.
* [`csharp-process-start`](https://loadwise.mintlify.site/rules/security/csharp-process-start) (medium): Process.Start launches an external process and risks command injection with untrusted arguments.
* [`go-exec-command-shell`](https://loadwise.mintlify.site/rules/security/go-exec-command-shell) (high): exec.Command invokes a shell, which risks command injection.
* [`go-sql-sprintf-injection`](https://loadwise.mintlify.site/rules/security/go-sql-sprintf-injection) (high): SQL text formatted with fmt.Sprintf risks SQL injection.
* [`go-tls-insecure-skip-verify`](https://loadwise.mintlify.site/rules/security/go-tls-insecure-skip-verify) (high): Setting InsecureSkipVerify: true on tls.Config disables TLS certificate verification.
* [`java-des-cipher`](https://loadwise.mintlify.site/rules/security/java-des-cipher) (medium): A JCA Cipher factory explicitly selects DES.
* [`java-objectinputstream-request-deserialization`](https://loadwise.mintlify.site/rules/security/java-objectinputstream-request-deserialization) (high): Java ObjectInputStream.readObject consumes a servlet request body.
* [`java-runtime-exec`](https://loadwise.mintlify.site/rules/security/java-runtime-exec) (medium): Runtime.getRuntime().exec runs an OS command and risks command injection with untrusted arguments.
* [`java-sql-string-concat`](https://loadwise.mintlify.site/rules/security/java-sql-string-concat) (high): A SQL query built by string concatenation risks SQL injection.
* [`python-insecure-deserialization`](https://loadwise.mintlify.site/rules/security/python-insecure-deserialization) (high): pickle or marshal deserialization of untrusted data can execute arbitrary code.
* [`python-requests-tls-verify-disabled`](https://loadwise.mintlify.site/rules/security/python-requests-tls-verify-disabled) (high): Calling Python requests with verify=False disables TLS certificate verification.
* [`python-sqlite-unbound-value`](https://loadwise.mintlify.site/rules/security/python-sqlite-unbound-value) (medium): A Python sqlite3 query inserts a value into SQL text instead of binding it.
* [`python-subprocess-shell-true`](https://loadwise.mintlify.site/rules/security/python-subprocess-shell-true) (high): subprocess with shell=True or os.system passes input through a shell, risking command injection.
* [`python-unsafe-yaml-load`](https://loadwise.mintlify.site/rules/security/python-unsafe-yaml-load) (high): yaml.load or yaml.load\_all without SafeLoader or BaseLoader can construct arbitrary Python objects.
* [`rust-command-shell`](https://loadwise.mintlify.site/rules/security/rust-command-shell) (high): Command::new("sh") or Command::new("bash") spawns a shell and risks command injection.
* [`rust-reqwest-danger-accept-invalid-certs`](https://loadwise.mintlify.site/rules/security/rust-reqwest-danger-accept-invalid-certs) (high): Calling danger\_accept\_invalid\_certs(true) on a reqwest client disables TLS certificate verification.
* [`rust-unsafe-raw-pointer-deref`](https://loadwise.mintlify.site/rules/security/rust-unsafe-raw-pointer-deref) (medium): A raw pointer dereference in an unsafe block bypasses Rust memory safety guarantees.

## Dependency checks

`loadwise sec deps --online [directory]` reads `npm-shrinkwrap.json` in preference to `package-lock.json` (npm lockfile version 2 or 3), `pnpm-lock.yaml` or `yarn.lock` (version 1 or Berry) from the directory or the nearest parent that has one, and asks the [OSV database](https://osv.dev) (which includes the GitHub Advisory Database) about every pinned package version. It sends package names, ecosystems and versions. Answers are cached for 24 hours in the `loadwise` folder of the OS cache directory. It takes `--format text|json` (or `--json`), `--include-contextual`, `--ignore` and `--fail-on`. A network failure exits 2 rather than passing. The network is opt-in: `loadwise sec --online` and `loadwise check --online` add these findings to their security report, and without `--online` they print one note that dependency checks were skipped.

The dependency check also accepts `Cargo.lock` versions 3 and 4 and includes the ecosystem in OSV queries. The Cargo adapter queries exact crates.io package identities and reports skipped local, patched, Git, private-registry and unresolved entries. Cargo production reachability is unknown. Python requirements and Go checksum files do not establish a supported dependency inventory.

Deno `deno.lock` (version 5) and Bun `bun.lock` (text versions 1 to 3) contribute exact npm package identities. The scan reports skipped JSR, URL and other unsupported identities, and labels the production reachability of reported Deno and Bun packages as unknown. Deno pins without a tarball and Bun entries with an empty registry are skipped when registry settings make their provenance uncertain. JSON reports include the selected lockfile and the skipped identity count under `dependencyCoverage`. The scanner uses Cargo, Deno, or Bun only when the directory and its parents have no npm, pnpm, or Yarn lockfile. If no identities could be checked in a nonempty inventory, the scan exits 2 and retains its findings. A baseline refresh also exits 2 and preserves the Security section if any identities were skipped. Combined baseline refreshes update each requested checker section independently. Fresh npm answers from the older cache can still serve npm scans against the default OSV origin. New answers are written to a separate ecosystem-aware cache. For legacy Bun binary locks, use `bun install --save-text-lockfile --frozen-lockfile --lockfile-only` to produce a text lock.

Set `LOADWISE_OSV_URL` in the process environment to send opt-in lookups to a trusted HTTPS mirror instead of `https://api.osv.dev`. Use an origin with no URL path or credentials. Each origin gets a separate cache, and lookup requests never follow redirects. Set `LOADWISE_OSV_CACHE_TTL_SECONDS` to a whole number from 0 to 86400 to shorten the cache lifetime. A value of 0 disables the cache. Each initial request has a 30-second timeout. All retries share 30 seconds of elapsed time across the lookup, including backoff and reading retried responses. Successful initial requests do not spend that allowance. Expired cache entries cannot satisfy a failed lookup.

For npm advisories, reports include a complete resolved path to each reachable transitive occurrence. CI jobs that retain full reports should allow for their output size. If advisories affect every level of a deep dependency chain, doubling its depth can roughly quadruple the path data.

* [`dependency-known-vulnerability`](https://loadwise.mintlify.site/rules/security/dependency-known-vulnerability) (medium): A resolved dependency version is listed in a published vulnerability advisory.

## Project-defined row scopes

Row-scope checks read `prismaScopes`, `drizzleScopes` and `kyselyScopes` from the `performance` section of `loadwise.config.json` (see [Project-defined access policy](https://loadwise.mintlify.site/checkers/performance.md#project-defined-access-policy)) and start only when the project names the model or table, its scoped property and the trusted helper that supplies an authorized scalar; column names such as `tenantId` mean nothing on their own. `prismaScopes` maps each generated model to its protected field and a named export of the project's authorization module, so `db.invoice.findMany({ where: { organizationId: requireOrganization() } })` is scoped; proof requires strict null checks, which the CLI enables for explicit source files with a policy. `drizzleScopes` names an exported table, its schema module, its scoped property (the ORM property, not the column name) and the trusted helper. A later `.where()` replaces the earlier condition, and every OR alternative must keep the scope. If a physical column is named `AND`, `OR` or `NOT`, configure the Prisma property that maps to it; quoted Drizzle properties such as `"org-id"` work with bracket access. Shapes the scanner cannot establish are reported as `prisma-scope-unverified`, `drizzle-scope-unverified` or `kysely-scope-unverified`. Kysely checks package-owned executed selects for an equality predicate using the configured authorization helper. These checks assume the helper authenticates the caller; middleware, injected clients, raw SQL and database row-level policies need separate verification. The import boundary for database modules is the maintainability `dataAccess` setting.

### Request-data trace depth

The source analyzer follows up to three local caller hops by default. Set `LOADWISE_TAINT_CALL_HOPS=4` on the scan command to include one additional service layer. The setting accepts `3` or `4`. The additional layer can increase analysis work, so enable it for projects that need it.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.