Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metadata Bindings #345

Open
wants to merge 11 commits into
base: page
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions config/example.config.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,9 @@
# Whether to anonymize the site (for review).
ANONYMOUS = False
ANONYMOUS_GIT = ""

# List of URLs to fetch additional metadata binding files from.
BINDING_URLS = []

# Secret key to validate jwt tokens of downloaded binding files with.
BINDINGS_PUBLIC_KEY = ""
Comment on lines +97 to +98
Copy link
Member

Choose a reason for hiding this comment

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

Is this a secret key or a public key? Comment says one thing, variable name says another. Some more documentation on using this would be helpful.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
"click",
"requests",
"feedgen",
"pyjwt",
]

[project.optional-dependencies]
Expand Down
5 changes: 5 additions & 0 deletions sec_certs_page/cc/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,10 @@ def entry(hashid):
cpes = list(map(load, mongo.db.cpe.find({"_id": {"$in": list(doc["heuristics"]["cpe_matches"])}})))
else:
cpes = []
with sentry_sdk.start_span(op="mongo", description="Find metadata bindings"):
additional_metadata = mongo.db.metadata_bindings.find_one({"cert_id" : doc["cert_id"]})
if not additional_metadata:
additional_metadata = []
with sentry_sdk.start_span(op="files", description="Find local files"):
local_files = entry_download_files(hashid, current_app.config["DATASET_PATH_CC_DIR"])
with sentry_sdk.start_span(op="network", description="Find network"):
Expand All @@ -317,6 +321,7 @@ def entry(hashid):
local_files=local_files,
json=StorageFormat(raw_doc).to_json_mapping(),
network=cert_network,
additional_metadata=additional_metadata,
)
else:
return abort(404)
Expand Down
Loading