Hub rules-nim

rules-nim

v3 public Verified

Nim

Nim is a statically typed, imperative programming language that compiles to C, C++, or JavaScript. These rules provide safety and best-practice governance for Nim development, focusing on memory safety and secure systems programming.

@sigmashakeinc 2 pulls 7 rules published Apr 8, 2026 synced Nov 22, 2026 sigmashakeinc/rules/rulesets/rules-nim →
Severity
2 error 4 warn 1 info
demo.cast
Nim is a statically typed, imperative programming language that compiles to C, C++, or JavaScript. These rules provide safety and best-practice governance for Nim development, focusing on memory safety and secure systems programming.

Rules index

7 governance rules

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

nim

nim-block-unsafe-patterns warning ask

Potentially unsafe pattern detected in nim code: "cast[". Review the use case — this may indicate a security risk, a deprecated API, or a misconfiguration. Confirm the write is intentional.

Rule source requires an active Pro or Enterprise subscription.
nim-force-updated-api warning log

RISK: system.alloc/dealloc bypasses Nim's memory manager and reference counting, requiring manual lifecycle management prone to use-after-free and double-free bugs (CWE-416). FIX: use alloc0/dealloc from the system module only inside {.noSideEffect.} FFI wrappers, or prefer Nim's managed allocation.

Rule source requires an active Pro or Enterprise subscription.
nim-importc-uninspected info log

INFO: {.importc.} imports a C symbol directly, bypassing Nim's type system — a mismatched signature produces undefined behaviour. Ensure the Nim declaration exactly matches the C header (name, calling convention, parameter types) and review for CWE-120 if the bound function handles buffers.

Rule source requires an active Pro or Enterprise subscription.
nim-os-exec-shell error block

RISK: execShellCmd/execCmd spawns a shell and passes the string verbatim — any interpolated variable enables command injection (CWE-78). FIX: use osproc.execProcess or osproc.startProcess with an explicit argv sequence and never pass user-controlled input as part of the command string.

Rule source requires an active Pro or Enterprise subscription.
nim-raw-memory-ops warning log

RISK: copyMem/moveMem/zeroMem perform raw memory copies without bounds checking — incorrect size or pointer arithmetic causes buffer overflows (CWE-119). FIX: use high-level seq/string operations or carefully pair with sizeof(T) and length checks; review in a security-focused code review.

Rule source requires an active Pro or Enterprise subscription.
nim-tls-no-verify error block

RISK: CVerifyNone / SslCVerifyNone disables server certificate validation, making every HTTPS connection trivially MITMable (CWE-295). FIX: use CVerifyPeer and supply a trusted CA bundle via the caFile parameter.

Rule source requires an active Pro or Enterprise subscription.
nim-unsafe-pragma warning log

RISK: {.unsafe.} disables Nim's safety checks for that block; {.noInit.} leaves variables uninitialized — both are documented sources of undefined behaviour and memory corruption analogous to Rust unsafe (CWE-457, CWE-119). FIX: confine these pragmas to minimal, peer-reviewed FFI wrappers and document the invariants that make the code safe.

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
0725e8f9d6658c4d35b4ec98dc057b6a4a425c20befe7143cf18f9e23bc0df3a
Signature
Verified (publisher key)
Tested with
claude-code@current
Plan
Starter (free)
Visibility
Public

Source history

Recent commits

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

No commit history available.