Class: Aikido::Zen::Scanners::SSRFScanner::RedirectChains Private

Inherits:
Object
  • Object
show all
Defined in:
lib/aikido/zen/scanners/ssrf_scanner.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Constructor Details

#initializeRedirectChains

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of RedirectChains.



230
231
232
# File 'lib/aikido/zen/scanners/ssrf_scanner.rb', line 230

def initialize
  @redirects = {}
end

Instance Method Details

#add(source:, destination:) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



234
235
236
237
# File 'lib/aikido/zen/scanners/ssrf_scanner.rb', line 234

def add(source:, destination:)
  @redirects[destination] = source
  self
end

#origin(uri) ⇒ URI?

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Recursively looks for the original URI that triggered the current chain. If given a URI that was not the result of a redirect chain, it returns nil

Parameters:

  • uri (URI)

Returns:

  • (URI, nil)


245
246
247
248
249
250
251
252
253
# File 'lib/aikido/zen/scanners/ssrf_scanner.rb', line 245

def origin(uri)
  source = @redirects[uri]

  if @redirects[source]
    origin(source)
  else
    source
  end
end