Only expose sessions data in debug mode, otherwise return just a count of sessions
This commit is contained in:
parent
ad1994574d
commit
f3920afe8c
@ -56,7 +56,14 @@ func GetAsset(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func GetSessions(c *gin.Context) {
|
func GetSessions(c *gin.Context) {
|
||||||
|
// 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)
|
c.JSON(200, DbSessions)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
c.JSON(200, map[string]int{"sessions": len(DbSessions)})
|
||||||
}
|
}
|
||||||
|
|
||||||
func Connect(c *gin.Context) {
|
func Connect(c *gin.Context) {
|
||||||
|
@ -15,8 +15,8 @@ import (
|
|||||||
|
|
||||||
type Client struct {
|
type Client struct {
|
||||||
db *sqlx.DB
|
db *sqlx.DB
|
||||||
History []history.Record
|
History []history.Record `json:"history"`
|
||||||
ConnectionString string
|
ConnectionString string `json:"connection_string"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Struct to hold table rows browsing options
|
// Struct to hold table rows browsing options
|
||||||
|
Loading…
x
Reference in New Issue
Block a user