bazelbuild / intellij

IntelliJ plugin for Bazel projects
https://ij.bazel.build/
Apache License 2.0
752 stars 296 forks source link

trusted project: respect intellij settings controlling project trustness #6521

Closed ujohnny closed 1 week ago

ujohnny commented 1 week ago

Checklist

Please note that the maintainers will not be reviewing this change until all checkboxes are ticked. See the Contributions section in the README for more details.

Discussion thread for this change

Issue number: <please reference the issue number or url here>

Description of this change

Do not show dialogs to trust if trust checks are disabled in the intellij platform. Project creation code is handled in a custom way in bazel plugin because any project is trusted by default in intellij. However, bazel plugin always creates a fake project in .cl/ij/aswb folder, so the plugin should handle trust checks by itself.

mai93 commented 1 week ago

is this related to https://github.com/bazelbuild/intellij/issues/6490?

tpasternak commented 1 week ago

is this related to #6490?

yes it is

brian-mcnamara commented 1 week ago

Thanks! It may be worth checking @tpasternak if TrustedProjects should come out of Internal status, most of this function could be replaced by other methods in that class

tpasternak commented 1 week ago

Thanks! It may be worth checking @tpasternak if TrustedProjects should come out of Internal status, most of this function could be replaced by other methods in that class

Sorry I don't understand

brian-mcnamara commented 1 week ago

Thanks! It may be worth checking @tpasternak if TrustedProjects should come out of Internal status, most of this function could be replaced by other methods in that class

Sorry I don't understand

Right now https://github.com/JetBrains/intellij-community/blob/master/platform/platform-impl/src/com/intellij/ide/trustedProjects/TrustedProjects.kt#L14 is marked internal, however the logic in this repo could also use getProjectTrustedState as well. I'm just unsure if this project prefers not to use internal apis

mai93 commented 1 week ago

do we need to add a similar check to BazelGuard https://github.com/bazelbuild/intellij/blob/master/base/src/com/google/idea/blaze/base/execution/BazelGuard.java#L31?

brian-mcnamara commented 1 week ago

do we need to add a similar check to BazelGuard https://github.com/bazelbuild/intellij/blob/master/base/src/com/google/idea/blaze/base/execution/BazelGuard.java#L31?

We do not have any extensions for that EP so we do not need a check there to fix this issue.

ujohnny commented 1 week ago

do we need to add a similar check to BazelGuard

no because it does not ask for trust.

is marked internal, however the logic in this repo could also use getProjectTrustedState as well. I'm just unsure if this project prefers not to use internal apis

We can't use getProjectTrustedState because we don't have a project yet. It's all because plugin creates a "fake" project in ijwb/clwb and all created projects are trusted by default. So because of this custom behavior in bazel plugin we have to ask explicitly in TrustAwareProjectCreator.

ujohnny commented 1 week ago

I checked this with gateway and I do not observe trust dialogs, so I'm moving forward to merge

tpasternak commented 3 days ago

@mai93 @ujohnny can we cut a hotfix release with this change?

mai93 commented 3 days ago

released in version 2024.06.04.0.3