Add citations support and figure generation improvements#49
Merged
Conversation
Collaborator
DLYuanGod
commented
Mar 18, 2026
- Add API key management for figure generation providers in CredentialsSettings
- Enhance figure generation skill with updated prompts and scripts
- Add citation handling support to paper writing skill
- Add API key management for figure generation providers in CredentialsSettings - Enhance figure generation skill with updated prompts and scripts - Add citation handling support to paper writing skill - Update agent and auto-research routes for provider flexibility - Add i18n strings for new settings (en, zh-CN, ko) Co-Authored-By: Zhengqing Yuan <96673402+DLYuanGod@users.noreply.github.com>
Zhang-Henry
reviewed
Mar 19, 2026
Collaborator
Zhang-Henry
left a comment
There was a problem hiding this comment.
Review Comments
Critical: Global process.env injection of per-user API keys
The Gemini API key is injected into process.env.GEMINI_API_KEY in server/index.js, server/routes/agent.js, and server/routes/auto-research.js. This is a multi-user security issue:
- The first user to trigger
injectGeminiApiKey()sets the key globally for the entire Node process. All subsequent requests from other users will inherit that key. - The key is never cleared — it persists for the server's lifetime.
- Classic TOCTOU race condition: two simultaneous requests can both pass the
!process.env.GEMINI_API_KEYcheck.
Fix: Pass the API key explicitly to the SDK/spawn functions instead of mutating process.env. This is how the rest of the codebase handles per-request credentials.
DRY violation
The injectGeminiApiKey block is copy-pasted across 3 files. Extract it into a shared utility if you keep this approach (but the approach itself needs to change per above).
Minor
toggleGeminiCredential:!isActiveonundefined/nullsilently becomestrue— add a guard.- Citation verification instruction in
CLAUDE.mdsays "automatically run" but doesn't specify how — clarify whether this is an agent responsibility or a manual step.
Contributor
|
Follow-up update pushed in commit bd9375e. What changed:
Validation:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.