Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 29 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,37 @@ on:
- 'rust/**'
- 'webui/**'
- 'common/**'
- 'tests/**'
- '*.sh'
- 'module.prop'
- '.github/workflows/build.yml'
pull_request:
branches: [main]
paths:
- 'rust/**'
- 'webui/**'
- 'common/**'
- 'tests/**'
- '*.sh'
- 'module.prop'
- '.github/workflows/build.yml'
workflow_dispatch:

jobs:
shell-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Test property handler
run: |
for script in prop.sh service.sh common/prop-handler.sh \
tests/prop-handler.sh tests/service-prop-handler.sh tests/package-contents.sh; do
sh -n "$script" || exit 1
done
bash -n package.sh
sh tests/prop-handler.sh
sh tests/service-prop-handler.sh

build:
runs-on: ubuntu-latest
strategy:
Expand Down Expand Up @@ -116,7 +137,7 @@ jobs:
retention-days: 7

package:
needs: build
needs: [build, shell-tests]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -171,6 +192,9 @@ jobs:
-x ".gitignore" \
-x ".gitmodules" \
-x ".github/*" \
-x ".omc/*" \
-x ".context/*" \
-x "handoff/*" \
-x "external/*" \
-x "artifacts/*" \
-x "CLAUDE.md" \
Expand All @@ -182,6 +206,7 @@ jobs:
-x "release/*" \
-x "package.sh" \
-x "rust/*" \
-x "tests/*" \
-x "node_modules/*" \
-x "webui/src/*" \
-x "webui/node_modules/*" \
Expand All @@ -208,6 +233,9 @@ jobs:
-x "webui/material-symbols-outlined.woff2" \
-x "*.md"

- name: Verify module ZIPs
run: sh tests/package-contents.sh release/*.zip

- name: Separate ZIPs
run: |
mkdir -p release/rel release/dbg
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## Unreleased

- Prefer the active root manager's native resetprop for the boot property handler, with the bundled ABI-specific binary as a fallback. Verify property writes and log failures. This adapts the vivo fork's resetprop fix without waiting until boot completion and avoids losing the handler if Magisk removes the original module copy.
- Run property-handler tests and Android builds for shell, WebUI and other module changes in pull requests; exclude test and session files from packaged ZIPs.

## v5.53.1 (2026-05-01)

### Bug Fixes
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ One binary. One process. One config file. No shell scripts in the hot path.
- [x] **15 properties spoofed** — `vbmeta.digest`, `device_state`, `verifiedbootstate`, and 12 more
- [x] **Captured at install time** — reads `ro.boot.vbmeta.digest` before any modules are active
- [x] **Fallback chain** — persisted file → bootloader property → APK extraction (last resort)
- [x] **Root-manager resetprop** — the boot property handler prefers the active manager's native resetprop, falls back to the bundled binary, and logs failed or ineffective writes to `ta-enhanced/logs/main.log`

**Custom ROM Identity Hiding**
- [x] **LineageOS prop scrub on boot:** strips the `lineage_` prefix from `ro.product.vendor.name`, replaces `org.lineageos.aperture` in `vendor.camera.aux.packagelist` and `persist.vendor.camera.privapp.list`, stops `vendor.lineage_health` and deletes its `init.svc.*` status prop
Expand Down
50 changes: 50 additions & 0 deletions common/prop-handler.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/bin/sh

select_prop_resetprop() {
local manager="$1" bundled="$2" adb_dir="${3:-/data/adb}" native=""

case "$manager" in
KSU) native="$adb_dir/ksu/bin/resetprop" ;;
APATCH) native="$adb_dir/ap/bin/resetprop" ;;
MAGISK) native="$adb_dir/magisk/resetprop" ;;
esac

if [ -n "$native" ] && [ -x "$native" ]; then
printf '%s\n' "$native"
elif [ -x "$bundled" ]; then
printf '%s\n' "$bundled"
else
printf 'No executable resetprop found for %s (bundled: %s)\n' "$manager" "$bundled" >&2
return 1
fi
}

set_reset_prop() {
local name="$1" expected="$2" value

if ! "$RP" -n "$name" "$expected"; then
printf 'Failed to set property %s\n' "$name" >&2
return 1
fi
if ! value=$("$RP" "$name"); then
printf 'Failed to verify property %s\n' "$name" >&2
return 1
fi
if [ "$value" != "$expected" ]; then
printf 'Property %s did not retain the requested value\n' "$name" >&2
return 1
fi
}

check_reset_prop() {
local name="$1" expected="$2" value

if ! value=$("$RP" "$name"); then
printf 'Failed to read property %s\n' "$name" >&2
return 1
fi
if [ -z "$value" ] || [ "$value" = "$expected" ]; then
return 0
fi
set_reset_prop "$name" "$expected"
}
2 changes: 2 additions & 0 deletions package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ REQUIRED_FILES=(
prop.sh
uninstall.sh
install_func.sh
common/prop-handler.sh
hotinstall.sh
module.prop
update.json
Expand Down Expand Up @@ -246,6 +247,7 @@ zip -r9 "$ZIP_PATH" . \
-x "release/*" \
-x "package.sh" \
-x "rust/*" \
-x "tests/*" \
-x "node_modules/*" \
-x "webui/src/*" \
-x "webui/node_modules/*" \
Expand Down
55 changes: 32 additions & 23 deletions prop.sh
Original file line number Diff line number Diff line change
@@ -1,37 +1,46 @@
#!/bin/sh

RP="${RP_BIN:-resetprop}"

check_reset_prop() {
local NAME=$1
local EXPECTED=$2
local VALUE=$($RP $NAME)
[ -z $VALUE ] || [ $VALUE = $EXPECTED ] || $RP -n $NAME $EXPECTED
}
SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd)
. "$SCRIPT_DIR/common/prop-handler.sh"

contains_reset_prop() {
local NAME=$1
local CONTAINS=$2
local NEWVAL=$3
[[ "$($RP $NAME)" = *"$CONTAINS"* ]] && $RP -n $NAME $NEWVAL
local VALUE
if ! VALUE=$("$RP" "$NAME"); then
printf 'Failed to read property %s\n' "$NAME" >&2
return 1
fi
case "$VALUE" in
*"$CONTAINS"*) set_reset_prop "$NAME" "$NEWVAL" ;;
esac
}

empty_reset_prop() {
local NAME=$1
local NEWVAL=$2
local VALUE=$(getprop "$NAME")
[ -z "$VALUE" ] && $RP -n $NAME $NEWVAL
local VALUE
if ! VALUE=$(getprop "$NAME"); then
printf 'Failed to read property %s\n' "$NAME" >&2
return 1
fi
[ -n "$VALUE" ] && return 0
set_reset_prop "$NAME" "$NEWVAL"
}

$RP -w sys.boot_completed 0

if [ -f "/data/adb/disable_prop_handler" ]; then
exit 0
fi

if [ ! -f "/data/adb/disable_vbmeta_digest_spoof" ] && [ -f "/data/adb/boot_hash" ]; then
hash_value=$(grep -v '^#' "/data/adb/boot_hash" | tr -d '[:space:]' | tr '[:upper:]' '[:lower:]')
[ -z "$hash_value" ] && rm -f /data/adb/boot_hash || $RP -n ro.boot.vbmeta.digest "$hash_value"
if [ -z "$hash_value" ]; then
rm -f /data/adb/boot_hash || printf '%s\n' 'Failed to remove empty boot hash' >&2
else
set_reset_prop ro.boot.vbmeta.digest "$hash_value"
fi
fi

check_reset_prop "ro.boot.vbmeta.device_state" "locked"
Expand Down Expand Up @@ -65,24 +74,24 @@ contains_reset_prop "ro.boot.bootmode" "recovery" "unknown"
contains_reset_prop "vendor.boot.bootmode" "recovery" "unknown"

# Custom ROM (LineageOS) identity scrub: only fires when LOS-only signatures are present
v=$($RP ro.product.vendor.name)
v=$("$RP" ro.product.vendor.name)
case "$v" in
lineage_*) $RP -n ro.product.vendor.name "${v#lineage_}" ;;
lineage_*) set_reset_prop ro.product.vendor.name "${v#lineage_}" ;;
esac

v=$($RP vendor.camera.aux.packagelist)
v=$("$RP" vendor.camera.aux.packagelist)
case "$v" in
*org.lineageos*) $RP -n vendor.camera.aux.packagelist "com.android.camera" ;;
*org.lineageos*) set_reset_prop vendor.camera.aux.packagelist "com.android.camera" ;;
esac

v=$($RP persist.vendor.camera.privapp.list)
v=$("$RP" persist.vendor.camera.privapp.list)
case "$v" in
*org.lineageos*) $RP -n persist.vendor.camera.privapp.list "com.android.camera" ;;
*org.lineageos*) set_reset_prop persist.vendor.camera.privapp.list "com.android.camera" ;;
esac

[ -n "$($RP init.svc.vendor.lineage_health)" ] && {
setprop ctl.stop vendor.lineage_health
$RP -d init.svc.vendor.lineage_health
[ -n "$("$RP" init.svc.vendor.lineage_health)" ] && {
setprop ctl.stop vendor.lineage_health || printf '%s\n' 'Failed to stop vendor.lineage_health' >&2
"$RP" -d init.svc.vendor.lineage_health || printf '%s\n' 'Failed to delete init.svc.vendor.lineage_health' >&2
}

# Reset vbmeta related prop
Expand All @@ -92,4 +101,4 @@ empty_reset_prop "ro.boot.vbmeta.avb_version" "1.0"
empty_reset_prop "ro.boot.vbmeta.hash_alg" "sha256"
empty_reset_prop "ro.boot.vbmeta.size" "4096"

$RP -c || true
exit 0
24 changes: 16 additions & 8 deletions service.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ HIDE_DIR="/data/adb/modules/.TA_enhanced"
TSPA="/data/adb/modules/tsupport-advance"

. "$MODPATH/common/common.sh"
. "$MODPATH/common/prop-handler.sh"
detect_manager

_log "INFO" "Service started (manager=$MANAGER)"
Expand Down Expand Up @@ -40,12 +41,6 @@ add_denylist_to_target() {
# Security patch is handled by the daemon's SecurityPatchTask (with retries + bulletin fetch).
# Running `set` here would overwrite bulletin-fetched dates with stale device props.

# prop.sh runs with RP_BIN pointed at the bundled resetprop-rs to keep the
# upstream calling pattern intact while sourcing the property setter from
# the module bundle.
RP_BIN="$MODPATH/bin/$ABI/resetprop-rs" sh "$MODPATH/prop.sh" &


# TSupport-A Interop
if [ -d "$TSPA" ]; then
touch "/storage/emulated/0/stop-tspa-auto-target" 2>/dev/null || true
Expand Down Expand Up @@ -77,6 +72,18 @@ else
[ -d "$HIDE_DIR" ] && rm -rf "$HIDE_DIR"
fi

if PROP_RP_BIN=$(select_prop_resetprop "$MANAGER" "$MODPATH/bin/$ABI/resetprop-rs"); then
_log "INFO" "Property handler using $PROP_RP_BIN"
(
RP_BIN="$PROP_RP_BIN" sh "$MODPATH/prop.sh" ||
printf '%s\n' "Property handler exited with an error"
) 2>&1 | while IFS= read -r line; do
_log "WARN" "$line"
done &
else
_log "ERROR" "Property handler could not find a usable resetprop"
fi

# Ensure system_app file exists for WebUI system app display
if [ ! -f "$TS_DIR/system_app" ]; then
: > "$TS_DIR/system_app"
Expand Down Expand Up @@ -150,8 +157,9 @@ mkdir -p "$MODPATH/common/tmp"
# Xposed Detection (background)
"$BIN" status xposed-scan >> "$LOG_BASE_DIR/main.log" 2>&1 &

# Magisk: clean up unhidden module dir
[ -f "$MODPATH/action.sh" ] && rm -rf "/data/adb/modules/TA_enhanced"
# Magisk: clean up the unhidden copy only after switching to the hidden copy.
[ "$MANAGER" = "MAGISK" ] && [ "$MODPATH" = "$HIDE_DIR" ] && [ -f "$MODPATH/action.sh" ] &&
rm -rf "/data/adb/modules/TA_enhanced"

# Launch Daemon
_log "INFO" "Starting ta-enhanced daemon"
Expand Down
30 changes: 30 additions & 0 deletions tests/package-contents.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/sh
set -eu

if [ "$#" -eq 0 ]; then
echo "Usage: sh tests/package-contents.sh <module.zip> [...]" >&2
exit 2
fi

for archive in "$@"; do
unzip -tq "$archive" >/dev/null
contents=$(unzip -Z1 "$archive" | sed 's|^\./||')

for required in \
META-INF/com/google/android/update-binary \
module.prop service.sh prop.sh common/prop-handler.sh webui/index.html \
bin/arm64-v8a/ta-enhanced bin/arm64-v8a/resetprop-rs \
bin/armeabi-v7a/ta-enhanced bin/armeabi-v7a/resetprop-rs \
bin/x86/ta-enhanced bin/x86/resetprop-rs \
bin/x86_64/ta-enhanced bin/x86_64/resetprop-rs; do
if ! printf '%s\n' "$contents" | grep -Fxq "$required"; then
printf 'Missing %s in %s\n' "$required" "$archive" >&2
exit 1
fi
done
if printf '%s\n' "$contents" | grep -Eq '^(\.git|\.github|\.omc|\.context|handoff|artifacts|release|rust|tests)/'; then
printf 'Development or session files found in %s\n' "$archive" >&2
exit 1
fi
printf 'Validated %s\n' "$archive"
done
Loading