Hub rules-mikro-orm

rules-mikro-orm

v3 public Verified

Mikro-orm

MikroORM is a TypeScript ORM based on Data Mapper and Unit of Work patterns. These rules govern entity definitions, relation handling, and database operations to prevent N+1 queries and insecure data mutations.

@sigmashakeinc 2 pulls 6 rules published Apr 8, 2026 synced Nov 22, 2026 sigmashakeinc/rules/rulesets/rules-mikro-orm →
Severity
3 error 3 warn 0 info
demo.cast
MikroORM is a TypeScript ORM based on Data Mapper and Unit of Work patterns. These rules govern entity definitions, relation handling, and database operations to prevent N+1 queries and insecure data mutations.

Rules index

6 governance rules

Indexed from the repository's .rules files, grouped by technology. Expand any rule to read the raw source.

mikro-orm

mikro-orm-no-disabled-validation warning log

Disabling MikroORM schema validation removes runtime enforcement of entity constraints. Validation catches incorrect data types and missing required fields before they reach the database. Keep validation enabled (the default); if you must disable it for a migration script, scope it to the migration file only.

Rule source requires an active Pro or Enterprise subscription.
mikro-orm-no-find-operator-injection error block

Operator injection risk: passing a raw HTTP request object (req.body, req.params, req.query) directly to em.find() allows attackers to inject MikroORM query operators such as { $ne: null } or { $like: '%' }. Always validate and explicitly pick only expected fields from the request before passing to the ORM.

Rule source requires an active Pro or Enterprise subscription.
mikro-orm-no-hardcoded-db-credentials error block

Hardcoded database password in MikroORM configuration (CWE-798). Database credentials committed to source are exposed to all repository readers and persist in git history. Use process.env.DB_PASSWORD or a secrets manager and never hardcode the value in defineConfig().

Rule source requires an active Pro or Enterprise subscription.
mikro-orm-no-raw-sql-interpolation error block

SQL injection risk (CWE-89): em.execute() or raw() is called with a string that interpolates JavaScript variables directly into the SQL. Use parameterized queries: em.execute('SELECT ... WHERE id = ?', [id]) — the second array argument is the safe parameter binding. Never concatenate or template-literal user values into SQL strings.

Rule source requires an active Pro or Enterprise subscription.
mikro-orm-no-spread-assign-entity warning log

Mass assignment via em.assign(entity, req.body) or wrap().assign(req.body) sets every field in the request body on the entity, including fields like 'role', 'isAdmin', or 'id' that should not be user-controlled (CWE-915). Explicitly list allowed fields: em.assign(entity, pick(req.body, ['name', 'email'])) or use a DTO validation layer.

Rule source requires an active Pro or Enterprise subscription.
mikro-orm-outdated-init-api warning log

MikroORM.init() is the legacy synchronous-style init. In MikroORM v5+ the recommended pattern is 'await MikroORM.init(config)' with defineConfig() for type-safe configuration. This is not a security issue but indicates the codebase may be on an older API version.

Rule source requires an active Pro or Enterprise subscription.

Version metadata

Published metadata

The hash-locked record of this published ruleset. When source contents change, the maintainer resyncs and the version bumps.

Version
v3
Published
Apr 8, 2026
Source commits
0
Synced
Nov 22, 2026
Hash
d14d5296b5523b073a446d5e012487dad614ec8500cbc3c1a274e196b69ed893
Signature
Verified (publisher key)
Tested with
claude-code@current
Plan
Starter (free)
Visibility
Public

Source history

Recent commits

Latest commits touching rulesets/rules-mikro-orm/.sigmashake/rules in sigmashakeinc/rules/rulesets/rules-mikro-orm. The published version only bumps when a maintainer resyncs.

No commit history available.