]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: always check if token is expired 4617/head
authorAnton Aksola <anton.aksola@nebula.fi>
Fri, 10 Apr 2015 10:25:21 +0000 (13:25 +0300)
committerAnton Aksola <anton.aksola@nebula.fi>
Fri, 8 May 2015 08:50:15 +0000 (11:50 +0300)
Fixes: #11367
Currently token expiration is only checked by the token cache. With PKI
tokens no expiration check is done after decoding the token. This causes
PKI tokens to be valid indefinitely. UUID tokens are validated by
keystone after cache miss so they are not affected by this bug.

This commit adds explicit token expiration check to
RGWSwift::validate_keystone_token()

Signed-off-by: Anton Aksola <anton.aksola@nebula.fi>
Reported-by: Riku Lehto <riku.lehto@nexetic.com>
src/rgw/rgw_swift.cc

index a08d94400d643dd24f1565d829fb338fc895f763..0a8d373ca9d5e87ef857b06c507b0c0632002339 100644 (file)
@@ -525,6 +525,11 @@ int RGWSwift::validate_keystone_token(RGWRados *store, const string& token, stru
   if (ret < 0)
     return ret;
 
+  if (t.expired()) {
+    ldout(cct, 0) << "got expired token: " << t.token.tenant.name << ":" << t.user.name << " expired: " << t.token.expires << dendl;
+    return -EPERM;
+  }
+
   keystone_token_cache->add(token_id, t);
 
   ret = update_user_info(store, info, rgw_user);