2 * rgw_crypt_sanitize.cc
4 * Created on: Mar 3, 2017
8 #include "rgw_common.h"
9 #include "rgw_crypt_sanitize.h"
10 #include "boost/algorithm/string/predicate.hpp"
13 namespace crypt_sanitize {
14 const char* HTTP_X_AMZ_SERVER_SIDE_ENCRYPTION_CUSTOMER_KEY = "HTTP_X_AMZ_SERVER_SIDE_ENCRYPTION_CUSTOMER_KEY";
15 const char* x_amz_server_side_encryption_customer_key = "x-amz-server-side-encryption-customer-key";
16 const char* dollar_x_amz_server_side_encryption_customer_key = "$x-amz-server-side-encryption-customer-key";
17 const char* suppression_message = "=suppressed due to key presence=";
19 std::ostream& operator<<(std::ostream& out, const env& e) {
20 if (g_ceph_context->_conf->rgw_crypt_suppress_logs) {
21 if (boost::algorithm::iequals(
23 HTTP_X_AMZ_SERVER_SIDE_ENCRYPTION_CUSTOMER_KEY))
25 out << suppression_message;
28 if (boost::algorithm::iequals(e.name, "QUERY_STRING") &&
29 boost::algorithm::ifind_first(
31 x_amz_server_side_encryption_customer_key))
33 out << suppression_message;
41 std::ostream& operator<<(std::ostream& out, const x_meta_map& x) {
42 if (g_ceph_context->_conf->rgw_crypt_suppress_logs &&
43 boost::algorithm::iequals(x.name, x_amz_server_side_encryption_customer_key))
45 out << suppression_message;
52 std::ostream& operator<<(std::ostream& out, const s3_policy& x) {
53 if (g_ceph_context->_conf->rgw_crypt_suppress_logs &&
54 boost::algorithm::iequals(x.name, dollar_x_amz_server_side_encryption_customer_key))
56 out << suppression_message;
63 std::ostream& operator<<(std::ostream& out, const auth& x) {
64 if (g_ceph_context->_conf->rgw_crypt_suppress_logs &&
65 x.s->info.env->get(HTTP_X_AMZ_SERVER_SIDE_ENCRYPTION_CUSTOMER_KEY, nullptr) != nullptr)
67 out << suppression_message;
74 std::ostream& operator<<(std::ostream& out, const log_content& x) {
75 if (g_ceph_context->_conf->rgw_crypt_suppress_logs &&
76 boost::algorithm::ifind_first(x.buf, x_amz_server_side_encryption_customer_key)) {
77 out << suppression_message;