Skip to content

Commit e990236

Browse files
Merge pull request #55 from checkmarx-ltd/2025_Q4_Integration_Branch
Visual Studio 2025 Q4 PR
2 parents a1bad8c + df2a5e5 commit e990236

7 files changed

Lines changed: 158 additions & 18 deletions

File tree

CxActionShared/Entities/LoginData.cs

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ public class LoginData : IEntity
1919
/// </summary>
2020
public const int DEFAULT_LANGUAGE_CODE = 1033;
2121

22+
/// <summary>
23+
/// Proxy type constants
24+
/// </summary>
25+
public const string PROXY_TYPE_NONE = "None";
26+
public const string PROXY_TYPE_HTTP = "http";
27+
public const string PROXY_TYPE_PAC = "pac";
28+
2229
#endregion
2330

2431
#region [Private Constants]
@@ -39,6 +46,11 @@ public class LoginData : IEntity
3946
private bool _ssl = false;
4047
private string _authenticationType = "access_control";
4148

49+
private string _proxyType = PROXY_TYPE_NONE;
50+
private string _proxyLocation = null;
51+
private string _noProxyList = null;
52+
53+
4254
private EntityId _id;
4355
private bool _isLogging;
4456
string unboundRunID;
@@ -49,8 +61,8 @@ public class LoginData : IEntity
4961
private SimpleDecision _isRunScanInBackground;
5062
private SimpleDecision _isOpenPerspective;
5163

52-
private string[] _excludeFileExt = "bak,tmp,aac,aif,iff,m3u,mid,mp3,mpa,ra,wav,wma,3g2,3gp,asf,asx,avi,flv,mov,mp4,mpg,rm,swf,vob,wmv,bmp,gif,jpg,png,psd,tif,swf,jar,zip,rar,exe,dll,pdb,7z,gz,tar.gz,tar,gz,ahtm,ahtml,fhtml,hdm,hdml,hsql,ht,hta,htc,htd,htmls,ihtml,mht,mhtm,mhtml,ssi,stm,stml,ttml,txn,xhtm,xhtml".Split(',');
53-
private string[] _excludeFolder = "bin,obj,.svn,_svn,backup".Split(',');
64+
private string[] _excludeFileExt = "bak,tmp,aac,aif,iff,m3u,mid,mp3,mpa,ra,wav,wma,3g2,3gp,asf,asx,avi,flv,mov,mp4,mpg,rm,swf,vob,wmv,bmp,gif,jpg,png,psd,tif,swf,jar,zip,rar,exe,dll,pdb,7z,gz,tar.gz,tar,gz,ahtm,ahtml,fhtml,hdm,hdml,hsql,ht,hta,htc,htd,htmls,ihtml,mht,mhtm,mhtml,ssi,stm,stml,ttml,txn,xhtm,xhtml,log,CxVsPlugin.conf".Split(',');
65+
private string[] _excludeFolder = "bin,obj,.svn,_svn,backup,GpuCache,DawnCache,.vs".Split(',');
5466

5567
private int _reconnectInterval = 15;
5668
private int _reconnectCount = 3;
@@ -183,6 +195,35 @@ public string AuthenticationType
183195
set { _authenticationType = value; }
184196
}
185197

198+
/// <summary>
199+
/// Gets or sets value indicating the type of the proxy server none, http or pac
200+
/// </summary>
201+
public string ProxyType
202+
{
203+
get { return _proxyType; }
204+
set { _proxyType = value; }
205+
}
206+
207+
/// <summary>
208+
/// Gets or sets value indicating the url of the http or pac proxy.
209+
/// </summary>
210+
public string ProxyLocation
211+
{
212+
get { return _proxyLocation; }
213+
set { _proxyLocation = value; }
214+
}
215+
216+
/// <summary>
217+
/// Gets or sets value indicating the hosts that should be excluded from the proxy
218+
/// </summary>
219+
public string NoProxyList
220+
{
221+
get { return _noProxyList; }
222+
set { _noProxyList = value; }
223+
}
224+
225+
226+
186227

187228
/// <summary>
188229
/// Get or set Entity prorepty
@@ -387,5 +428,6 @@ public bool IsPublic
387428
public List<ScanReportInfo> ScanReports { get { return scanReports; } set { scanReports = value; } }
388429
}
389430

431+
390432
}
391433
}

CxActionShared/Helpers/LoginHelper.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ internal static LoginData Load(int tryNum)
180180
{
181181
Logger.Create().Error(ex);
182182
}
183+
_oidcLoginHelper.PluginConfiguration = login;
183184

184185
return login;
185186
}

CxActionShared/Helpers/OIDCLoginHelper.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@ public class OIDCLoginHelper
1515
public static bool errorWasShown = false;
1616

1717
private OidcLoginResult _latestResult;
18+
private LoginData _pluginConfiguration = null;
1819

1920
public OIDCLoginHelper()
2021
{
21-
22+
_pluginConfiguration = null;
2223
}
2324

2425
public void resetLatestResult()
@@ -55,7 +56,7 @@ private void ConectAndWait(string baseServerUri, string AuthenticationType)
5556
var browserForm = new BrowserForm();
5657
BrowserForm.NavigationCompleted += OidcLoginCtrlOnNavigationCompleted;
5758
BrowserForm.NavigationError += OidcLoginCtrlOnNavigationError;
58-
BrowserForm.IsbrowserIntialized();
59+
BrowserForm.IsbrowserIntialized(_pluginConfiguration);
5960
browserForm.Show();
6061
string txturl = "about:blank";
6162
browserForm.Invoke(new MethodInvoker(() =>
@@ -99,5 +100,14 @@ public void CloseLoginWindow()
99100
_oidcLoginFrm.CloseForm();
100101
}
101102
}
103+
104+
/// <summary>
105+
/// plugin's configuration
106+
/// </summary>
107+
public LoginData PluginConfiguration
108+
{
109+
get { return _pluginConfiguration; }
110+
set { _pluginConfiguration = value; }
111+
}
102112
}
103113
}

CxActionShared/Views/BrowserForm.cs

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,41 @@ public BrowserForm()
3737
ChromiumWebBrowser browser;
3838
static bool IsIntialized = false;
3939
public static void IsbrowserIntialized()
40+
{
41+
CefSettings settings = new CefSettings();
42+
initializeCefBrowserWithSettings(settings);
43+
}
44+
45+
public static void IsbrowserIntialized(LoginData pluginConfiguration)
46+
{
47+
CefSettings settings = new CefSettings();
48+
49+
if (!string.IsNullOrEmpty(pluginConfiguration.ProxyType) &&
50+
pluginConfiguration.ProxyType != LoginData.PROXY_TYPE_NONE)
51+
{
52+
if (pluginConfiguration.ProxyType == LoginData.PROXY_TYPE_HTTP)
53+
{
54+
settings.CefCommandLineArgs.Add("proxy-server", pluginConfiguration.ProxyLocation);
55+
56+
if (!string.IsNullOrEmpty(pluginConfiguration.NoProxyList))
57+
{
58+
settings.CefCommandLineArgs.Add("proxy-bypass-list", pluginConfiguration.NoProxyList);
59+
}
60+
}
61+
else if (pluginConfiguration.ProxyType == LoginData.PROXY_TYPE_PAC)
62+
{
63+
settings.CefCommandLineArgs.Add("proxy-pac-url", pluginConfiguration.ProxyLocation);
64+
}
65+
}
66+
67+
initializeCefBrowserWithSettings(settings);
68+
}
69+
70+
private static void initializeCefBrowserWithSettings(CefSettings settings)
4071
{
4172
if (IsIntialized == false)
4273
{
43-
CefSharpSettings.ShutdownOnExit = false;
44-
CefSettings settings = new CefSettings();
74+
CefSharpSettings.ShutdownOnExit = false;
4575
Cef.Initialize(settings);
4676
IsIntialized = true;
4777
}

CxViewer2022/source.extension.vsixmanifest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
33
<Metadata>
4-
<Identity Id="ade162dc-e470-4fc9-9868-2a878fb23422" Version="9.00.31" Language="en-US" Publisher="Checkmarx" />
4+
<Identity Id="ade162dc-e470-4fc9-9868-2a878fb23422" Version="9.00.35" Language="en-US" Publisher="Checkmarx" />
55
<DisplayName>CxViewer</DisplayName>
66
<Description xml:space="preserve">Checkmarx Visual Studio Plugin</Description>
77
<MoreInfo>https://checkmarx.atlassian.net/wiki/spaces/SD/pages/1339392185/Visual+Studio+Plugin</MoreInfo>

CxViewerVSIX/source.extension.vsixmanifest

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
33
<Metadata>
4-
<Identity Id="37506746-5265-481e-ac06-32f67910eedd" Publisher="Checkmarx" Version="9.00.31" Language="en-US" />
4+
<Identity Id="37506746-5265-481e-ac06-32f67910eedd" Publisher="Checkmarx" Version="9.00.35" Language="en-US" />
55
<DisplayName>CxViewer</DisplayName>
66
<Description xml:space="preserve" >Checkmarx Visual Studio Plugin</Description>
77
<MoreInfo>https://checkmarx.atlassian.net/wiki/spaces/SD/pages/1339392185/Visual+Studio+Plugin</MoreInfo>
@@ -21,3 +21,4 @@
2121
<Prerequisite Id="Microsoft.VisualStudio.Component.CoreEditor" Version="[15.0,17.0)" DisplayName="Visual Studio core editor" />
2222
</Prerequisites>
2323
</PackageManifest>
24+

Jenkinsfile

Lines changed: 66 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,64 @@
11
#!/groovy
22
@Library('cx-jenkins-pipeline-kit')
3+
import groovy.xml.DOMBuilder
4+
import groovy.xml.XmlUtil
5+
import javax.xml.parsers.DocumentBuilderFactory
6+
import org.w3c.dom.Document
37

48
def ipAddress
59
def vmName = "Plugin-VisualStudio-" + UUID.randomUUID().toString()
6-
def msbuildLocationVS2019 = "\"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\MSBuild\\Current\\Bin\\MSBuild.exe\""
10+
def msbuildLocationVS2019 = "\"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Professional\\MSBuild\\Current\\Bin\\MSBuild.exe\""
711
def msbuildLocationVS2022 = "\"C:\\Program Files\\Microsoft Visual Studio\\2022\\Professional\\MSBuild\\Current\\Bin\\MSBuild.exe\""
12+
def versionOfVS2022
13+
def versionOfVS2019
14+
def decommissionPeriod = "3 hour"
815

916
pipeline {
1017
parameters {
11-
string(name: "decommissionPeriod", defaultValue: "3 hour", description: "Decommission period")
1218
choice(name: "templateName", choices: ["VisualStudio2019-Template","VisualStudio2022-Template"], description: "Template name, if not specified then \"VisualStudio2019-Template\" template will be chosen")
1319
booleanParam(name: 'doNotDeleteVM', defaultValue: false, description: 'If selected, VM will not be deleted after process finished')
1420
gitParameter branchFilter: 'origin/(.*)', defaultValue: 'master', name: 'branch', type: 'PT_BRANCH'
1521
}
1622
agent { node { label 'install01' } }
1723
stages {
24+
stage('Checkout') {
25+
steps {
26+
checkout([$class: 'GitSCM',
27+
branches: [[name: "${branch}"]],
28+
userRemoteConfigs: [[url: 'https://github.com/checkmarx-ltd/VisualStudio.git']]])
29+
}
30+
}
31+
stage('Extract Version') {
32+
steps {
33+
script {
34+
if(templateName == "VisualStudio2019-Template")
35+
{
36+
def vs2019ManifestPath = 'CxViewerVSIX/source.extension.vsixmanifest'
37+
// Extract versions using a helper function
38+
versionOfVS2019 = extractVersionUsingDOMBuilder(vs2019ManifestPath)
39+
echo "VS2019 version: ${versionOfVS2019}"
40+
}
41+
else
42+
{
43+
def vs2022ManifestPath = 'CxViewer2022/source.extension.vsixmanifest'
44+
// Extract versions using a helper function
45+
versionOfVS2022 = extractVersionUsingDOMBuilder(vs2022ManifestPath)
46+
echo "VS2022 version: ${versionOfVS2022}"
47+
}
48+
}
49+
}
50+
}
1851
stage('Create VM') {
1952
steps {
2053
script {
2154
kit.Create_Vm_Terraform(vmName, templateName, "18000", "8", "VMWARE", decommissionPeriod, "Auto", "Plugins-Developers")
2255
ipAddress = kit.getIpAddress(vmName, "VMWARE")
23-
kit.Create_Jenkins_Slave_On_Master(vmName)
24-
kit.Start_Jenkins_Slave_On_Windows_Pstools(ipAddress, vmName)
56+
kit.Create_Jenkins_Slave_On_Master_cx_operation(vmName)
57+
kit.Start_Jenkins_Slave_On_Windows_Pstools_cx_operation(ipAddress, vmName)
2558
}
2659
}
2760
}
28-
61+
2962
stage('Build and Pack') {
3063
agent { node { label vmName } }
3164
steps {
@@ -41,19 +74,17 @@ pipeline {
4174
}
4275
}
4376

44-
stage('Upload To Artifactory') {
77+
stage('Upload To Artifactory') {
4578
agent { node { label vmName } }
4679
steps {
4780
script {
4881
if(templateName == "VisualStudio2019-Template")
4982
{
50-
fileOperations([folderRenameOperation(source: "${WORKSPACE}\\Artifacts\\CxViewerVSIX-2019.vsix", destination: "${WORKSPACE}\\Artifacts\\CxViewerVSIX-9.00.19.vsix")])
51-
kit.Upload_To_Artifactory("${WORKSPACE}\\Artifacts\\CxViewerVSIX-9.00.19.vsix", "plugins-release-local/com/checkmarx/visual-studio/")
83+
kit.Upload_To_Artifactory("${WORKSPACE}\\Artifacts\\CxViewerVSIX-2019.vsix", "plugins-release-local/com/checkmarx/visual-studio/${versionOfVS2019}/")
5284
}
5385
else
5486
{
55-
fileOperations([folderRenameOperation(source: "${WORKSPACE}\\Artifacts\\CxViewerVSIX-2022.vsix", destination: "${WORKSPACE}\\Artifacts\\CxViewerVSIX-9.00.19.vsix")])
56-
kit.Upload_To_Artifactory("${WORKSPACE}\\Artifacts\\CxViewerVSIX-9.00.19.vsix", "plugins-release-local/com/checkmarx/visual-studio/")
87+
kit.Upload_To_Artifactory("${WORKSPACE}\\Artifacts\\CxViewerVSIX-2022.vsix", "plugins-release-local/com/checkmarx/visual-studio/${versionOfVS2022}/")
5788
}
5889
}
5990
}
@@ -83,3 +114,28 @@ pipeline {
83114
}
84115
}
85116
}
117+
def extractVersionUsingDOMBuilder(manifestPath) {
118+
def manifestContent = readFile(manifestPath)
119+
manifestContent = manifestContent.replaceFirst(/^\xEF\xBB\xBF/, '').trim()
120+
121+
def version = ''
122+
try {
123+
// Create DocumentBuilderFactory and parse the XML content
124+
def factory = DocumentBuilderFactory.newInstance()
125+
def builder = factory.newDocumentBuilder()
126+
def inputStream = new ByteArrayInputStream(manifestContent.getBytes("UTF-8"))
127+
128+
// Parse the input stream into a Document
129+
Document document = builder.parse(inputStream)
130+
131+
// Use DOM to extract the Version attribute
132+
def node = document.getElementsByTagName("Identity").item(0)
133+
version = node?.getAttribute("Version")
134+
if (!version) {
135+
error "Version attribute not found in ${manifestPath}"
136+
}
137+
return version
138+
} catch (Exception e) {
139+
error "Failed to parse XML using DOMBuilder for ${manifestPath}: ${e.message}"
140+
}
141+
}

0 commit comments

Comments
 (0)