summaryrefslogtreecommitdiff
path: root/res/ari/resource_bridges.c
diff options
context:
space:
mode:
authorKinsey Moore <kmoore@digium.com>2013-11-22 20:10:46 +0000
committerKinsey Moore <kmoore@digium.com>2013-11-22 20:10:46 +0000
commitd9015a5356dfff70ce15ed2ea5726325de71d9e3 (patch)
treeb4b253dcc96a4cbc27f54ee294dae45264e12dbb /res/ari/resource_bridges.c
parent1c45a32ee861fa427e0243abe03c729966fa4436 (diff)
ARI: Don't leak implementation details
This change prevents channels used as implementation details from leaking out to ARI. It does this by preventing creation of JSON blobs of channel snapshots created from those channels and sanitizing JSON blobs of bridge snapshots as they are created. This introduces a framework for excluding information from output targeted at Stasis applications on a consumer-by-consumer basis using channel sanitization callbacks which could be extended to bridges or endpoints if necessary. This prevents unhelpful error messages from being generated by ast_json_pack. This also corrects a bug where BridgeCreated events would not be created. (closes issue ASTERISK-22744) Review: https://reviewboard.asterisk.org/r/2987/ Reported by: David M. Lee ........ Merged revisions 403069 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@403070 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/ari/resource_bridges.c')
-rw-r--r--res/ari/resource_bridges.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/res/ari/resource_bridges.c b/res/ari/resource_bridges.c
index 7c4fed29b..e09bea6b5 100644
--- a/res/ari/resource_bridges.c
+++ b/res/ari/resource_bridges.c
@@ -605,7 +605,7 @@ void ast_ari_bridges_get(struct ast_variable *headers,
}
ast_ari_response_ok(response,
- ast_bridge_snapshot_to_json(snapshot));
+ ast_bridge_snapshot_to_json(snapshot, stasis_app_get_sanitizer()));
}
void ast_ari_bridges_destroy(struct ast_variable *headers,
@@ -656,7 +656,9 @@ void ast_ari_bridges_list(struct ast_variable *headers,
while ((obj = ao2_iterator_next(&i))) {
RAII_VAR(struct stasis_message *, msg, obj, ao2_cleanup);
struct ast_bridge_snapshot *snapshot = stasis_message_data(msg);
- if (ast_json_array_append(json, ast_bridge_snapshot_to_json(snapshot))) {
+ struct ast_json *json_bridge = ast_bridge_snapshot_to_json(snapshot, stasis_app_get_sanitizer());
+
+ if (!json_bridge || ast_json_array_append(json, json_bridge)) {
ast_ari_response_alloc_failed(response);
return;
}
@@ -689,5 +691,5 @@ void ast_ari_bridges_create(struct ast_variable *headers,
}
ast_ari_response_ok(response,
- ast_bridge_snapshot_to_json(snapshot));
+ ast_bridge_snapshot_to_json(snapshot, stasis_app_get_sanitizer()));
}