Gradle plugin for Android applications for detecting unexpected changes in AndroidManifest.xml

Overview

manifest-guard

Build Status Latest release

Gradle plugin for Android applications for detecting unexpected changes in AndroidManifest.xml

The problem being solved

Every third-party android library except .jar ones can have their own AndroidManifest.xml. Every Android-specific module in multi-module project is also required to have it. The final AndroidManifest.xml included in application is made by merging all manifests from all libraries and modules. It's hard to track changes due to this file is inside build folder which is usually not under some VCS. But AndroidManifest.xml is extremely important file of your application. What if some library would introduce new dangerous permission and you would never know it until some problem occurs in the production.

ManifestGuard Gradle plugin is aimed to solve this issue for you. For every build process it will automatically compare old merged manifest with the new one and throw the error if unexpected changes are found.

Setup

ManifestGuard is applicable only to Android application modules because for libraries it does not make any sense. The setup is easy, just add the plugin to plugins blocks in your application's build.gradle:

plugins {
    id 'com.android.application'
    id 'kotlin-android'
    id 'com.dpforge.manifestguard' version 'x.x.x'
}

Basically that's it. But you can configure the plugin depending on your needs. Take a look at the next section.

Configure the plugin

Plugin has default settings but you can change them in the following way:

manifestGuard {
    compareOnAssemble = false // default value is true
    referenceFile = new File(projectDir, "manifest/original.xml")
    htmlDiffFile = new File(projectDir, "manifest-diff.html")
    ignore {
        ignoreAppVersionChanges true // default value is false
    }
}
  • compareOnAssemble - whether manifest comparison is done automatically on every project assembly. Default value is true while false means you have to invoke task compare${VARIANT_NAME}MergedManifest manually. For example compareDebugMergedManifest.
  • referenceFile - path to the file which is treated like a reference AndroidManifest.xml. It means that this file is going to be compared with new merged manifest during next build. The default file is GuardedAndroidManifest.xml placed in the root of the project;
  • htmlDiffFile - path to the file where HTML report will be written when there are differences between two manifests;
  • ignore - configuration of ignore options
    • ignoreAppVersionChanges - treat as expected changes in android:versionCode and android:versionName attributes of manifest tag. Value of true means that if app version has changed then manifest comparison will be successful and no report would be generated. Default value is false.

Update reference manifest

If there is no reference AndroidManifest.xml file then it will be created automatically on next comparison. When you introduce changes into manifest intentionally and want to update the reference then you should invoke task update${VARIANT_NAME}ReferenceManifest. For example updateDebugReferenceManifest. It will update reference manifest and the next comparison will be successful.

Credits

Thanks to Dmitriy Voronin for the project idea and the contribution.

License

Copyright (c) 2022 Daniil Popov

Licensed under the MIT License.

You might also like...

Stetho is a debug bridge for Android applications, enabling the powerful Chrome Developer Tools and much more.

Stetho Stetho is a sophisticated debug bridge for Android applications. When enabled, developers have access to the Chrome Developer Tools feature nat

Jan 3, 2023

This app brings Privacy dashboard features from Android 12 to older android devices.

This app brings Privacy dashboard features from Android 12 to older android devices.

PrivacyDashboard This app brings Privacy dashboard features from Android 12 to older android devices. Have you ever thought which apps are accessing y

Jan 7, 2023

Share food-Android- - Food donation coded in native android with firebase, google maps api and php server xampp

Share food-Android- - Food donation coded in native android with firebase, google maps api and php server xampp

share_food-Android- Instructions: 1. Create a firebase account and link it with the project via google-services.json. 2. This project also uses a XAMP

Dec 28, 2021

Simple Android app during a coding night. Just Learning Firebase and Android

Simple Android app during a coding night. Just Learning Firebase and Android

KUI-App Simple Android app during a coding night. Just Learning Firebase and Android What we learned: Some basics of Android Basic setup of Firebase:

Aug 28, 2022

Plugin for executing android intents from Capacitor app

capacitor-intent Plugin for executing android intents from Capacitor app Install npm install capacitor-intent npx cap sync API startActivity(...) Inte

Jan 19, 2022

This project is an Android Studio plugin version of BlackObfuscator, it supports obfuscating code automatically. More information about this project are in BlackObfuscator.

DEX控制流混淆插件版 · BlackObfuscator-ASPlugin English Version 本项目为 BlackObfuscator 的Android Studio插件版,支持打包自动化混淆。功能及介绍方面请查看 BlackObfuscator 源项目 注意事项 首要注意:Blac

Dec 31, 2022

trying to create a plugin using the spigot api! this plugin will be responsible for delivering the products according to the settings!

KettraShop "simples plugin de ativação de produtos da loja, dentro do Minecraft" ⚙️ Configurações caso você não tenha uma loja virtual para seu servid

Nov 2, 2022

Two Spring-boot applications registering themselves to an spring-boot-admin-server application as separate clients for the purpose of monitoring and managing the clients

Two Spring-boot applications registering themselves to an spring-boot-admin-server application as separate clients for the purpose of monitoring and managing the clients

Spring-boot-admin implementation with 1 Server and 2 clients Creating a Server application to monitor and manage Spring boot applications (clients) un

Dec 6, 2022

Generates and keeps up-to-date your Spring Boot applications' Let's Encrypt or other ACME compliant SSL certificates.

Generates and keeps up-to-date your Spring Boot applications' Let's Encrypt or other ACME compliant SSL certificates.

Generates and keeps up-to-date your Spring Boot applications' Let's Encrypt or other ACME compliant SSL certificates. Pure Java in a single file of library code. An automated embedded alternative to Certbot and docker-sidecars. No JVM restart is needed on certificate update.

Nov 18, 2022
Comments
  • Enhance error message

    Enhance error message

    When error "Manifest has items that have the same name and the same set of attributes. It's unsupported case for now" occurs it is hard to understand which particular tag or tags cause the issue. This info should be added to the error message.

    enhancement 
    opened by int02h 1
Releases(v1.0.0)
  • v1.0.0(Dec 13, 2022)

    BE CAREFUL! This is a major release. Breaking changes introduced. Please refer to README for a migration guide.

    What's Changed

    • Now the plugin has both a default configuration and the ability to make a separate configuration for a particular build variant (https://github.com/int02h/manifest-guard/pull/14)

    New Contributors

    • @sboishtyan made their first contribution in https://github.com/int02h/manifest-guard/pull/14

    Full Changelog: https://github.com/int02h/manifest-guard/compare/v0.0.4...v1.0.0

    Source code(tar.gz)
    Source code(zip)
  • v0.0.4(Sep 30, 2022)

    • More accurate fix for the problem that supposed to be fixed in v0.0.3 when tags have the same name and set of attributes.

    Full Changelog: https://github.com/int02h/manifest-guard/compare/v0.0.3...v0.0.4

    Source code(tar.gz)
    Source code(zip)
  • v0.0.3(Sep 15, 2022)

    What's new

    • Fix for the issue in the plugin which could not handle the case when in manifest there is more than one tag within the same parent with the same name and set of attributes. Like the following one:
    <activity android:name=".MainActivity" android:exported="true">
        <intent-filter>
            <action android:name="android.intent.action.SEND"/>
            <category android:name="android.intent.category.DEFAULT"/>
            <data android:mimeType="text/plain"/>
        </intent-filter>
                        
        <intent-filter>
            <action android:name="android.intent.action.VIEW"/>
            <category android:name="android.intent.category.DEFAULT"/>
            <data android:mimeType="image/*"/>
        </intent-filter>
    </activity>
    

    Full Changelog: https://github.com/int02h/manifest-guard/compare/v0.0.2...v0.0.3

    Source code(tar.gz)
    Source code(zip)
  • v0.0.2(Mar 16, 2022)

    What's new

    • New flag compareOnAssemble in plugin settings that allows you to disable automatic manifest comparison on every project assembly
    • New task in format update${VARIANT_NAME}ReferenceManifest has been added which is aimed to update the current reference manifest in case manifest has been changed intentionally.

    Full Changelog: https://github.com/int02h/manifest-guard/compare/v0.0.1...v0.0.2

    Source code(tar.gz)
    Source code(zip)
  • v0.0.1(Mar 3, 2022)

Owner
Daniil Popov
Android Developer and Musician
Daniil Popov
This program is a simple machine learning implementation in Java for detecting skin pixels.

Skin Detector ?? ?? Detects human skin from images This program is a simple machine learning implementation in Java for detecting skin pixels. How to

Tasmia Zerin 1 Jan 21, 2022
Xerath - 🔪 AOP development framework implemented through *Annotation + ASM + Gradle Transform API* for Android🤖

简体中文 | English | Xerath Xerath 是一个通过 [自定义注解]+ASM + Gradle Transform API 实现的一套功能强大,方便开发,并且能够有效减少重复代码的Android Aop 框架。 旨在编译器进行全局性的修改,来完成一些诸如方法耗时统计,异常收集,拦

Pumpkin 325 Nov 22, 2022
Android Auto Apps Downloader (AAAD) is an app for Android Phones that downloads popular Android Auto 3rd party apps and installs them in the correct way to have them in Android Auto.

Android Auto Apps Downloader (AAAD) is an app for Android Phones that downloads popular Android Auto 3rd party apps and installs them in the correct way to have them in Android Auto.

Gabriele Rizzo 865 Jan 2, 2023
Idk. Simple argument parser for u. Probably needs some changes xd

SimpleArgumentParser Maven <repositories> <repository> <id>jitpack.io</id> <url>https://jitpack.io</url> </repository> </repositories> <de

なるみ 6 Sep 30, 2022
Simple Calender App Written in Java , Built with Gradle

Simple Calendar Simple Calendar is an just another open-source Android Calendar application written in java. Features Minimal & Clean Fullfilles needs

Aryan Sinha 2 Dec 3, 2021
A sample microservice built with Spring Boot and Gradle.

Project Overview A sample microservice built with Spring Boot and Gradle. There are APIs built using REST and the resource is bicycle. All CRUD operat

Gordon Mendonsa 1 Feb 2, 2022
A supercharged gradle template for developing Minecraft plugins with multi platform support.

Minecraft Multi-Platform Template You can use this template to develop your own high quality Minecraft plugins for multiple platforms using Gradle wit

sVoxelDev 3 Nov 23, 2022
SitemapGen4j is a library to generate XML sitemaps in Java.

sitemapgen4j SitemapGen4j is a library to generate XML sitemaps in Java. What's an XML sitemap? Quoting from sitemaps.org: Sitemaps are an easy way fo

Dan Fabulich 151 Dec 16, 2022
This project demonstrates usage of Captcha, OTP APIs to access Offline eKYC XML.

Client Application to simulate offline eKYC wrapper API flow Introduction This is a Spring boot application which can be used to download offline eKYC

UIDAI 4 Oct 29, 2021
Acceso a Datos - 02 XML. 2DAM. Ejercicios realizados por el alumnado. Curso 2021-2022

Acceso a Datos - 02 - Ejercicios - 2021-2022 Acceso a Datos - 02 XML. 2DAM. Ejercicios realizados por el alumnado. Curso 2021-2022 ¿Cómo Colaborar? Es

José Luis González Sánchez 5 Dec 27, 2022