Skip to content

Commit

Permalink
Dsomm (#445)
Browse files Browse the repository at this point in the history
* decrease slug size

* start importing dsomm

* start importing dsomm

* lint

* finish dsomm iso mappings importer

* add ability to also use SAMM as a glue

* lint

* add makefile target

---------

Signed-off-by: Spyros <[email protected]>
  • Loading branch information
northdpole authored Nov 19, 2023
1 parent b99079a commit d1f2162
Show file tree
Hide file tree
Showing 7 changed files with 596 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ import-all:
make migrate-upgrade && export FLASK_APP=$(CURDIR)/cre.py &&\
python cre.py --add --from_spreadsheet https://docs.google.com/spreadsheets/d/1eZOEYgts7d_-Dr-1oAbogPfzBLh6511b58pX3b59kvg &&\
python cre.py --generate_embeddings && \
python cre.py --zap_in --cheatsheets_in --github_tools_in --capec_in --owasp_secure_headers_in --pci_dss_4_in --juiceshop_in --cloud_native_security_controls_in &&\
python cre.py --zap_in --cheatsheets_in --github_tools_in --capec_in --owasp_secure_headers_in --pci_dss_4_in --juiceshop_in --dsomm_in --cloud_native_security_controls_in &&\
python cre.py --generate_embeddings

import-neo4j:
Expand Down
5 changes: 5 additions & 0 deletions application/cmd/cre_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
secure_headers,
pci_dss,
juiceshop,
dsomm,
cloud_native_security_controls,
)
from application.prompt_client import prompt_client as prompt_client
Expand Down Expand Up @@ -415,6 +416,10 @@ def run(args: argparse.Namespace) -> None: # pragma: no cover
juiceshop.parse(
cache=db_connect(args.cache_file),
)
if args.dsomm_in:
dsomm.parse(
cache=db_connect(args.cache_file),
)
if args.cloud_native_security_controls_in:
cloud_native_security_controls.parse(
cache=db_connect(args.cache_file),
Expand Down
3 changes: 3 additions & 0 deletions application/database/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -950,6 +950,9 @@ def get_nodes(
logger.fatal(
f"CRE {dbcre_link.cre} exists in the links but not in the cre table, database corrupt?"
)
raise AssertionError(
f"CRE {dbcre_link.cre} exists in the links but not in the cre table, database corrupt?"
)
if not include_only or (
include_only
and (
Expand Down
2 changes: 1 addition & 1 deletion application/prompt_client/prompt_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def __init__(self, database: db.Node_collection) -> None:
)
else:
logger.error(
"cannot instantiate ai client, neither OPENAI_API_KEY nor GOOGLE_APPLICATION_CREDENTIALS are set "
"cannot instantiate ai client, neither OPENAI_API_KEY nor SERVICE_ACCOUNT_CREDENTIALS are set "
)
self.database = database
self.embeddings_instance = in_memory_embeddings.instance(
Expand Down
Loading

0 comments on commit d1f2162

Please sign in to comment.