Skip to content
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

Fix high CVEs #280

Merged
merged 7 commits into from
Dec 4, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions network/hostport/hostport_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"bytes"
"crypto/sha256"
"encoding/base32"
"encoding/json"
"fmt"
"net"
"strconv"
Expand Down Expand Up @@ -428,12 +429,18 @@ func getExistingHostportIPTablesRules(
existingHostportChains := make(map[utiliptables.Chain]string)
existingHostportRules := []string{}

for chain := range existingNATChains {
for chain, value := range existingNATChains {
if strings.HasPrefix(string(chain), string(kubeHostportsChain)) ||
strings.HasPrefix(string(chain), kubeHostportChainPrefix) {
if _, ok := existingNATChains[chain]; ok {
// This just means true
existingHostportChains[chain] = ""
// It looks like the value isn't used, just the key. We convert the map
// to string anyway to make sure we save it if we need it later.
out, err := json.Marshal(value)
if err != nil {
return nil, nil, fmt.Errorf("failed to marshal chain %s: %v", chain, err)
}

existingHostportChains[chain] = string(out)
nwneisen marked this conversation as resolved.
Show resolved Hide resolved
}
}
}
Expand Down
Loading