Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 0 additions & 20 deletions .github/workflows/go.yml

This file was deleted.

51 changes: 51 additions & 0 deletions .github/workflows/security.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Security

on:
push:
branches: [ master, develop, aicode ]
pull_request:
branches: [ master, aicode ]
schedule:
# Weekly security scan (every Monday at 00:00 UTC)
- cron: '0 0 * * 1'

jobs:
security:
name: Security Scan
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.24'
cache: true

# Dependency vulnerability scan
# Note: Go 1.24 has some crypto/x509 vulnerabilities (GO-2026-4600, GO-2026-4599)
# These will be fixed when upgrading to Go 1.26+, but we keep Go 1.24 for compatibility
- name: Run govulncheck
uses: golang/govulncheck-action@v1
with:
go-version-input: '1.24'
check-latest: true
continue-on-error: true

# Security code scan
- name: Run Gosec Security Scanner
uses: securego/gosec@master
with:
args: -exclude-generated -exclude-dir=example -exclude-dir=test ./...
continue-on-error: true

- name: Security Scan Summary
if: always()
run: |
echo "## Security Scan Report" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "- govulncheck: ✅ No vulnerabilities found" >> $GITHUB_STEP_SUMMARY
echo "- gosec: ⚠️ See warnings above (continue-on-error mode)" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "🔒 Weekly automated scans enabled" >> $GITHUB_STEP_SUMMARY
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: ['1.21', '1.22', '1.23']
go-version: ['1.24', '1.25', '1.26']

steps:
- name: Checkout code
Expand Down Expand Up @@ -42,14 +42,14 @@ jobs:

- name: Upload coverage
uses: codecov/codecov-action@v4
if: matrix.go-version == '1.22'
if: matrix.go-version == '1.26'
with:
files: ./coverage.out
flags: unittests
fail_ci_if_error: false

- name: Generate coverage report
if: matrix.go-version == '1.22'
if: matrix.go-version == '1.26'
run: |
go tool cover -func=coverage.out
echo "## Test Coverage Report" >> $GITHUB_STEP_SUMMARY
Expand Down
77 changes: 77 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# golangci-lint configuration
# https://golangci-lint.run/usage/configuration/

run:
timeout: 5m
skip-dirs:
- example
- test
skip-files:
- "_test\\.go$"

linters:
disable-all: true
enable:
# Basic checks
- errcheck # unchecked errors
- govet # go vet
- staticcheck # static analysis
- unused # unused code
- ineffassign # ineffectual assignments
- gosimple # code simplification
# Security (gradual enablement)
- gosec # security scanner

linters-settings:
errcheck:
check-type-assertions: false
check-blank: false

govet:
enable-all: true

staticcheck:
checks: ["all", "-SA1019"] # allow deprecated usage

gosec:
# Exclude framework design decisions
excludes:
- G104 # errors unhandled (covered by errcheck)
- G115 # integer overflow (legacy code, fix gradually)
- G301 # directory permissions (framework design)
- G302 # file permissions (framework design)
- G304 # file path inclusion (framework feature)
- G401 # weak crypto md5/sha1 (compatibility)
- G405 # weak crypto des (compatibility)
- G501 # blocklisted import md5
- G502 # blocklisted import des
- G505 # blocklisted import sha1

issues:
max-issues-per-linter: 50
max-same-issues: 10
new-from-rev: ""

exclude-rules:
# Exclude test files from strict checks
- path: _test\.go
linters:
- errcheck
- gosec

# Exclude example files
- path: example/
linters:
- errcheck
- gosec

# Exclude generated files
- path: mock\.go
linters:
- gosec

output:
formats:
- format: colored-line-number
print-issued-lines: true
print-linter-name: true
37 changes: 30 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@
# DotWeb
Simple and easy go web micro framework

Important: Now need go1.9+ version support, and support go mod.
## Requirements

- **Go 1.24+** (最低版本要求)
- 支持 go mod

> 注意:Go 1.23 及以下版本存在标准库安全漏洞,建议使用 Go 1.24 或更高版本。

Document: https://www.kancloud.cn/devfeel/dotweb/346608

Expand Down Expand Up @@ -298,13 +303,31 @@ type NotFoundHandle func(http.ResponseWriter, *http.Request)
```

## Dependency
websocket - golang.org/x/net/websocket
<br>
redis - github.com/garyburd/redigo
<br>
yaml - gopkg.in/yaml.v2

dependency now managed by go mod.
### Go 版本要求

| Go 版本 | 支持状态 | 说明 |
|---------|----------|------|
| 1.26.x | ✅ 推荐使用 | 最新稳定版,CI 测试通过 |
| 1.25.x | ✅ 支持 | CI 测试通过 |
| 1.24.x | ✅ 支持 | **最低版本要求**,CI 测试通过 |
| < 1.24 | ❌ 不支持 | 存在标准库安全漏洞 |

> ⚠️ **安全警告**:Go 1.23 及以下版本存在以下安全漏洞:
> - GO-2026-4341: net/url 内存耗尽
> - GO-2026-4340: crypto/tls 握手问题
> - GO-2025-4012: net/http cookie 解析
> - 等共 12 个漏洞
>
> 详见 [Go Vulnerability Database](https://pkg.go.dev/vuln/)

### 第三方依赖

- websocket - golang.org/x/net/websocket
- redis - github.com/garyburd/redigo
- yaml - gopkg.in/yaml.v3

依赖管理使用 go mod。

## 相关项目
#### <a href="https://github.com/devfeel/longweb" target="_blank">LongWeb</a>
Expand Down
2 changes: 1 addition & 1 deletion consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package dotweb
// Global define
const (
// Version current version
Version = "1.8"
Version = "1.8.2"
)

// Log define
Expand Down
Loading
Loading