mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-24 12:04:56 -07:00
fix(core): whitelist TERM and COLORTERM in environment sanitization (#20514)
Co-authored-by: Sri Pasumarthi <sripas@google.com> Co-authored-by: Sri Pasumarthi <111310667+sripasg@users.noreply.github.com>
This commit is contained in:
@@ -32,6 +32,29 @@ describe('sanitizeEnvironment', () => {
|
||||
expect(sanitized).toEqual(env);
|
||||
});
|
||||
|
||||
it('should allow TERM and COLORTERM environment variables', () => {
|
||||
const env = {
|
||||
TERM: 'xterm-256color',
|
||||
COLORTERM: 'truecolor',
|
||||
};
|
||||
const sanitized = sanitizeEnvironment(env, EMPTY_OPTIONS);
|
||||
expect(sanitized).toEqual(env);
|
||||
});
|
||||
|
||||
it('should preserve TERM and COLORTERM even in strict sanitization mode', () => {
|
||||
const env = {
|
||||
GITHUB_SHA: 'abc123',
|
||||
TERM: 'xterm-256color',
|
||||
COLORTERM: 'truecolor',
|
||||
SOME_OTHER_VAR: 'value',
|
||||
};
|
||||
const sanitized = sanitizeEnvironment(env, EMPTY_OPTIONS);
|
||||
expect(sanitized).toEqual({
|
||||
TERM: 'xterm-256color',
|
||||
COLORTERM: 'truecolor',
|
||||
});
|
||||
});
|
||||
|
||||
it('should allow variables prefixed with GEMINI_CLI_', () => {
|
||||
const env = {
|
||||
GEMINI_CLI_FOO: 'bar',
|
||||
|
||||
Reference in New Issue
Block a user