OpenCRE icon indicating copy to clipboard operation
OpenCRE copied to clipboard

Create an API endpoint which given a Standard JSON, suggests which CREs are the most likely mappings for this standard section

Open northdpole opened this issue 3 years ago • 3 comments

As an opencre or standard maintainer, I want to be able to import new standards or other security information very quickly in the CRE graph. Given I have this information in a CRE Standard format, I need to find which CRE is best suited for linking with a specific section of my standard. In order to do that I need an API call POST opencre.org/rest/v1/link/suggest where the body of the api call is a CRE Standard in json format. OpenCRE then needs to reply with a json array of CREs that are best suited to match my standard. e.g. POST opencre.org/rest/v1/link/suggest

{"doctype":"Standard","hyperlink":"https://github.com/OWASP/ASVS/blob/v4.0.2/4.0/en/0x11-V2-Authentication.md","links":[],"name":"ASVS","section":"Verify that the challenge nonce is at least 64 bits in length, and statistically unique or unique over the lifetime of the cryptographic device.","sectionID":"V2.9.2"}]

Response:

[{"doctype":"CRE","id":"287-251","name":"Use a unique challenge nonce of sufficient size","tags":["Cryptography"]},{"doctype":"CRE","id":"287-252","name":"Some other CRE","tags":["Cryptography"]}]

northdpole avatar Apr 29 '23 19:04 northdpole

Hi @northdpole ! I’ve been looking into this issue and wanted to confirm my understanding before starting.

One possible starting approach could be:

  • Create the /rest/v1/link/suggest API endpoint
  • Extract the section text from the provided Standard JSON
  • Compare it with existing CRE names/descriptions
  • Use a simple text similarity approach (for example TF-IDF + cosine similarity) to rank possible matches
  • Return the top matching CREs as suggestions

This would provide a basic suggestion system that could help speed up mapping standards to CREs , and it could be improved later if needed.

Does this sound like a reasonable direction for implementing the first version of this feature?

Abhijeet2409 avatar Mar 08 '26 07:03 Abhijeet2409

Hi @northdpole , I would like to work on this. I have built two deployed RAG systems using semantic search and vector embeddings. My approach would be to extract the section text from the Standard JSON, generate embeddings, compare against CRE embeddings, and return top matches ranked by semantic similarity rather than keyword overlap. Could you confirm the preferred embedding model and whether you would prefer the vector index stored in SQLite or as a separate file? Happy to start immediately.

balaji049 avatar Mar 21 '26 12:03 balaji049

Hi @northdpole I've been trying to join the OWASP Slack but all the invite links I've found seem to be expired. Could you share a working one? Also wanted to check in on issue #275 before I start writing code. I went through the codebase and noticed that get_id_of_most_similar_cre_paginated and get_text_embeddings are already implemented in prompt_client.py. So my plan is to wire those into a new POST /rest/v1/link/suggest endpoint rather than building embedding logic from scratch. Does that sound like the right direction to you? Happy to start immediately if this is still available.

balaji049 avatar Mar 21 '26 12:03 balaji049