Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Reading Zotero API key at startup causes safe storage prompt in Positron #659

Open
jmcphers opened this issue Feb 11, 2025 · 1 comment
Open
Labels

Comments

@jmcphers
Copy link
Collaborator

With the Quarto extension enabled, opening a new Positron window will always result in a prompt like this one, unless you've already granted Positron access to safe storage.

Image

This happens in part because the Quarto extension attempts to access safe storage when the extension starts; when we initialize Zotero as part of extension activation, this happens:

async function safeReadZoteroApiKey(context: ExtensionContext) {
try {
return await context.secrets.get(kQuartoZoteroWebApiKey);
} catch (error) {
console.log("Error reading zotero api key");
return undefined;
}
}

Unfortunately just checking for a key in safe storage is enough to trigger an access that results in a prompt. This is unavoidable if we really do need to read a secret, but in most cases we don't. Could we load this API key lazily so the user doesn't get prompted until we use the key, and/or store out-of-band a marker indicating whether there is an API key to read (so we don't hit the storage service unnecessarily when there isn't one)?

@mcanouil
Copy link
Contributor

What is possible for sure is to limit this behaviour to only happen if a Quarto document (or Jupyter Notebook) is opened, or even active in the editor view.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants