Hub rules-maui

rules-maui

v3 public Verified

Maui

.NET MAUI is a framework for building native cross-platform apps with C# and XAML. These rules govern MAUI development to ensure secure cross-platform data storage, proper platform-specific API usage, and consistent UI/UX patterns.

@sigmashakeinc 2 pulls 7 rules published Apr 8, 2026 synced Nov 22, 2026 sigmashakeinc/rules/rulesets/rules-maui →
Severity
3 error 4 warn 0 info
demo.cast
.NET MAUI is a framework for building native cross-platform apps with C# and XAML. These rules govern MAUI development to ensure secure cross-platform data storage, proper platform-specific API usage, and consistent UI/UX patterns.

Rules index

7 governance rules

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

maui

maui-no-dllimport-ask warning ask

DllImport (P/Invoke) calls native unmanaged code which bypasses .NET memory safety. Ensure: (1) the DLL path is not user-controlled (DLL hijacking via relative paths), (2) string marshalling is explicitly set (CharSet.Unicode), (3) the native function is from a trusted system or bundled library. Prefer [LibraryImport] (source-generated, safer) over [DllImport] in .NET 7+.

Rule source requires an active Pro or Enterprise subscription.
maui-no-hardcoded-api-key error block

Hardcoded API key or connection string (CWE-798). Mobile app binaries are trivially decompiled with tools like dnSpy or dotPeek — any secret embedded in MAUI source or resource files is readable by anyone who downloads the app. Use .NET MAUI SecureStorage for sensitive values, or retrieve secrets from a backend API at runtime.

Rule source requires an active Pro or Enterprise subscription.
maui-no-insecure-http-endpoint warning log

HTTP (non-TLS) endpoint in MAUI app. Mobile OS network security policies (Android Network Security Config, iOS ATS) block plain HTTP to production hosts by default. Use HTTPS endpoints; HTTP is also susceptible to MITM on public networks (CWE-319). If a non-TLS endpoint is unavoidable for testing, scope it to debug builds only.

Rule source requires an active Pro or Enterprise subscription.
maui-no-preferences-for-secrets warning log

MAUI Preferences stores values in plaintext (SharedPreferences on Android, NSUserDefaults on iOS) — both are readable by other apps with root access and appear in device backups. Use SecureStorage for tokens, passwords, and secrets; it uses Keychain (iOS) and Android Keystore (Android) backed encrypted storage.

Rule source requires an active Pro or Enterprise subscription.
maui-no-unsafe-code-block error block

unsafe code blocks in C# disable memory safety guarantees and can cause buffer overruns, use-after-free, and pointer corruption (CWE-119). MAUI apps run on managed platforms — native interop requirements should use DllImport/LibraryImport with explicitly marshalled types, never raw pointer arithmetic in unsafe blocks.

Rule source requires an active Pro or Enterprise subscription.
maui-no-webview-javascript-user-content error block

JavaScript injection via WebView (CWE-79): EvaluateJavaScriptAsync/InvokeScript with a concatenated or interpolated string allows attacker-controlled input to execute arbitrary JavaScript in the WebView context. In a MAUI WebView, JavaScript runs in the same process and can call C# via JavaScript bridges. Always use JSON.stringify on user values and pass them as parameters, never embed them directly in script strings.

Rule source requires an active Pro or Enterprise subscription.
maui-no-xamarin-forms-api warning log

Xamarin.Forms namespace is not supported in .NET MAUI. The Xamarin.Forms migration guide requires replacing namespaces with Microsoft.Maui and Microsoft.Maui.Controls. Xamarin.Forms APIs produce compile errors in MAUI projects and the Xamarin SDK reached end-of-life in May 2024.

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

Source history

Recent commits

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

No commit history available.