Only expose sessions data in debug mode, otherwise return just a count of sessions

This commit is contained in:
Dan Sosedoff 2016-01-10 15:16:31 -06:00
parent ad1994574d
commit f3920afe8c
2 changed files with 10 additions and 3 deletions

View File

@ -56,7 +56,14 @@ func GetAsset(c *gin.Context) {
}
func GetSessions(c *gin.Context) {
c.JSON(200, DbSessions)
// In debug mode endpoint will return a lot of sensitive information
// like full database connection string and all query history.
if command.Opts.Debug {
c.JSON(200, DbSessions)
return
}
c.JSON(200, map[string]int{"sessions": len(DbSessions)})
}
func Connect(c *gin.Context) {

View File

@ -15,8 +15,8 @@ import (
type Client struct {
db *sqlx.DB
History []history.Record
ConnectionString string
History []history.Record `json:"history"`
ConnectionString string `json:"connection_string"`
}
// Struct to hold table rows browsing options