mirror of
https://github.com/smittix/intercept.git
synced 2026-04-24 06:40:00 -07:00
Fix playbooks endpoint to return array format
- Change /tscm/playbooks to return array instead of dict - Add id, name, category fields to each playbook for JS compatibility - Fix tscmViewPlaybook JS to use correct field names (action/details/safety_note) - Display when_to_escalate and documentation_required sections Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -3165,12 +3165,18 @@ def list_playbooks():
|
||||
try:
|
||||
from utils.tscm.advanced import PLAYBOOKS
|
||||
|
||||
# Return as array with id field for JavaScript compatibility
|
||||
playbooks_list = []
|
||||
for pid, pb in PLAYBOOKS.items():
|
||||
pb_dict = pb.to_dict()
|
||||
pb_dict['id'] = pid
|
||||
pb_dict['name'] = pb_dict.get('title', pid)
|
||||
pb_dict['category'] = pb_dict.get('risk_level', 'general')
|
||||
playbooks_list.append(pb_dict)
|
||||
|
||||
return jsonify({
|
||||
'status': 'success',
|
||||
'playbooks': {
|
||||
pid: pb.to_dict()
|
||||
for pid, pb in PLAYBOOKS.items()
|
||||
}
|
||||
'playbooks': playbooks_list
|
||||
})
|
||||
|
||||
except Exception as e:
|
||||
|
||||
Reference in New Issue
Block a user