Skip to content

feat(auth): add the "--purge" option to logout - #251

Merged
zeroshade merged 2 commits into
mainfrom
purge-auth-creds
Jan 20, 2026
Merged

feat(auth): add the "--purge" option to logout#251
zeroshade merged 2 commits into
mainfrom
purge-auth-creds

Conversation

@zeroshade

Copy link
Copy Markdown
Member

Add a --purge option to dbc auth logout which will delete the entire credentials dir (including the columnar.lic and credentials.toml files).

Also, it appears that the auth subcommands were not in the autocompletion scripts so this also adds the appropriate completions.

@amoeba amoeba left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good. One comment.

Comment thread auth/credentials.go Outdated
}

func PurgeCredentials() error {
return os.RemoveAll(filepath.Dir(credPath))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think it's okay to not get too paranoid about this line of code since, while credPath can be overridden by the user with env var, we always append multiple subdirs to it so even a path traversal attack would be less successful. Thoughts?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

+1, it'd be safer to delete specific files by name

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

How's the updated version?

@amoeba amoeba left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks. That's probably good enough.

@zeroshade
zeroshade merged commit 6654979 into main Jan 20, 2026
15 of 18 checks passed
@zeroshade
zeroshade deleted the purge-auth-creds branch January 20, 2026 18:17
@ianmcook

Copy link
Copy Markdown
Member

A simple test would be nice. I'm worried that we'll add more files to this location later then forget to have the --purge implementation remove them. @zeroshade can you add a simple test that would catch this?

zeroshade added a commit that referenced this pull request Apr 17, 2026
Add a `--purge` option to `dbc auth logout` which will delete the entire
credentials dir (including the `columnar.lic` and `credentials.toml`
files).

Also, it appears that the auth subcommands were not in the
autocompletion scripts so this also adds the appropriate completions.
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