Compare commits
19 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 89d18e39b9 | |||
| edab8c3514 | |||
| c5e6c54f51 | |||
| f758e069c6 | |||
| 8edb66b504 | |||
| 523fe213a8 | |||
| 5046ec88c1 | |||
| 4c00e43b07 | |||
| 7dd61d58a6 | |||
| 53a5758356 | |||
| c8ed4645eb | |||
| 1c1fc49a9d | |||
| 13c7b4bd84 | |||
| 71927eb541 | |||
| 90b76e2a74 | |||
| 96afa5815c | |||
| eaae39ac07 | |||
| dfcaa0c63c | |||
| 8c3850bd2d |
@@ -0,0 +1,23 @@
|
||||
[
|
||||
{
|
||||
"level": "critical",
|
||||
"role": "Leo",
|
||||
"location": ".gitea/workflows/review.yaml:13",
|
||||
"suggestion": "將 `GEMINI_API_KEY` 參數中串接 20 個 API 金鑰的方式進行重構。這種寫法極度冗長,難以閱讀、維護和除錯。如果 Gitea Action 支援多個金鑰,應考慮使用更結構化的方式傳遞(例如,如果 Action 支援 YAML 列表或單一包含所有金鑰的 Secret)。如果 Action 預期單一金鑰,則此配置可能導致錯誤。建議與 Action 的開發者確認其支援的多金鑰機制,或考慮在 Action 內部處理金鑰輪替邏輯,以簡化工作流程配置。",
|
||||
"is_new": true
|
||||
},
|
||||
{
|
||||
"level": "critical",
|
||||
"role": "Rex",
|
||||
"location": ".gitea/workflows/review.yaml:18-20",
|
||||
"suggestion": "新建立的 `review.yaml` 工作流程賦予 `code-review` action 過於寬泛的權限,特別是 `contents: write`。這允許該 action 修改程式碼庫內容,若 action 存在漏洞或被惡意利用,可能導致程式碼注入、竄改或刪除。請重新評估 `code-review` action 所需的最小權限。如果僅需評論 PR,`pull-requests: write` 和 `issues: write` 可能已足夠,但仍需謹慎。建議限制為只讀權限,或僅授予評論 PR 的權限,並確保 action 不會執行不必要的寫入操作。",
|
||||
"is_new": true
|
||||
},
|
||||
{
|
||||
"level": "warning",
|
||||
"role": "Rex",
|
||||
"location": ".gitea/workflows/master.yaml:13\n.gitea/workflows/review.yaml:12",
|
||||
"suggestion": "兩個工作流程都使用了來自 `https://gitea.jsc.idv.tw` 的外部 action (`calculate-version` 和 `code-review`)。這引入了供應鏈風險,因為這些 action 的安全性直接影響到整個 CI/CD 流程。如果 `gitea.jsc.idv.tw` 受到損害,或這些 action 包含惡意程式碼,可能會導致嚴重的安全問題。建議對這些外部 action 的原始碼進行嚴格審查,確保其安全性,並考慮將其託管在內部或使用更受信任的來源。同時,確保使用固定的版本號(例如 `v1.2.3` 而非 `main` 或 `latest`)來避免意外的行為變更。",
|
||||
"is_new": true
|
||||
}
|
||||
]
|
||||
@@ -1,10 +1,11 @@
|
||||
name: CD
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
jobs:
|
||||
version:
|
||||
name: "CD > 計算版本號"
|
||||
name: 計算版本號
|
||||
runs-on: ubuntu
|
||||
outputs:
|
||||
version: ${{ steps.version.outputs.version }}
|
||||
@@ -13,7 +14,7 @@ jobs:
|
||||
id: version
|
||||
uses: https://gitea.jsc.idv.tw/actions/calculate-version@${{ vars.ACTION_CALCULATE_VERSION }}
|
||||
release:
|
||||
name: "CD > 發布專案"
|
||||
name: 發布專案
|
||||
runs-on: ubuntu
|
||||
needs: version
|
||||
steps:
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
name: AI
|
||||
on:
|
||||
pull_request:
|
||||
branches-ignore:
|
||||
- master
|
||||
types: [opened, synchronize]
|
||||
jobs:
|
||||
code-review:
|
||||
name: Code Review
|
||||
runs-on: ubuntu
|
||||
steps:
|
||||
- name: AI Code Review
|
||||
uses: https://gitea.jsc.idv.tw/actions/code-review@${{ vars.ACTION_CODE_REVIEW_VERSION }}
|
||||
with:
|
||||
GITEA_TOKEN: ${{ secrets.RUNNER_TOKEN }}
|
||||
GITEA_COMMENT_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }},${{ secrets.GEMINI_API_KEY_1 }},${{ secrets.GEMINI_API_KEY_2 }},${{ secrets.GEMINI_API_KEY_3 }},${{ secrets.GEMINI_API_KEY_4 }},${{ secrets.GEMINI_API_KEY_5 }},${{ secrets.GEMINI_API_KEY_6 }},${{ secrets.GEMINI_API_KEY_7 }},${{ secrets.GEMINI_API_KEY_8 }},${{ secrets.GEMINI_API_KEY_9 }},${{ secrets.GEMINI_API_KEY_10 }},${{ secrets.GEMINI_API_KEY_11 }},${{ secrets.GEMINI_API_KEY_12 }},${{ secrets.GEMINI_API_KEY_13 }},${{ secrets.GEMINI_API_KEY_14 }},${{ secrets.GEMINI_API_KEY_15 }},${{ secrets.GEMINI_API_KEY_16 }},${{ secrets.GEMINI_API_KEY_17 }},${{ secrets.GEMINI_API_KEY_18 }},${{ secrets.GEMINI_API_KEY_19 }}
|
||||
GEMINI_BASE_URL: https://generativelanguage.googleapis.com/v1beta
|
||||
GEMINI_MODEL: ${{ vars.GEMINI_MODEL }}
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
issues: write
|
||||
+6
-2
@@ -5,6 +5,9 @@ inputs:
|
||||
DOTNET_VERSION:
|
||||
description: '使用的 .NET 版本'
|
||||
default: '10.0'
|
||||
DOTNET_ENVIRONMENT:
|
||||
description: '使用的 .NET 環境名稱'
|
||||
default: 'Production'
|
||||
PROJECT_NAME:
|
||||
description: '專案名稱(包含 Microsoft.EntityFrameworkCore.Design 的專案)'
|
||||
required: true
|
||||
@@ -16,8 +19,6 @@ inputs:
|
||||
required: true
|
||||
runs:
|
||||
using: 'composite'
|
||||
env:
|
||||
ASPNETCORE_ENVIRONMENT: "Production"
|
||||
steps:
|
||||
- name: 取得專案
|
||||
uses: actions/checkout@v6
|
||||
@@ -26,5 +27,8 @@ runs:
|
||||
with:
|
||||
dotnet-version: ${{ inputs.DOTNET_VERSION }}
|
||||
- name: 資料庫移轉
|
||||
env:
|
||||
ASPNETCORE_ENVIRONMENT: ${{ env.ASPNETCORE_ENVIRONMENT || inputs.DOTNET_ENVIRONMENT }}
|
||||
run: dotnet ef database update --project ../${{ inputs.MIGRATION_PROJECT_NAME }} --context ${{ inputs.MIGRATION_CONTEXT }}
|
||||
shell: bash
|
||||
working-directory: ${{ inputs.PROJECT_NAME }}
|
||||
Reference in New Issue
Block a user