mirror of
https://github.com/KaySar12/NextZen-UserService.git
synced 2025-03-15 23:25:35 +07:00
fix gosec G114/G112
This commit is contained in:
parent
8fcaee063d
commit
0d7fee0cb1
@ -1,3 +1,3 @@
|
||||
package common
|
||||
|
||||
const Version = "0.3.6"
|
||||
const Version = "0.3.7"
|
||||
|
9
main.go
9
main.go
@ -6,6 +6,7 @@ import (
|
||||
"net"
|
||||
"net/http"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/IceWhaleTech/CasaOS-Common/utils/logger"
|
||||
"github.com/IceWhaleTech/CasaOS-Gateway/common"
|
||||
@ -94,7 +95,13 @@ func main() {
|
||||
}
|
||||
|
||||
logger.Info("User service is listening...", zap.Any("address", listener.Addr().String()))
|
||||
err = http.Serve(listener, r)
|
||||
|
||||
s := &http.Server{
|
||||
Handler: r,
|
||||
ReadHeaderTimeout: 5 * time.Second, // fix G112: Potential slowloris attack (see https://github.com/securego/gosec)
|
||||
}
|
||||
|
||||
err = s.Serve(listener) // not using http.serve() to fix G114: Use of net/http serve function that has no support for setting timeouts (see https://github.com/securego/gosec)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user