From 5ce783f105bfe2358a33fa90dba963e80af249ad Mon Sep 17 00:00:00 2001 From: mahmoud karzoun <135722882+mkarson1997@users.noreply.github.com> Date: Sat, 5 Sep 2026 15:05:01 +0300 Subject: [PATCH 1/3] security: add CodeQL analysis --- .github/workflows/codeql.yml | 40 ++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) 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..54b65fa --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,40 @@ +name: CodeQL + +on: + push: + branches: [main] + pull_request: + branches: [main] + schedule: + - cron: "29 4 * * 3" + +jobs: + analyze: + name: Analyze C# + permissions: + contents: read + security-events: write + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup .NET 10 + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '10.0.x' + + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: csharp + queries: security-extended + + - name: Autobuild + uses: github/codeql-action/autobuild@v3 + + - name: Perform CodeQL analysis + uses: github/codeql-action/analyze@v3 + with: + category: "/language:csharp" From 417c1d0e5aea2d900f71ae78a85c49638e74ba72 Mon Sep 17 00:00:00 2001 From: mahmoud karzoun <135722882+mkarson1997@users.noreply.github.com> Date: Sat, 5 Sep 2026 15:05:07 +0300 Subject: [PATCH 2/3] security: add Dependabot update policy --- .github/dependabot.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..438dabe --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,19 @@ +version: 2 +updates: + - package-ecosystem: nuget + directory: / + schedule: + interval: weekly + open-pull-requests-limit: 5 + + - package-ecosystem: github-actions + directory: / + schedule: + interval: weekly + open-pull-requests-limit: 5 + + - package-ecosystem: docker + directory: / + schedule: + interval: weekly + open-pull-requests-limit: 3 From 30774fb0e09c6737b2f94ca3bbee8b3286d22ecf Mon Sep 17 00:00:00 2001 From: mahmoud karzoun <135722882+mkarson1997@users.noreply.github.com> Date: Sat, 5 Sep 2026 15:05:14 +0300 Subject: [PATCH 3/3] ci: scope permissions and remove hardcoded test password --- .github/workflows/ci.yml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fbd5957..5116452 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,11 +6,10 @@ on: pull_request: branches: [main] -permissions: - contents: read - jobs: build-and-test: + permissions: + contents: read runs-on: ubuntu-latest timeout-minutes: 15 @@ -32,9 +31,14 @@ jobs: - name: Test run: dotnet test CargoAPI.Tests/CargoAPI.Tests.csproj --configuration Release --no-build --verbosity normal + - name: Create ephemeral SQL Server password for compose validation + shell: bash + run: | + password="Aa1!$(openssl rand -hex 24)" + echo "::add-mask::$password" + echo "MSSQL_SA_PASSWORD=$password" >> "$GITHUB_ENV" + - name: Validate Docker Compose configuration - env: - MSSQL_SA_PASSWORD: CI_Only_Password_2026! run: docker compose config --quiet - name: Build API container image