Skip to content

Commit f81c9fd

Browse files
bkudiessCopilotshanselman
authored
fix(exec): clarify executable allowlist rules (#1112)
* fix(exec): clarify executable allowlist rules Co-authored-by: Copilot App <[email protected]> * fix(exec): align allowlist copy with runtime policy Co-authored-by: Copilot App <[email protected]> --------- Co-authored-by: Copilot App <[email protected]> Co-authored-by: Scott Hanselman <[email protected]>
1 parent 89666df commit f81c9fd

9 files changed

Lines changed: 275 additions & 111 deletions

File tree

‎src/OpenClaw.Tray.WinUI/Pages/PermissionsPage.xaml‎

Lines changed: 31 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@
187187
<TextBlock x:Uid="PermissionsPage_TextBlock_14" Text="Exec policy" Style="{StaticResource BodyStrongTextBlockStyle}"
188188
Margin="{StaticResource PermSectionHeaderMargin}"/>
189189
<TextBlock x:Uid="PermissionsPage_TextBlock_17"
190-
Text="Controls which executables agents can launch on this node. Allowlist entries match resolved executable paths."
190+
Text="Controls which executables the agent can launch on this node. The executable-path allowlist starts empty."
191191
Style="{StaticResource CaptionTextBlockStyle}"
192192
Foreground="{ThemeResource TextFillColorSecondaryBrush}" TextWrapping="Wrap"
193193
Margin="4,0,4,4"/>
@@ -203,7 +203,7 @@
203203
</Grid.ColumnDefinitions>
204204
<StackPanel Grid.Column="0" VerticalAlignment="Center" Spacing="2">
205205
<TextBlock x:Uid="PermissionsPage_DefaultAction" Text="Default action" Style="{StaticResource BodyTextBlockStyle}"/>
206-
<TextBlock x:Uid="PermissionsPage_WhatHappensWhenA" Text="What happens when a command doesn't match the allowlist below."
206+
<TextBlock x:Uid="PermissionsPage_WhatHappensWhenA" Text="What happens when a command doesn't match the executable-path allowlist below."
207207
Style="{StaticResource CaptionTextBlockStyle}"
208208
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
209209
TextWrapping="Wrap"/>
@@ -218,21 +218,21 @@
218218
</Grid>
219219
</Border>
220220

221-
<!-- Rules card -->
221+
<!-- Executable-path allowlist card -->
222222
<Border Background="{ThemeResource CardBackgroundFillColorDefaultBrush}"
223223
BorderBrush="{ThemeResource CardStrokeColorDefaultBrush}"
224224
BorderThickness="1" CornerRadius="8">
225225
<StackPanel>
226-
<!-- Card header: title + rule count badge + auto-save hint -->
226+
<!-- Card header: title + entry count badge + auto-save hint -->
227227
<Grid Padding="16,12,16,12" ColumnSpacing="8">
228228
<Grid.ColumnDefinitions>
229229
<ColumnDefinition Width="*"/>
230230
<ColumnDefinition Width="Auto"/>
231231
<ColumnDefinition Width="Auto"/>
232232
</Grid.ColumnDefinitions>
233233
<StackPanel Grid.Column="0" Spacing="2">
234-
<TextBlock x:Uid="PermissionsPage_TextBlock_28" Text="Rules" Style="{StaticResource BodyStrongTextBlockStyle}"/>
235-
<TextBlock x:Uid="PermissionsPage_PatternsAreMatchedLeft" Text="Allowlist patterns match resolved executable paths. Use wildcards such as **/git.exe. Changes save automatically."
234+
<TextBlock x:Uid="PermissionsPage_TextBlock_28" Text="Executable-path allowlist" Style="{StaticResource BodyStrongTextBlockStyle}"/>
235+
<TextBlock x:Uid="PermissionsPage_PatternsAreMatchedLeft" Text="Allow Always creates an argument-bound entry for an eligible native .exe command. Entries added here are path-only and can allow matching executables with any arguments. Deny and Ask remain controlled by Default action. Changes save automatically."
236236
Style="{StaticResource CaptionTextBlockStyle}"
237237
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
238238
TextWrapping="Wrap"/>
@@ -248,24 +248,25 @@
248248
Background="{ThemeResource ControlAltFillColorSecondaryBrush}"
249249
CornerRadius="10" Padding="10,2"
250250
VerticalAlignment="Center">
251-
<TextBlock x:Uid="PermissionsPage_0Rules" x:Name="RulesCountBadge" Text="0 rules"
251+
<TextBlock x:Uid="PermissionsPage_0Rules" x:Name="RulesCountBadge" Text="0 entries"
252252
Style="{StaticResource CaptionTextBlockStyle}"
253253
Foreground="{ThemeResource TextFillColorSecondaryBrush}"/>
254254
</Border>
255255
</Grid>
256256

257257
<Border Height="1" Background="{ThemeResource CardStrokeColorDefaultBrush}"/>
258258

259-
<!-- Empty state — visible when there are no rules -->
259+
<!-- Empty state — visible when there are no allowlist entries -->
260260
<TextBlock x:Uid="PermissionsPage_NoRulesYetAdd" x:Name="RulesEmptyState"
261-
Text="No rules yet. Add a pattern below to deny, allow, or ask for specific commands."
261+
Text="No executable-path allowlist entries. Approve an eligible native .exe command with Allow Always, or add a path-only pattern such as **/hostname.exe."
262262
Style="{StaticResource CaptionTextBlockStyle}"
263263
Foreground="{ThemeResource TextFillColorTertiaryBrush}"
264+
TextWrapping="Wrap"
264265
HorizontalAlignment="Center"
265266
Margin="16,20,16,20"
266267
Visibility="Collapsed"/>
267268

268-
<!-- Rules list -->
269+
<!-- Allowlist entries -->
269270
<ListView x:Name="PolicyRulesList" SelectionMode="None"
270271
MaxHeight="320"
271272
ItemContainerTransitions="{x:Null}">
@@ -305,7 +306,7 @@
305306
Padding="6" MinWidth="0"
306307
AutomationProperties.Name="{Binding RemoveRuleAutomationName}"
307308
AutomationProperties.AutomationId="{Binding RemoveRuleAutomationId}"
308-
ToolTipService.ToolTip="Remove rule">
309+
ToolTipService.ToolTip="Remove allowlist entry">
309310
<FontIcon Glyph="&#xE74D;" FontSize="14"
310311
Foreground="{ThemeResource TextFillColorSecondaryBrush}"/>
311312
</Button>
@@ -316,21 +317,30 @@
316317

317318
<Border Height="1" Background="{ThemeResource CardStrokeColorDefaultBrush}"/>
318319

319-
<!-- Add rule row -->
320+
<!-- Add allowlist entry row -->
320321
<Grid Padding="16,12,16,12" ColumnSpacing="8">
321322
<Grid.ColumnDefinitions>
322323
<ColumnDefinition Width="*"/>
323324
<ColumnDefinition Width="Auto"/>
324-
<ColumnDefinition Width="Auto"/>
325325
</Grid.ColumnDefinitions>
326-
<TextBox Grid.Column="0" x:Uid="NewRulePattern" x:Name="NewRulePattern"
327-
PlaceholderText="Executable path pattern (e.g. **/git.exe)"
328-
FontFamily="Consolas"/>
329-
<ComboBox Grid.Column="1" x:Uid="PermissionsPage_NewRuleAction" x:Name="NewRuleAction"
330-
MinWidth="100" SelectedIndex="0">
331-
<ComboBoxItem x:Uid="PermissionsPage_ComboBoxItem_55" Content="Allow" Tag="allow"/>
332-
</ComboBox>
333-
<Button Grid.Column="2" x:Uid="PermissionsPage_Button_57" Content="Add" Click="OnAddRule"/>
326+
<StackPanel Grid.Column="0" Spacing="4">
327+
<TextBox x:Uid="NewRulePattern" x:Name="NewRulePattern"
328+
PlaceholderText="Executable-path pattern (e.g. **/hostname.exe)"
329+
FontFamily="Consolas"
330+
AutomationProperties.AutomationId="NewExecAllowlistPatternTextBox"/>
331+
<TextBlock x:Uid="PermissionsPage_ExecAllowlistPatternValidation"
332+
x:Name="ExecAllowlistPatternValidation"
333+
Text="Enter an executable-path pattern such as **/hostname.exe. Basename or command-text patterns such as hostname are invalid."
334+
Style="{StaticResource CaptionTextBlockStyle}"
335+
Foreground="{ThemeResource SystemFillColorCriticalBrush}"
336+
TextWrapping="Wrap"
337+
Visibility="Collapsed"
338+
AutomationProperties.AutomationId="ExecAllowlistPatternValidation"
339+
AutomationProperties.LiveSetting="Assertive"/>
340+
</StackPanel>
341+
<Button Grid.Column="1" x:Uid="PermissionsPage_Button_57" Content="Add entry"
342+
Click="OnAddRule"
343+
AutomationProperties.AutomationId="AddExecAllowlistPatternButton"/>
334344
</Grid>
335345
</StackPanel>
336346
</Border>

‎src/OpenClaw.Tray.WinUI/Pages/PermissionsPage.xaml.cs‎

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ private void RefreshPolicyRulesList()
541541
r.Pattern,
542542
Action = DisplayExecPolicyAction(r.Action),
543543
r.Index,
544-
RemoveRuleAutomationName = $"Remove rule {r.Pattern}",
544+
RemoveRuleAutomationName = $"Remove allowlist entry {r.Pattern}",
545545
RemoveRuleAutomationId = $"RemoveExecPolicyRuleButton_{r.Index}",
546546
ActionBrush = allowBrush
547547
}).ToList();
@@ -561,20 +561,52 @@ private void RefreshPolicyRulesList()
561561
private void OnAddRule(object sender, RoutedEventArgs e)
562562
{
563563
var pattern = NewRulePattern.Text.Trim();
564-
if (string.IsNullOrEmpty(pattern)) return;
564+
if (string.IsNullOrEmpty(pattern))
565+
{
566+
ShowExecAllowlistPatternValidation();
567+
return;
568+
}
565569
if (!ExecApprovalsStore.IsValidAllowlistPattern(pattern))
566570
{
567-
NewRulePattern.Focus(FocusState.Programmatic);
571+
ShowExecAllowlistPatternValidation();
568572
return;
569573
}
570574
ExecPolicyRuleList.UpsertByPattern(_policyRules, pattern, "allow");
571575
var rule = CloneExecPolicyRule(_policyRules.First(r =>
572576
string.Equals(r.Pattern, pattern, StringComparison.OrdinalIgnoreCase)));
573577
NewRulePattern.Text = "";
578+
HideExecAllowlistPatternValidation();
574579
RefreshPolicyRulesList();
575580
SaveExecPolicyToDisk(new ExecPolicyMutation(ExecPolicyMutationKind.AddRule, rule));
576581
}
577582

583+
private void ShowExecAllowlistPatternValidation()
584+
{
585+
ExecAllowlistPatternValidation.Visibility = Visibility.Visible;
586+
Microsoft.UI.Xaml.Automation.AutomationProperties.SetHelpText(
587+
NewRulePattern,
588+
ExecAllowlistPatternValidation.Text);
589+
NewRulePattern.Focus(FocusState.Programmatic);
590+
DispatcherQueue.TryEnqueue(
591+
Microsoft.UI.Dispatching.DispatcherQueuePriority.Low,
592+
() =>
593+
{
594+
if (ExecAllowlistPatternValidation.Visibility == Visibility.Visible)
595+
{
596+
ExecAllowlistPatternValidation.StartBringIntoView(
597+
new BringIntoViewOptions { AnimationDesired = false });
598+
}
599+
});
600+
}
601+
602+
private void HideExecAllowlistPatternValidation()
603+
{
604+
ExecAllowlistPatternValidation.Visibility = Visibility.Collapsed;
605+
Microsoft.UI.Xaml.Automation.AutomationProperties.SetHelpText(
606+
NewRulePattern,
607+
string.Empty);
608+
}
609+
578610
private void OnRemoveRule(object sender, RoutedEventArgs e)
579611
{
580612
if (sender is Button btn && btn.Tag is int index && index < _policyRules.Count)

‎src/OpenClaw.Tray.WinUI/Strings/en-us/Resources.resw‎

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1950,7 +1950,7 @@ Use one of these options:
19501950
<value>Exec Policy</value>
19511951
</data>
19521952
<data name="PermissionsPage_TextBlock_17.Text" xml:space="preserve">
1953-
<value>Controls which executables the agent can launch on this node. Rules match resolved executable paths.</value>
1953+
<value>Controls which executables the agent can launch on this node. The executable-path allowlist starts empty.</value>
19541954
</data>
19551955
<data name="DefaultActionCombo.Header" xml:space="preserve">
19561956
<value>Default Action</value>
@@ -1965,22 +1965,22 @@ Use one of these options:
19651965
<value>Ask</value>
19661966
</data>
19671967
<data name="PermissionsPage_TextBlock_28.Text" xml:space="preserve">
1968-
<value>Rules</value>
1968+
<value>Executable-path allowlist</value>
19691969
</data>
19701970
<data name="NewRulePattern.PlaceholderText" xml:space="preserve">
1971-
<value>Executable path pattern (e.g. **/git.exe)</value>
1971+
<value>Executable-path pattern (e.g. **/hostname.exe)</value>
1972+
</data>
1973+
<data name="PermissionsPage_ExecAllowlistPatternValidation.Text" xml:space="preserve">
1974+
<value>Enter an executable-path pattern such as **/hostname.exe. Basename or command-text patterns such as hostname are invalid.</value>
19721975
</data>
19731976
<data name="PermissionsPage_ComboBoxItem_54.Content" xml:space="preserve">
19741977
<value>Deny</value>
19751978
</data>
1976-
<data name="PermissionsPage_ComboBoxItem_55.Content" xml:space="preserve">
1977-
<value>Allow</value>
1978-
</data>
19791979
<data name="PermissionsPage_ComboBoxItem_56.Content" xml:space="preserve">
19801980
<value>Ask</value>
19811981
</data>
19821982
<data name="PermissionsPage_Button_57.Content" xml:space="preserve">
1983-
<value>Add Rule</value>
1983+
<value>Add entry</value>
19841984
</data>
19851985
<data name="PermissionsPage_TextBlock_69.Text" xml:space="preserve">
19861986
<value>Node Allowlist</value>
@@ -3439,13 +3439,13 @@ Commands are blocked while sandboxing is unavailable because strict fallback blo
34393439
<value>URL copied to clipboard</value>
34403440
</data>
34413441
<data name="PermissionsPage_RulesCount_None" xml:space="preserve">
3442-
<value>No rules</value>
3442+
<value>No entries</value>
34433443
</data>
34443444
<data name="PermissionsPage_RulesCount_One" xml:space="preserve">
3445-
<value>1 rule</value>
3445+
<value>1 entry</value>
34463446
</data>
34473447
<data name="PermissionsPage_RulesCount_ManyFormat" xml:space="preserve">
3448-
<value>{0} rules</value>
3448+
<value>{0} entries</value>
34493449
</data>
34503450
<data name="PermissionsPage_Allowlist_NoConfig" xml:space="preserve">
34513451
<value>No allowlist data available. Connect to a gateway first.</value>
@@ -4498,19 +4498,19 @@ Commands are blocked while sandboxing is unavailable because strict fallback blo
44984498
<value>Default action</value>
44994499
</data>
45004500
<data name="PermissionsPage_WhatHappensWhenA.Text" xml:space="preserve">
4501-
<value>What happens when a command doesn't match any rule below.</value>
4501+
<value>What happens when a command doesn't match the executable-path allowlist below.</value>
45024502
</data>
45034503
<data name="PermissionsPage_PatternsAreMatchedLeft.Text" xml:space="preserve">
4504-
<value>Allowlist patterns match resolved executable paths. Use wildcards such as **/git.exe. Changes save automatically.</value>
4504+
<value>Allow Always creates an argument-bound entry for an eligible native .exe command. Entries added here are path-only and can allow matching executables with any arguments. Deny and Ask remain controlled by Default action. Changes save automatically.</value>
45054505
</data>
45064506
<data name="PermissionsPage_Saved.Text" xml:space="preserve">
45074507
<value>Saved</value>
45084508
</data>
45094509
<data name="PermissionsPage_0Rules.Text" xml:space="preserve">
4510-
<value>0 rules</value>
4510+
<value>0 entries</value>
45114511
</data>
45124512
<data name="PermissionsPage_NoRulesYetAdd.Text" xml:space="preserve">
4513-
<value>No rules yet. Add a pattern below to deny, allow, or ask for specific commands.</value>
4513+
<value>No executable-path allowlist entries. Approve an eligible native .exe command with Allow Always, or add a path-only pattern such as **/hostname.exe.</value>
45144514
</data>
45154515
<data name="PermissionsPage_WindowsPrivacy.Text" xml:space="preserve">
45164516
<value>Windows privacy</value>
@@ -6895,9 +6895,6 @@ Make sure the gateway is running.</value>
68956895
<data name="SettingsPage_GatewayInfoLabel_Uptime.Text" xml:space="preserve">
68966896
<value>Uptime</value>
68976897
</data>
6898-
<data name="PermissionsPage_NewRuleAction.[using:Microsoft.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
6899-
<value>Rule action</value>
6900-
</data>
69016898
<data name="SandboxPage_UnavailablePrimaryButton.[using:Microsoft.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
69026899
<value>Sandbox action</value>
69036900
</data>

0 commit comments

Comments
 (0)