mirror of
https://github.com/Luzifer/mondash.git
synced 2024-09-20 01:12:58 +00:00
Checking for short APIKeys and rejecting
This commit is contained in:
parent
9c289377df
commit
ee0fe6e221
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +1,2 @@
|
|||||||
gin-bin
|
gin-bin
|
||||||
|
mondash
|
||||||
|
4
main.go
4
main.go
@ -101,6 +101,10 @@ func main() {
|
|||||||
|
|
||||||
dash, err := LoadDashboard(params["dashid"])
|
dash, err := LoadDashboard(params["dashid"])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if len(req.Header.Get("Authorization")) < 10 {
|
||||||
|
http.Error(res, "APIKey is too insecure", http.StatusUnauthorized)
|
||||||
|
return
|
||||||
|
}
|
||||||
dash = &Dashboard{APIKey: req.Header.Get("Authorization"), Metrics: DashboardMetrics{}, DashboardID: params["dashid"]}
|
dash = &Dashboard{APIKey: req.Header.Get("Authorization"), Metrics: DashboardMetrics{}, DashboardID: params["dashid"]}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user