github-code-scanning[bot] commented on code in PR #7302:
URL: https://github.com/apache/trafficcontrol/pull/7302#discussion_r1081774801
##########
traffic_monitor/cache/astats.go:
##########
@@ -116,8 +117,23 @@
astats.Ats["system.proc.loadavg"] = astats.System.ProcLoadavg
astats.Ats["system.proc.net.dev"] = astats.System.ProcNetDev
+ via := ctx.HTTPHeader.Get("Via")
+ if via != "" {
+ result := regexp.MustCompile(`
([a-z0-9\-]*)\..*comcast.net`).FindStringSubmatch(via)
Review Comment:
## Incomplete regular expression for hostnames
This regular expression has an unescaped dot before 'net', so it might match
more hosts than expected when [the regular expression is used](1).
[Show more
details](https://github.com/apache/trafficcontrol/security/code-scanning/252)
##########
traffic_monitor/cache/stats_over_http.go:
##########
@@ -72,6 +73,14 @@
ctx := pollCTX.(*poller.HTTPPollCtx)
+ via := ctx.HTTPHeader.Get("Via")
+ if via != "" {
+ result := regexp.MustCompile(`
([a-z0-9\-]*)\..*comcast.net`).FindStringSubmatch(via)
Review Comment:
## Incomplete regular expression for hostnames
This regular expression has an unescaped dot before 'net', so it might match
more hosts than expected when [the regular expression is used](1).
[Show more
details](https://github.com/apache/trafficcontrol/security/code-scanning/254)
##########
traffic_monitor/cache/astats.go:
##########
@@ -116,8 +117,23 @@
astats.Ats["system.proc.loadavg"] = astats.System.ProcLoadavg
astats.Ats["system.proc.net.dev"] = astats.System.ProcNetDev
+ via := ctx.HTTPHeader.Get("Via")
+ if via != "" {
+ result := regexp.MustCompile(`
([a-z0-9\-]*)\..*comcast.net`).FindStringSubmatch(via)
+ if len(result) > 0 {
+ astats.Ats["via"] = result[1]
+ }
+ }
+
return stats, astats.Ats, nil
} else if ctype == "text/csv" {
+ via := ctx.HTTPHeader.Get("Via")
+ if via != "" {
+ result := regexp.MustCompile(`
([a-z0-9\-]*)\..*comcast.net`).FindStringSubmatch(via)
Review Comment:
## Incomplete regular expression for hostnames
This regular expression has an unescaped dot before 'net', so it might match
more hosts than expected when [the regular expression is used](1).
[Show more
details](https://github.com/apache/trafficcontrol/security/code-scanning/253)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]