From 6266701fc4c7d5501de7e9e737827010799019c0 Mon Sep 17 00:00:00 2001 From: Ivo Anjo Date: Tue, 10 Oct 2023 09:04:24 +0100 Subject: [PATCH 1/2] Upgrade steep typechecker to latest version 1.5.3 **What does this PR do?** This PR upgrades the steep typechecker to the latest version available, 1.5.3. It also disables type-checking one of the appsec files that started failing typechecking with this version. **Motivation:** Use latest version of typechecker. **Additional Notes:** N/A **How to test the change?** Observe that typecheck still passes in CI. --- Gemfile | 2 +- Steepfile | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 11ac5d88b84..1c1a6d857ac 100644 --- a/Gemfile +++ b/Gemfile @@ -113,7 +113,7 @@ end group :check do if RUBY_VERSION >= '3.0.0' && RUBY_PLATFORM != 'java' gem 'rbs', '~> 3.2.0', require: false - gem 'steep', '~> 1.4.0', require: false + gem 'steep', '~> 1.5.3', require: false end end diff --git a/Steepfile b/Steepfile index b676f61d6ee..aa1667d674a 100644 --- a/Steepfile +++ b/Steepfile @@ -32,6 +32,7 @@ target :ddtrace do ignore 'lib/datadog/appsec/contrib/sinatra/request_middleware.rb' ignore 'lib/datadog/appsec/monitor/gateway/watcher.rb' ignore 'lib/datadog/appsec/monitor/reactive/set_user.rb' + ignore 'lib/datadog/appsec/processor/rule_merger.rb' ignore 'lib/datadog/ci.rb' ignore 'lib/datadog/ci/configuration/components.rb' ignore 'lib/datadog/ci/configuration/settings.rb' From 7f147ecc2736a14b40b31f00675387e42782f8a8 Mon Sep 17 00:00:00 2001 From: Gustavo Caso Date: Tue, 10 Oct 2023 11:40:27 +0200 Subject: [PATCH 2/2] fix rule_merger.rbs --- Steepfile | 1 - sig/datadog/appsec/processor/rule_merger.rbs | 16 ++++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/Steepfile b/Steepfile index aa1667d674a..b676f61d6ee 100644 --- a/Steepfile +++ b/Steepfile @@ -32,7 +32,6 @@ target :ddtrace do ignore 'lib/datadog/appsec/contrib/sinatra/request_middleware.rb' ignore 'lib/datadog/appsec/monitor/gateway/watcher.rb' ignore 'lib/datadog/appsec/monitor/reactive/set_user.rb' - ignore 'lib/datadog/appsec/processor/rule_merger.rb' ignore 'lib/datadog/ci.rb' ignore 'lib/datadog/ci/configuration/components.rb' ignore 'lib/datadog/ci/configuration/settings.rb' diff --git a/sig/datadog/appsec/processor/rule_merger.rbs b/sig/datadog/appsec/processor/rule_merger.rbs index 979b45260e6..ffd4127fe81 100644 --- a/sig/datadog/appsec/processor/rule_merger.rbs +++ b/sig/datadog/appsec/processor/rule_merger.rbs @@ -8,16 +8,16 @@ module Datadog type rules = ::Hash[::String, untyped] type data = ::Array[::Hash[::String, untyped]] - type overrides = ::Array[::Hash[::String, untyped]] - type exclusions = ::Array[::Hash[::String, untyped]] - type custom_rules = ::Array[::Hash[::String, untyped]] + type overrides = ::Array[::Array[::Hash[::String, untyped]]] + type exclusions = ::Array[::Array[::Hash[::String, untyped]]] + type custom_rules = ::Array[::Array[::Hash[::String, untyped]]] type processors = ::Array[::Hash[::String, untyped]] type scanners = ::Array[::Hash[::String, untyped]] DEFAULT_WAF_PROCESSORS: processors DEFAULT_WAF_SCANNERS: processors - def self.merge: (rules: ::Array[rules], ?data: ::Array[data], ?overrides: ::Array[overrides], ?exclusions: ::Array[exclusions], ?custom_rules: ::Array[custom_rules], ?processors: processors, ?scanners: scanners) -> rules + def self.merge: (rules: ::Array[rules], ?data: ::Array[data], ?overrides: overrides, ?exclusions: exclusions, ?custom_rules: custom_rules, ?processors: processors, ?scanners: scanners) -> rules private @@ -25,13 +25,13 @@ module Datadog def self.combine_data: (::Array[data] data) -> data? - def self.merge_data_base_on_expiration: (data data1, data data2) -> ::Array[data] + def self.merge_data_base_on_expiration: (data data1, data data2) -> data - def self.combine_overrides: (::Array[overrides] overrides) -> ::Array[overrides]? + def self.combine_overrides: (overrides overrides) -> overrides? - def self.combine_exclusions: (::Array[exclusions] exclusions) -> ::Array[exclusions]? + def self.combine_exclusions: (exclusions exclusions) -> exclusions? - def self.combine_custom_rules: (::Array[custom_rules] custom_rules) -> ::Array[custom_rules]? + def self.combine_custom_rules: (custom_rules custom_rules) -> custom_rules? end end end