const char* x_amz_server_side_encryption_customer_key = "x-amz-server-side-encryption-customer-key";
const char* dollar_x_amz_server_side_encryption_customer_key = "$x-amz-server-side-encryption-customer-key";
const char* suppression_message = "=suppressed due to key presence=";
-}
-}
-namespace std {
std::ostream& operator<<(std::ostream& out, const rgw::crypt_sanitize::env& e) {
if (g_ceph_context->_conf->rgw_crypt_suppress_logs) {
if (boost::algorithm::iequals(
std::ostream& operator<<(std::ostream& out, const rgw::crypt_sanitize::log_content& x) {
if (g_ceph_context->_conf->rgw_crypt_suppress_logs &&
- strstr(x.buf, rgw::crypt_sanitize::x_amz_server_side_encryption_customer_key) != nullptr) {
+ boost::algorithm::ifind_first(x.buf, rgw::crypt_sanitize::x_amz_server_side_encryption_customer_key)) {
out << rgw::crypt_sanitize::suppression_message;
return out;
}
return out;
}
-
-
+}
}
namespace rgw {
namespace crypt_sanitize {
-
+/*
+ * Temporary container for suppressing printing if variable contains secret key.
+ */
struct env {
boost::string_ref name;
boost::string_ref value;
: name(name), value(value) {}
};
+/*
+ * Temporary container for suppressing printing if aws meta attributes contains secret key.
+ */
struct x_meta_map {
boost::string_ref name;
boost::string_ref value;
: name(name), value(value) {}
};
+/*
+ * Temporary container for suppressing printing if s3_policy calculation variable contains secret key.
+ */
struct s3_policy {
boost::string_ref name;
boost::string_ref value;
: name(name), value(value) {}
};
+/*
+ * Temporary container for suppressing printing if auth string contains secret key.
+ */
struct auth {
const req_state* const s;
boost::string_ref value;
: s(s), value(value) {}
};
+/*
+ * Temporary container for suppressing printing if log made from civetweb may contain secret key.
+ */
struct log_content {
const char* buf;
log_content(const char* buf)
: buf(buf) {}
};
-}
-}
-
-namespace std {
std::ostream& operator<<(std::ostream& out, const rgw::crypt_sanitize::env& e);
std::ostream& operator<<(std::ostream& out, const rgw::crypt_sanitize::x_meta_map& x);
std::ostream& operator<<(std::ostream& out, const rgw::crypt_sanitize::s3_policy& x);
std::ostream& operator<<(std::ostream& out, const rgw::crypt_sanitize::auth& x);
std::ostream& operator<<(std::ostream& out, const rgw::crypt_sanitize::log_content& x);
}
+}
#endif /* RGW_RGW_CRYPT_SANITIZE_H_ */