Hub rules-kotlin

rules-kotlin

v3 public Verified

Kotlin

Kotlin/Android security governance rules for AI coding agents. Blocks force non-null assertions that cause NPEs, SQL string interpolation, Java deserialization (RCE), command injection via Runtime.exec(), hardcoded credentials, unsafe unchecked casts, and cleartext HTTP in production.

@sigmashakeinc 3 pulls 10 rules published Apr 8, 2026 synced Oct 11, 2026 sigmashakeinc/rules/rulesets/rules-kotlin →
Severity
8 error 2 warn 0 info
demo.cast
Kotlin/Android security governance rules for AI coding agents. Blocks force non-null assertions that cause NPEs, SQL string interpolation, Java deserialization (RCE), command injection via Runtime.exec(), hardcoded credentials, unsafe unchecked casts, and cleartext HTTP in production.

Rules index

10 governance rules

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

kotlin

no-cleartext-http-kotlin error log

Cleartext HTTP transmits data without encryption — vulnerable to interception. Use HTTPS for all network communication. For Android, do not set cleartextTrafficPermitted.

Rule source requires an active Pro or Enterprise subscription.
no-force-non-null-kotlin warning log

The !! operator throws NullPointerException on null — the exact problem Kotlin's type system prevents. Use safe calls (?.), let{}, or provide a default with ?:

Rule source requires an active Pro or Enterprise subscription.
no-hardcoded-secrets-kotlin error log

Hardcoded credentials in Kotlin source are embedded in the APK/JAR. Store secrets in environment variables, BuildConfig fields from a gitignored local.properties, or a secrets manager.

Rule source requires an active Pro or Enterprise subscription.
no-java-deserialization-kotlin error block

Java deserialization via ObjectInputStream is a known RCE vector. Use kotlinx.serialization, Gson, or Moshi for safe data serialization.

Rule source requires an active Pro or Enterprise subscription.
no-path-traversal-kotlin error block

Constructing file paths from user-controlled input enables path traversal (CWE-22). Sanitize input by resolving to a canonical path and verifying it is within the expected base directory before opening the file.

Rule source requires an active Pro or Enterprise subscription.
no-runtime-exec-kotlin error log

Runtime.exec() or ProcessBuilder with string interpolation enables command injection. Build command arguments as a list — never concatenate user input into a command string.

Rule source requires an active Pro or Enterprise subscription.
no-sql-concat-kotlin error block

String interpolation/concatenation in SQL queries enables SQL injection. Use PreparedStatement with ? placeholders or a Kotlin-aware ORM like Exposed.

Rule source requires an active Pro or Enterprise subscription.
no-trust-all-certs-kotlin error block

Trust-all X509TrustManager disables TLS certificate validation, making TLS useless and enabling trivial MITM attacks (CWE-295). Use the system trust store or pin specific certificates with OkHttp's CertificatePinner.

Rule source requires an active Pro or Enterprise subscription.
no-unchecked-cast-kotlin warning log

Unchecked casts (as) throw ClassCastException if the type doesn't match. Use safe casts (as?) which return null on mismatch, then handle the null case explicitly.

Rule source requires an active Pro or Enterprise subscription.
no-weak-random-kotlin error block

java.util.Random is not cryptographically secure (CWE-338). Use java.security.SecureRandom for any security-sensitive value: tokens, passwords, salts, nonces, session IDs.

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
Oct 11, 2026
Hash
fbf48ff763227658b87393f35f9c05a6dc102a31a4cde7424d723ef5c495edc6
Signature
Verified (publisher key)
Tested with
claude-code@current
Plan
Starter (free)
Visibility
Public

Source history

Recent commits

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

No commit history available.