The Magic Mask for Android
This report presents the forensic synthetic code analysis of topjohnwu/Magisk, a Kotlin project with 61,670 GitHub stars. SynthScan v2.0 examined 85,682 lines of code across 646 source files, recording 144 pattern matches distributed across 9 syntactic categories. The overall adjusted score of 3.1 places this repository in the Likely human-written band.
The scanner applied 160+ deterministic lexical heuristics, multi-line block detectors, abstract syntax tree depth profilers, and a cross-file Jaccard similarity matrix to construct a statistically normalised synthetic code estimate. All matches are individually weighted by severity coefficient and contextual multiplier before summation, and the resulting headline score is temporally discounted to account for the repository's development history relative to the commercial emergence of large language model coding tooling (November 2022 onward).
This chart maps the temporal evolution of the adjusted synthetic code score across successive scan runs. An upward trajectory indicates ongoing incorporation of AI-generated code or expanding LLM-assisted scaffolding; a stable or declining trajectory may reflect active human refactoring, code removal, or the adoption of stricter authorship policies. The dashed secondary line (right axis) independently tracks total raw pattern hit count, which can diverge from the normalised score when codebase size changes significantly between scans.
Classifies detected patterns by their diagnostic confidence and structural impact. CRITICAL patterns (coefficient 10) represent definitive synthetic signatures — hallucinated imports, explicit LLM attribution metadata — virtually never produced by human authors. HIGH (5) indicates strong structural tells such as cross-file repetition or cross-linguistic idioms. MEDIUM (2) covers recognisable conversational padding and AI-specific vocabulary. LOW (1) captures subtle indicators like tautological comments and generic boilerplate that require density to carry independent signal.
This horizontal bar chart decomposes the repository's raw synthetic code score by top-level directory, allowing you to pinpoint precisely which modules or components carry the highest AI authorship density. Directories with disproportionately high scores relative to their size warrant targeted manual review: concentrated AI signatures often trace back to mass-generated configuration layers, auto-ported test suites, LLM-scaffolded boilerplate classes, or entire subsystems authored under heavy copilot assistance. Use this view to prioritise your human code-review effort.
The scanner identified 144 distinct pattern matches across 9 syntactic categories. Each entry below represents a discrete location in the source code where the engine recorded a statistically significant AI authorship indicator. Expand any category row to inspect the individual file paths, line numbers, code snippets, and the lexical context (CODE, COMMENT, or STRING) in which each match was detected.
Reading the findings table: The Severity column indicates the diagnostic confidence level (CRITICAL / HIGH / MEDIUM / LOW). The Context column identifies whether the match occurred inside executable code, an inline comment, or a string literal — comment-context matches receive a ×1.5 weight because LLMs systematically over-annotate. The ⚡ bolt icon marks clustered matches: three or more patterns within a 10-line window, each receiving an additional ×1.5 density multiplier as dense clusters constitute far stronger evidence of synthetic authorship than isolated hits.
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| MEDIUM⚡ | native/src/core/zygisk/hook.cpp | 31 | // ┌───────┐ | COMMENT |
| MEDIUM⚡ | native/src/core/zygisk/hook.cpp | 34 | // │ │ ┌────────────────┐ | COMMENT |
| MEDIUM⚡ | native/src/core/zygisk/hook.cpp | 35 | // │ └────────────────────────────────────────►│LoadNativeBridge│ | COMMENT |
| MEDIUM⚡ | native/src/core/zygisk/hook.cpp | 36 | // │ └───────┬────────┘ | COMMENT |
| MEDIUM⚡ | native/src/core/zygisk/hook.cpp | 37 | // ┌────────────────┐ │ │ | COMMENT |
| MEDIUM⚡ | native/src/core/zygisk/hook.cpp | 38 | // │LoadNativeBridge│◄────────────┼───────────────────────────────────────────────────┘ | COMMENT |
| MEDIUM⚡ | native/src/core/zygisk/hook.cpp | 39 | // └───────┬────┬───┘ │ | COMMENT |
| MEDIUM⚡ | native/src/core/zygisk/hook.cpp | 40 | // │ │ │ ┌───────────────┐ | COMMENT |
| MEDIUM⚡ | native/src/core/zygisk/hook.cpp | 41 | // │ └─────────────────┼────────────────────►│NativeBridgeItf│ | COMMENT |
| MEDIUM⚡ | native/src/core/zygisk/hook.cpp | 42 | // │ │ └──────┬────────┘ | COMMENT |
| MEDIUM⚡ | native/src/core/zygisk/hook.cpp | 45 | // │ │ ┌────────┐ | COMMENT |
| MEDIUM⚡ | native/src/core/zygisk/hook.cpp | 47 | // ▼ │ └────────┘ | COMMENT |
| MEDIUM⚡ | native/src/core/zygisk/hook.cpp | 48 | // ┌───────┐ │ | COMMENT |
| MEDIUM⚡ | native/src/core/zygisk/hook.cpp | 52 | // │ │ ┌───────────────────────┐ | COMMENT |
| MEDIUM⚡ | native/src/core/zygisk/hook.cpp | 53 | // └──────────────────────┼────────────────►│post_native_bridge_load│ | COMMENT |
| MEDIUM⚡ | native/src/core/zygisk/hook.cpp | 54 | // │ └───────────────────────┘ | COMMENT |
| MEDIUM⚡ | native/src/core/zygisk/hook.cpp | 56 | // ┌──────────────────────┐ | COMMENT |
| MEDIUM⚡ | native/src/core/zygisk/hook.cpp | 58 | // └───────────┬────┬─────┘ | COMMENT |
| MEDIUM⚡ | native/src/core/zygisk/hook.cpp | 59 | // │ │ ┌───────────────┐ | COMMENT |
| MEDIUM⚡ | native/src/core/zygisk/hook.cpp | 60 | // │ └───────────────►│hook_zygote_jni│ | COMMENT |
| MEDIUM⚡ | native/src/core/zygisk/hook.cpp | 61 | // │ └───────────────┘ ┌─────────┐ | COMMENT |
| MEDIUM⚡ | native/src/core/zygisk/hook.cpp | 63 | // └────────────────────────────────────────────►│ JVM │ | COMMENT |
| MEDIUM⚡ | native/src/core/zygisk/hook.cpp | 66 | // ┌───────────────────┐ │ │ | COMMENT |
| MEDIUM⚡ | native/src/core/zygisk/hook.cpp | 67 | // │nativeXXXSpecialize│◄─────────────────────────────────────┘ │ | COMMENT |
| MEDIUM⚡ | native/src/core/zygisk/hook.cpp | 68 | // └─────────────┬─────┘ │ | COMMENT |
| MEDIUM⚡ | native/src/core/zygisk/hook.cpp | 69 | // │ ┌─────────────┐ │ | COMMENT |
| MEDIUM⚡ | native/src/core/zygisk/hook.cpp | 70 | // └────────────────►│ZygiskContext│ │ | COMMENT |
| MEDIUM⚡ | native/src/core/zygisk/hook.cpp | 71 | // └─────────────┘ ▼ | COMMENT |
| MEDIUM⚡ | native/src/core/zygisk/hook.cpp | 72 | // ┌────────────────────┐ | COMMENT |
| MEDIUM⚡ | native/src/core/zygisk/hook.cpp | 74 | // └─────────┬──────────┘ | COMMENT |
| MEDIUM⚡ | native/src/core/zygisk/hook.cpp | 75 | // ┌────────────────┐ │ | COMMENT |
| MEDIUM⚡ | native/src/core/zygisk/hook.cpp | 76 | // │restore_plt_hook│◄───────────┘ | COMMENT |
| MEDIUM⚡ | native/src/core/zygisk/hook.cpp | 77 | // └────────────────┘ | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | native/src/init/twostage.rs | 41 | } | COMMENT |
| LOW | native/src/init/selinux.rs | 21 | const SELINUX_ENFORCE: &Utf8CStr = cstr!(concatcp!(SELINUX_MNT, "/enforce")); | COMMENT |
| LOW | native/src/core/logging.rs | 141 | } | COMMENT |
| LOW | native/src/core/magisk.rs | 81 | #[derive(FromArgs)] | COMMENT |
| LOW | native/src/core/zygisk/zygisk.hpp | 1 | #pragma once | COMMENT |
| LOW | native/src/core/zygisk/hook.cpp | 1 | #include <sys/mman.h> | COMMENT |
| LOW | native/src/core/zygisk/hook.cpp | 21 | // | COMMENT |
| LOW | native/src/core/zygisk/hook.cpp | 41 | // │ └─────────────────┼────────────────────►│NativeBridgeItf│ | COMMENT |
| LOW | native/src/core/zygisk/hook.cpp | 61 | // │ └───────────────┘ ┌─────────┐ | COMMENT |
| LOW | native/src/core/zygisk/api.hpp | 121 | // AppSpecializeArgs object. You can read and overwrite these arguments to change how the app | COMMENT |
| LOW | native/src/core/zygisk/api.hpp | 181 | struct api_table; | COMMENT |
| LOW | native/src/core/zygisk/api.hpp | 201 | COMMENT | |
| LOW | native/src/core/zygisk/api.hpp | 221 | // function that would be called in the root process with REGISTER_ZYGISK_COMPANION(func). | COMMENT |
| LOW | native/src/core/zygisk/api.hpp | 241 | // | COMMENT |
| LOW | native/src/core/zygisk/api.hpp | 261 | COMMENT | |
| LOW | native/src/core/include/core.hpp | 1 | #pragma once | COMMENT |
| LOW | native/src/core/su/su.cpp | 1 | /* | COMMENT |
| LOW | native/src/core/deny/utils.cpp | 1 | #include <sys/types.h> | COMMENT |
| LOW | native/src/boot/bootimg.hpp | 101 | // https://android.googlesource.com/platform/system/tools/mkbootimg/+/refs/heads/android12-release/include/bootimg/booti | COMMENT |
| LOW | native/src/boot/bootimg.cpp | 1 | #include <bit> | COMMENT |
| LOW | native/src/boot/magiskboot.hpp | 1 | #pragma once | COMMENT |
| LOW | native/src/boot/magiskboot.hpp | 21 | #define BOOT_MAGIC "ANDROID!" | COMMENT |
| LOW | native/src/include/consts.hpp | 1 | #pragma once | COMMENT |
| LOW | native/src/include/consts.hpp | 21 | COMMENT | |
| LOW | native/src/external/xz_config/config.h | 401 | # define _GNU_SOURCE 1 | COMMENT |
| LOW | native/src/external/xz_config/config.h | 421 | significant byte first (like Motorola and SPARC, unlike Intel). */ | COMMENT |
| LOW | native/src/external/xz-embedded/xz_config.h | 121 | # define get_le32 get_unaligned_le32 | COMMENT |
| LOW | native/src/external/xz-embedded/xz_private.h | 21 | # include <linux/string.h> | COMMENT |
| LOW | native/src/external/xz-embedded/xz_private.h | 41 | # define memzero(buf, size) memset(buf, 0, size) | COMMENT |
| LOW | native/src/external/xz-embedded/xz_private.h | 61 | /* | COMMENT |
| LOW | native/src/external/xz-embedded/xz_private.h | 81 | # define DEC_IS_DYNALLOC(mode) (false) | COMMENT |
| LOW | native/src/external/lz4-sys/src/wasm_shim.rs | 1 | //! A shim for the libc functions used in lz4-rs that are not available when building for wasm | COMMENT |
| LOW | native/src/external/lz4-sys/src/lib.rs | 201 | // This is achieved using LZ4F_createCompressionContext(), which takes as argument a version | COMMENT |
| LOW | native/src/external/lz4-sys/src/lib.rs | 221 | // LZ4F_compressBegin() : | COMMENT |
| LOW | native/src/external/lz4-sys/src/lib.rs | 241 | // LZ4F_compressBound() : | COMMENT |
| LOW | native/src/external/lz4-sys/src/lib.rs | 261 | // meaning input data was just buffered. | COMMENT |
| LOW | native/src/external/lz4-sys/src/lib.rs | 281 | // to be be filled, you can call LZ4_flush(), which will immediately compress any remaining | COMMENT |
| LOW | native/src/external/lz4-sys/src/lib.rs | 301 | // It will flush whatever data remained within compressionContext (like LZ4_flush()) | COMMENT |
| LOW | native/src/external/lz4-sys/src/lib.rs | 321 | // The first thing to do is to create a decompressionContext object, which will be used | COMMENT |
| LOW | native/src/external/lz4-sys/src/lib.rs | 341 | COMMENT | |
| LOW | native/src/external/lz4-sys/src/lib.rs | 361 | srcBuffer: *const u8, | COMMENT |
| LOW | native/src/external/lz4-sys/src/lib.rs | 381 | // | COMMENT |
| LOW | native/src/sepolicy/include/sepolicy.hpp | 1 | #pragma once | COMMENT |
| LOW | native/src/base/argh.rs | 1 | // Copyright (c) 2020 Google LLC All rights reserved. | COMMENT |
| LOW | native/src/base/argh.rs | 21 | //! /// whether or not to jump | COMMENT |
| LOW | native/src/base/argh.rs | 41 | //! | COMMENT |
| LOW | native/src/base/argh.rs | 61 | //! `#[argh(default = "<your_code_here>")]` attribute, and in this case an | COMMENT |
| LOW | native/src/base/argh.rs | 81 | //! height: usize, | COMMENT |
| LOW | native/src/base/argh.rs | 101 | //! #[derive(FromArgs)] | COMMENT |
| LOW | native/src/base/argh.rs | 121 | //! /// A command with positional arguments. | COMMENT |
| LOW | native/src/base/argh.rs | 141 | //! #[argh(option)] | COMMENT |
| LOW | native/src/base/argh.rs | 161 | //! over each command: | COMMENT |
| LOW | native/src/base/argh.rs | 181 | //! /// First subcommand. | COMMENT |
| LOW | native/src/base/argh.rs | 201 | //! `dynamic` attribute. Instead of deriving `FromArgs`, the value inside the | COMMENT |
| LOW | native/src/base/argh.rs | 221 | //! Normal(NormalSubCommand), | COMMENT |
| LOW | native/src/base/argh.rs | 241 | //! impl DynamicSubCommand for Dynamic { | COMMENT |
| LOW | native/src/base/argh.rs | 261 | //! } | COMMENT |
| LOW | native/src/base/argh.rs | 281 | //! for command in Self::commands() { | COMMENT |
| LOW | native/src/base/argh.rs | 301 | //! # use argh::FromArgs; | COMMENT |
| LOW | native/src/base/argh.rs | 341 | } | COMMENT |
| 19 more matches not shown… | ||||
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| CRITICAL | …/src/main/java/com/topjohnwu/magisk/ui/MainActivity.kt | 268 | val invalidDialog = com.topjohnwu.magisk.ui.component.rememberConfirmDialog( | CODE |
| CRITICAL | …/src/main/java/com/topjohnwu/magisk/ui/MainActivity.kt | 289 | com.topjohnwu.magisk.ui.component.rememberConfirmDialog( | CODE |
| CRITICAL | …/src/main/java/com/topjohnwu/magisk/ui/MainActivity.kt | 301 | val shortcutDialog = com.topjohnwu.magisk.ui.component.rememberConfirmDialog( | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | native/src/init/selinux.rs | 102 | // Step 0: determine strategy | COMMENT |
| LOW | native/src/init/selinux.rs | 126 | // Step 1: setup for intercepting init boot control flow | COMMENT |
| LOW | native/src/init/selinux.rs | 187 | // Step 2: wait for selinuxfs to be mounted (only for LEGACY) | COMMENT |
| LOW | native/src/init/selinux.rs | 219 | // Step 3: obtain sepolicy, patch, and load the patched sepolicy | COMMENT |
| LOW⚡ | native/src/core/sqlite.cpp | 111 | // Step 1: prepare statement | COMMENT |
| LOW⚡ | native/src/core/sqlite.cpp | 119 | // Step 2: bind arguments | COMMENT |
| LOW⚡ | native/src/core/sqlite.cpp | 129 | // Step 3: execute | COMMENT |
| LOW | native/src/core/module.rs | 848 | // Step 1: Create virtual filesystem tree | COMMENT |
| LOW | native/src/core/module.rs | 878 | // Step 2: Inject custom files | COMMENT |
| LOW | native/src/core/module.rs | 897 | // Step 3: Extract all supported read-only partition roots | COMMENT |
| LOW | native/src/core/module.rs | 925 | // Step 4: Convert virtual filesystem tree into concrete operations | COMMENT |
| LOW | native/src/core/zygisk/hook.cpp | 267 | // On arm32, we need to check if the pc is in thumb mode, | COMMENT |
| LOW | native/src/boot/bootimg.cpp | 318 | // We need to check if it is LZ4_LG | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | native/src/init/selinux.rs | 102 | // Step 0: determine strategy | COMMENT |
| LOW | native/src/init/selinux.rs | 126 | // Step 1: setup for intercepting init boot control flow | COMMENT |
| LOW | native/src/init/selinux.rs | 187 | // Step 2: wait for selinuxfs to be mounted (only for LEGACY) | COMMENT |
| LOW | native/src/init/selinux.rs | 219 | // Step 3: obtain sepolicy, patch, and load the patched sepolicy | COMMENT |
| LOW⚡ | native/src/core/sqlite.cpp | 111 | // Step 1: prepare statement | COMMENT |
| LOW⚡ | native/src/core/sqlite.cpp | 119 | // Step 2: bind arguments | COMMENT |
| LOW⚡ | native/src/core/sqlite.cpp | 129 | // Step 3: execute | COMMENT |
| LOW | native/src/core/module.rs | 848 | // Step 1: Create virtual filesystem tree | COMMENT |
| LOW | native/src/core/module.rs | 878 | // Step 2: Inject custom files | COMMENT |
| LOW | native/src/core/module.rs | 897 | // Step 3: Extract all supported read-only partition roots | COMMENT |
| LOW | native/src/core/module.rs | 925 | // Step 4: Convert virtual filesystem tree into concrete operations | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | scripts/flash_script.sh | 60 | # Check if system root is installed and remove | COMMENT |
| LOW | scripts/boot_patch.sh | 58 | # Check if 64-bit | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | scripts/live_setup.sh | 7 | # For developing Magisk, just use: | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | build.py | 17 | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | …/java/com/topjohnwu/magisk/core/su/SuRequestHandler.kt | 25 | class SuRequestHandler( | CODE |