1
0
Fork 0
mirror of https://github.com/Luzifer/mondash.git synced 2024-12-22 20:11:18 +00:00

Checking for short APIKeys and rejecting

This commit is contained in:
Knut Ahlers 2015-02-07 21:01:05 +01:00
parent 9c289377df
commit ee0fe6e221
2 changed files with 5 additions and 0 deletions

1
.gitignore vendored
View file

@ -1 +1,2 @@
gin-bin
mondash

View file

@ -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"]}
}