Skip to content

Commit 353b07d

Browse files
authored
Merge pull request #224 from hyperledger-firefly/fix-translation-keys
fix: translation key for ffnet
2 parents fa983f2 + 25888cf commit 353b07d

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

pkg/ffnet/ffnet_test.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,19 @@ func TestNewDialerAllowsAndConnects(t *testing.T) {
175175
_ = conn.Close()
176176
}
177177

178+
func TestConfigKeysDocumented(t *testing.T) {
179+
// Initialize the net config as a subsection (as ffresty does), then generate the config
180+
// markdown for every known key. This panics if any key is missing a translation, guarding
181+
// against the "Translation for config key '...net.cidrDenylist' was not found" regression.
182+
config.RootConfigReset()
183+
InitConfig(config.RootSection("backend").SubSection("net"))
184+
185+
assert.NotPanics(t, func() {
186+
_, err := config.GenerateConfigMarkdown(context.Background(), "", config.GetKnownKeys())
187+
assert.NoError(t, err)
188+
})
189+
}
190+
178191
func TestGenerateConfigDenylistFromConfig(t *testing.T) {
179192
resetConf()
180193
ipv4PrivateCIDRs := []string{

pkg/i18n/en_base_config_descriptions.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ var (
9292
ConfigGlobalMaxIdleConnsPerHost = ffc("config.global.maxIdleConnsPerHost", "The max number of idle connections, per unique hostname. Zero means net/http uses the default of only 2.", IntType)
9393
ConfigGlobalDNSServers = ffc("config.global.dns.servers", "An optional list of DNS server addresses (host or host:port, port defaults to 53) to use instead of the system resolver. Setting this forces use of Go's built-in DNS resolver.", ArrayStringType)
9494
ConfigGlobalDNSTimeout = ffc("config.global.dns.timeout", "The dial timeout when contacting a configured DNS server", TimeDurationType)
95+
ConfigGlobalNetCIDRDenylist = ffc("config.global.net.cidrDenylist", "A list of CIDR ranges to which outbound connections are blocked, as a core SSRF mitigation. Empty by default.", ArrayStringType)
9596
ConfigGlobalMethod = ffc("config.global.method", "The HTTP method to use when making requests to the Address Resolver", StringType)
9697
ConfigGlobalAuthType = ffc("config.global.auth.type", "The auth plugin to use for server side authentication of requests", StringType)
9798
ConfigGlobalPassthroughHeadersEnabled = ffc("config.global.passthroughHeadersEnabled", "Enable passing through the set of allowed HTTP request headers", BooleanType)

0 commit comments

Comments
 (0)