fix(calculate-version): 修復 AI 審查的安全與健全性問題

- Dockerfile 移除 --no-check-certificate,恢復 TLS 憑證檢查以防中間人攻擊
- config 對 GITEA_SERVER_URL 加入 http/https URL 格式驗證
- logger.fail 改為 logger.error(僅輸出不終止行程),退出移至 index 頂層處理
- index.main 改用相依注入並於頂層攔截錯誤後 exit 1,避免 library 內呼叫 process.exit
- releases 將 response.text() 包入 try-catch 並附帶頁碼

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jeffery
2026-06-26 10:52:19 +08:00
co-authored by Claude Opus 4.8
parent f71d2cc35c
commit fdf33b41d8
5 changed files with 72 additions and 51 deletions
+5 -8
View File
@@ -28,18 +28,15 @@ function info(message) {
}
/**
* 輸出錯誤層級的 log 訊息至標準錯誤輸出(stderr),並以狀態碼 1
* 立即終止整個行程。用於發生無法復原的錯誤時中止執行。
* 輸出錯誤層級的 log 訊息至標準錯誤輸出(stderr),自動加上 `[error]` 前綴與換行。
*
* 注意:此函式呼叫 `process.exit(1)`,正常情況下不會回傳給呼叫端,
* 其後的程式碼不會被執行。
* 僅負責輸出,不終止行程;是否結束由呼叫端(進入點)決定,以利測試與錯誤復原。
*
* @param {string} message - 要輸出的錯誤描述內容。
* @returns {never} 不會正常回傳(行程會被終止)。
* @returns {void}
*/
function fail(message) {
function error(message) {
process.stderr.write(`[error] ${message}\n`);
process.exit(1);
}
module.exports = { section, info, fail };
module.exports = { section, info, error };