Skip to content

Commit c0abce4

Browse files
committed
Merge remote-tracking branch 'origin/master' into Issue91042Generics
2 parents da28cde + 8e475da commit c0abce4

File tree

20 files changed

+287
-280
lines changed

20 files changed

+287
-280
lines changed

.github/workflows/veracode.yml

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
# This workflow uses actions that are not certified by GitHub.
2+
# They are provided by a third-party and are governed by
3+
# separate terms of service, privacy policy, and support
4+
# documentation.
5+
6+
# This workflow will initiate a Veracode Static Analysis Pipeline scan, return a results.json and convert to SARIF for upload as a code scanning alert
7+
8+
name: Veracode Static Analysis Pipeline Scan
9+
10+
on:
11+
workflow_dispatch:
12+
inputs:
13+
configuration:
14+
description: 'Build project configuration (options:Release|Debug)'
15+
default: 'Release'
16+
options:
17+
- Release
18+
- Debug
19+
push:
20+
branches: [ main ]
21+
#schedule:
22+
# - cron: '44 4 * * 5'
23+
24+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
25+
permissions:
26+
contents: read
27+
28+
jobs:
29+
# This workflow contains a job to build and submit pipeline scan, you will need to customize the build process accordingly and make sure the artifact you build is used as the file input to the pipeline scan file parameter
30+
build-and-pipeline-scan:
31+
env:
32+
ZipFilename: netClassesForScan.zip
33+
34+
# The type of runner that the job will run on
35+
permissions:
36+
contents: read # for actions/checkout to fetch code
37+
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
38+
39+
runs-on: windows-latest
40+
41+
steps:
42+
43+
- name: Checkout repository
44+
uses: actions/checkout@v2
45+
with:
46+
repository: ''
47+
48+
- name: Set build configuration from dispatch
49+
if: ${{ github.event.inputs.configuration != '' }}
50+
run: |
51+
$configuration = '${{github.event.inputs.configuration}}'
52+
echo "BuildConfiguration=$configuration" >> $env:GITHUB_ENV
53+
- name: Set default build configuration
54+
if: ${{ github.event.inputs.configuration == '' }}
55+
run: echo "BuildConfiguration=Release" >> $env:GITHUB_ENV
56+
57+
- uses: actions/setup-dotnet@v1
58+
with:
59+
source-url: https://nuget.pkg.github.com/genexuslabs/index.json
60+
env:
61+
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
62+
63+
- name: Build
64+
run: |
65+
$veracodesolution = "VeracodeSolution"
66+
dotnet new sln --name $veracodesolution --output dotnet --force
67+
dotnet msbuild dotnet\DotNetStandardClasses.sln /t:DumpProjects -p:DumpSolutionName=$veracodesolution /m:1
68+
dotnet msbuild dotnet\Directory.Build.targets /t:PublishForAnalyzer -p:DumpSolutionName=$veracodesolution
69+
70+
- name: Create package for Veracode scan
71+
shell: powershell
72+
run: Compress-Archive .out\*.* $env:ZipFilename
73+
74+
- name: Download Veracode Static Analysis Pipeline scan jar
75+
shell: powershell
76+
run: |
77+
Invoke-WebRequest -Uri "https://downloads.veracode.com/securityscan/pipeline-scan-LATEST.zip" -OutFile "pipeline-scan.zip"
78+
Expand-Archive "pipeline-scan.zip" -DestinationPath ".veracode" -Force
79+
80+
- name: Upload package for scan
81+
uses: actions/setup-java@v1
82+
with:
83+
java-version: 1.8
84+
- name: Execute scan
85+
run: java -jar ".veracode\pipeline-scan.jar" --veracode_api_id "${{secrets.VERACODE_API_ID}}" --veracode_api_key "${{secrets.VERACODE_API_KEY}}" --fail_on_severity="Very High, High" --file $env:ZipFilename
86+
continue-on-error: true
87+
- name: Convert pipeline scan output to SARIF format
88+
id: convert
89+
uses: veracode/veracode-pipeline-scan-results-to-sarif@ff08ae5b45d5384cb4679932f184c013d34da9be
90+
with:
91+
pipeline-results-json: results.json
92+
source-base-path-1: "^.*/${{ github.event.repository.name }}/dotnet/:dotnet/"
93+
#source-base-path-1: "^.*/${{ github.event.repository.name }}/dotnet/:blob/main/dotnet/"
94+
95+
- uses: github/codeql-action/upload-sarif@v1
96+
with:
97+
# Path to SARIF file relative to the root of the repository
98+
sarif_file: veracode-results.sarif
99+
100+
- uses: actions/upload-artifact@v3
101+
with:
102+
name: veracode_json_and_sarif_results
103+
path: |
104+
results.json
105+
veracode-results.sarif
106+
retention-days: 15

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,3 +361,6 @@ build
361361
/dotnet/src/dotnetcore/GxDataInitialization/net6.0/GXDataInitialization.deps.json
362362
/dotnet/src/dotnetcore/GxNetCoreStartup/net6.0/GxNetCoreStartup.deps.json
363363
/dotnet/src/dotnetcore/Reor/net6.0/Reor.deps.json
364+
.out
365+
/dotnet/Veracode.sln
366+
/dotnet/VeracodeSolution.sln

dotnet/Directory.Build.targets

Lines changed: 13 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@
1212
<ApplicationIcon >$(MSBuildThisFileDirectory)\src\resources\Default_App.ico</ApplicationIcon>
1313
</PropertyGroup>
1414

15+
<PropertyGroup>
16+
<DumpSolutionName>TempSolution</DumpSolutionName>
17+
<DumpSolutionTargetFrameworkDefault>net6</DumpSolutionTargetFrameworkDefault>
18+
</PropertyGroup>
19+
1520
<PropertyGroup>
1621
<DeployDirectory>$(MSBuildThisFileDirectory)bin\$(TargetFramework)</DeployDirectory>
1722
<!--Set a default deploy dir-->
@@ -24,50 +29,17 @@
2429
</PackageReference>
2530
</ItemGroup>
2631

27-
<UsingTask
28-
TaskName="ReplaceFileText"
29-
TaskFactory="RoslynCodeTaskFactory"
30-
AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll">
31-
<ParameterGroup>
32-
<InputFilename ParameterType="System.String" Required="true" />
33-
<OutputFilename ParameterType="System.String" Required="true" />
34-
<MatchExpression ParameterType="System.String" Required="true" />
35-
<ReplacementText ParameterType="System.String" Required="true" />
36-
</ParameterGroup>
37-
<Task>
38-
<Using Namespace="System"/>
39-
<Using Namespace="System.IO"/>
40-
<Using Namespace="System.Text.RegularExpressions" />
41-
<Code Type="Fragment" Language="cs">
42-
<![CDATA[
43-
File.WriteAllText(
44-
OutputFilename,
45-
Regex.Replace(File.ReadAllText(InputFilename), MatchExpression, ReplacementText)
46-
);
47-
]]>
48-
</Code>
49-
</Task>
50-
</UsingTask>
51-
52-
53-
<Target Name="PostBuild" AfterTargets="Build" Condition="'$(GxGenerateDepsFile)'=='true' AND ('$(TargetFramework)'=='net6.0')">
54-
<MakeDir Directories="$(TargetFramework)"/>
55-
<Exec Command="copy $(OutDir)$(ProjectName).deps.json $(TargetFramework)\$(ProjectName).deps.json" />
56-
<ReplaceFileText
57-
InputFilename="$(TargetFramework)\$(ProjectName).deps.json"
58-
OutputFilename="$(TargetFramework)\$(ProjectName).deps.json"
59-
MatchExpression="GeneXus\.Classes\.Core"
60-
ReplacementText="GxClasses" />
61-
<ReplaceFileText
62-
InputFilename="$(TargetFramework)\$(ProjectName).deps.json"
63-
OutputFilename="$(TargetFramework)\$(ProjectName).deps.json"
64-
MatchExpression="GeneXus\.Classes\.Web\.Core"
65-
ReplacementText="GxClasses.Web"/>
66-
</Target>
67-
6832
<Target Name="CopyAssemblies" Condition="'$(ProjectName)'!='' AND Exists('$(ProjectDir)$(OutDir)$(TargetFileName)')">
6933
<Message Importance="high" Text="Copying $(ProjectDir)$(OutDir)$(TargetFileName) to $(DeployDirectory)"></Message>
7034
<Copy SourceFiles="$(ProjectDir)$(OutDir)$(TargetFileName)" DestinationFolder="$(DeployDirectory)" />
7135
</Target>
7236

37+
<Target Name="DumpProjects" Condition="($(TargetFramework.StartsWith($(DumpSolutionTargetFrameworkDefault))) OR $(TargetFrameworks.Contains($(DumpSolutionTargetFrameworkDefault))) ) AND !$(MSBuildProjectFullPath.Contains('\test\')) AND ('$(IsPublishable)'=='true' OR '$(IsPublishable)'=='')">
38+
<Exec Command="dotnet sln $(MSBuildThisFileDirectory)$(DumpSolutionName).sln add $(MSBuildProjectFullPath)"></Exec>
39+
</Target>
40+
41+
<Target Name="PublishForAnalyzer">
42+
<Exec Command="dotnet publish $(MSBuildThisFileDirectory)$(DumpSolutionName).sln --configuration Debug -o $(MSBuildThisFileDirectory)..\.out -p:Publishing=true -p:SignAssembly=false --framework net6.0"></Exec>
43+
</Target>
44+
7345
</Project>

dotnet/src/dotnetcore/GxDataInitialization/GXDataInitialization.csproj

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,6 @@
1616
<ProjectReference Include="..\GxClasses\GxClasses.csproj"/>
1717
</ItemGroup>
1818

19-
<ItemGroup>
20-
<Content Include="net6.0\$(MSBuildProjectName).deps.json">
21-
<Pack>true</Pack>
22-
<PackagePath>\content\net6.0\</PackagePath>
23-
</Content>
24-
</ItemGroup>
2519
<Target Name="CustomContentTarget">
2620
<ItemGroup>
2721
<TfmSpecificPackageFile Include="$(OutputPath)\$(MSBuildProjectName).deps.json">

dotnet/src/dotnetcore/GxNetCoreStartup/GxNetCoreStartup.csproj

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,6 @@
2828
</Reference>
2929
</ItemGroup>
3030

31-
<ItemGroup>
32-
<Content Include="net6.0\$(MSBuildProjectName).deps.json">
33-
<Pack>true</Pack>
34-
<PackagePath>\content\net6.0\</PackagePath>
35-
</Content>
36-
</ItemGroup>
3731
<Target Name="CustomContentTarget">
3832
<ItemGroup>
3933
<TfmSpecificPackageFile Include="$(OutputPath)\$(MSBuildProjectName).deps.json">

0 commit comments

Comments
 (0)