Skip to content

Commit

Permalink
Implementing signed policy scenarios (#474)
Browse files Browse the repository at this point in the history
Improved the deployment page by adding flyouts to the browse buttons to display the files you select. The page is also augmented with the Sidebar so it supports quick policy file assignment.

You can now deploy signed policies in the deployment page.

The system information page now allows the removal of all non-system policies. Whenever you select a policy, it will automatically detect the type of it and will take the appropriate action.

Many guardrails have been put in place to guide the user during policy signing and signed policy removal in order to prevent accidents or boot failures.

Reduced the empty spaces at the top of certain pages.

Made the remaining regex expressions throughout the code source generated and compiled for improved performance.
  • Loading branch information
HotCakeX authored Dec 26, 2024
1 parent 2c0ece2 commit 793c76e
Show file tree
Hide file tree
Showing 29 changed files with 2,269 additions and 252 deletions.
1 change: 1 addition & 0 deletions AppControl Manager/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Threading.Tasks;
using AppControlManager.Logging;
using CommunityToolkit.WinUI;
using Microsoft.UI;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Media;
Expand Down
162 changes: 162 additions & 0 deletions AppControl Manager/CustomUIElements/SigningDetailsDialog.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
<ContentDialog
x:Class="AppControlManager.CustomUIElements.SigningDetailsDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:AppControlManager.CustomUIElements"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ui="using:CommunityToolkit.WinUI"
xmlns:controls="using:CommunityToolkit.WinUI.Controls"
xmlns:win="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
mc:Ignorable="d"
Title="Signing Details"
PrimaryButtonText="Submit"
CloseButtonText="Cancel"
IsPrimaryButtonEnabled="False"
DefaultButton="Primary"
BorderThickness="1"
CornerRadius="8"
Style="{ThemeResource DefaultContentDialogStyle}"
BorderBrush="{ThemeResource AccentFillColorDefaultBrush}">

<ContentDialog.Resources>
<!-- These styles can be referenced to create a consistent SettingsPage layout -->

<!-- Spacing between cards -->
<x:Double x:Key="SettingsCardSpacing">4</x:Double>

<!-- Style (inc. the correct spacing) of a section header -->
<Style x:Key="SettingsSectionHeaderTextBlockStyle"
BasedOn="{StaticResource BodyStrongTextBlockStyle}"
TargetType="TextBlock">
<Style.Setters>
<Setter Property="Margin" Value="1,30,0,6" />
</Style.Setters>
</Style>

<!-- https://github.com/microsoft/microsoft-ui-xaml/issues/424 -->
<x:Double x:Key="ContentDialogMaxWidth">2000</x:Double>
</ContentDialog.Resources>

<ScrollView>

<Grid>

<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>

<TextBlock IsTextSelectionEnabled="True" Grid.Row="0" TextWrapping="Wrap" VerticalAlignment="Top" Text="Please provide the required details that will be used to sign the XML App Control Policies." />

<InfoBar
Margin="15"
Grid.Row="1"
BorderThickness="0"
CornerRadius="0"
IsIconVisible="True"
IsOpen="True"
IsClosable="False"
Message="You can configure the following details in the app settings once, eliminating the need to enter them repeatedly"
Severity="Informational">
<InfoBar.ActionButton>
<Button Content="Go to Settings" Click="OpenAppSettingsButton_Click" />
</InfoBar.ActionButton>
</InfoBar>


<StackPanel HorizontalAlignment="Stretch"
Spacing="{StaticResource SettingsCardSpacing}" Grid.Row="2">

<win:StackPanel.ChildrenTransitions>
<win:EntranceThemeTransition FromVerticalOffset="50" />
<win:RepositionThemeTransition IsStaggeringEnabled="False" />
</win:StackPanel.ChildrenTransitions>


<controls:SettingsCard Header="Certificate File"
Description="Its details will be added to the policy file"
HeaderIcon="{ui:FontIcon Glyph=&#xEA86;}">

<controls:WrapPanel Orientation="Vertical" VerticalSpacing="10" HorizontalSpacing="10">

<Button x:Name="CertFileBrowseButton" HorizontalAlignment="Center" Click="CertFileBrowseButton_Click" Content="Browse"/>
<TextBox MaxWidth="700" x:Name="CertFilePathTextBox" TextWrapping="Wrap" PlaceholderText=".cer file path" />

</controls:WrapPanel>

</controls:SettingsCard>

<controls:SettingsCard Header="Certificate Common Name"
Description="Used during the signing operation"
HeaderIcon="{ui:FontIcon Glyph=&#xEA86;}">

<controls:WrapPanel Orientation="Vertical" HorizontalSpacing="10" VerticalSpacing="10">

<AutoSuggestBox x:Name="CertificateCommonNameAutoSuggestBox"
MaxWidth="700"
QueryIcon="Find"
GotFocus="CertificateCommonNameAutoSuggestBox_GotFocus"
TextChanged="CertificateCNAutoSuggestBox_TextChanged"
PlaceholderText="Find Certificate Common Names"/>

</controls:WrapPanel>

</controls:SettingsCard>



<controls:SettingsCard Header="SignTool Path"
Description="Used to sign the policy CIP file"
HeaderIcon="{ui:FontIcon Glyph=&#xEA86;}">

<controls:WrapPanel VerticalSpacing="10" HorizontalSpacing="10" Orientation="Vertical">

<StackPanel Orientation="Horizontal" Spacing="10" HorizontalAlignment="Center" Margin="0,0,0,5" ToolTipService.ToolTip="Automatically downloads the signtool.exe from Microsoft servers">
<ToggleSwitch x:Name="AutoAcquireSignTool" Toggled="AutoAcquireSignTool_Toggled" />
<TextBlock Text="Auto Acquire" Margin="0,8.7,0,0" />
</StackPanel>

<Button x:Name="SignToolBrowseButton" Click="SignToolBrowseButton_Click" HorizontalAlignment="Center" Content="Browse"/>
<TextBox MaxWidth="700" x:Name="SignToolPathTextBox" PlaceholderText="SignTool.exe Path" TextWrapping="Wrap"/>

</controls:WrapPanel>


</controls:SettingsCard>


</StackPanel>

<controls:WrapPanel Grid.Row="3" Orientation="Vertical" HorizontalSpacing="10" VerticalSpacing="10" Margin="10,15,10,0" HorizontalAlignment="Center">

<Button HorizontalAlignment="Center" ToolTipService.ToolTip="Verify the settings before submitting them"
Click="VerifyButton_Click"
x:Name="VerifyButton">

<Button.Content>
<StackPanel Orientation="Horizontal" Padding="10,5,10,5">
<ProgressRing VerticalAlignment="Center" x:Name="VerifyButtonProgressRing" Margin="0,0,10,0" Visibility="Collapsed" IsIndeterminate="True"/>
<TextBlock x:Name="VerifyButtonContentTextBlock" VerticalAlignment="Center" FontWeight="SemiBold" Text="Verify"/>
</StackPanel>
</Button.Content>

</Button>


<TeachingTip x:Name="VerifyButtonTeachingTip"
Target="{x:Bind VerifyButton}"
Title="Error">
</TeachingTip>

</controls:WrapPanel>

</Grid>

</ScrollView>



</ContentDialog>
Loading

0 comments on commit 793c76e

Please sign in to comment.