diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 000000000..06005e587 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,37 @@ +# Dependabot 依赖更新门禁 +# 安全更新(security updates)按单条 PR 处理,不进入 groups(applies-to: version-updates 限定分组范围) +version: 2 +updates: + - package-ecosystem: maven + directory: "/" + schedule: + interval: weekly + day: monday + time: "03:00" + timezone: "Asia/Shanghai" + open-pull-requests-limit: 10 + labels: + - "dependencies" + groups: + maven-minor-patch: + applies-to: version-updates + update-types: + - minor + - patch + + - package-ecosystem: npm + directory: "/frontend" + schedule: + interval: weekly + day: monday + time: "03:00" + timezone: "Asia/Shanghai" + open-pull-requests-limit: 10 + labels: + - "dependencies" + groups: + npm-minor-patch: + applies-to: version-updates + update-types: + - minor + - patch diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 000000000..7cc5257bc --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,61 @@ +# CodeQL 静态安全扫描 +# 语言选择:java-kotlin(Maven 多模块,autobuild 走 ./mvnw)与 javascript-typescript(前端,无需构建) +# queries 用 security-and-quality:在默认规则集之上叠加 security-extended,换取更全的漏洞与质量覆盖 +name: "CodeQL" + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + schedule: + - cron: '23 18 * * 1' + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + analyze: + name: Analyze (${{ matrix.language }}) + runs-on: ubuntu-latest + timeout-minutes: 60 + permissions: + security-events: write + actions: read + contents: read + strategy: + fail-fast: false + matrix: + include: + - language: java-kotlin + build-mode: autobuild + - language: javascript-typescript + build-mode: none + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + # autobuild 依赖 ./mvnw 编译,必须显式提供 temurin 17,否则默认 JDK 可能不匹配 pom.xml + - name: Set up JDK 17 + if: matrix.language == 'java-kotlin' + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 17 + cache: maven + + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: ${{ matrix.language }} + build-mode: ${{ matrix.build-mode }} + queries: security-and-quality + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 + with: + category: "/language:${{matrix.language}}" diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml new file mode 100644 index 000000000..df5c280bb --- /dev/null +++ b/.github/workflows/dependency-review.yml @@ -0,0 +1,28 @@ +# Dependency Review 依赖审查 +# 在 PR 上对比依赖清单差异,命中 high 及以上严重级别漏洞即失败(fail-on-severity: high) +# Maven pom.xml 与 frontend/package-lock.json 由 action 自动发现,无需额外配置 +name: "Dependency Review" + +on: + pull_request: + +permissions: + contents: read + pull-requests: write + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + dependency-review: + runs-on: ubuntu-latest + timeout-minutes: 15 + steps: + - name: "Checkout Repository" + uses: actions/checkout@v4 + + - name: "Dependency Review" + uses: actions/dependency-review-action@v4 + with: + fail-on-severity: high