Skip to content

feat: Add MCP secret scrubbing and optional sync#16

Merged
iHildy merged 2 commits intomainfrom
feat/mcp-secret-sync
Dec 31, 2025
Merged

feat: Add MCP secret scrubbing and optional sync#16
iHildy merged 2 commits intomainfrom
feat/mcp-secret-sync

Conversation

@iHildy
Copy link
Owner

@iHildy iHildy commented Dec 31, 2025

Summary

Introduce MCP secret scrubbing and optional commit of MCP secrets in private repos. Add includeMcpSecrets flag and wiring through config, tooling, and tests.

Changes

  • Add src/sync/mcp-secrets.ts with MCP secret extraction logic
  • Add src/sync/mcp-secrets.test.ts and extend config tests for new behavior
  • Extend config types: includeMcpSecrets in SyncConfig, normalization via normalizeSyncConfig, and new helper canCommitMcpSecrets
  • Wire MCP secrets scrubbing into the local-to-repo sync path in src/sync/apply.ts
  • Extend src/sync/service.ts and src/index.ts to support enabling secrets with includeMcpSecrets
  • Update status logging to reflect MCP secrets setting
  • Update docs: README, src/command/sync-init.md, src/command/sync-enable-secrets.md to mention MCP secrets option

Testing

  • Run unit tests: bun test (or mise run test)
  • Verify that with includeSecrets and includeMcpSecrets enabled, MCP secrets are moved to local overrides and replaced with env placeholders in opencode-synced.overrides.jsonc and synced config contains placeholders
  • Review tests for MCP secret extraction (bearer headers, OAuth client secrets) to ensure correct env-var naming and placeholders

@iHildy iHildy changed the title Add MCP secret scrubbing and optional sync feat: Add MCP secret scrubbing and optional sync Dec 31, 2025
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @iHildy, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the security and flexibility of opencode-synced by implementing automatic scrubbing of MCP (Multi-Cloud Provider) secrets. It ensures that sensitive API keys and OAuth client secrets found in opencode.json(c) are not inadvertently committed to repositories. Instead, these secrets are moved to a local-only overrides file and replaced with environment variable placeholders in the synced configuration. For private repositories, a new includeMcpSecrets flag provides an explicit opt-in mechanism to allow these secrets to be committed, offering granular control over sensitive data. The changes involve new utility functions for secret extraction, updates to the configuration and sync service, and comprehensive documentation to guide users on this new behavior.

Highlights

  • MCP Secret Scrubbing: Automatically extracts MCP (Multi-Cloud Provider) secrets from opencode.json(c) files, moves them to local overrides (opencode-synced.overrides.jsonc), and replaces them with {env:...} placeholders in the synced configuration.
  • Optional Secret Commitment: Introduces a new configuration flag, includeMcpSecrets, which, when enabled alongside includeSecrets, allows MCP secrets to be committed to private repositories.
  • New Core Logic: Adds src/sync/mcp-secrets.ts containing the core logic for identifying, extracting, and sanitizing MCP secrets, along with utility functions for environment variable naming.
  • Enhanced Configuration & Service: Extends the SyncConfig interface, normalizeSyncConfig function, and SyncService methods to support the new includeMcpSecrets flag and integrate the secret scrubbing process into the local-to-repo sync path.
  • Documentation Updates: Updates README.md and command documentation (sync-init.md, sync-enable-secrets.md) to clearly explain the new MCP secret handling, scrubbing rules, and the includeMcpSecrets option.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a valuable security feature for scrubbing MCP secrets from configuration files before syncing them to a repository. The implementation is well-structured, with the core logic for secret extraction isolated in a new mcp-secrets.ts module, complete with unit tests. The new functionality is correctly wired into the existing sync service, CLI, and configuration handling. The documentation has also been updated accordingly. My review includes one suggestion to make the secret scrubbing logic more robust.

@jules-relay
Copy link

jules-relay bot commented Dec 31, 2025

🤖 Review Jules Relay

I found 1 Gemini suggestion so far.

Type /relay batch to send all suggestions to Jules.

@iHildy iHildy merged commit 7ab9dfb into main Dec 31, 2025
3 checks passed
@iHildy iHildy deleted the feat/mcp-secret-sync branch December 31, 2025 14:53
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.

1 participant