Skip to content

Commit 657114b

Browse files
committed
fix(router): remove complexity mode env var support
1 parent c03f859 commit 657114b

File tree

3 files changed

+3
-19
lines changed

3 files changed

+3
-19
lines changed

docs-website/router/configuration.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2050,7 +2050,7 @@ The configuration for the security. The security is used to configure the securi
20502050
| SECURITY_BLOCK_PERSISTED_OPERATIONS_CONDITION | block_persisted_operations.condition | <Icon icon="square" /> | The [expression](/router/configuration/template-expressions) to evaluate if the operation should be blocked. | |
20512051
| | complexity_calculation_cache | <Icon icon="square" /> | Complexity Cache configuration | |
20522052
| | complexity_limits | <Icon icon="square" /> | Complexity limits configuration | |
2053-
| SECURITY_COMPLEXITY_MODE | complexity_limits.mode | <Icon icon="square" /> | `measure` calculates complexity without rejecting; `enforce` rejects operations exceeding limits. | enforce |
2053+
| | complexity_limits.mode | <Icon icon="square" /> | `measure` calculates complexity without rejecting; `enforce` rejects operations exceeding limits. | enforce |
20542054
| | parser_limits.approximate_depth_limit | <Icon icon="square" /> | The approximate cumulative depth limit of a query, including fragments. Set to 0 to disable. | 200 |
20552055
| | parser_limits.total_fields_limit | <Icon icon="square" /> | The total number of fields the parser will allow. Set to 0 to disable. | 3500 |
20562056
| SECURITY_OPERATION_NAME_LENGTH_LIMIT | operation_name_length_limit | <Icon icon="square" /> | The maximum allowed length for the operation name. Set to 0 to disable. | 512 |
@@ -2156,7 +2156,7 @@ The `mode` field controls enforcement versus measurement:
21562156

21572157
| Environment Variable | YAML | Required | Description | Default Value |
21582158
| ------------------------ | --------------------------- | ---------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- |
2159-
| SECURITY_COMPLEXITY_MODE | mode | <Icon icon="square" /> | `measure` calculates complexity without rejecting; `enforce` rejects operations exceeding limits. | enforce |
2159+
| | mode | <Icon icon="square" /> | `measure` calculates complexity without rejecting; `enforce` rejects operations exceeding limits. | enforce |
21602160
| | enabled | <Icon icon="square" /> | Enable the specific limit. If the value is true (default: false), and a valid limit value is set, the limit will be applied. | false |
21612161
| | limit | <Icon icon="square" /> | The limit amount for query. If the limit is 0, this limit is not applied. | 0 |
21622162
| | ignore_persisted_operations | <Icon icon="square" /> | Disable the limit for persisted operations. Since persisted operations are stored intentionally, users may want to disable the limit to consciously allow nested persisted operations. | false |

router/pkg/config/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ type ComplexityLimits struct {
509509
// Mode controls complexity limits behavior:
510510
// - "measure": calculates complexity without rejecting operations (for monitoring)
511511
// - "enforce": calculates complexity and rejects operations exceeding limits
512-
Mode ComplexityLimitsMode `yaml:"mode,omitempty" envDefault:"enforce" env:"SECURITY_COMPLEXITY_MODE"`
512+
Mode ComplexityLimitsMode `yaml:"mode,omitempty"`
513513

514514
Depth *ComplexityLimit `yaml:"depth"`
515515
TotalFields *ComplexityLimit `yaml:"total_fields"`

router/pkg/config/config_test.go

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1764,22 +1764,6 @@ security:
17641764
require.Equal(t, ComplexityLimitsModeMeasure, cfg.Config.SecurityConfiguration.ComplexityLimits.Mode)
17651765
})
17661766

1767-
t.Run("mode env var requires YAML expansion", func(t *testing.T) {
1768-
t.Setenv("SECURITY_COMPLEXITY_MODE", "measure")
1769-
1770-
f := createTempFileFromFixture(t, `
1771-
version: "1"
1772-
1773-
security:
1774-
complexity_limits:
1775-
depth:
1776-
enabled: true
1777-
limit: 5
1778-
`)
1779-
cfg, err := LoadConfig([]string{f})
1780-
require.NoError(t, err)
1781-
require.Equal(t, ComplexityLimitsModeUnset, cfg.Config.SecurityConfiguration.ComplexityLimits.Mode)
1782-
})
17831767
}
17841768

17851769
func TestCostControlConfig(t *testing.T) {

0 commit comments

Comments
 (0)