mirror of
https://github.com/Luzifer/mondash.git
synced 2024-11-10 00:20:02 +00:00
Checking for short APIKeys and rejecting
This commit is contained in:
parent
9c289377df
commit
ee0fe6e221
2 changed files with 5 additions and 0 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1 +1,2 @@
|
|||
gin-bin
|
||||
mondash
|
||||
|
|
4
main.go
4
main.go
|
@ -101,6 +101,10 @@ func main() {
|
|||
|
||||
dash, err := LoadDashboard(params["dashid"])
|
||||
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"]}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue