-
Notifications
You must be signed in to change notification settings - Fork 342
Open
Labels
hmaItems related to the hasher-matcher-actioner systemItems related to the hasher-matcher-actioner system
Description
POST /bank/<bank_name>/content accepts and stores metadata, but GET /bank/<bank_name>/content/<id> does not return it. The response includes original_media_uri and collab_metadata, but not the user-supplied metadata.
Repro
POST /bank/MYBANK/contentwithmetadata(content_id,content_uri,json).GET /bank/MYBANK/content/<id>.- See that
metadatais missing in the response.
Current code (abridged)
response: BankContentResponse = {
"id": content_config.id,
"disable_until_ts": content_config.disable_until_ts,
"collab_metadata": content_config.collab_metadata,
"original_media_uri": content_config.original_media_uri,
"bank": content_config.bank,
}Full `bank_get_content` method
ThreatExchange/hasher-matcher-actioner/src/OpenMediaMatch/blueprints/curation.py
Lines 147 to 173 in 2e5f23f
| def bank_get_content(bank_name: str, content_id: int): | |
| storage = persistence.get_storage() | |
| bank = storage.get_bank(bank_name) | |
| if not bank: | |
| abort(404, f"bank '{bank_name}' not found") | |
| include_signals = request.args.get("include_signals", "false").lower() == "true" | |
| content = storage.bank_content_get([content_id]) | |
| if not content: | |
| abort(404, f"content '{content_id}' not found") | |
| content_config = content[0] | |
| # Create base response | |
| response: BankContentResponse = { | |
| "id": content_config.id, | |
| "disable_until_ts": content_config.disable_until_ts, | |
| "collab_metadata": content_config.collab_metadata, | |
| "original_media_uri": content_config.original_media_uri, | |
| "bank": content_config.bank, | |
| } | |
| # If signals were requested, fetch them separately and include in response | |
| if include_signals: | |
| signals = storage.bank_content_get_signals([content_id]) | |
| if content_id in signals: | |
| response["signals"] = signals[content_id] | |
| return jsonify(response) |
Expected
Return the stored user metadata:
"metadata": {
"content_id": "...",
"content_uri": "...",
"json": { "..." : "..." }
}Proposal
Include metadata in the response:
response["metadata"] = content_config.metadataOptionally support ?include_metadata=true|false, similar to include_signals.
Why
We're been banking descriptive metadata for curation and audit, and need it on read.
Related
Dcallies
Metadata
Metadata
Assignees
Labels
hmaItems related to the hasher-matcher-actioner systemItems related to the hasher-matcher-actioner system