Skip to content

Commit de6d028

Browse files
authored
Create codeql-analysis.yml (#145)
* Create codeql-analysis.yml, fix all build issues * Only builds a subset yet
1 parent cab67c1 commit de6d028

File tree

13 files changed

+126
-50
lines changed

13 files changed

+126
-50
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "CodeQL"
13+
14+
on:
15+
push:
16+
branches: [ master ]
17+
pull_request:
18+
# The branches below must be a subset of the branches above
19+
branches: [ master ]
20+
schedule:
21+
- cron: '30 6 * * 1'
22+
23+
jobs:
24+
analyze:
25+
name: Analyze
26+
runs-on: windows-latest
27+
28+
strategy:
29+
fail-fast: false
30+
matrix:
31+
language: [ 'csharp' ]
32+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
33+
# Learn more:
34+
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
35+
36+
steps:
37+
- name: Checkout repository
38+
uses: actions/checkout@v2
39+
40+
- name: Setup .NET
41+
uses: actions/setup-dotnet@v1
42+
with:
43+
dotnet-version: '5.x' # SDK Version to use;
44+
45+
# Add MSBuild to the PATH: https://github.com/microsoft/setup-msbuild
46+
- name: Setup MSBuild.exe
47+
uses: microsoft/[email protected]
48+
49+
# Initializes the CodeQL tools for scanning.
50+
- name: Initialize CodeQL
51+
uses: github/codeql-action/init@v1
52+
with:
53+
languages: ${{ matrix.language }}
54+
# If you wish to specify custom queries, you can do so here or in a config file.
55+
# By default, queries listed here will override any specified in a config file.
56+
# Prefix the list here with "+" to use these queries and those in the config file.
57+
# queries: ./path/to/local/query, your-org/your-repo/queries@main
58+
59+
- name: Restore Packages
60+
run: |
61+
nuget restore "UA Quickstart Applications.sln"
62+
nuget restore "UA Sample Applications.sln"
63+
64+
- name: Build Solution
65+
run: |
66+
msbuild.exe "UA Quickstart Applications.sln" /p:configuration="Release" /p:UseSharedCompilation=false
67+
msbuild.exe "UA Sample Applications.sln" /p:configuration="Release" /p:UseSharedCompilation=false
68+
69+
- name: Perform CodeQL Analysis
70+
uses: github/codeql-action/analyze@v1

ComIOP/Common/Proxy/OpcProxyUtils.cs

Lines changed: 18 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,15 @@
2727
* http://opcfoundation.org/License/MIT/1.00/
2828
* ======================================================================*/
2929

30-
using System;
3130
using System.Collections.Generic;
32-
using Opc.Ua;
3331
using System.Security.Cryptography.X509Certificates;
34-
using System.Threading.Tasks;
3532

3633
namespace Opc.Ua.Com
3734
{
3835
/// <summary>
3936
/// A helper class for COpcProxyUtils.cpp
4037
/// </summary>
41-
public class ProxyUtils
38+
public static class ProxyUtils
4239
{
4340
/// <summary>
4441
/// Synchronous helper implementation of CheckApplicationInstanceCertificate for C++ Proxy
@@ -74,44 +71,32 @@ public static void CheckApplicationInstanceCertificate(ApplicationConfiguration
7471

7572
// create a new certificate with a new public key pair.
7673
certificate = CertificateFactory.CreateCertificate(
77-
id.StoreType,
78-
id.StorePath,
79-
null,
80-
configuration.ApplicationUri,
81-
configuration.ApplicationName,
82-
subjectName,
83-
hostNames,
84-
2048,
85-
DateTime.UtcNow - TimeSpan.FromHours(1),
86-
120,
87-
256,
88-
false,
89-
null,
90-
null);
74+
configuration.ApplicationUri,
75+
configuration.ApplicationName,
76+
subjectName,
77+
hostNames)
78+
.CreateForRSA()
79+
.AddToStore(
80+
id.StoreType,
81+
id.StorePath);
9182

92-
// update and save the configuration file.
9383
id.Certificate = certificate;
84+
85+
// update and save the configuration file.
9486
configuration.SaveToFile(configuration.SourceFilePath);
9587

9688
// add certificate to the trusted peer store so other applications will trust it.
97-
ICertificateStore store = configuration.SecurityConfiguration.TrustedPeerCertificates.OpenStore();
98-
99-
try
89+
using (ICertificateStore store = configuration.SecurityConfiguration.TrustedPeerCertificates.OpenStore())
10090
{
101-
X509Certificate2Collection certificateCollection = store.FindByThumbprint(certificate.Thumbprint).Result;
102-
if (certificateCollection != null)
103-
{
104-
store.Add(certificateCollection[0]).Wait();
105-
}
106-
}
107-
finally
108-
{
109-
store.Close();
91+
X509Certificate2Collection certificateCollection = store.FindByThumbprint(certificate.Thumbprint).Result;
92+
if (certificateCollection != null)
93+
{
94+
store.Add(certificateCollection[0]).Wait();
95+
}
11096
}
11197

11298
// tell the certificate validator about the new certificate.
11399
configuration.CertificateValidator.Update(configuration.SecurityConfiguration).Wait();
114-
115100
}
116101

117102
/// <summary>
@@ -123,6 +108,5 @@ public static ApplicationConfiguration ApplicationConfigurationLoad(string secti
123108
config = ApplicationConfiguration.Load(sectionName, applicationType).Result;
124109
return config;
125110
}
126-
127111
}
128-
}
112+
}

ComIOP/Common/UA COM Interop Library.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
<ItemGroup>
6565
<Reference Include="System" />
6666
<Reference Include="System.ComponentModel.DataAnnotations" />
67-
<Reference Include="System.configuration" />
67+
<Reference Include="System.Configuration" />
6868
<Reference Include="System.Core">
6969
<RequiredTargetFramework>3.5</RequiredTargetFramework>
7070
</Reference>

ComIOP/Wrapper/Common/OPC Sample Utility Classes.vcxproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<RootNamespace>OPC Sample Utility Classes</RootNamespace>
1717
<WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion>
1818
</PropertyGroup>
19-
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
19+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" Condition="exists('$(VCTargetsPath)\Microsoft.Cpp.Default.props')" />
2020
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
2121
<ConfigurationType>StaticLibrary</ConfigurationType>
2222
<PlatformToolset>v141</PlatformToolset>
@@ -29,16 +29,14 @@
2929
<UseOfMfc>false</UseOfMfc>
3030
<CharacterSet>Unicode</CharacterSet>
3131
</PropertyGroup>
32-
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
32+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" Condition="exists('$(VCTargetsPath)\Microsoft.Cpp.props')" />
3333
<ImportGroup Label="ExtensionSettings">
3434
</ImportGroup>
3535
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
3636
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
37-
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
3837
</ImportGroup>
3938
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
4039
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
41-
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
4240
</ImportGroup>
4341
<PropertyGroup Label="UserMacros" />
4442
<PropertyGroup>
@@ -47,10 +45,12 @@
4745
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
4846
<OutDir>..\..\bin\Release\</OutDir>
4947
<IntDir>$(OutDir)intermediate\$(ProjectName)\</IntDir>
48+
<TargetName>OpcComServer</TargetName>
5049
</PropertyGroup>
5150
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
5251
<OutDir>..\..\bin\Debug\</OutDir>
5352
<IntDir>$(OutDir)intermediate\$(ProjectName)\</IntDir>
53+
<TargetName>OpcComServer</TargetName>
5454
</PropertyGroup>
5555
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
5656
<CustomBuildStep>
@@ -322,7 +322,7 @@
322322
<ClInclude Include="resource.h" />
323323
<ClInclude Include="StdAfx.h" />
324324
</ItemGroup>
325-
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
325+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" Condition="exists('$(VCTargetsPath)\Microsoft.Cpp.targets')" />
326326
<ImportGroup Label="ExtensionTargets">
327327
</ImportGroup>
328328
</Project>

LICENSE.TXT

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2222
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2323
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2424
SOFTWARE.
25+

SECURITY.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Security Policy
2+
3+
## Supported Versions
4+
5+
Only the latest version will receive security updates.
6+
7+
## Reporting a Vulnerability
8+
9+
The OPC Foundation publishes security bulletins that affect software that it maintains or distributes. In many cases these bulletins will affect code that OPC vendors incorporate into their products. As a result, vendors will have to patch their products to address the vulnerabilities identified.
10+
11+
All the bulletins that have been published are available [here](https://opcfoundation.org/security-bulletins/).
12+
13+
Any vulnerabilities or security concerns should be reported to ‘securityteam AT opcfoundation DOT org’.
14+
A PGP key to encrypt any sensitive security report can be found [here](https://opcfoundation.org/SecurityBulletins/securityteam_public_key.txt).
15+
16+
Complete information can be found [here](https://opcfoundation.org/security/).

Samples/Client.Net4/UA Sample Client.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
</PropertyGroup>
5252
<ItemGroup>
5353
<Reference Include="System" />
54-
<Reference Include="System.configuration" />
54+
<Reference Include="System.Configuration" />
5555
<Reference Include="System.Configuration.Install" />
5656
<Reference Include="System.Core">
5757
<RequiredTargetFramework>3.5</RequiredTargetFramework>

Samples/GDS/Client/app.config renamed to Samples/GDS/Client/App.config

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@
4747
</ConfigurationLocation>
4848
</Opc.Ua.ClientConfiguration>
4949

50-
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/></startup>
50+
<startup>
51+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/>
52+
</startup>
5153
<runtime>
5254
</runtime>
5355
</configuration>

Samples/GDS/Client/GlobalDiscoveryClient.csproj

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@
4646
<ApplicationManifest>app.manifest</ApplicationManifest>
4747
</PropertyGroup>
4848
<ItemGroup>
49-
<Reference Include="PresentationCore" />
50-
<Reference Include="PresentationFramework" />
5149
<Reference Include="System" />
5250
<Reference Include="System.Configuration" />
5351
<Reference Include="System.IdentityModel" />
@@ -57,7 +55,6 @@
5755
<Reference Include="System.Windows.Forms" />
5856
<Reference Include="System.Xml" />
5957
<Reference Include="System.Xml.Serialization" />
60-
<Reference Include="WindowsBase" />
6158
</ItemGroup>
6259
<ItemGroup>
6360
<Compile Include="Controls\ApplicationCertificateControl.cs">
@@ -75,7 +72,7 @@
7572
<Compile Include="Controls\RegisterApplicationControl.cs">
7673
<SubType>UserControl</SubType>
7774
</Compile>
78-
<Compile Include="Controls\RegisterApplicationControl.designer.cs">
75+
<Compile Include="Controls\RegisterApplicationControl.Designer.cs">
7976
<DependentUpon>RegisterApplicationControl.cs</DependentUpon>
8077
</Compile>
8178
<Compile Include="MainForm.cs">
@@ -109,7 +106,9 @@
109106
<DependentUpon>Resources.resx</DependentUpon>
110107
<DesignTime>True</DesignTime>
111108
</Compile>
112-
<None Include="App.config" />
109+
<None Include="App.config">
110+
<SubType>Designer</SubType>
111+
</None>
113112
<None Include="app.manifest">
114113
<SubType>Designer</SubType>
115114
</None>

Samples/GDS/Client/Properties/Resources.resx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@
119119
</resheader>
120120
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
121121
<data name="environment_view" type="System.Resources.ResXFileRef, System.Windows.Forms">
122-
<value>..\images\environment_view.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
122+
<value>..\Images\environment_view.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
123123
</data>
124124
<data name="error" type="System.Resources.ResXFileRef, System.Windows.Forms">
125125
<value>..\Images\error.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>

0 commit comments

Comments
 (0)