Skip to content
Snippets Groups Projects
Commit fd882c72 authored by Jose Carlos Luna Duran's avatar Jose Carlos Luna Duran
Browse files

Token alerting & logging

- Include Type of token in alerts
- Remove lowercase type on logs, just keep the token alert type
parent a3f986f9
No related branches found
No related tags found
No related merge requests found
......@@ -25,6 +25,7 @@ type Canary struct {
Key string
Tag string
Level string
Type string
}
type HTTPCanary struct {
......@@ -105,7 +106,6 @@ func PostSlackHook(message string) {
func HTTPAlert(canaryinfo HTTPCanary, alertType string) {
if alertType == "log" || alertType == "all" {
slog.Info("token-alert",
"type", "token-alert",
"Key", canaryinfo.Canary.Key,
"Tag", canaryinfo.Canary.Tag,
"Level", canaryinfo.Canary.Level,
......@@ -132,7 +132,6 @@ func HTTPAlert(canaryinfo HTTPCanary, alertType string) {
func DNSAlert(canaryinfo DNSCanary, alertType string) {
if alertType == "log" || alertType == "all" {
slog.Info("token-alert",
"type", "token-alert",
"Key", canaryinfo.Canary.Key,
"Tag", canaryinfo.Canary.Tag,
"Level", canaryinfo.Canary.Level,
......
......@@ -27,6 +27,7 @@ func getCanaryInfo(t tokens.CanaryRecord, w dns.ResponseWriter) alert.DNSCanary
Key: t.Key,
Tag: t.Tag,
Level: t.Level,
Type: "token-dns",
},
RemoteAddr: w.RemoteAddr().String(),
LocalAddr: w.LocalAddr().String(),
......
......@@ -53,6 +53,7 @@ func getCanaryInfo(t tokens.CanaryRecord, r *http.Request) alert.HTTPCanary {
Key: t.Key,
Tag: t.Tag,
Level: t.Level,
Type: "token-http",
},
UserAgent: r.UserAgent(),
FullUrl: getFullUrl(r),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment