]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: Data encryption is not follow the AWS agreement 15994/head
authorhechuang <hechuang@xsky.com>
Thu, 29 Jun 2017 02:38:23 +0000 (10:38 +0800)
committerhechuang <hechuang@xsky.com>
Thu, 29 Jun 2017 02:42:38 +0000 (10:42 +0800)
Encryption request headers should not be sent for GET requests and HEAD
requests if your object uses SSE-KMS/SSE-S3 or you’ll get an HTTP 400
BadRequest error.

Signed-off-by: hechuang <hechuang@xsky.com>
src/rgw/rgw_crypt.cc

index dabc0be97a8ca2d6a2e0ff90c9857700b6516647..987e5392916535f9a2ee2d946c50220bf7af561b 100644 (file)
@@ -1145,6 +1145,12 @@ int rgw_s3_prepare_decrypt(struct req_state* s,
   int res = 0;
   std::string stored_mode = get_str_attribute(attrs, RGW_ATTR_CRYPT_MODE);
   ldout(s->cct, 15) << "Encryption mode: " << stored_mode << dendl;
+
+  const char *req_sse = s->info.env->get("HTTP_X_AMZ_SERVER_SIDE_ENCRYPTION", NULL);
+  if (nullptr != req_sse && (s->op == OP_GET || s->op == OP_HEAD)) {
+    return -ERR_INVALID_REQUEST;
+  }
+
   if (stored_mode == "SSE-C-AES256") {
     if (s->cct->_conf->rgw_crypt_require_ssl &&
         !s->info.env->exists("SERVER_PORT_SECURE")) {