-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Add support for setting source trust level #4216
Conversation
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure that StoreOrigin
should even be exposed. It doesn't really hurt anything directly, but I also don't foresee anyone using it (except us for testing). My expectation is only that it causes confusion. I would suggest that it be supported but undocumented (including in the argument description and error messages).
src/AppInstallerRepositoryCore/Public/winget/RepositorySource.h
Outdated
Show resolved
Hide resolved
src/AppInstallerRepositoryCore/Public/winget/RepositorySource.h
Outdated
Show resolved
Hide resolved
|
||
// Trust level is represented as an array of trust level strings since there can be multiple flags set. | ||
int i = 0; | ||
for (std::string entry : TrustLevel) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: There is a for
loop syntax that is designed just for this...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤦
@@ -357,7 +357,8 @@ namespace AppInstaller::Settings | |||
json["Explicit"] = Explicit; | |||
|
|||
// Trust level is represented as an array of trust level strings since there can be multiple flags set. | |||
for (int i = 0; i < TrustLevel.size(); ++i) | |||
int trustLevelLength = static_cast<int>(TrustLevel.size()); | |||
for (int i = 0; i < trustLevelLength; ++i) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: The better solution is generally to use size_t i
.
Is this the fix for #4046 (installations from REST sources hanging indefinitely due to MotW)? |
@jantari, yes, this work will accrue to unblocking the hang. |
Summary:
This PR adds support for specifying the trust level and making a source explicit when adding a new source. If a source is
explicit
, the source will not be discoverable unless explictly declared when searching for a package. i.e.winget search foo.bar --source explicitSource
--trust-level 'trusted|storeOrigin
winget source list
will also show their current state. The only way to remove the trust level or explicit state is by removing the source entirely.Added unit and E2E tests to verify these behaviors.
Microsoft Reviewers: Open in CodeFlow