Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not attempt post install ARP correlation if PackageFamilyName is provided and present for the user #3391

Merged
merged 8 commits into from
Jul 6, 2023

Conversation

JohnMcPMS
Copy link
Member

@JohnMcPMS JohnMcPMS commented Jun 29, 2023

Change

We had the case of an EXE installer that would install an MSI on lower OS versions and an MSIX on higher ones. This change attempts to improve the correlation experience as best as we can, although given the current greedy correlation strategy this requires some careful work in the manifest construction. Even then you can't get the best case results, but this allows more options. By changing the package name slightly, one can give up matching pre-existing installs of the MSI in exchange for detecting that the MSIX has been uninstalled outside of winget.

The simple change is to not attempt the confidence interval-based correlation after installing an installer that has a PackageFamilyName value present, when that family name is found to be registered for the user.

Validation

A new E2E test is added that recreates the targeted flow.

Microsoft Reviewers: codeflow:open?pullrequest=#3391

Url: https://localhost:5001/TestKit/AppInstallerTestExeInstaller/AppInstallerTestExeInstaller.exe
Sha256: <EXEHASH>
InstallerType: exe
PackageFamilyName: 6c6338fe-41b7-46ca-8ba6-b5ad5312bb0e_8wekyb3d8bbwe
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this the intended way of doing the correlation? I thought that's what the AppsAndFeaturesEntries were for, so that the different InstallerType could be specified. In fact, this isn't the first time I've seen the issue where an exe installs MSIX packages -

If this is the intended way, that's great, I would only ask that it be documented somewhere that the PackageFamilyName may be used for correlation even though it is outside of the AppsAndFeaturesEntries, since based on the current manifest documentation, I would have thought that it wouldn't be used. And then, since the package behaves differently based on the OS Version, that there would be an installer node for each MinimumOSVersion that has a unique AppsAndFeaturesEntries to make the correlation unambiguous.

Copy link
Member Author

Choose a reason for hiding this comment

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

AppsAndFeaturesEntries is for the Add/Remove Programs data in the Uninstall registry key. It doesn't contain the package family name:

"AppsAndFeaturesEntry": {
"type": "object",
"properties": {
"DisplayName": {
"type": [ "string", "null" ],
"minLength": 1,
"maxLength": 256,
"description": "The DisplayName registry value"
},
"Publisher": {
"type": [ "string", "null" ],
"minLength": 1,
"maxLength": 256,
"description": "The Publisher registry value"
},
"DisplayVersion": {
"type": [ "string", "null" ],
"minLength": 1,
"maxLength": 128,
"description": "The DisplayVersion registry value"
},
"ProductCode": {
"$ref": "#/definitions/ProductCode"
},
"UpgradeCode": {
"$ref": "#/definitions/ProductCode"
},
"InstallerType": {
"$ref": "#/definitions/InstallerType"
}
},
"description": "Various key values under installer's ARP entry"
},

Yes, the WinApp SDK / Runtime is what caused us to open that value up to installer types that were not definitely MSIX based. Where would you suggest that it be documented that Installer > PackageFamilyName be used when an MSIX is installed?

The OS version targeting portion is relevant to the real manifest in question, not the test one. I don't think it should be necessary if we can help it though.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, I see, that clarifies things. I think it can be documented at pkgs in the manifest docs; I can do that after this is merged.

Thank you for the explanation!

@JohnMcPMS
Copy link
Member Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@JohnMcPMS JohnMcPMS marked this pull request as ready for review July 5, 2023 20:26
@JohnMcPMS JohnMcPMS requested a review from a team as a code owner July 5, 2023 20:26
@@ -691,6 +691,15 @@ namespace AppInstaller::CLI::Workflow
return;
}

// If the installer claims to have a PackageFamilyName, and that family name is currently registered for the user,
// let that be the correlated item and skip any attempt at further ARP correlation.
auto installer = context.Get<Execution::Data::Installer>();
Copy link
Contributor

Choose a reason for hiding this comment

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

nit const auto& to avoid a copy?

Copy link
Member Author

Choose a reason for hiding this comment

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

The fact that auto doesn't preserve the reference in the type constantly escapes my brain, no matter how many times I relearn it...

yao-msft
yao-msft previously approved these changes Jul 5, 2023
yao-msft
yao-msft previously approved these changes Jul 5, 2023
yao-msft
yao-msft previously approved these changes Jul 5, 2023
@JohnMcPMS JohnMcPMS merged commit aeb5284 into microsoft:master Jul 6, 2023
@JohnMcPMS JohnMcPMS deleted the ifpfn-noarpcorr branch July 6, 2023 17:55
JohnMcPMS added a commit that referenced this pull request Jul 6, 2023
…rovided and present for the user (#3391)

The simple change is to not attempt the confidence interval-based correlation after installing an installer that has a `PackageFamilyName` value present, when that family name is found to be registered for the user.
ryfu-msft pushed a commit that referenced this pull request Jul 10, 2023
…rovided and present for the user (#3391)

The simple change is to not attempt the confidence interval-based correlation after installing an installer that has a `PackageFamilyName` value present, when that family name is found to be registered for the user.
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.

4 participants