From e4b0258b2ce18ab804013e1297181d2c15a597e2 Mon Sep 17 00:00:00 2001 From: nd Date: Sat, 24 Aug 2024 11:02:34 +0700 Subject: [PATCH 1/2] Update + Updated references - Removed vulnerable Aspire (upgrade didn't work) --- .github/workflows/codeql.yml | 90 +++++++++++++++++++ README.md | 6 +- .../Properties/Resources.Designer.cs | 2 +- .../Properties/Resources.resx | 2 +- .../wan24-AutoDiscover Shared.csproj | 6 +- src/wan24-AutoDiscover.AppHost/Program.cs | 2 + .../wan24-AutoDiscover.AppHost.csproj | 2 +- .../wan24-AutoDiscover.ServiceDefaults.csproj | 14 +-- src/wan24-AutoDiscover.sln | 23 ++--- src/wan24-AutoDiscover/Program.cs | 2 - .../Services/CommandLineInterface.Upgrade.cs | 1 + src/wan24-AutoDiscover/latest-release.txt | 2 +- .../wan24-AutoDiscover.csproj | 7 +- 13 files changed, 120 insertions(+), 39 deletions(-) create mode 100644 .github/workflows/codeql.yml diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..30d0e1d --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,90 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL" + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + schedule: + - cron: '33 10 * * 6' + +jobs: + analyze: + name: Analyze (${{ matrix.language }}) + # Runner size impacts CodeQL analysis time. To learn more, please see: + # - https://gh.io/recommended-hardware-resources-for-running-codeql + # - https://gh.io/supported-runners-and-hardware-resources + # - https://gh.io/using-larger-runners (GitHub.com only) + # Consider using larger runners or machines with greater resources for possible analysis time improvements. + runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} + timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }} + permissions: + # required for all workflows + security-events: write + + # required to fetch internal or private CodeQL packs + packages: read + + # only required for workflows in private repositories + actions: read + contents: read + + strategy: + fail-fast: false + matrix: + include: + - language: csharp + build-mode: manual + # CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' + # Use `c-cpp` to analyze code written in C, C++ or both + # Use 'java-kotlin' to analyze code written in Java, Kotlin or both + # Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both + # To learn more about changing the languages that are analyzed or customizing the build mode for your analysis, + # see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning. + # If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how + # 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 + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: ${{ matrix.language }} + build-mode: ${{ matrix.build-mode }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + + # 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 + # queries: security-extended,security-and-quality + + # If the analyze step fails for one of the languages you are analyzing with + # "We were unable to automatically build your code", modify the matrix above + # to set the build mode to "manual" for that language. Then modify this step + # to build your code. + # ℹ️ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + - if: matrix.build-mode == 'manual' + shell: bash + run: | + dotnet workload install aspire + dotnet restore ./src/wan24-AutoDiscover.sln --ignore-failed-sources + dotnet build "./src/wan24-AutoDiscover/wan24-AutoDiscover.csproj" --no-restore + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 + with: + category: "/language:${{matrix.language}}" diff --git a/README.md b/README.md index aef3198..1c2f31e 100644 --- a/README.md +++ b/README.md @@ -25,9 +25,9 @@ For example on a Debian Linux server: ```bash mkdir /home/autodiscover cd /home/autodiscover -wget https://github.com/nd1012/wan24-AutoDiscover/releases/download/v1.1.0/wan24-AutoDiscover.v1.1.0.zip -unzip wan24-AutoDiscover.v1.1.0.zip -rm wan24-AutoDiscover.v1.1.0.zip +wget https://github.com/nd1012/wan24-AutoDiscover/releases/download/v1.2.0/wan24-AutoDiscover.v1.2.0.zip +unzip wan24-AutoDiscover.v1.2.0.zip +rm wan24-AutoDiscover.v1.2.0.zip ``` ### `appsettings.json` diff --git a/src/wan24-AutoDiscover Shared/Properties/Resources.Designer.cs b/src/wan24-AutoDiscover Shared/Properties/Resources.Designer.cs index e0904e6..ef3ae9b 100644 --- a/src/wan24-AutoDiscover Shared/Properties/Resources.Designer.cs +++ b/src/wan24-AutoDiscover Shared/Properties/Resources.Designer.cs @@ -61,7 +61,7 @@ internal Resources() { } /// - /// Sucht eine lokalisierte Zeichenfolge, die 1.1.0 ähnelt. + /// Sucht eine lokalisierte Zeichenfolge, die 1.2.0 ähnelt. /// internal static string VERSION { get { diff --git a/src/wan24-AutoDiscover Shared/Properties/Resources.resx b/src/wan24-AutoDiscover Shared/Properties/Resources.resx index 70dbabc..2fc996f 100644 --- a/src/wan24-AutoDiscover Shared/Properties/Resources.resx +++ b/src/wan24-AutoDiscover Shared/Properties/Resources.resx @@ -118,6 +118,6 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - 1.1.0 + 1.2.0 \ No newline at end of file diff --git a/src/wan24-AutoDiscover Shared/wan24-AutoDiscover Shared.csproj b/src/wan24-AutoDiscover Shared/wan24-AutoDiscover Shared.csproj index fab8a58..18ab763 100644 --- a/src/wan24-AutoDiscover Shared/wan24-AutoDiscover Shared.csproj +++ b/src/wan24-AutoDiscover Shared/wan24-AutoDiscover Shared.csproj @@ -11,9 +11,9 @@ - - - + + + diff --git a/src/wan24-AutoDiscover.AppHost/Program.cs b/src/wan24-AutoDiscover.AppHost/Program.cs index 948ba6b..b91aa6e 100644 --- a/src/wan24-AutoDiscover.AppHost/Program.cs +++ b/src/wan24-AutoDiscover.AppHost/Program.cs @@ -1,3 +1,5 @@ +using Aspire.Hosting; + var builder = DistributedApplication.CreateBuilder(args); builder.AddProject("wan24-autodiscover"); diff --git a/src/wan24-AutoDiscover.AppHost/wan24-AutoDiscover.AppHost.csproj b/src/wan24-AutoDiscover.AppHost/wan24-AutoDiscover.AppHost.csproj index 3b19f44..2002466 100644 --- a/src/wan24-AutoDiscover.AppHost/wan24-AutoDiscover.AppHost.csproj +++ b/src/wan24-AutoDiscover.AppHost/wan24-AutoDiscover.AppHost.csproj @@ -10,7 +10,7 @@ - + diff --git a/src/wan24-AutoDiscover.ServiceDefaults/wan24-AutoDiscover.ServiceDefaults.csproj b/src/wan24-AutoDiscover.ServiceDefaults/wan24-AutoDiscover.ServiceDefaults.csproj index a67d9bc..2567583 100644 --- a/src/wan24-AutoDiscover.ServiceDefaults/wan24-AutoDiscover.ServiceDefaults.csproj +++ b/src/wan24-AutoDiscover.ServiceDefaults/wan24-AutoDiscover.ServiceDefaults.csproj @@ -11,15 +11,15 @@ - - - - - + + + + + - + - + diff --git a/src/wan24-AutoDiscover.sln b/src/wan24-AutoDiscover.sln index b569976..3fde75d 100644 --- a/src/wan24-AutoDiscover.sln +++ b/src/wan24-AutoDiscover.sln @@ -7,16 +7,14 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "wan24-AutoDiscover", "wan24 EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "wan24-AutoDiscover Shared", "wan24-AutoDiscover Shared\wan24-AutoDiscover Shared.csproj", "{610B6034-2404-4EBA-80E1-92102CE9E5B4}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "wan24-AutoDiscover.AppHost", "wan24-AutoDiscover.AppHost\wan24-AutoDiscover.AppHost.csproj", "{697D3342-956F-4C77-93A9-1C80833EF5F5}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "wan24-AutoDiscover.ServiceDefaults", "wan24-AutoDiscover.ServiceDefaults\wan24-AutoDiscover.ServiceDefaults.csproj", "{F506B56D-8CF8-4C42-A842-6B4EBD4E58B1}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Wan24-Core", "..\..\wan24-Core\src\Wan24-Core\Wan24-Core.csproj", "{08E6E5D6-4B4A-46DB-9BD0-E649ABF456D0}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ObjectValidation", "..\..\ObjectValidation\src\ObjectValidation\ObjectValidation.csproj", "{6DD8879F-DBF9-4C20-BF4E-139A7DD3ED48}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "wan24-CLI", "..\..\wan24-CLI\src\wan24-CLI\wan24-CLI.csproj", "{D0D4CCB2-22DE-47BB-9FA8-5D0FD4DA20A3}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Referenced", "Referenced", "{389A8A4D-B1E3-4FE5-B56A-2077202BBC62}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -36,18 +34,6 @@ Global {610B6034-2404-4EBA-80E1-92102CE9E5B4}.Release|Any CPU.Build.0 = Release|Any CPU {610B6034-2404-4EBA-80E1-92102CE9E5B4}.Trunk|Any CPU.ActiveCfg = Trunk|Any CPU {610B6034-2404-4EBA-80E1-92102CE9E5B4}.Trunk|Any CPU.Build.0 = Trunk|Any CPU - {697D3342-956F-4C77-93A9-1C80833EF5F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {697D3342-956F-4C77-93A9-1C80833EF5F5}.Debug|Any CPU.Build.0 = Debug|Any CPU - {697D3342-956F-4C77-93A9-1C80833EF5F5}.Release|Any CPU.ActiveCfg = Release|Any CPU - {697D3342-956F-4C77-93A9-1C80833EF5F5}.Release|Any CPU.Build.0 = Release|Any CPU - {697D3342-956F-4C77-93A9-1C80833EF5F5}.Trunk|Any CPU.ActiveCfg = Trunk|Any CPU - {697D3342-956F-4C77-93A9-1C80833EF5F5}.Trunk|Any CPU.Build.0 = Trunk|Any CPU - {F506B56D-8CF8-4C42-A842-6B4EBD4E58B1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F506B56D-8CF8-4C42-A842-6B4EBD4E58B1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F506B56D-8CF8-4C42-A842-6B4EBD4E58B1}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F506B56D-8CF8-4C42-A842-6B4EBD4E58B1}.Release|Any CPU.Build.0 = Release|Any CPU - {F506B56D-8CF8-4C42-A842-6B4EBD4E58B1}.Trunk|Any CPU.ActiveCfg = Trunk|Any CPU - {F506B56D-8CF8-4C42-A842-6B4EBD4E58B1}.Trunk|Any CPU.Build.0 = Trunk|Any CPU {08E6E5D6-4B4A-46DB-9BD0-E649ABF456D0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {08E6E5D6-4B4A-46DB-9BD0-E649ABF456D0}.Release|Any CPU.ActiveCfg = Release|Any CPU {08E6E5D6-4B4A-46DB-9BD0-E649ABF456D0}.Trunk|Any CPU.ActiveCfg = Trunk|Any CPU @@ -64,6 +50,11 @@ Global GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {08E6E5D6-4B4A-46DB-9BD0-E649ABF456D0} = {389A8A4D-B1E3-4FE5-B56A-2077202BBC62} + {6DD8879F-DBF9-4C20-BF4E-139A7DD3ED48} = {389A8A4D-B1E3-4FE5-B56A-2077202BBC62} + {D0D4CCB2-22DE-47BB-9FA8-5D0FD4DA20A3} = {389A8A4D-B1E3-4FE5-B56A-2077202BBC62} + EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {EA8C3992-DDF7-4778-9ED7-670279F08583} EndGlobalSection diff --git a/src/wan24-AutoDiscover/Program.cs b/src/wan24-AutoDiscover/Program.cs index bfc3988..2d0c911 100644 --- a/src/wan24-AutoDiscover/Program.cs +++ b/src/wan24-AutoDiscover/Program.cs @@ -122,7 +122,6 @@ async Task LoadConfigAsync() // Build and run the app Logging.WriteInfo("Autodiscovery service app startup"); WebApplicationBuilder builder = WebApplication.CreateBuilder(args); -builder.AddServiceDefaults(); builder.Logging.ClearProviders() .AddConsole(); if (ENV.IsLinux) @@ -151,7 +150,6 @@ async Task LoadConfigAsync() cts.Cancel(); }); app.UseExceptionHandler(builder => { });// .NET 8 bugfix :( - app.MapDefaultEndpoints();// Aspire app.UseForwardedHeaders(); if (app.Environment.IsDevelopment()) { diff --git a/src/wan24-AutoDiscover/Services/CommandLineInterface.Upgrade.cs b/src/wan24-AutoDiscover/Services/CommandLineInterface.Upgrade.cs index df95d8b..7670b89 100644 --- a/src/wan24-AutoDiscover/Services/CommandLineInterface.Upgrade.cs +++ b/src/wan24-AutoDiscover/Services/CommandLineInterface.Upgrade.cs @@ -232,6 +232,7 @@ await transaction.ExecuteAsync( } Logging.WriteInfo("All backup files have been restored during rollback of a failed transaction"); }, + commit: null, CancellationToken.None ).DynamicContext(); // Copy new files diff --git a/src/wan24-AutoDiscover/latest-release.txt b/src/wan24-AutoDiscover/latest-release.txt index 1cc5f65..867e524 100644 --- a/src/wan24-AutoDiscover/latest-release.txt +++ b/src/wan24-AutoDiscover/latest-release.txt @@ -1 +1 @@ -1.1.0 \ No newline at end of file +1.2.0 \ No newline at end of file diff --git a/src/wan24-AutoDiscover/wan24-AutoDiscover.csproj b/src/wan24-AutoDiscover/wan24-AutoDiscover.csproj index 715b9b3..df70dfc 100644 --- a/src/wan24-AutoDiscover/wan24-AutoDiscover.csproj +++ b/src/wan24-AutoDiscover/wan24-AutoDiscover.csproj @@ -19,9 +19,9 @@ - - - + + + @@ -29,7 +29,6 @@ - From 00e0465ace0e5023f805084ed9f79da569bb3cc2 Mon Sep 17 00:00:00 2001 From: nd Date: Sat, 24 Aug 2024 11:05:32 +0700 Subject: [PATCH 2/2] Update --- .github/workflows/codeql.yml | 1 - .github/workflows/docfx.yml | 2 -- .github/workflows/dotnet.yml | 2 -- 3 files changed, 5 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 30d0e1d..ddd5668 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -80,7 +80,6 @@ jobs: - if: matrix.build-mode == 'manual' shell: bash run: | - dotnet workload install aspire dotnet restore ./src/wan24-AutoDiscover.sln --ignore-failed-sources dotnet build "./src/wan24-AutoDiscover/wan24-AutoDiscover.csproj" --no-restore diff --git a/.github/workflows/docfx.yml b/.github/workflows/docfx.yml index 890cca7..fac4d2d 100644 --- a/.github/workflows/docfx.yml +++ b/.github/workflows/docfx.yml @@ -18,8 +18,6 @@ jobs: dotnet-version: 8.0.x - name: Setup docfx run: dotnet tool update -g docfx - - name: Install .NET Aspire workload - run: dotnet workload install aspire - name: Copy README run: cp README.md "./src/wan24-AutoDiscover Docs/index.md" - name: Build docs diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 827b4fc..8882759 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -20,8 +20,6 @@ jobs: uses: actions/setup-dotnet@v3 with: dotnet-version: 8.0.x - - name: Install .NET Aspire workload - run: dotnet workload install aspire - name: Restore dependencies run: dotnet restore ./src/wan24-AutoDiscover.sln --ignore-failed-sources - name: Build lib