-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Features #135
Conversation
Implemented a ConnectionManager to track and manage network connections. Added Lua bindings for registering and querying connection targets, as well as Prometheus metric for active connections. Updated project dependencies to support this feature. Signed-off-by: Christian Roessner <[email protected]>
Implemented a ConnectionManager to track and manage network connections. Added Lua bindings for registering and querying connection targets, as well as Prometheus metric for active connections. Updated project dependencies to support this feature. Signed-off-by: Christian Roessner <[email protected]>
# Conflicts: # server/lualib/connmgr/netstats.go
Introduced the `GenericConnections` metric to track active connections with labels for description, target, and direction. Added support for registering connection targets with descriptions and provided a new function to update the connection metrics dynamically. Signed-off-by: Christian Roessner <[email protected]>
Implement `validateDNSResolver` to ensure DNS resolver entries are in valid host:port format in the Server configuration. Adjust `NewDNSResolver` to use the provided resolver setting directly, aligning with the new validation checks. Signed-off-by: Christian Roessner <[email protected]>
Integrated nauthilus_psnet module across haveibeenpwnd, blocklist, backend, and geoip Lua plugins. This inclusion enables registering remote connection targets for enhanced network communication handling. Signed-off-by: Christian Roessner <[email protected]>
Update the connection target to include the port 443 for secure communication. This change ensures that the HTTP request to the pwnedpasswords API is correctly routed and handled. Signed-off-by: Christian Roessner <[email protected]>
Centralize HTTP client initialization with consistent settings across various packages by introducing InitHTTPClient method. The global httpClient variable is now pre-configured once at startup, eliminating redundant client creation and closure, resulting in cleaner and more maintainable code. Signed-off-by: Christian Roessner <[email protected]>
Introduced a ticker-based IP monitoring system to the ConnectionManager to check for IP updates at regular intervals. This includes adding `StartMonitoring` and auxiliary functions such as `equalIPs`, and `checkForIPUpdates`, as well as integrating the new monitoring process into the server's lifecycle. Signed-off-by: Christian Roessner <[email protected]>
|
||
for _, ip := range m.ipTargets[target] { | ||
if ip == "0.0.0.0" || ip == "::" || ip == addr.IP { | ||
if addr.Port == uint32(port) { |
Check failure
Code scanning / CodeQL
Incorrect conversion between integer types High
strconv.Atoi
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 4 months ago
To fix the problem, we need to ensure that the integer value parsed from the string is within the valid range for uint32
before performing the cast. This can be achieved by using strconv.ParseUint
with a specified bit size of 32, which will directly return a uint64
value. We can then safely cast this value to uint32
after ensuring it is within the valid range.
- Replace the use of
strconv.Atoi
withstrconv.ParseUint
specifying a bit size of 32. - Ensure the parsed value is within the valid range for
uint32
before casting.
-
Copy modified line R247 -
Copy modified line R253 -
Copy modified line R267
@@ -246,3 +246,3 @@ | ||
|
||
port, err := strconv.Atoi(portStr) | ||
port64, err := strconv.ParseUint(portStr, 10, 32) | ||
if err != nil { | ||
@@ -252,2 +252,3 @@ | ||
} | ||
port := uint32(port64) | ||
|
||
@@ -265,3 +266,3 @@ | ||
if ip == "0.0.0.0" || ip == "::" || ip == addr.IP { | ||
if addr.Port == uint32(port) { | ||
if addr.Port == port { | ||
count++ |
No description provided.