Skip to content

Add authentication APP-7384#10

Merged
ivpusic merged 1 commit into
cli_cifrom
authenticate
Mar 3, 2026
Merged

Add authentication APP-7384#10
ivpusic merged 1 commit into
cli_cifrom
authenticate

Conversation

@ivpusic
Copy link
Copy Markdown
Member

@ivpusic ivpusic commented Mar 2, 2026

Persistent authentication based on ~/.config/dune directory

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 2, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Member Author

ivpusic commented Mar 2, 2026

@ivpusic ivpusic changed the title Add authentication Add authentication APP-7384 Mar 3, 2026
@ivpusic ivpusic marked this pull request as ready for review March 3, 2026 08:51
@linear
Copy link
Copy Markdown

linear Bot commented Mar 3, 2026

APP-7384 Dune CLI persistent authentication

Stored in the home directory

@cursor
Copy link
Copy Markdown

cursor Bot commented Mar 3, 2026

PR Summary

Medium Risk
Adds a new persisted credential store and changes how all commands resolve API keys; incorrect config handling or permissions could block CLI usage or expose keys if misconfigured.

Overview
Adds persistent authentication by introducing an authconfig package that saves/loads an API key from ~/.config/dune/config.yaml (YAML) with restrictive permissions (dir 0700, file 0600).

Introduces a new dune auth command that captures an API key from --api-key, DUNE_API_KEY, or an interactive prompt and writes it to disk.

Updates the root command’s auth setup to skip client initialization for commands annotated with skipAuth (used by auth) and to fall back to the saved config when neither --api-key nor env vars are provided, with clearer error messages for missing/empty/malformed config. Adds gopkg.in/yaml.v3 dependency and accompanying tests for config IO and root/auth behavior.

Written by Cursor Bugbot for commit a7a9da3. Configure here.

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is ON. A cloud agent has been kicked off to fix the reported issue.

Comment @cursor review or bugbot run to trigger another review on this PR

Comment thread authconfig/authconfig.go Outdated
Comment thread authconfig/authconfig.go
if err != nil {
return "", err
}
return filepath.Join(home, ".config", "dune"), nil
Copy link
Copy Markdown
Collaborator

@norbertdurcansk norbertdurcansk Mar 3, 2026

Choose a reason for hiding this comment

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

Nit: I think tools usually use this path, wdyt ?
~/.toolname/config

~/.aws/config

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.

I think it's quite depends. checked the tools that I use, and they are more to the "convention" that is implemented here, eg: gh / github cli tool

@ivpusic ivpusic merged commit a4b2834 into cli_ci Mar 3, 2026
1 check passed
@ivpusic ivpusic deleted the authenticate branch March 6, 2026 11:44
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.

2 participants