Skip to content

Commit 5aad92f

Browse files
Merge remote-tracking branch 'origin/main' into v1-bug-fixes
2 parents b97407f + 9a326f6 commit 5aad92f

22 files changed

+934
-46
lines changed

.github/workflows/codeql.yml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
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 Advanced"
13+
14+
on:
15+
push:
16+
branches: [ "main", dev, demo ]
17+
pull_request:
18+
branches: [ "main", dev, demo ]
19+
schedule:
20+
- cron: '38 9 * * 2'
21+
22+
jobs:
23+
analyze:
24+
name: Analyze (${{ matrix.language }})
25+
# Runner size impacts CodeQL analysis time. To learn more, please see:
26+
# - https://gh.io/recommended-hardware-resources-for-running-codeql
27+
# - https://gh.io/supported-runners-and-hardware-resources
28+
# - https://gh.io/using-larger-runners (GitHub.com only)
29+
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
30+
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
31+
permissions:
32+
# required for all workflows
33+
security-events: write
34+
35+
# required to fetch internal or private CodeQL packs
36+
packages: read
37+
38+
# only required for workflows in private repositories
39+
actions: read
40+
contents: read
41+
42+
strategy:
43+
fail-fast: false
44+
matrix:
45+
include:
46+
- language: csharp
47+
build-mode: none
48+
# CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift'
49+
# Use `c-cpp` to analyze code written in C, C++ or both
50+
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
51+
# Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
52+
# To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
53+
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
54+
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
55+
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
56+
steps:
57+
- name: Checkout repository
58+
uses: actions/checkout@v4
59+
60+
# Initializes the CodeQL tools for scanning.
61+
- name: Initialize CodeQL
62+
uses: github/codeql-action/init@v3
63+
with:
64+
languages: ${{ matrix.language }}
65+
build-mode: ${{ matrix.build-mode }}
66+
# If you wish to specify custom queries, you can do so here or in a config file.
67+
# By default, queries listed here will override any specified in a config file.
68+
# Prefix the list here with "+" to use these queries and those in the config file.
69+
70+
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
71+
# queries: security-extended,security-and-quality
72+
73+
# If the analyze step fails for one of the languages you are analyzing with
74+
# "We were unable to automatically build your code", modify the matrix above
75+
# to set the build mode to "manual" for that language. Then modify this step
76+
# to build your code.
77+
# ℹ️ Command-line programs to run using the OS shell.
78+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
79+
- if: matrix.build-mode == 'manual'
80+
shell: bash
81+
run: |
82+
echo 'If you are using a "manual" build mode for one or more of the' \
83+
'languages you are analyzing, replace this with the commands to build' \
84+
'your code, for example:'
85+
echo ' make bootstrap'
86+
echo ' make release'
87+
exit 1
88+
89+
- name: Perform CodeQL Analysis
90+
uses: github/codeql-action/analyze@v3
91+
with:
92+
category: "/language:${{matrix.language}}"

.github/workflows/sync-branches.yml

Lines changed: 0 additions & 44 deletions
This file was deleted.

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ _textdb/
1717
##
1818
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
1919

20+
# .NET C#
21+
appsettings.json
22+
23+
2024
# User-specific files
2125
*.rsuser
2226
*.suo

Deployment/docs/ArchitectureDescription.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ The user interaction and flow of information are as follows:
1111

1212
**1 Upload / Register Document for AI analysis**
1313

14-
Note: The user can be one of these roles: Sustainability Manager, Head of Extra-Financial Reporting, or other designated person in the organization.
14+
Note: The user has a designated role in the organization, such as Sustainability Manager, Head of Extra-Financial Reporting, or Chief Sustainability Officer.
1515

1616
The user logs into the Power App and uploads a sustainability reports he & his (she & her) colleagues would use to create Benchmarking & Gap Analysis reports. Power Automate sends these documents to backend services so they are ready to be processed.
1717

@@ -41,7 +41,7 @@ Once the output document is successfully created in the backend, power automate
4141

4242
**4 User Accesses the Output Documents**
4343

44-
Note: The user can be one of these roles: Sustainability Manager, Head of Extra-Financial Reporting, or Chief Sustainability Officer, or other designated person in the organization, as long as the user is added to the Teams channel.
44+
Note: The user needs to be added to the Teams channel prior to use below features.
4545

4646
After the document is available in SharePoint, the user gets a notification in Teams from a custom copilot. At this point, the user can view the document by clicking a hyperlink from Teams or he can choose to chat with the copilot to get insights about the generated document.
4747

107 KB
Loading
91.8 KB
Loading
42.7 KB
Loading

Services/testapp/Choice.cs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Copyright (c) Microsoft. All rights reserved.
2+
// Licensed under the MIT License.
3+
using System.ComponentModel;
4+
5+
namespace Tester.ConsoleApp
6+
{
7+
enum Choice
8+
{
9+
[Description("1. List Registered Documents")]
10+
ListRegisteredDocuments,
11+
[Description("2. Register Documents")]
12+
RegisterDocuments,
13+
[Description("3. Delete Registered Documents in Azure")]
14+
DeleteDocuments,
15+
[Description("4. Perform Gap Analysis")]
16+
GapAnalysis,
17+
[Description("5. Get All Gap Analysis Results")]
18+
GetAllGapAnalysisResults,
19+
[Description("6. Perform Benchmark Analysis")]
20+
BenchMarks,
21+
[Description("7. Get All Benchmark Analysis Results")]
22+
GetAllBenchMarksResults,
23+
[Description("8. Test API Connection")]
24+
TestApiConnection,
25+
[Description("9. Exit")]
26+
Exit
27+
}
28+
}
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
// Copyright (c) Microsoft. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
using System.Security.Cryptography.X509Certificates;
5+
using Spectre.Console;
6+
7+
namespace Tester.ConsoleApp.Functions
8+
{
9+
public static class ApiConnection
10+
{
11+
public static async void TestConnection(Uri uri)
12+
{
13+
// Create a custom HttpClientHandler to handle SSL certificate validation
14+
var handler = new HttpClientHandler
15+
{
16+
ServerCertificateCustomValidationCallback = (message, cert, chain, sslPolicyErrors) =>
17+
{
18+
// Here you can add custom logic to validate the certificate
19+
// For example, you can check the certificate thumbprint, issuer, etc.
20+
// Returning true will bypass the SSL certificate validation
21+
if (cert == null)
22+
{
23+
AnsiConsole.WriteLine("No Server Certificate Found");
24+
return false;
25+
}
26+
return ValidateCertificate(cert);
27+
}
28+
};
29+
30+
// Create an HttpClient using the custom handler
31+
using (var client = new HttpClient(handler))
32+
{
33+
// Set the base address of the API
34+
client.BaseAddress = uri;
35+
try
36+
{
37+
// Make a GET request to the API
38+
HttpResponseMessage response = await client.GetAsync("/api/endpoint");
39+
// Check if the response is successful
40+
if (response.IsSuccessStatusCode)
41+
{
42+
// Read the response content
43+
string content = await response.Content.ReadAsStringAsync();
44+
//AnsiConsole.WriteLine("\nTest Connection Response Content: " + content);
45+
}
46+
AnsiConsole.WriteLine("API Connection is successful.");
47+
}
48+
catch (Exception ex)
49+
{
50+
//AnsiConsole.WriteLine("\nTest Connection Failed with Exception (check your appsettings.json and services): " + ex.Message);
51+
AnsiConsole.WriteLine("Test Connection Failed with Exceptions. Check your appsettings.json and API services.");
52+
}
53+
}
54+
}
55+
56+
// Validate the SSL certificate
57+
static bool ValidateCertificate(X509Certificate2 cert)
58+
{
59+
// Add custom validation logic here
60+
// For example, check the certificate thumbprint, issuer, expiration date, etc.
61+
//AnsiConsole.WriteLine("Certificate Subject: " + cert.Subject);
62+
//AnsiConsole.WriteLine("Certificate Issuer: " + cert.Issuer);
63+
//AnsiConsole.WriteLine("Certificate Thumbprint: " + cert.Thumbprint);
64+
//AnsiConsole.WriteLine("Certificate Expiration: " + cert.NotAfter);
65+
//AnsiConsole.WriteLine(); // Write a new line
66+
67+
// Example: Validate the certificate thumbprint. This is just an example, you should use a valid thumbprint.
68+
string expectedThumbprint = "B89BB8B0BEF4B6CF59A472284B4F8F234525302B";
69+
if (cert.Thumbprint == expectedThumbprint)
70+
{
71+
return true;
72+
}
73+
74+
// Example: Validate the certificate issuer. This is just an example, you should use a valid issuer.
75+
string expectedIssuer = "Kubernetes Ingress Controller Fake Certificate";
76+
if (cert.Issuer == expectedIssuer)
77+
{
78+
return true;
79+
}
80+
81+
// Example: Validate the certificate expiration date
82+
if (DateTime.Now < cert.NotAfter)
83+
{
84+
return true;
85+
}
86+
87+
// If none of the validation checks pass, return false
88+
return false;
89+
}
90+
}
91+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// Copyright (c) Microsoft. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
namespace Tester.ConsoleApp.Functions
5+
{
6+
public class AppConfig
7+
{
8+
public string JobOwner { get; set; }
9+
public string Type { get; set; }
10+
public string disclosureNumber { get; set; }
11+
public string disclosureName { get; set; }
12+
public string disclosureRequirement { get; set; }
13+
public string disclosureRequirementDetail { get; set; }
14+
public string disclosureAnnex { get; set; }
15+
16+
// Constructor to initialize properties
17+
public AppConfig(string myJobOwner, string myType, string myDisclosureNumber, string myDisclosureName, string myDisclosureRequirement, string myDisclosureRequirementDetail, string myDisclosureAnnex)
18+
{
19+
JobOwner = myJobOwner;
20+
Type = myType;
21+
disclosureNumber = myDisclosureNumber;
22+
disclosureName = myDisclosureName;
23+
disclosureRequirement = myDisclosureRequirement;
24+
disclosureRequirementDetail = myDisclosureRequirementDetail;
25+
disclosureAnnex = myDisclosureAnnex;
26+
}
27+
28+
// Parameterless constructor for deserialization
29+
public AppConfig()
30+
{
31+
JobOwner = string.Empty;
32+
Type = string.Empty;
33+
disclosureNumber = string.Empty;
34+
disclosureName = string.Empty;
35+
disclosureRequirement = string.Empty;
36+
disclosureRequirementDetail = string.Empty;
37+
disclosureAnnex = string.Empty;
38+
}
39+
}
40+
}

0 commit comments

Comments
 (0)