Skip to content

Conversation

sarafarajnasardi
Copy link

@sarafarajnasardi sarafarajnasardi commented Sep 1, 2025

What does this PR do?

  • Skips OSVDB-prefixed references when processing Metasploit data
  • Strips "URL-" prefix from references and extracts commit links if present
  • Ensures commit links are stored in notes in a sorted order

Why is this needed?

Some references in Metasploit data include OSVDB identifiers and URL-prefixed strings,
which are inconsistent and can cause invalid aliases. This change normalizes references
and ensures proper commit link handling.

How was this tested?

  • Created a test file locally to simulate Metasploit data
  • Ran the pipeline using the modified code
  • Verified that:
    • OSVDB references are skipped
    • URL-prefixed references are normalized
    • Commit links appear correctly in notes under commit_links

Related issue

…boutcode-org#1697

* Skip OSVDB-prefixed references when processing Metasploit data
* Strip "URL-" prefix from references and add commit links if present
* Ensure commit links are stored in notes in a sorted order
* Improves data consistency and avoids invalid aliases

Signed-off-by: Sarafaraj Nasardi <sarafarajnasardi786@gmail.com>
ref for ref in references if not ref.startswith("OSVDB") and not ref.startswith("URL-")
]
# Regex to allow short commit hashes (6–40 chars)
commit_pattern = re.compile(r"https://github\.com/.+/commit/[a-f0-9]{6,40}")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make this function instead and this should not be github-specific.

Copy link
Member

@pombredanne pombredanne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, we need tests. Also please avoid AI-generated PR comments, they are annoying and bland.

},
)

return 1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we return 1 here? This is highly unsual

source_url = f"https://github.com/rapid7/metasploit-framework/tree/master{path}"
source_date_published = None

# Add unique commit links to notes
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this comment? The code below looks obvious

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.

Incomplete reference collection in Metasploit ( missing affected/fixed commits )
2 participants