Skip to content

Commit

Permalink
campaignd: Remove unwanted attributes from server response
Browse files Browse the repository at this point in the history
As opposed to merely blanking them out.

Closes #4800.
  • Loading branch information
irydacea committed Mar 30, 2020
1 parent a658072 commit 62c9aec
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions src/campaign_server/campaign_server.cpp
Expand Up @@ -641,19 +641,16 @@ void server::handle_request_campaign_list(const server::request& req)

for(config& j : campaign_list.child_range("campaign"))
{
j["passphrase"] = "";
j["passhash"] = "";
j["passsalt"] = "";
j["upload_ip"] = "";
j["email"] = "";
j["feedback_url"] = "";

// Build a feedback_url string attribute from the
// internal [feedback] data.
// Remove attributes containing information that's considered sensitive
// or irrelevant to clients
j.remove_attributes("passphrase", "passhash", "passsalt", "upload_ip", "email");

// Build a feedback_url string attribute from the internal [feedback]
// data or deliver an empty value, in case clients decide to assume its
// presence.
const config& url_params = j.child_or_empty("feedback");
if(!url_params.empty() && !feedback_url_format_.empty()) {
j["feedback_url"] = format_addon_feedback_url(feedback_url_format_, url_params);
}
j["feedback_url"] = !url_params.empty() && !feedback_url_format_.empty()
? format_addon_feedback_url(feedback_url_format_, url_params) : "";

// Clients don't need to see the original data, so discard it.
j.clear_children("feedback");
Expand Down

0 comments on commit 62c9aec

Please sign in to comment.