Skip to content

Fix: handle regex in first triple subject#42

Open
je-bugshell wants to merge 1 commit into
owasp-amass:developfrom
je-bugshell:develop
Open

Fix: handle regex in first triple subject#42
je-bugshell wants to merge 1 commit into
owasp-amass:developfrom
je-bugshell:develop

Conversation

@je-bugshell
Copy link
Copy Markdown

Summary

  • findFirstSubject() was sending the raw #/.../# delimited key as a
    literal SQL filter via subjectToAsset(), so regex subjects on the first
    triple never matched anything.
  • When subject.Regexp is set, this now uses FindEntitiesByType() and
    filters in-memory with valueMatch() / allAttrsMatch() instead — same
    pattern already used by performWalk() and predAndObject().
  • Added tests for regex subject lookup and end-to-end extraction.

Closes #41 (also related: owasp-amass/amass#1098)

Note

I'm not a Go developer, so this is AI-assisted. Would appreciate a careful
review. The fix stays within the existing single-root Extract() design.

Test plan

  • New tests fail without the fix, pass with it
  • All 16 tests pass: go test ./triples/ -v

findFirstSubject() was passing the raw #/.../# key into subjectToAsset(),
which sent it as a literal SQL filter. Used FindEntitiesByType() with
in-memory valueMatch() filtering instead, same approach as performWalk().
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant