Skip to content
Open
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
48 changes: 44 additions & 4 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ Run commands from this repository's root, not from `msal/`, `common/`, or the
parent android-complete checkout. The commands below use PowerShell on Windows;
on macOS/Linux use `./gradlew` with equivalent JDK, SDK, and feed configuration.

1. Use **JDK 17**, as configured in the
1. Use **JDK 21**, as configured for upgraded-branch validation in the
[MSAL PR pipeline](azure-pipelines/pull-request-validation/pr-msal.yml).
Set `JAVA_HOME` for the current shell. Use the checked-in wrapper
(Gradle 8.11.1), not a globally installed Gradle; check `.\gradlew.bat --version`.
(Gradle 9.3.1 / AGP 9.1.1), not a globally installed Gradle; check `.\gradlew.bat --version`.
Java 8 source/bytecode targets are not the required Gradle runtime.
2. Initialize the pinned Common submodule in a fresh checkout:

Expand All @@ -40,9 +40,11 @@ on macOS/Linux use `./gradlew` with equivalent JDK, SDK, and feed configuration.

Inspect existing submodule work before updating an established checkout.
Do not use `--remote` or change the submodule pin merely to make a build pass.
3. Install Android SDK platform 36 and the build tools required by
3. Install Android SDK platform 37 and the build tools required by
[version configuration](gradle/versions.gradle). Configure `ANDROID_HOME`
or an untracked root `local.properties` containing `sdk.dir`.
or an untracked root `local.properties` containing `sdk.dir`. The upgrade retains
targetSdk 36 and all existing minSdk values. Java/Kotlin bytecode remains at 1.8;
the library retains dev's Kotlin language/API 1.9 compatibility pin.
4. Obtain Packaging Read access to the NewAndroid feed configured in
[settings](settings.gradle) and [the root build](build.gradle).
Provision `ENV_VSTS_MVN_CRED_USERNAME` and `ENV_VSTS_MVN_CRED_ACCESSTOKEN`
Expand Down Expand Up @@ -94,8 +96,46 @@ These match the build/report/lint tasks and SDK used by the
[PR pipeline](azure-pipelines/pull-request-validation/pr-msal.yml).
SpotBugs requires assembled outputs; its task name comes from
[Common's template](common/azure-pipelines/templates/steps/spotbugs.yml).
Do not count `spotbugsLocalDebug NO-SOURCE` as a pass. Keep the assembly hooks
lazy with `tasks.configureEach`: `tasks.whenTaskAdded` eagerly realizes SpotBugs
6.5.8 tasks before AGP 9 registers their javac tasks, leaving analysis inputs
empty. Verify the SpotBugs task executes with nonempty compiled-class inputs;
inspect its findings or an explicitly enabled report, not just the build status.
XML reports are enabled for each SpotBugs variant under
`msal/build/reports/spotbugs/`; confirm the report has analyzed classes.
The [SpotBugs filter](config/spotbugs/exclude.xml) baselines reviewed findings by
class, method, and detector to preserve existing API and recovery behavior.
These deferred ownership, nullability, locking, and hardening findings are not
proof of safety. Keep new exclusions equally scoped; do not disable detectors
globally or copy another repository's baseline wholesale.
The analyzer also emits missing Android/JSON class diagnostics that were present
before the upgrade. A passing findings gate does not resolve that separate
analysis-classpath completeness limitation.
The coverage task depends on `testLocalDebugUnitTest` and fails if execution
data is missing. Do not publish a missing-data report as successful coverage.
The custom local/dist reports include AGP 9 built-in Kotlin outputs as well as
javac outputs. Inspect the XML for Kotlin classes, not just a successful task.

### Distribution and publication metadata

Source builds do not validate published Common compatibility. Separately run:

```powershell
.\gradlew.bat :msal:assembleDistRelease :msal:generatePomFileForMsalPublication "-PdistCommonVersion=<published-common-version>"
.\gradlew.bat :msal:jacocoDistTestReport :msal:assembleDistDebugAndroidTest "-PdistCommonVersion=<published-common-version>" "-PdistCommon4jVersion=<published-common4j-version>" -PcodeCoverageEnabled=true
```

These commands do not publish. Verify the generated POM has `aar` packaging and
the intended Common dependency. DIST configuration/assembly must also work in
a checkout without Common source; never move or overwrite a working submodule
to test this while another build is using it. The standalone golden examples
have their own legacy wrappers and consume published MSAL, not this source build;
they are not evidence of SDK source validation. The root sample is
`:testapps:testapp:assembleLocalDebug` (also test `assembleLocalRelease` for R8).
`:package-inspector:assembleDebug` is independent of Common. The optional
`:pop-benchmarker:assembleDebug` currently cannot select between Common's
local/dist variants; report that separately rather than selecting a flavor or
raising its minSdk as part of this upgrade.

### Network integration and UI-less E2E

Expand Down
11 changes: 6 additions & 5 deletions azure-pipelines/pull-request-validation/pr-msal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ stages:
displayName: 'Set VSTS Fields in Environment'
- template: azure-pipelines/templates/steps/automation-cert.yml@common
- task: JavaToolInstaller@0
displayName: Use Java 17
displayName: Use Java 21
inputs:
versionSpec: '17'
versionSpec: '21'
jdkArchitectureOption: x64
jdkSourceOption: PreInstalled
- task: CodeQL3000Init@0
Expand All @@ -65,7 +65,7 @@ stages:
tasks: clean msal:assembleLocal
publishJUnitResults: false
testResultsFiles: '**/build/test-results/TEST-*.xml'
jdkVersion: $(BuildParameters.jdkVersion)
jdkVersion: 1.21
jdkArchitecture: $(BuildParameters.jdkArchitecture)
sqGradlePluginVersion: 2.0.1
- task: CodeQL3000Finalize@0
Expand All @@ -74,7 +74,7 @@ stages:
inputs:
tasks: msal:jacocoTestReport -PcodeCoverageEnabled=true -ProbolectricSdkVersion=${{variables.robolectricSdkVersion}} -PmockApiUrl=$(MOCK_API_URL) -PnativeAuthConfigString=$(NATIVE_AUTH_CONFIG_STRING)
javaHomeSelection: $(BuildParameters.javaHomeSelection)
jdkVersion: 1.17
jdkVersion: 1.21
- template: azure-pipelines/templates/steps/collect-changed-files.yml@common
parameters:
outputDir: $(Build.SourcesDirectory)/msal/build/reports/jacoco/jacocoTestReport
Expand Down Expand Up @@ -149,6 +149,7 @@ stages:
- template: azure-pipelines/templates/steps/spotbugs.yml@common
parameters:
project: msal
javaVersion: "1.21"
- job: lint
displayName: Lint (PR)
cancelTimeoutInMinutes: 1
Expand All @@ -166,7 +167,7 @@ stages:
inputs:
tasks: clean msal:lintLocalDebug
publishJUnitResults: false
jdkVersion: 1.17
jdkVersion: 1.21
- template: azure-pipelines/code-coverage/compare-code-coverage.yml@common
parameters:
commonRepoAlias: common
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ name: $(date:yyyyMMdd)$(rev:.r)
trigger: none
variables:
- name: BuildParameters.jdkVersion
value: 1.17
value: 1.21
- name: BuildParameters.jdkArchitecture
value: x64

Expand Down Expand Up @@ -40,9 +40,9 @@ stages:
displayName: 'Set VSTS Fields in Environment'
- template: azure-pipelines/templates/steps/automation-cert.yml@common
- task: JavaToolInstaller@0
displayName: Use Java 17
displayName: Use Java 21
inputs:
versionSpec: '17'
versionSpec: '21'
jdkArchitectureOption: x64
jdkSourceOption: PreInstalled
- task: Gradle@2
Expand Down
2 changes: 1 addition & 1 deletion common
Submodule common updated 46 files
+4 −0 .github/copilot-instructions.md
+162 −0 AGENTS.md
+11 −10 LabApiUtilities/build.gradle
+4 −0 README.md
+5 −5 azure-pipelines/pull-request-validation/build-consumers.yml
+4 −4 azure-pipelines/pull-request-validation/common.yml
+14 −8 azure-pipelines/pull-request-validation/common4j.yml
+2 −2 azure-pipelines/pull-request-validation/lab-utilities.yml
+3 −3 azure-pipelines/templates/steps/continuous-delivery/assemble-publish-projversion.yml
+1 −1 azure-pipelines/templates/steps/spotbugs.yml
+2 −0 changelog.txt
+1 −1 common-java-root/gradle/wrapper/gradle-wrapper.properties
+6 −7 common-java-root/settings.gradle
+61 −14 common/build.gradle
+0 −4 common/src/androidTest/AndroidManifest.xml
+56 −4 common/src/main/java/com/microsoft/identity/common/internal/apps/AppRegistry.kt
+283 −9 common/src/test/java/com/microsoft/identity/common/internal/apps/AppRegistryTest.kt
+171 −0 common/src/test/java/com/microsoft/identity/common/internal/ui/webview/authux/AuthUxBridgeSessionTest.kt
+1 −1 common/src/test/java/com/microsoft/identity/common/internal/util/AndroidKeyStoreUtilTest.java
+63 −21 common4j/build.gradle
+9 −1 common4j/gradle/wrapper/gradle-wrapper.properties
+6 −0 common4j/src/main/com/microsoft/identity/common/java/flighting/CommonFlight.java
+16 −0 common4j/src/main/com/microsoft/identity/common/java/flighting/FlagType.kt
+23 −0 common4j/src/main/com/microsoft/identity/common/java/flighting/FlightMeta.kt
+4 −0 common4j/src/main/com/microsoft/identity/common/java/opentelemetry/SpanName.java
+61 −0 common4j/src/test/com/microsoft/identity/common/java/flighting/FlightMetaInteropTest.kt
+28 −0 common4j/src/test/com/microsoft/identity/common/java/util/ObjectMapperTest.java
+102 −0 common4j/src/test/com/microsoft/identity/common/java/util/ResultFutureTest.java
+77 −0 common4j/src/test/com/microsoft/identity/common/java/util/StringUtilTest.java
+54 −0 common4j/src/test/com/microsoft/identity/common/java/util/UrlUtilTest.java
+16 −0 config/spotbugs/exclude.xml
+48 −0 docs/premortem/_TEMPLATE.md
+5 −0 gradle.properties
+14 −6 gradle/versions.gradle
+1 −1 gradle/wrapper/gradle-wrapper.properties
+4 −2 keyvault/build.gradle
+4 −2 labapi/build.gradle
+6 −7 settings.gradle
+15 −8 testutils/build.gradle
+64 −0 tooling/flight-governance/README.md
+42 −0 tooling/flight-governance/build.gradle.kts
+231 −0 tooling/flight-governance/src/main/kotlin/com/microsoft/identity/tools/flightgovernance/FlightInventory.kt
+169 −0 tooling/flight-governance/src/main/kotlin/com/microsoft/identity/tools/flightgovernance/Main.kt
+176 −0 tooling/flight-governance/src/test/kotlin/com/microsoft/identity/tools/flightgovernance/FlightInventoryTest.kt
+80 −0 ...ing/flight-governance/src/test/kotlin/com/microsoft/identity/tools/flightgovernance/InventoryCommandTest.kt
+1 −1 uiautomationutilities/build.gradle
197 changes: 197 additions & 0 deletions config/spotbugs/exclude.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
<?xml version="1.0" encoding="UTF-8"?>
<FindBugsFilter>
<!-- Preserve existing shared-reference API behavior during the toolchain upgrade.
These are scoped compatibility baselines, not assertions that mutable ownership is safe.
Revisit ownership contracts before introducing defensive copies or immutable views. -->
<Match>
<Class name="com.microsoft.identity.client.Account" />
<Method name="getClaims" />
<Bug pattern="EI_EXPOSE_REP" />
</Match>
<Match>
<Class name="com.microsoft.identity.client.AcquireTokenParameters" />
<Method name="~^(getExtraQueryStringParameters|getExtraScopesToConsent)$" />
<Bug pattern="EI_EXPOSE_REP" />
</Match>
<Match>
<Class name="com.microsoft.identity.client.AcquireTokenParameters$Builder" />
<Method name="~^(withAuthorizationQueryStringParameters|withOtherScopesToAuthorize)$" />
<Bug pattern="EI_EXPOSE_REP2" />
</Match>
<Match>
<Class name="com.microsoft.identity.client.PublicClientApplication" />
<Method name="getConfiguration" />
<Bug pattern="EI_EXPOSE_REP" />
</Match>
<Match>
<Class name="com.microsoft.identity.client.PublicClientApplicationConfiguration" />
<Method name="~^(getAuthorities|getBrowserSafeList|getHttpConfiguration|getOAuth2TokenCache|getTelemetryConfiguration)$" />
<Bug pattern="EI_EXPOSE_REP" />
</Match>
<Match>
<Class name="com.microsoft.identity.client.PublicClientApplicationConfiguration" />
<Method name="setOAuth2TokenCache" />
<Bug pattern="EI_EXPOSE_REP2" />
</Match>
<Match>
<Class name="com.microsoft.identity.client.SignInParameters" />
<Method name="getScopes" />
<Bug pattern="EI_EXPOSE_REP" />
</Match>
<Match>
<Class name="com.microsoft.identity.client.SignInParameters" />
<Method name="setScopes" />
<Bug pattern="EI_EXPOSE_REP2" />
</Match>
<Match>
<Class name="com.microsoft.identity.client.TokenParameters" />
<Method name="~^(getAccountRecord|getScopes)$" />
<Bug pattern="EI_EXPOSE_REP" />
</Match>
<Match>
<Class name="com.microsoft.identity.client.TokenParameters" />
<Method name="setAccountRecord" />
<Bug pattern="EI_EXPOSE_REP2" />
</Match>
<Match>
<Class name="com.microsoft.identity.client.TokenParameters$Builder" />
<Method name="withScopes" />
<Bug pattern="EI_EXPOSE_REP2" />
</Match>
<Match>
<Class name="com.microsoft.identity.client.claims.ClaimsRequest" />
<Method name="~^(getAccessTokenClaimsRequested|getIdTokenClaimsRequested|getUserInfoClaimsRequested)$" />
<Bug pattern="EI_EXPOSE_REP" />
</Match>
<Match>
<Class name="com.microsoft.identity.client.claims.RequestedClaim" />
<Method name="getAdditionalInformation" />
<Bug pattern="EI_EXPOSE_REP" />
</Match>
<Match>
<Class name="com.microsoft.identity.client.claims.RequestedClaim" />
<Method name="setAdditionalInformation" />
<Bug pattern="EI_EXPOSE_REP2" />
</Match>
<Match>
<Class name="com.microsoft.identity.client.claims.RequestedClaimAdditionalInformation" />
<Method name="getValues" />
<Bug pattern="EI_EXPOSE_REP" />
</Match>
<Match>
<Class name="com.microsoft.identity.client.claims.RequestedClaimAdditionalInformation" />
<Method name="setValues" />
<Bug pattern="EI_EXPOSE_REP2" />
</Match>
<Match>
<Class name="com.microsoft.identity.client.exception.MsalDeclinedScopeException" />
<Method name="~^(getDeclinedScopes|getGrantedScopes|getSilentParametersForGrantedScopes)$" />
<Bug pattern="EI_EXPOSE_REP" />
</Match>
<Match>
<Class name="com.microsoft.identity.client.exception.MsalDeclinedScopeException" />
<Method name="&lt;init&gt;" />
<Bug pattern="EI_EXPOSE_REP2" />
</Match>
<Match>
<Class name="com.microsoft.identity.client.internal.AsyncResult" />
<Method name="getException" />
<Bug pattern="EI_EXPOSE_REP" />
</Match>
<Match>
<Class name="com.microsoft.identity.client.internal.AsyncResult" />
<Method name="&lt;init&gt;" />
<Bug pattern="EI_EXPOSE_REP2" />
</Match>

<!-- Returning the shared Logger is the purpose of getInstance(). -->
<Match>
<Class name="com.microsoft.identity.client.Logger" />
<Method name="getInstance" />
<Bug pattern="MS_EXPOSE_REP" />
</Match>

<!-- Defer local snapshots of nullable claims; do not suppress nullability checks elsewhere. -->
<Match>
<Class name="com.microsoft.identity.client.Account" />
<Method name="~^(getAuthority|getUsername)$" />
<Bug pattern="NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE" />
</Match>
<Match>
<Class name="com.microsoft.identity.client.TenantProfile" />
<Method name="getTenantId" />
<Bug pattern="NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE" />
</Match>
<Match>
<!-- Anonymous usernameMatcher implementation in PublicClientApplication. -->
<Class name="com.microsoft.identity.client.PublicClientApplication$23" />
<Method name="matches" />
<Bug pattern="NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE" />
</Match>
<Match>
<Class name="com.microsoft.identity.client.internal.CommandParametersAdapter" />
<Method name="getUsername" />
<Bug pattern="NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE" />
</Match>

<!-- Lombok emits defensive null checks in generated equals/hashCode for non-null fields. -->
<Match>
<Class name="com.microsoft.identity.client.SignInParameters" />
<Method name="~^(equals|hashCode)$" />
<Bug pattern="RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE" />
</Match>

<!-- Preserve redirect-validation and malformed-account-cache recovery behavior. -->
<Match>
<Class name="com.microsoft.identity.client.PublicClientApplicationConfiguration" />
<Method name="hasSchemeAndAuthority" />
<Bug pattern="DCN_NULLPOINTER_EXCEPTION" />
</Match>
<Match>
<!-- GetCurrentAccountCommand callback in getCurrentAccountAsyncInternal. -->
<Class name="com.microsoft.identity.client.SingleAccountPublicClientApplication$1$1" />
<Method name="onTaskCompleted" />
<Bug pattern="DCN_NULLPOINTER_EXCEPTION" />
</Match>

<!-- Defer Logger constructor visibility and synchronization changes to a compatibility review. -->
<Match>
<Class name="com.microsoft.identity.client.Logger" />
<Method name="&lt;init&gt;" />
<Bug pattern="SING_SINGLETON_HAS_NONPRIVATE_CONSTRUCTOR" />
</Match>
<Match>
<Class name="com.microsoft.identity.client.Logger" />
<Method name="~^(removeExternalLogger|setExternalLogger)$" />
<Bug pattern="USO_UNSAFE_METHOD_SYNCHRONIZATION" />
</Match>

<!-- Defer finalizer hardening; preserve constructor validation and subclassing compatibility. -->
<Match>
<Class name="com.microsoft.identity.client.MsalChromeCustomTabManager" />
<Method name="&lt;init&gt;" />
<Bug pattern="CT_CONSTRUCTOR_THROW" />
</Match>
<Match>
<Class name="com.microsoft.identity.client.PublicClientApplication" />
<Method name="&lt;init&gt;" />
<Bug pattern="CT_CONSTRUCTOR_THROW" />
</Match>
<Match>
<Class name="com.microsoft.identity.client.SignInParameters" />
<Method name="&lt;init&gt;" />
<Bug pattern="CT_CONSTRUCTOR_THROW" />
</Match>
<Match>
<Class name="com.microsoft.identity.client.exception.MsalUnsupportedBrokerException" />
<Method name="&lt;init&gt;" />
<Bug pattern="CT_CONSTRUCTOR_THROW" />
</Match>

<!-- Retain the existing Lombok null-check suppression for older analyzer compatibility. -->
<Match>
<Class name="com.microsoft.identity.client.exception.MsalUnsupportedBrokerException" />
<Method name="&lt;init&gt;" />
<Bug pattern="US_USELESS_SUPPRESSION_ON_METHOD" />
</Match>
</FindBugsFilter>
7 changes: 7 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ ariaTenantTokenTest="1e8435186fa849b28b1a402fb5074ff1-0b91a9ec-efad-440c-b92c-ac
android.useAndroidX=true
android.enableJetifier=true

# AGP 9 opt-out (STOPGAP, removed in AGP 10): restores the legacy DSL + Variant API
# (libraryVariants/applicationVariants) still used by common/build.gradle (output naming
# + per-variant Javadoc). Root gradle.properties governs the whole multi-project build,
# so this must live here (the copy in common/gradle.properties is not read as a subproject).
# Track migration to the androidComponents API before AGP 10.
android.newDsl=false

# https://office.visualstudio.com/Outlook%20Mobile/_wiki/wikis/Outlook-Mobile.wiki/3780/Android-Studio-Gradle-Performance-tips-and-tricks
org.gradle.parallel=true
org.gradle.daemon=true
Expand Down
18 changes: 11 additions & 7 deletions gradle/versions.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@
ext {
// SDK
minSdkVersion = 24
targetSdkVersion = 35
compileSdkVersion = 36
buildToolsVersion = "36.0.0"
targetSdkVersion = 36
compileSdkVersion = 37
buildToolsVersion = "37.0.0"

// Plugins
gradleVersion = '8.10.0'
kotlinVersion = '2.0.21'
// NOTE: 'gradleVersion' is the AGP (Android Gradle Plugin) version, NOT the Gradle
// wrapper version (that lives in gradle/wrapper/gradle-wrapper.properties = 9.3.1).
gradleVersion = '9.1.1'
// Kotlin 1.8.x has no Gradle 9 support (removed SelfResolvingDependency); AGP 9
// built-in Kotlin also needs KGP >= 2.2.10. Matches the upgraded common submodule.
kotlinVersion = '2.2.21'
spotBugsGradlePluginVersion = '4.7.1'
jupiterApiVersion = '5.6.0'

Expand Down Expand Up @@ -42,7 +46,7 @@ ext {
powerMockVersion = "2.0.9"
runnerVersion = "1.2.0"
rulesVersion = "1.2.0"
robolectricVersion = "4.14"
robolectricVersion = "4.16.1"
uiAutomatorVersion = "2.2.0"
daggerVersion = "2.31.2"
daggerCompilerVersion = "2.31.2"
Expand All @@ -67,7 +71,7 @@ ext {
yubikitAndroidVersion = "2.5.0"
yubikitPivVersion = "2.5.0"
powerliftAndroidVersion="1.0.3"
kotlinXCoroutinesVersion = "1.6.4"
kotlinXCoroutinesVersion = "1.9.0"
mockkVersion = "1.11.0"
mockitoKotlinVersion = "4.1.0"
androidxAnnotationVersion = "1.4.0"
Expand Down
Loading
Loading