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

fix: logout credentials cleanup #2670

Merged

Conversation

avallete
Copy link
Member

@avallete avallete commented Sep 10, 2024

What kind of change does this PR introduce?

  • Import the zalando/go-keyring into our codebase to extend it with a DeleteAll method, removing all credentials associated with a service
  • Remove all "Supabase CLI" credentials on user logout

What is the current behavior?

Linked projects credentials stay within the keychain even after logout.

Fixes #2594

Additional context

I'm pretty sure there might be a cleaner method in go to just "extend" the "zalando/go-keyring" module, instead of importing it as a whole. I think I could do some refactoring if pointed in the right direction for that. In the meantime, this allowed me to test the new behavior on OSX.

TODO: Test on Linux and Windows

@avallete avallete force-pushed the avallete/fix-logout-credentials-cleanup branch from 3869f28 to 173f861 Compare September 10, 2024 16:37
@avallete avallete marked this pull request as ready for review September 10, 2024 16:40
@avallete avallete requested a review from a team as a code owner September 10, 2024 16:40
@coveralls
Copy link

coveralls commented Sep 10, 2024

Pull Request Test Coverage Report for Build 10849056342

Details

  • 48 of 68 (70.59%) changed or added relevant lines in 9 files are covered.
  • 5 unchanged lines in 1 file lost coverage.
  • Overall coverage increased (+0.03%) to 60.091%

Changes Missing Coverage Covered Lines Changed/Added Lines %
internal/utils/flags/db_url.go 0 1 0.0%
internal/logout/logout.go 1 3 33.33%
internal/utils/credentials/store.go 8 12 66.67%
internal/utils/credentials/store_mock.go 31 44 70.45%
Files with Coverage Reduction New Missed Lines %
internal/gen/keys/keys.go 5 12.9%
Totals Coverage Status
Change from base Build 10848295662: 0.03%
Covered Lines: 6443
Relevant Lines: 10722

💛 - Coveralls

internal/utils/credentials/store.go Outdated Show resolved Hide resolved
internal/utils/credentials/store.go Outdated Show resolved Hide resolved
Copy link
Contributor

@sweatybridge sweatybridge left a comment

Choose a reason for hiding this comment

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

LGTM. We might refactor this code further once upstream supports DeleteAll.

internal/utils/credentials/store.go Outdated Show resolved Hide resolved
internal/logout/logout_test.go Outdated Show resolved Hide resolved
internal/utils/credentials/store_mock.go Outdated Show resolved Hide resolved
internal/logout/logout.go Outdated Show resolved Hide resolved
@avallete
Copy link
Member Author

Thank you for the thorough review and valuable feedback! I've made the suggested changes.

@sweatybridge sweatybridge merged commit 230be7f into supabase:develop Sep 13, 2024
12 checks passed
@github-actions github-actions bot mentioned this pull request Sep 17, 2024
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.

Supabase CLI: Logout Does Not Restrict Access to Previously Linked Projects
3 participants