summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Duffield <tom@chef.io>2017-02-09 13:57:35 -0600
committerGitHub <noreply@github.com>2017-02-09 13:57:35 -0600
commit48671f8bb74d3679a42f2cac089aee814943a755 (patch)
tree6ef662035a4abde3235b861c5d2bb06bdc7f3496
parentf3141911a95f6c1475fe833884a772fc4b8eb3f9 (diff)
parent8278a357e3aeaf4b58bc88fcfbdd48e27c0ff944 (diff)
downloadchef-48671f8bb74d3679a42f2cac089aee814943a755.tar.gz
Merge pull request #5793 from chef/lcg/data-collector-utf8masster
Sanitize UTF-8 data sent to Data Collector
-rw-r--r--lib/chef/data_collector.rb7
-rw-r--r--spec/support/shared/context/client.rb2
2 files changed, 4 insertions, 5 deletions
diff --git a/lib/chef/data_collector.rb b/lib/chef/data_collector.rb
index acd42c355e..0a92b800a6 100644
--- a/lib/chef/data_collector.rb
+++ b/lib/chef/data_collector.rb
@@ -2,7 +2,7 @@
# Author:: Adam Leff (<adamleff@chef.io>)
# Author:: Ryan Cragun (<ryan@chef.io>)
#
-# Copyright:: Copyright 2012-2016, Chef Software Inc.
+# Copyright:: Copyright 2012-2017, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -288,9 +288,9 @@ class Chef
# raise an exception.
def setup_http_client
if data_collector_token.nil?
- Chef::ServerAPI.new(data_collector_server_url)
+ Chef::ServerAPI.new(data_collector_server_url, validate_utf8: false)
else
- Chef::HTTP::SimpleJSON.new(data_collector_server_url)
+ Chef::HTTP::SimpleJSON.new(data_collector_server_url, validate_utf8: false)
end
end
@@ -333,7 +333,6 @@ class Chef
def send_to_data_collector(message)
return unless data_collector_accessible?
- Chef::Log.debug("data_collector_reporter: POSTing the following message to #{data_collector_server_url}: #{Chef::JSONCompat.to_json(message)}")
http.post(nil, message, headers)
end
diff --git a/spec/support/shared/context/client.rb b/spec/support/shared/context/client.rb
index 295bd6ce5f..c65650e6b1 100644
--- a/spec/support/shared/context/client.rb
+++ b/spec/support/shared/context/client.rb
@@ -95,7 +95,7 @@ shared_context "a client run" do
def stub_for_data_collector_init
expect(Chef::ServerAPI).to receive(:new).
- with(Chef::Config[:data_collector][:server_url]).
+ with(Chef::Config[:data_collector][:server_url], validate_utf8: false).
exactly(:once).
and_return(http_data_collector)
end