VulnCheck.Feeds.TextHints (VulnCheck v1.0.1)

Copy Markdown View Source

Conservative extraction of machine-usable hints from advisory prose.

  • symbols/1 only accepts explicit, backtick-quoted signatures with an arity (`Plug.CSRFProtection.valid_state_and_csrf_token?/2` or `hex_http_httpc:http_options/2`). Names without an arity are never guessed.
  • otp_constraint/1 recognizes a small set of unambiguous phrasings that restrict a vulnerability to specific Erlang/OTP releases, and only in sentences that talk about what is affected.

Summary

Functions

Extracts an OTP runtime constraint (for VulnCheck.Semver.otp_affected?/2) from advisory prose, or nil.

Extracts backtick-quoted Module.function/arity signatures.

Functions

otp_constraint(text)

@spec otp_constraint(String.t() | nil) :: String.t() | nil

Extracts an OTP runtime constraint (for VulnCheck.Semver.otp_affected?/2) from advisory prose, or nil.

iex> VulnCheck.Feeds.TextHints.otp_constraint("This only affects OTP 24 and 25, where verify_none was the default.")
"24 || 25"
iex> VulnCheck.Feeds.TextHints.otp_constraint("Applications running on OTP 25 and earlier are vulnerable.")
"<= 25"
iex> VulnCheck.Feeds.TextHints.otp_constraint("Tested on OTP 26 and 27.")
nil

symbols(text)

@spec symbols(String.t() | nil) :: [VulnCheck.Types.MFA.t()]

Extracts backtick-quoted Module.function/arity signatures.

iex> VulnCheck.Feeds.TextHints.symbols("Calling `Plug.Conn.Query.decode/4` is slow, unlike `decode`.")
[%VulnCheck.Types.MFA{module: "Elixir.Plug.Conn.Query", function: "decode", arity: 4}]