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

backend: add error variant for access denied, handle when diffing #3785

Merged
merged 2 commits into from
May 31, 2024

Conversation

martinvonz
Copy link
Member

@martinvonz martinvonz commented May 29, 2024

Checklist

If applicable:

  • I have updated CHANGELOG.md
  • I have updated the documentation (README.md, docs/, demos/)
  • I have updated the config schema (cli/src/config-schema.json)
  • I have added tests to cover my changes

@martinvonz martinvonz force-pushed the push-ktvkyyrulzom branch 5 times, most recently from 9741dcc to ae4f5f2 Compare May 29, 2024 19:07
Copy link
Collaborator

@PhilipMetzger PhilipMetzger left a comment

Choose a reason for hiding this comment

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

Some backends, like the one we have at Google, can restrict access to
certain files. For such files, if they return a regular
BackendError::ReadObject, then that will terminate iteration in many
cases (e.g. when diffing or listing files). This patch adds a new
error variant for them to return instead, plus handling of such errors
in diff output.

Happy to see this feature, as better ACLs is something I really want for the native backend.

lib/src/secret_backend.rs Outdated Show resolved Hide resolved
cli/tests/test_acls.rs Outdated Show resolved Hide resolved
lib/src/store.rs Outdated Show resolved Hide resolved
@martinvonz martinvonz force-pushed the push-ktvkyyrulzom branch from ae4f5f2 to e4d9e24 Compare May 29, 2024 23:57
cli/src/diff_util.rs Outdated Show resolved Hide resolved
cli/src/diff_util.rs Outdated Show resolved Hide resolved
Copy link
Collaborator

@PhilipMetzger PhilipMetzger left a comment

Choose a reason for hiding this comment

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

LG after addressing Yuya's nits.

@martinvonz martinvonz force-pushed the push-ktvkyyrulzom branch from e4d9e24 to a6aa6a6 Compare May 31, 2024 00:46
I'm going to add a similar message for access denied. That will want
an error message printed at the end. For consistency, let's do the
same for non-file paths.
@martinvonz martinvonz force-pushed the push-ktvkyyrulzom branch 4 times, most recently from 1480d70 to ff79a02 Compare May 31, 2024 01:13
@martinvonz martinvonz enabled auto-merge (rebase) May 31, 2024 01:16
Some backends, like the one we have at Google, can restrict access to
certain files. For such files, if they return a regular
`BackendError::ReadObject`, then that will terminate iteration in many
cases (e.g. when diffing or listing files). This patch adds a new
error variant for them to return instead, plus handling of such errors
in diff output and in the working copy.

In order to test the feature, I added a new commit backend that
returns the new `ReadAccessDenied` error when the caller tries to read
certain objects.
@martinvonz martinvonz force-pushed the push-ktvkyyrulzom branch from ff79a02 to 20816cf Compare May 31, 2024 01:18
@martinvonz martinvonz merged commit 404f31c into main May 31, 2024
16 checks passed
@martinvonz martinvonz deleted the push-ktvkyyrulzom branch May 31, 2024 01:27
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.

3 participants