Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Learn More and Remediation Examples tabs in SAST #135

Merged
merged 28 commits into from
Aug 25, 2023
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
7a1a057
Adding Learn More and Remediation Examples tabs
igorlombacx Aug 18, 2023
ad28fe3
Fix for sca vulnerabilities with no packages
igorlombacx Aug 21, 2023
07d7ed9
Merge branch 'main' into FEATURE/LEARN-MORE-AST-28255
igorlombacx Aug 23, 2023
9c91bf7
Delete .gitignore
igorlombacx Aug 23, 2023
d50814b
Delete ast-visual-studio-extension.iml
igorlombacx Aug 23, 2023
154bc0a
Delete git_toolbox_prj.xml
igorlombacx Aug 23, 2023
a675c31
Delete Project_Default.xml
igorlombacx Aug 23, 2023
5af317a
Delete misc.xml
igorlombacx Aug 23, 2023
f915a3f
Delete modules.xml
igorlombacx Aug 23, 2023
3ea7e17
Delete vcs.xml
igorlombacx Aug 23, 2023
581e303
PR review
igorlombacx Aug 24, 2023
25c227a
Delete .gitignore
igorlombacx Aug 24, 2023
cd1f630
Create workspace.xml
igorlombacx Aug 24, 2023
cc902cb
Delete ast-visual-studio-extension.iml
igorlombacx Aug 24, 2023
9a32a1c
Delete git_toolbox_prj.xml
igorlombacx Aug 24, 2023
88fb352
Delete Project_Default.xml
igorlombacx Aug 24, 2023
3250eb9
Delete misc.xml
igorlombacx Aug 24, 2023
e169470
Delete modules.xml
igorlombacx Aug 24, 2023
bb18bfa
Delete vcs.xml
igorlombacx Aug 24, 2023
4f49144
Delete workspace.xml
igorlombacx Aug 24, 2023
59ae11a
PR review fix
igorlombacx Aug 24, 2023
54bb551
Merge branch 'FEATURE/LEARN-MORE-AST-28255' of https://github.com/Che…
hmmachadocx Aug 24, 2023
231703f
remove empty line
hmmachadocx Aug 24, 2023
802ef3b
remove unused import
hmmachadocx Aug 24, 2023
8075ebe
remove empty line
hmmachadocx Aug 24, 2023
2265f7e
fix for non utf8 characters in learn more
igorlombacx Aug 25, 2023
2651504
Merge branch 'FEATURE/LEARN-MORE-AST-28255' of https://github.com/Che…
igorlombacx Aug 25, 2023
6e5fe50
blessed refactor in AddTextWithTitle and AddSectionTitle functions
igorlombacx Aug 25, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
121 changes: 119 additions & 2 deletions ast-visual-studio-extension/CxExtension/CxWindowControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@
</StackPanel>

<!-- Column 1 -->
<ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" Margin="1,1,2,0" PreviewMouseWheel="ResultsTreePanelPreviewMouseWheel">
<ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" Margin="1,1,2,0" PreviewMouseWheel="PreviewMouseWheel">
<TreeView Background="Transparent" Margin="10,5,0,13" x:Name="TreeViewResults" HorizontalAlignment="Left" VerticalAlignment="Top" BorderThickness="0">
<TreeView.Resources>
<!-- Style the inactive selection the same as active -->
Expand Down Expand Up @@ -637,8 +637,9 @@
</TabControl>
</StackPanel>


<!-- Column 3 -->
<ScrollViewer Grid.Row="1" Grid.Column="2" x:Name="VulnerabilitiesPanel" Visibility="Hidden" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" Margin="1,1,2,0" PreviewMouseWheel="VulnerabilitiesPanelPreviewMouseWheel">
<ScrollViewer Grid.Row="1" Grid.Column="2" x:Name="VulnerabilitiesPanel" Visibility="Hidden" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" Margin="1,1,2,0" PreviewMouseWheel="PreviewMouseWheel">
<StackPanel>
<!-- Result Title -->
<WrapPanel Orientation="Horizontal" Margin="10" MinHeight="24">
Expand All @@ -657,6 +658,122 @@
</ListView>
</StackPanel>
</ScrollViewer>

<ScrollViewer Grid.Row="1" Grid.Column="2" x:Name="SastVulnerabilitiesPanel" Visibility="Hidden" VerticalScrollBarVisibility="Disabled" HorizontalScrollBarVisibility="Disabled" Margin="1,1,2,0">
<TabControl x:Name="LearnMoreAndRemediationTabControl" TabStripPlacement="Top" HorizontalAlignment="Stretch" Background="Transparent" BorderBrush="Transparent" Margin="0,10,0,0">
<TabControl.Resources>
<Style TargetType="TabItem">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="TabItem">
<StackPanel Name="Panel" Cursor="Hand" Orientation="Vertical">
<ContentPresenter x:Name="ContentSite" VerticalAlignment="Center" HorizontalAlignment="Center" ContentSource="Header" Margin="10,2"/>
<TextBlock Name="BottomBar" Background="Transparent" Height="3" />
<StackPanel.Style>
<Style TargetType="{x:Type StackPanel}">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="{DynamicResource {x:Static vsfx:VsBrushes.AccentDarkKey}}"/>
</Trigger>
</Style.Triggers>
</Style>
</StackPanel.Style>
</StackPanel>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter TargetName="BottomBar" Property="Background" Value="LightBlue" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</TabControl.Resources>
<TabItem x:Name="VulnerabilitiesTabItem">
<TabItem.HeaderTemplate>
<DataTemplate>
<DataTemplate.Resources>
<Style TargetType="TextBlock" BasedOn="{StaticResource {x:Type TextBlock}}" />
</DataTemplate.Resources>
<Grid HorizontalAlignment="Stretch">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="5*" />
</Grid.ColumnDefinitions>
<TextBlock Text="Attack Vector" Grid.Column="1" VerticalAlignment="Center"/>
</Grid>
</DataTemplate>
</TabItem.HeaderTemplate>
<TabItem.Content>
<ScrollViewer PreviewMouseWheel="PreviewMouseWheel">
<ScrollViewer.VerticalScrollBarVisibility>Auto</ScrollViewer.VerticalScrollBarVisibility>
<ScrollViewer.Content>
<StackPanel>
<ListView x:Name="VulnerabilitiesListSast" Grid.Column="2" Background="Transparent" BorderThickness="0">
<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<Setter Property="Focusable" Value="false"/>
<Setter Property="Margin" Value="5"/>
</Style>
</ListView.ItemContainerStyle>
</ListView>
</StackPanel>
</ScrollViewer.Content>
</ScrollViewer>
</TabItem.Content>
</TabItem>
<TabItem Name="LearnMore" MouseUp="OnClickLearnMoreRemediation">
<TabItem.HeaderTemplate>
<DataTemplate>
<DataTemplate.Resources>
<Style TargetType="TextBlock" BasedOn="{StaticResource {x:Type TextBlock}}" />
</DataTemplate.Resources>
<Grid HorizontalAlignment="Stretch">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="5*" />
</Grid.ColumnDefinitions>
<TextBlock Text="Learn More" Grid.Column="1" VerticalAlignment="Center"/>
</Grid>
</DataTemplate>
</TabItem.HeaderTemplate>
<TabItem.Content>
<ScrollViewer PreviewMouseWheel="PreviewMouseWheel">
<ScrollViewer.VerticalScrollBarVisibility>Auto</ScrollViewer.VerticalScrollBarVisibility>
<ScrollViewer.Content>
<StackPanel x:Name="LearnMorePanelTitle" CanVerticallyScroll="True">
</StackPanel>
</ScrollViewer.Content>
</ScrollViewer>
</TabItem.Content>
</TabItem>
<TabItem Name="Remediation" MouseUp="OnClickLearnMoreRemediation">
<TabItem.HeaderTemplate>
<DataTemplate>
<DataTemplate.Resources>
<Style TargetType="TextBlock" BasedOn="{StaticResource {x:Type TextBlock}}" />
</DataTemplate.Resources>
<Grid HorizontalAlignment="Stretch">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="5*" />
</Grid.ColumnDefinitions>
<TextBlock Text="Remediation" Grid.Column="1" VerticalAlignment="Center"/>
</Grid>
</DataTemplate>
</TabItem.HeaderTemplate>
<TabItem.Content>
<ScrollViewer PreviewMouseWheel="PreviewMouseWheel">
<ScrollViewer.VerticalScrollBarVisibility>Auto</ScrollViewer.VerticalScrollBarVisibility>
<ScrollViewer.Content>
<StackPanel x:Name="RemediationPanelTitle" CanVerticallyScroll="True">
</StackPanel>
</ScrollViewer.Content>
</ScrollViewer>
</TabItem.Content>
</TabItem>
</TabControl>
</ScrollViewer>
</Grid>


Expand Down
24 changes: 10 additions & 14 deletions ast-visual-studio-extension/CxExtension/CxWindowControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public partial class CxWindowControl : UserControl
private readonly CxToolbar cxToolbar;
private readonly ResultInfoPanel resultInfoPanel;
private readonly AsyncPackage package;

private readonly ResultVulnerabilitiesPanel resultsVulnPanel;
public CxWindowControl(AsyncPackage package)
{
InitializeComponent();
Expand All @@ -27,7 +27,9 @@ public CxWindowControl(AsyncPackage package)

resultInfoPanel = new ResultInfoPanel(this);

ResultsTreePanel resultsTreePanel = new ResultsTreePanel(package, this, resultInfoPanel);
resultsVulnPanel = new ResultVulnerabilitiesPanel(package, this);

ResultsTreePanel resultsTreePanel = new ResultsTreePanel(package, this, resultInfoPanel, resultsVulnPanel);

// Subscribe OnApply event in checkmarx settings window
CxPreferencesUI.GetInstance().OnApplySettingsEvent += CheckToolWindowPanel;
Expand Down Expand Up @@ -105,21 +107,11 @@ private void CheckToolWindowPanel()
}

/// <summary>
/// Handle mouse wheel in the vulnerabilities panel
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void VulnerabilitiesPanelPreviewMouseWheel(object sender, MouseWheelEventArgs e)
{
HandleScrollViewer((ScrollViewer)sender, e);
}

/// <summary>
/// Handle mouse wheel in the results tree panel
/// Handle mouse wheel
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ResultsTreePanelPreviewMouseWheel(object sender, MouseWheelEventArgs e)
private void PreviewMouseWheel(object sender, MouseWheelEventArgs e)
{
HandleScrollViewer((ScrollViewer)sender, e);
}
Expand Down Expand Up @@ -271,5 +263,9 @@ private void OnClickCodebashingLink(object sender, MouseButtonEventArgs e)
{
_ = resultInfoPanel.CodeBashingListAsync(cxToolbar);
}
private void OnClickLearnMoreRemediation(object sender, RoutedEventArgs e)
{
_ = resultsVulnPanel.LearnMoreAndRemediationAsync(cxToolbar);
}
}
}
Loading
Loading