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

Enable plugins to restrict non-Microsoft hosts #41

Merged
merged 2 commits into from
Mar 17, 2023

Conversation

EricJohnson327
Copy link
Contributor

@EricJohnson327 EricJohnson327 commented Mar 17, 2023

Summary of the pull request

Enable plugins to block COM clients that aren't approved Microsoft Dev Home plugin hosts.

References and relevant issues

#34

Detailed description of the pull request / Additional comments

Plugins can pass 'true' to RegisterPlugin() to restrict access to only approved Microsoft Dev Home plugin hosts. This works by querying the calling COM client for PackageFamilyName and comparing to a hardcoded list (currently Dev Home and Terminal). If the caller is not approved, plugin will return E_ACCESSDENIED.

Validation steps performed

Tested with local builds.

PR checklist

  • Closes #xxx
  • Tests added/passed
  • Documentation updated

src/Package.appxmanifest Outdated Show resolved Hide resolved
@EricJohnson327 EricJohnson327 merged commit f509d47 into main Mar 17, 2023
Comment on lines +111 to +121
switch (valueStr)
{
case "Microsoft.Windows.DevHome_8wekyb3d8bbwe\0":
case "Microsoft.WindowsTerminal\0":
case "Microsoft.WindowsTerminal_8wekyb3d8bbwe\0":
case "WindowsTerminalDev_8wekyb3d8bbwe\0":
case "Microsoft.WindowsTerminalPreview_8wekyb3d8bbwe\0":
return true;
default:
return false;
}
Copy link
Member

Choose a reason for hiding this comment

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

replace with: starts with "Microsoft." ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We don't necessarily want any Microsoft app to have access (even though it's likely safe). There are also things that could fall out of that pattern. "WindowsTerminalDev" is one of them. In theory, we can give access to hosts outside of Microsoft as well as long as we trust them to not do anything malicious.

Ideally, this code all goes away and we use Custom Capabilities or something else more established than this. Unfortunately, Custom Capabilities look like they no longer work as expected...

@EricJohnson327 EricJohnson327 deleted the user/ejohn/blockUnknownHosts branch March 17, 2023 22:12
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