mirror of
https://github.com/microsoft/terminal.git
synced 2025-12-19 18:11:39 -05:00
Let folks disable OSC 52 (#18449)
This pull request introduces a new profile setting, `compatibility.allowOSC52`, which defaults to `true`. When disabled, it will not allow applications to write to the clipboard. Security-minded folks may choose to disable it.
This commit is contained in:
@@ -2373,11 +2373,6 @@
|
|||||||
"description": "When set to true, Windows Terminal will run in the background. This allows globalSummon and quakeMode actions to work even when no windows are open.",
|
"description": "When set to true, Windows Terminal will run in the background. This allows globalSummon and quakeMode actions to work even when no windows are open.",
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
},
|
},
|
||||||
"compatibility.allowDECRQCRA": {
|
|
||||||
"default": false,
|
|
||||||
"description": "When set to true, the terminal will support the DECRQCRA (Request Checksum of Rectangular Area) escape sequence.",
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"compatibility.textMeasurement": {
|
"compatibility.textMeasurement": {
|
||||||
"default": "graphemes",
|
"default": "graphemes",
|
||||||
"description": "This changes the way incoming text is grouped into cells. The \"graphemes\" option is the most modern and Unicode-correct way to do so, while \"wcswidth\" is a common approach on UNIX, and \"console\" replicates the way it used to work on Windows.",
|
"description": "This changes the way incoming text is grouped into cells. The \"graphemes\" option is the most modern and Unicode-correct way to do so, while \"wcswidth\" is a common approach on UNIX, and \"console\" replicates the way it used to work on Windows.",
|
||||||
@@ -2726,6 +2721,16 @@
|
|||||||
"description": "When set to true, when opening a new tab or pane it will get reloaded environment variables.",
|
"description": "When set to true, when opening a new tab or pane it will get reloaded environment variables.",
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
},
|
},
|
||||||
|
"compatibility.allowDECRQCRA": {
|
||||||
|
"default": false,
|
||||||
|
"description": "When set to true, the terminal will support the DECRQCRA (Request Checksum of Rectangular Area) escape sequence.",
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
|
"compatibility.allowOSC52": {
|
||||||
|
"default": true,
|
||||||
|
"description": "When set to true, VT applications will be allowed to set the contents of the local clipboard using OSC 52 (Manipulate Selection Data).",
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
"unfocusedAppearance": {
|
"unfocusedAppearance": {
|
||||||
"$ref": "#/$defs/AppearanceConfig",
|
"$ref": "#/$defs/AppearanceConfig",
|
||||||
"description": "Sets the appearance of the terminal when it is unfocused.",
|
"description": "Sets the appearance of the terminal when it is unfocused.",
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ namespace Microsoft.Terminal.Core
|
|||||||
|
|
||||||
Boolean ForceVTInput;
|
Boolean ForceVTInput;
|
||||||
Boolean AllowVtChecksumReport;
|
Boolean AllowVtChecksumReport;
|
||||||
|
Boolean AllowVtClipboardWrite;
|
||||||
Boolean TrimBlockSelection;
|
Boolean TrimBlockSelection;
|
||||||
Boolean DetectURLs;
|
Boolean DetectURLs;
|
||||||
|
|
||||||
|
|||||||
@@ -89,6 +89,7 @@ void Terminal::UpdateSettings(ICoreSettings settings)
|
|||||||
_trimBlockSelection = settings.TrimBlockSelection();
|
_trimBlockSelection = settings.TrimBlockSelection();
|
||||||
_autoMarkPrompts = settings.AutoMarkPrompts();
|
_autoMarkPrompts = settings.AutoMarkPrompts();
|
||||||
_rainbowSuggestions = settings.RainbowSuggestions();
|
_rainbowSuggestions = settings.RainbowSuggestions();
|
||||||
|
_clipboardOperationsAllowed = settings.AllowVtClipboardWrite();
|
||||||
|
|
||||||
if (_stateMachine)
|
if (_stateMachine)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -413,6 +413,7 @@ private:
|
|||||||
Microsoft::Console::Types::Viewport _mutableViewport;
|
Microsoft::Console::Types::Viewport _mutableViewport;
|
||||||
til::CoordType _scrollbackLines = 0;
|
til::CoordType _scrollbackLines = 0;
|
||||||
bool _detectURLs = false;
|
bool _detectURLs = false;
|
||||||
|
bool _clipboardOperationsAllowed = true;
|
||||||
|
|
||||||
til::size _altBufferSize;
|
til::size _altBufferSize;
|
||||||
std::optional<til::size> _deferredResize;
|
std::optional<til::size> _deferredResize;
|
||||||
|
|||||||
@@ -140,7 +140,10 @@ unsigned int Terminal::GetInputCodePage() const noexcept
|
|||||||
|
|
||||||
void Terminal::CopyToClipboard(wil::zwstring_view content)
|
void Terminal::CopyToClipboard(wil::zwstring_view content)
|
||||||
{
|
{
|
||||||
_pfnCopyToClipboard(content);
|
if (_clipboardOperationsAllowed)
|
||||||
|
{
|
||||||
|
_pfnCopyToClipboard(content);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Method Description:
|
// Method Description:
|
||||||
|
|||||||
@@ -154,6 +154,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
|||||||
OBSERVABLE_PROJECTED_SETTING(_profile, RepositionCursorWithMouse);
|
OBSERVABLE_PROJECTED_SETTING(_profile, RepositionCursorWithMouse);
|
||||||
OBSERVABLE_PROJECTED_SETTING(_profile, ForceVTInput);
|
OBSERVABLE_PROJECTED_SETTING(_profile, ForceVTInput);
|
||||||
OBSERVABLE_PROJECTED_SETTING(_profile, AllowVtChecksumReport);
|
OBSERVABLE_PROJECTED_SETTING(_profile, AllowVtChecksumReport);
|
||||||
|
OBSERVABLE_PROJECTED_SETTING(_profile, AllowVtClipboardWrite);
|
||||||
OBSERVABLE_PROJECTED_SETTING(_profile, AnswerbackMessage);
|
OBSERVABLE_PROJECTED_SETTING(_profile, AnswerbackMessage);
|
||||||
OBSERVABLE_PROJECTED_SETTING(_profile, RainbowSuggestions);
|
OBSERVABLE_PROJECTED_SETTING(_profile, RainbowSuggestions);
|
||||||
OBSERVABLE_PROJECTED_SETTING(_profile, PathTranslationStyle);
|
OBSERVABLE_PROJECTED_SETTING(_profile, PathTranslationStyle);
|
||||||
|
|||||||
@@ -157,5 +157,6 @@ namespace Microsoft.Terminal.Settings.Editor
|
|||||||
OBSERVABLE_PROJECTED_PROFILE_SETTING(String, AnswerbackMessage);
|
OBSERVABLE_PROJECTED_PROFILE_SETTING(String, AnswerbackMessage);
|
||||||
OBSERVABLE_PROJECTED_PROFILE_SETTING(Boolean, RainbowSuggestions);
|
OBSERVABLE_PROJECTED_PROFILE_SETTING(Boolean, RainbowSuggestions);
|
||||||
OBSERVABLE_PROJECTED_PROFILE_SETTING(Microsoft.Terminal.Control.PathTranslationStyle, PathTranslationStyle);
|
OBSERVABLE_PROJECTED_PROFILE_SETTING(Microsoft.Terminal.Control.PathTranslationStyle, PathTranslationStyle);
|
||||||
|
OBSERVABLE_PROJECTED_PROFILE_SETTING(Boolean, AllowVtClipboardWrite);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,6 +60,15 @@
|
|||||||
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
|
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
|
||||||
</local:SettingContainer>
|
</local:SettingContainer>
|
||||||
|
|
||||||
|
<!-- Allow VT Clipboard Writing -->
|
||||||
|
<local:SettingContainer x:Uid="Profile_AllowVtClipboardWrite"
|
||||||
|
ClearSettingValue="{x:Bind Profile.ClearAllowVtClipboardWrite}"
|
||||||
|
HasSettingValue="{x:Bind Profile.HasAllowVtClipboardWrite, Mode=OneWay}"
|
||||||
|
SettingOverrideSource="{x:Bind Profile.AllowVtClipboardWriteOverrideSource, Mode=OneWay}">
|
||||||
|
<ToggleSwitch IsOn="{x:Bind Profile.AllowVtClipboardWrite, Mode=TwoWay}"
|
||||||
|
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
|
||||||
|
</local:SettingContainer>
|
||||||
|
|
||||||
<!-- Answerback Message -->
|
<!-- Answerback Message -->
|
||||||
<local:SettingContainer x:Uid="Profile_AnswerbackMessage"
|
<local:SettingContainer x:Uid="Profile_AnswerbackMessage"
|
||||||
ClearSettingValue="{x:Bind Profile.ClearAnswerbackMessage}"
|
ClearSettingValue="{x:Bind Profile.ClearAnswerbackMessage}"
|
||||||
|
|||||||
@@ -568,6 +568,10 @@
|
|||||||
<value>Allow DECRQCRA (Request Checksum of Rectangular Area)</value>
|
<value>Allow DECRQCRA (Request Checksum of Rectangular Area)</value>
|
||||||
<comment>{Locked="DECRQCRA"}{Locked="Request Checksum of Rectangular Area"}Header for a control to toggle support for the DECRQCRA control sequence.</comment>
|
<comment>{Locked="DECRQCRA"}{Locked="Request Checksum of Rectangular Area"}Header for a control to toggle support for the DECRQCRA control sequence.</comment>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="Profile_AllowVtClipboardWrite.Header" xml:space="preserve">
|
||||||
|
<value>Allow OSC 52 (Manipulate Selection Data) to write to the clipboard</value>
|
||||||
|
<comment>{Locked="OSC 52"}{Locked="Manipulate Selection Data"}Header for a control to toggle support for applications to change the contents of the Windows system clipboard.</comment>
|
||||||
|
</data>
|
||||||
<data name="Globals_AllowHeadless.Header" xml:space="preserve">
|
<data name="Globals_AllowHeadless.Header" xml:space="preserve">
|
||||||
<value>Allow Windows Terminal to run in the background</value>
|
<value>Allow Windows Terminal to run in the background</value>
|
||||||
<comment>Header for a control to toggle support for Windows Terminal to run in the background.</comment>
|
<comment>Header for a control to toggle support for Windows Terminal to run in the background.</comment>
|
||||||
|
|||||||
@@ -101,6 +101,7 @@ Author(s):
|
|||||||
X(bool, RainbowSuggestions, "experimental.rainbowSuggestions", false) \
|
X(bool, RainbowSuggestions, "experimental.rainbowSuggestions", false) \
|
||||||
X(bool, ForceVTInput, "compatibility.input.forceVT", false) \
|
X(bool, ForceVTInput, "compatibility.input.forceVT", false) \
|
||||||
X(bool, AllowVtChecksumReport, "compatibility.allowDECRQCRA", false) \
|
X(bool, AllowVtChecksumReport, "compatibility.allowDECRQCRA", false) \
|
||||||
|
X(bool, AllowVtClipboardWrite, "compatibility.allowOSC52", true) \
|
||||||
X(bool, AllowKeypadMode, "compatibility.allowDECNKM", false) \
|
X(bool, AllowKeypadMode, "compatibility.allowDECNKM", false) \
|
||||||
X(Microsoft::Terminal::Control::PathTranslationStyle, PathTranslationStyle, "pathTranslationStyle", Microsoft::Terminal::Control::PathTranslationStyle::None)
|
X(Microsoft::Terminal::Control::PathTranslationStyle, PathTranslationStyle, "pathTranslationStyle", Microsoft::Terminal::Control::PathTranslationStyle::None)
|
||||||
|
|
||||||
|
|||||||
@@ -94,6 +94,7 @@ namespace Microsoft.Terminal.Settings.Model
|
|||||||
INHERITABLE_PROFILE_SETTING(Boolean, ForceVTInput);
|
INHERITABLE_PROFILE_SETTING(Boolean, ForceVTInput);
|
||||||
INHERITABLE_PROFILE_SETTING(Boolean, AllowVtChecksumReport);
|
INHERITABLE_PROFILE_SETTING(Boolean, AllowVtChecksumReport);
|
||||||
INHERITABLE_PROFILE_SETTING(Boolean, AllowKeypadMode);
|
INHERITABLE_PROFILE_SETTING(Boolean, AllowKeypadMode);
|
||||||
|
INHERITABLE_PROFILE_SETTING(Boolean, AllowVtClipboardWrite);
|
||||||
|
|
||||||
INHERITABLE_PROFILE_SETTING(Microsoft.Terminal.Control.PathTranslationStyle, PathTranslationStyle);
|
INHERITABLE_PROFILE_SETTING(Microsoft.Terminal.Control.PathTranslationStyle, PathTranslationStyle);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -348,6 +348,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
|||||||
_RainbowSuggestions = profile.RainbowSuggestions();
|
_RainbowSuggestions = profile.RainbowSuggestions();
|
||||||
_ForceVTInput = profile.ForceVTInput();
|
_ForceVTInput = profile.ForceVTInput();
|
||||||
_AllowVtChecksumReport = profile.AllowVtChecksumReport();
|
_AllowVtChecksumReport = profile.AllowVtChecksumReport();
|
||||||
|
_AllowVtClipboardWrite = profile.AllowVtClipboardWrite();
|
||||||
_PathTranslationStyle = profile.PathTranslationStyle();
|
_PathTranslationStyle = profile.PathTranslationStyle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -97,6 +97,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
|||||||
INHERITABLE_SETTING(Model::TerminalSettings, bool, AllowVtChecksumReport, false);
|
INHERITABLE_SETTING(Model::TerminalSettings, bool, AllowVtChecksumReport, false);
|
||||||
INHERITABLE_SETTING(Model::TerminalSettings, bool, TrimBlockSelection, true);
|
INHERITABLE_SETTING(Model::TerminalSettings, bool, TrimBlockSelection, true);
|
||||||
INHERITABLE_SETTING(Model::TerminalSettings, bool, DetectURLs, true);
|
INHERITABLE_SETTING(Model::TerminalSettings, bool, DetectURLs, true);
|
||||||
|
INHERITABLE_SETTING(Model::TerminalSettings, bool, AllowVtClipboardWrite, true);
|
||||||
|
|
||||||
INHERITABLE_SETTING(Model::TerminalSettings, Windows::Foundation::IReference<Microsoft::Terminal::Core::Color>, TabColor, nullptr);
|
INHERITABLE_SETTING(Model::TerminalSettings, Windows::Foundation::IReference<Microsoft::Terminal::Core::Color>, TabColor, nullptr);
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,8 @@
|
|||||||
X(bool, AutoMarkPrompts) \
|
X(bool, AutoMarkPrompts) \
|
||||||
X(bool, RepositionCursorWithMouse, false) \
|
X(bool, RepositionCursorWithMouse, false) \
|
||||||
X(bool, RainbowSuggestions) \
|
X(bool, RainbowSuggestions) \
|
||||||
X(bool, AllowVtChecksumReport)
|
X(bool, AllowVtChecksumReport) \
|
||||||
|
X(bool, AllowVtClipboardWrite)
|
||||||
|
|
||||||
// --------------------------- Control Settings ---------------------------
|
// --------------------------- Control Settings ---------------------------
|
||||||
// All of these settings are defined in IControlSettings.
|
// All of these settings are defined in IControlSettings.
|
||||||
|
|||||||
Reference in New Issue
Block a user