Skip to content

handle app_link query parameter Intent Redirection, Fixes AB#3590136#3102

Merged
rpdome merged 10 commits into
devfrom
rapong/reject
May 14, 2026
Merged

handle app_link query parameter Intent Redirection, Fixes AB#3590136#3102
rpdome merged 10 commits into
devfrom
rapong/reject

Conversation

@rpdome
Copy link
Copy Markdown
Member

@rpdome rpdome commented Apr 29, 2026

Copilot AI review requested due to automatic review settings April 29, 2026 22:56
@rpdome rpdome requested a review from a team as a code owner April 29, 2026 22:56
@github-actions
Copy link
Copy Markdown

❌ Work item link check failed. Description does not contain AB#{ID}.

Click here to Learn more.

@rpdome
Copy link
Copy Markdown
Member Author

rpdome commented Apr 29, 2026

@copilot update changelog with this pr id (3102)

@github-actions
Copy link
Copy Markdown

✅ Work item link check complete. Description contains link AB#3590136 to an Azure Boards work item.

@github-actions
Copy link
Copy Markdown

❌ Work item link check failed. Description contains AB#3590136 but the Bot could not link it to an Azure Boards work item.

Click here to learn more.

Copilot AI requested a review from a team as a code owner April 29, 2026 22:57
Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 29, 2026

@copilot update changelog with this pr id (3102)

Done. Added the changelog entry for PR #3102 in commit b7f6052.

@github-actions github-actions Bot changed the title handle app_link Intent Redirection handle app_link Intent Redirection, Fixes AB#3590136 Apr 29, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR hardens handling of app_link carried on broker-installation redirect URIs by introducing a strict allowlist validator and expanding test coverage for both safe and hostile app_link targets.

Changes:

  • Add BrokerInstallLinkValidator to strictly allowlist eSTS-supported broker install links (Play Store + China fwlink) and reject everything else.
  • Update RawAuthorizationResult to validate app_link before classifying the redirect as BROKER_INSTALLATION_TRIGGERED.
  • Add/extend unit tests covering additional allowlisted links and hostile app_link inputs.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
common4j/src/main/com/microsoft/identity/common/java/providers/RawAuthorizationResult.java Enforces allowlist validation for app_link and rejects non-allowlisted redirects.
common4j/src/main/com/microsoft/identity/common/java/providers/BrokerInstallLinkValidator.kt Implements strict allowlist validation logic for app_link URLs.
common4j/src/test/com/microsoft/identity/common/java/providers/RawAuthorizationResultTest.java Adds tests for new allowlisted broker-install links and hostile app_link cases.
common4j/src/test/com/microsoft/identity/common/java/providers/Constants.java Adds new redirect URI test constants for allowlisted and hostile app_link scenarios.
common4j/src/test/com/microsoft/identity/common/java/providers/BrokerInstallLinkValidatorTest.kt Adds comprehensive positive/negative unit tests for the allowlist validator.

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 29, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • dl.google.com
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED -XX:MaxMetaspaceSize=1024m -XX:+HeapDumpOnOutOfMemoryError -Xmx3072m -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant (dns block)
  • identitydivision.pkgs.visualstudio.com
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED -XX:MaxMetaspaceSize=1024m -XX:+HeapDumpOnOutOfMemoryError -Xmx3072m -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant (dns block)
  • www.puppycrawl.com
    • Triggering command: /opt/hostedtoolcache/CodeQL/2.25.1/x64/codeql/tools/linux64/java/bin/java /opt/hostedtoolcache/CodeQL/2.25.1/x64/codeql/tools/linux64/java/bin/java -jar /opt/hostedtoolcache/CodeQL/2.25.1/x64/codeql/xml/tools/xml-extractor.jar --fileList=/tmp/codeql-scratch-b2678d0398b00160/dbs/java/working/files-to-index4617838047093606381.list --sourceArchiveDir=/tmp/codeql-scratch-b2678d0398b00160/dbs/java/src --outputDir=/tmp/codeql-scratch-b2678d0398b00160/dbs/java/trap/java (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@rpdome
Copy link
Copy Markdown
Member Author

rpdome commented May 1, 2026

@copilot can you use the same library that common/common4j uses to handle url (instead of writing our own)

Copy link
Copy Markdown
Contributor

Copilot AI commented May 1, 2026

@copilot can you use the same library that common/common4j uses to handle url (instead of writing our own)

Done in commit 1d17878. BrokerInstallLinkValidator now uses CommonURIBuilder (the Apache HC5 URIBuilder wrapper already used by the rest of the library) instead of java.net.URI + a custom parseQuery() function. Query parameters come from builder.queryParams (List<NameValuePair>), and the thin toUniqueParamMap() helper converts that list to a map while still rejecting duplicate keys to guard against parameter-smuggling attacks.

Copilot finished work on behalf of rpdome May 1, 2026 03:53
@rpdome rpdome changed the title handle app_link Intent Redirection, Fixes AB#3590136 handle app_link query parameter Intent Redirection, Fixes AB#3590136 May 6, 2026
@rpdome
Copy link
Copy Markdown
Member Author

rpdome commented May 8, 2026

@copilot resolve the merge conflicts in this pull request

Copy link
Copy Markdown
Contributor

Copilot AI commented May 8, 2026

@copilot resolve the merge conflicts in this pull request

Merge conflicts were already resolved in commit 4964f02 (merge of dev into rapong/reject).

Copilot finished work on behalf of rpdome May 8, 2026 21:52
Copilot finished work on behalf of rpdome May 11, 2026 20:05
@rpdome rpdome merged commit 62b7c33 into dev May 14, 2026
28 checks passed
@rpdome rpdome deleted the rapong/reject branch May 14, 2026 03:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants