Hello, Lately I’ve been playing with Lua scripting on top of RGW. I would like to implement a request blocking based on bucket name -> when there is a dot in a bucket name return error code and a message that this name is invalid. Here is the code I was able to came up with. if string.find(Request.HTTP.URI, '%.') then Request.Response.HTTPStatusCode = 400 Request.Response.HTTPStatus = “InvalidBucketName" Request.Response.Message = “Dots in bucket name are not allowed." end This works fine, but the request for creating a bucket would be processed and the bucket will be created. I thought about a dirty workaround with setting the Request.Bucket.Name to a bucket that already exists but it seems that this field is not writable in Quincy. Is there a way to block the request from processing? Any help is much appreciated. Kind regards, Ondrej
Hi Ondřej, Greater to hear that you use lua. You are right, this field has become writable only in reef. I can backport the fix to quincy, so that you can use it in the next quincy release (not sure when it is). A better option would be to allow setting the failure from lua - but this would be a new feature, that would probably land post reef. Yuval On Sun, Apr 30, 2023 at 7:49 PM Ondřej Kukla <ondrej@kuuk.la> wrote:
Hello,
Lately I’ve been playing with Lua scripting on top of RGW.
I would like to implement a request blocking based on bucket name -> when there is a dot in a bucket name return error code and a message that this name is invalid.
Here is the code I was able to came up with.
if string.find(Request.HTTP.URI, '%.') then Request.Response.HTTPStatusCode = 400 Request.Response.HTTPStatus = “InvalidBucketName" Request.Response.Message = “Dots in bucket name are not allowed." end
This works fine, but the request for creating a bucket would be processed and the bucket will be created. I thought about a dirty workaround with setting the Request.Bucket.Name to a bucket that already exists but it seems that this field is not writable in Quincy.
Is there a way to block the request from processing?
Any help is much appreciated.
Kind regards,
Ondrej _______________________________________________ ceph-users mailing list -- ceph-users@ceph.io To unsubscribe send an email to ceph-users-leave@ceph.io
Hi Yuval, Playing with Lua, I faced similar issue. It would be perfect if you can backport this fix to Quincy. Thank you! Vladimir. -----Original Message----- From: Yuval Lifshitz <ylifshit@redhat.com> To: Ondřej Kukla <ondrej@kuuk.la> Cc: ceph-users@ceph.io Subject: [ceph-users] Re: RGW Lua - cancel request Date: Sun, 30 Apr 2023 21:00:21 +0300 Hi Ondřej, Greater to hear that you use lua. You are right, this field has become writable only in reef. I can backport the fix to quincy, so that you can use it in the next quincy release (not sure when it is). A better option would be to allow setting the failure from lua - but this would be a new feature, that would probably land post reef. Yuval On Sun, Apr 30, 2023 at 7:49 PM Ondřej Kukla <ondrej@kuuk.la> wrote:
Hello,
Lately I’ve been playing with Lua scripting on top of RGW.
I would like to implement a request blocking based on bucket name -> when there is a dot in a bucket name return error code and a message that this name is invalid.
Here is the code I was able to came up with.
if string.find(Request.HTTP.URI, '%.') then Request.Response.HTTPStatusCode = 400 Request.Response.HTTPStatus = “InvalidBucketName" Request.Response.Message = “Dots in bucket name are not allowed." end
This works fine, but the request for creating a bucket would be processed and the bucket will be created. I thought about a dirty workaround with setting the Request.Bucket.Name to a bucket that already exists but it seems that this field is not writable in Quincy.
Is there a way to block the request from processing?
Any help is much appreciated.
Kind regards,
Ondrej _______________________________________________ ceph-users mailing list -- ceph-users@ceph.io To unsubscribe send an email to ceph-users-leave@ceph.io
_______________________________________________ ceph-users mailing list -- ceph-users@ceph.io To unsubscribe send an email to ceph-users-leave@ceph.io
Vladimir and Ondřej, Created a quincy backport PR: https://github.com/ceph/ceph/pull/51300 Hopefully it would land in the next quincy release. Yuval On Mon, May 1, 2023 at 7:37 PM Vladimir Sigunov <vladimir.sigunov@gmail.com> wrote:
Hi Yuval,
Playing with Lua, I faced similar issue. It would be perfect if you can backport this fix to Quincy.
Thank you! Vladimir.
-----Original Message----- *From*: Yuval Lifshitz <ylifshit@redhat.com <Yuval%20Lifshitz%20%3cylifshit@redhat.com%3e>> *To*: Ondřej Kukla <ondrej@kuuk.la <%3d%3fUTF-8%3fQ%3fOnd%3dC5%3d99ej%3f%3d%20Kukla%20%3condrej@kuuk.la%3e>> *Cc*: ceph-users@ceph.io *Subject*: [ceph-users] Re: RGW Lua - cancel request *Date*: Sun, 30 Apr 2023 21:00:21 +0300
Hi Ondřej, Greater to hear that you use lua. You are right, this field has become writable only in reef. I can backport the fix to quincy, so that you can use it in the next quincy release (not sure when it is). A better option would be to allow setting the failure from lua - but this would be a new feature, that would probably land post reef.
Yuval
On Sun, Apr 30, 2023 at 7:49 PM Ondřej Kukla <ondrej@kuuk.la> wrote:
Hello,
Lately I’ve been playing with Lua scripting on top of RGW.
I would like to implement a request blocking based on bucket name -> when there is a dot in a bucket name return error code and a message that this name is invalid.
Here is the code I was able to came up with.
if string.find(Request.HTTP.URI, '%.') then Request.Response.HTTPStatusCode = 400 Request.Response.HTTPStatus = “InvalidBucketName" Request.Response.Message = “Dots in bucket name are not allowed." end
This works fine, but the request for creating a bucket would be processed and the bucket will be created. I thought about a dirty workaround with setting the Request.Bucket.Name to a bucket that already exists but it seems that this field is not writable in Quincy.
Is there a way to block the request from processing?
Any help is much appreciated.
Kind regards,
Ondrej _______________________________________________ ceph-users mailing list -- ceph-users@ceph.io To unsubscribe send an email to ceph-users-leave@ceph.io
_______________________________________________ ceph-users mailing list -- ceph-users@ceph.io To unsubscribe send an email to ceph-users-leave@ceph.io
participants (3)
-
Ondřej Kukla
-
Vladimir Sigunov
-
Yuval Lifshitz