Skip to content

Conversation

@skeshive
Copy link
Collaborator

@skeshive skeshive commented Jan 7, 2026

This commit introduces the ability to apply remote admin settings, ensuring any admin settings in local files do not get used. This PR is still a no-op since we don't fetch admin settings from CCPA yet but defaults will be enforced.

Changes include:

  • Added method to to update configuration based on remote inputs.
  • Modified to prioritize remote admin settings.
  • Moved authentication flow in to occur before sandbox entry to fetch remote settings.

Fixes: https://github.com/google-gemini/maintainers-gemini-cli/issues/1167

…file-based settings.

This commit introduces the ability to fetch and apply remote administration settings, ensuring they take precedence over any conflicting settings defined in local configuration files. This enhances centralized control and consistency across deployments.

Changes include:
- Added  method to  to update configuration based on remote inputs.
- Modified  to prioritize remote admin settings.
- Moved authentication flow in  to occur before sandbox entry to fetch remote settings.
- Updated related tests in , , and  to cover new remote admin functionality.
@skeshive skeshive requested a review from a team as a code owner January 7, 2026 22:59
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @skeshive, 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 lays the groundwork for centralized administrative control by enabling the application to consume and prioritize remote admin settings. It establishes a clear hierarchy where remote configurations override local file-based settings, ensuring consistent policy enforcement. The authentication flow has been strategically repositioned to facilitate the retrieval of these settings early in the application lifecycle, preparing the system for future integration with a central configuration management service, even though the actual fetching is currently a no-op.

Highlights

  • Remote Admin Settings Application: Introduced the ability to apply remote admin settings, ensuring local file-based admin settings are ignored in favor of remote configurations.
  • LoadedSettings Enhancement: Added a setRemoteAdminSettings method to the LoadedSettings class to update configuration based on remote inputs, and modified computeMergedSettings to prioritize these remote settings.
  • Authentication Flow Adjustment: Moved the authentication process in gemini.tsx to occur before sandbox entry, which is necessary to fetch remote settings from CCPA without interference from the sandbox environment.
  • Comprehensive Testing: Added new test cases in settings.test.ts to thoroughly validate the behavior of remote admin settings, including prioritization, merging logic, and handling of partial or undefined inputs.
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.

@github-actions
Copy link

github-actions bot commented Jan 7, 2026

Size Change: +1.12 kB (+0.01%)

Total Size: 22.3 MB

Filename Size Change
./bundle/gemini.js 22.3 MB +1.12 kB (+0.01%)
ℹ️ View Unchanged
Filename Size
./bundle/sandbox-macos-permissive-closed.sb 1.03 kB
./bundle/sandbox-macos-permissive-open.sb 890 B
./bundle/sandbox-macos-permissive-proxied.sb 1.31 kB
./bundle/sandbox-macos-restrictive-closed.sb 3.29 kB
./bundle/sandbox-macos-restrictive-open.sb 3.36 kB
./bundle/sandbox-macos-restrictive-proxied.sb 3.56 kB

compressed-size-action

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 logic to apply remote admin settings, ensuring local settings are ignored in favor of schema defaults and remote configurations. While this enhances centralized management, the current implementation has a high-severity vulnerability: the application blindly trusts remote settings without integrity checks, which could allow a Man-in-the-Middle attacker to disable security features. Furthermore, a critical issue in gemini.tsx causes fetched remote admin settings to be lost when the application relaunches into a sandbox, defeating the intended purpose of applying these settings.

Comment on lines +417 to 424
const remoteAdminSettings = partialConfig.getRemoteAdminSettings();
// Set remote admin settings if returned from CCPA.
if (remoteAdminSettings) {
settings.setRemoteAdminSettings(remoteAdminSettings);
}

// hop into sandbox if we are outside and sandboxing is enabled
if (!process.env['SANDBOX']) {
Copy link
Contributor

Choose a reason for hiding this comment

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

critical

There appears to be a critical issue with how remote admin settings are handled when sandboxing is enabled.

The remote admin settings are fetched and applied to the in-memory settings object at lines 417-421. However, immediately after, the application may be relaunched to enter a sandbox (inside the if (!process.env['SANDBOX']) block).

When the application is relaunched, it's a new process that starts execution from the main() function again. This new process calls loadSettings() (line 302), which re-initializes the settings from files. The in-memory changes made to the settings object in the parent process are lost.

The authentication logic that fetches the remote settings has been moved out of the sandboxed execution path, so the new process will not re-fetch them. Consequently, the sandboxed process will operate without the remote admin settings, which contradicts the goal of this pull request.

To fix this, the fetched remote settings need to be persisted across the process relaunch. This could be done by:

  1. Serializing the remote settings and passing them to the child process via an environment variable.
  2. Saving the remote settings to a temporary file that the child process can read on startup.

Given the importance of enforcing admin settings, this should be addressed before merging.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Agree this is an important consideration.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

hmm I might be missing something but this comment seems incorrect.

After we enter the sandbox, we would still hit lines 385 to 521 where the sandbox in-memory settings would be overwritten

@gemini-cli gemini-cli bot added the status/need-issue Pull requests that need to have an associated issue. label Jan 7, 2026
@skeshive skeshive requested a review from jacob314 January 8, 2026 20:21
@skeshive skeshive enabled auto-merge January 9, 2026 15:43
Copy link
Collaborator

@jacob314 jacob314 left a comment

Choose a reason for hiding this comment

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

lgtm

@skeshive skeshive added this pull request to the merge queue Jan 9, 2026
Merged via the queue into main with commit d74bf9e Jan 9, 2026
26 checks passed
@skeshive skeshive deleted the apply-remote-admin-controls branch January 9, 2026 22:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status/need-issue Pull requests that need to have an associated issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants