Android deep link security: validate incoming links and object access
A link in an email can open a document directly in an Android application. Associating a domain with an app and authorizing someone to read that document are separate checks. Mixing them can turn convenient navigation into access to another user’s data. Here is how to build deep link handling and test it with your own sample objects.
Understand what a deep link can and cannot prove
A deep link brings an external address and parameters into the app. They are not trustworthy merely because an installed client opened them. Several applications can register a conventional custom scheme, affecting handler selection and creating a risk of intercepted navigation.
Android App Links use HTTP/HTTPS with a verified association to a website. Correct handler selection does not establish correct authorization. A legitimate app must still check whether the route is allowed and whether the current user may perform its action.
Verify the association between app and website
For App Links, declare a manifest intent filter with autoVerify=true and publish /.well-known/assetlinks.json. Android verifies the website’s association with the application. The flag starts the process; it does not prove that verification succeeded.
Check the package name and signing certificate of the installed version. Debug and distributed release builds can have different signatures. Record the build, domain, verification state and device together: a green result on one installation should not silently become a claim about another.
A fictional example: the “Route” application
This training example is entirely fictional. “Route” accepts https://links.example.com/document?document_id=demo-a. The parameter identifies the requested document; it grants no right to read it. The server independently checks the current user and object owner.
Without a session, the client displays a safe sign-in screen. After sign-in, it requests the document again through the API. Do not treat a cached response as evidence of fresh access: switching accounts must change the server-side authorization result. Create two synthetic documents and two test accounts for this exercise.
A safe test matrix
Define the inputs and expected behavior before testing. Hiding a button is not sufficient to demonstrate denial: ensure the API response contains no data from the other test account’s object. Use only your own applications, accounts and synthetic data.
- Signed out: no private document is delivered, and the sign-in flow reveals no contents.
- Accounts A and B: each receives its own training document; accessing the other one is denied.
- Missing, invalid and repeated document_id: behavior is unambiguous, with no unexpected object selection.
- Unexpected scheme or host: reject the route or handle it through an explicitly designed safe path.
- Cold and warm starts, debug and release: authorization works regardless of the screen’s current state.
Check App Links on a test device
On a test device running Android 12 or later, run adb shell pm verify-app-links --re-verify com.example.demo. The device needs an internet connection. Allow verification to finish, then inspect the result with adb shell pm get-app-links com.example.demo.
The verified state confirms the domain association; it does not test document access. A none state can mean verification has not finished. Resolve the association state first, then run the authorization scenarios separately: they are different results.
Validate parameters and keep secrets out of URLs
Before exposing sensitive data or performing an action, validate the incoming values and authentication and authorization state. Parse the address and check its scheme and exact host; a simple string-prefix match must not select a trusted website.
Keep long-lived tokens and passwords out of URLs. If a route accepts a next address, restrict it to expected destinations. Record scenario types and access outcomes in the test log, rather than secrets or the contents of private documents.
Document the result for your developer
Provide a table covering build, route, sign-in state, object owner and server response. For each discrepancy, describe the expected behavior and where to fix it: URI parsing in the client, domain association or API authorization. Repeat the original scenario on the same build after the fix.
For the web part of your product, start with a free website audit. This guide helps your own team prepare Android deep link tests; CheckMyApp’s automated mobile audit is not yet available for purchase.