fix(core): whitelist TERM and COLORTERM in environment sanitization#21473
fix(core): whitelist TERM and COLORTERM in environment sanitization#21473
Conversation
Terminal editors (vim, emacs) and interactive commands (top) fail when these variables are redacted. They are safe to pass through as they only describe terminal capabilities. Fixes #20444
Summary of ChangesHello, 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 enhances the system's compatibility with terminal-based tools by ensuring essential environment variables are preserved during process execution. By allowing Highlights
Changelog
Activity
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
Code Review
This pull request correctly whitelists the TERM and COLORTERM environment variables, which is crucial for compatibility with terminal-based tools. The changes are straightforward and include corresponding tests. The suggested improvement to one of the new tests to make it more robust has been retained as it aligns with general good testing practices and is not contradicted by any specific rules.
|
Size Change: +146 B (0%) Total Size: 26 MB ℹ️ View Unchanged
|
|
The original PR is by @deadsmash07 - here #20514 Thank you @deadsmash07 - but collaboration from maintainers a bit unwieldy with a PR request from a different cloned repo. |
|
This is not required. I opened it assuming it would be weird to push via cloned repo. It isn't 😊 |
[original author - @deadsmash07 - from PR - 20514]
Summary
TERMandCOLORTERMtoALWAYS_ALLOWED_ENVIRONMENT_VARIABLESin the environment sanitization servicesandbox.ts), so this aligns the sanitization behaviorDetails
Terminal-based editors fail to initialize ("Terminal type not defined") and interactive commands default to no-color mode because
TERMandCOLORTERMare stripped during environment sanitization. This change simply whitelists them so they pass through to spawned processes unchanged — no fallback values are introduced.Related Issues
Fixes #20444
How to Validate
EDITOR=vimorEDITOR=emacstopvia shell command and verify color support worksPre-Merge Checklist
npm run