Module: Leakferret

Defined in:
lib/leakferret.rb,
lib/leakferret/error.rb,
lib/leakferret/binary.rb,
lib/leakferret/client.rb,
lib/leakferret/version.rb,
lib/leakferret/platform.rb

Overview

Ruby wrapper around the native ‘leakferret` binary.

The binary is downloaded once per platform at gem install time (‘ext/leakferret/extconf.rb`) into `lib/leakferret/bin/`. Subsequent calls shell out to it and parse the JSON output.

Defined Under Namespace

Modules: Binary, Platform Classes: BinaryInvocationError, BinaryNotFoundError, Client, Error

Constant Summary collapse

VERSION =

The gem’s own version.

'0.1.4'
BINARY_VERSION =

The native binary release this gem downloads. Tracks the leakferret core release, which may move independently of the gem’s own version (e.g. a gem-only bugfix).

'0.1.2'

Class Method Summary collapse

Class Method Details

.binary_pathObject

Path to the bundled binary. Useful for tooling integration.



37
38
39
# File 'lib/leakferret.rb', line 37

def binary_path
  Binary.path
end

.binary_versionObject

Version reported by the bundled binary (Rust) — may differ from the gem version during pre-release.



43
44
45
46
# File 'lib/leakferret.rb', line 43

def binary_version
  out, _err, _status = Open3.capture3(binary_path, '--version')
  out.strip
end

.rewrite(path = '.', apply: false, **opts) ⇒ Object

Scan + classify + propose rewrites for REAL findings. Use apply: true to write the rewrites in place.



32
33
34
# File 'lib/leakferret.rb', line 32

def rewrite(path = '.', apply: false, **opts)
  Client.new.rewrite(path, apply: apply, **opts)
end

.scan(path = '.', **opts) ⇒ Object

Scan a directory; returns an array of finding hashes.



20
21
22
# File 'lib/leakferret.rb', line 20

def scan(path = '.', **opts)
  Client.new.scan(path, **opts)
end

.verify(path = '.', **opts) ⇒ Object

Scan + verify + classify; returns findings with verification + verdict filled in.



26
27
28
# File 'lib/leakferret.rb', line 26

def verify(path = '.', **opts)
  Client.new.verify(path, **opts)
end