Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 0 additions & 5 deletions Steepfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,6 @@ target :datadog do
ignore 'lib/datadog/appsec/contrib/devise/patches/signup_tracking_patch.rb'
ignore 'lib/datadog/appsec/contrib/devise/patches/skip_signin_tracking_patch.rb'
ignore 'lib/datadog/appsec/contrib/devise/tracking_middleware.rb'
ignore 'lib/datadog/appsec/contrib/faraday/connection_patch.rb'
ignore 'lib/datadog/appsec/contrib/faraday/integration.rb'
ignore 'lib/datadog/appsec/contrib/faraday/patcher.rb'
ignore 'lib/datadog/appsec/contrib/faraday/rack_builder_patch.rb'
ignore 'lib/datadog/appsec/contrib/faraday/ssrf_detection_middleware.rb'
ignore 'lib/datadog/appsec/contrib/graphql/appsec_trace.rb'
ignore 'lib/datadog/appsec/contrib/graphql/gateway/multiplex.rb'
ignore 'lib/datadog/appsec/contrib/graphql/gateway/watcher.rb'
Expand Down
2 changes: 1 addition & 1 deletion lib/datadog/appsec/contrib/faraday/integration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def self.loaded?
end

def self.compatible?
super && version >= MINIMUM_VERSION
super && !!(version&.>= MINIMUM_VERSION)
end

def self.auto_instrument?
Expand Down
2 changes: 1 addition & 1 deletion lib/datadog/appsec/contrib/faraday/patcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def patch
end

def configure_default_faraday_connection
if target_version >= Gem::Version.new('1.0.0')
if target_version&.>= Gem::Version.new('1.0.0')
# Patch the default connection (e.g. +Faraday.get+)
::Faraday.default_connection.use(:datadog_appsec)

Expand Down
4 changes: 2 additions & 2 deletions sig/datadog/appsec/contrib/faraday/connection_patch.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ module Datadog
module AppSec
module Contrib
module Faraday
class ConnectionPatch
def initialize: (*untyped args) ?{ () -> untyped } -> void
module ConnectionPatch : ::Faraday::Connection
def initialize: (*untyped) ?{ (::Faraday::Connection) -> void } -> void
end
end
end
Expand Down
3 changes: 2 additions & 1 deletion sig/datadog/appsec/contrib/faraday/integration.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module Datadog
module Faraday
class Integration
include Datadog::AppSec::Contrib::Integration
extend Datadog::AppSec::Contrib::Integration::ClassMethods

MINIMUM_VERSION: ::Gem::Version

Expand All @@ -15,7 +16,7 @@ module Datadog

def self.auto_instrument?: () -> bool

def patcher: () -> Datadog::AppSec::Contrib::Faraday::Patcher
def patcher: () -> singleton(Patcher)
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions sig/datadog/appsec/contrib/faraday/patcher.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ module Datadog
module Patcher
def self?.patched?: () -> bool

def self?.target_version: () -> ::Gem::Version
def self?.target_version: () -> ::Gem::Version?

def self?.patch: () -> bool
def self?.patch: () -> void

def self?.configure_default_faraday_connection: () -> void
end
Expand Down
4 changes: 2 additions & 2 deletions sig/datadog/appsec/contrib/faraday/rack_builder_patch.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ module Datadog
module AppSec
module Contrib
module Faraday
module RackBuilder
def adapter: (*untyped args) -> untyped
module RackBuilderPatch : ::Faraday::RackBuilder
def adapter: (*untyped) -> ::Faraday::RackBuilder::Handler?
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module Datadog

SAMPLE_BODY_KEY: ::Symbol

def call: (::Faraday::Env env) -> untyped
def call: (::Faraday::Env env) -> ::Faraday::Response

private

Expand Down
51 changes: 47 additions & 4 deletions vendor/rbs/faraday/0/faraday.rbs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
module Faraday
class Middleware
end

module Utils
class Headers < ::Hash[::String, ::String]
end
Expand All @@ -16,12 +13,58 @@ module Faraday

attr_accessor request_headers: Utils::Headers

attr_accessor response_headers: Utils::Headers
attr_accessor response_headers: Utils::Headers?

attr_accessor status: ::Integer?

def []: (::Symbol key) -> untyped

def []=: (::Symbol key, untyped value) -> untyped
end

class Response
def env: () -> Env?

def status: () -> ::Integer?

def headers: () -> ::Hash[::String, ::String]

def body: () -> ::String?

def on_complete: () { (Env) -> void } -> self
end

class Middleware
attr_reader app: Middleware

attr_reader options: ::Hash[::Symbol, untyped]

def self.register_middleware: (**singleton(Middleware)) -> void

def call: (Env env) -> Response
end

class Connection
attr_reader builder: RackBuilder

def use: (::Symbol | singleton(Middleware) middleware, *untyped) -> void
end

class RackBuilder
class Handler
def klass: () -> ::Class
end

@handlers: ::Array[Handler]

def handlers: () -> ::Array[Handler]

def insert: (::Integer index, singleton(Middleware) middleware) -> void

def use: (::Symbol | singleton(Middleware) middleware, *untyped) -> void

def adapter: (*untyped) -> Handler?
end

def self.default_connection: () -> Connection
end