]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
rgw: Avoid segfault when OPA authz is enabled 46107/head
authorBenoît Knecht <bknecht@protonmail.ch>
Tue, 12 Apr 2022 09:51:10 +0000 (11:51 +0200)
committerBenoît Knecht <bknecht@protonmail.ch>
Mon, 2 May 2022 07:13:23 +0000 (09:13 +0200)
commit3279f004e2a9259e1980e32e7a0f4d2e8a3e4a3f
tree0a35789e6ab36050471fb6a9f9b226c4c4c0b6a1
parent759e9aca3c22c0edddce07dc02a7a0cd8edee217
rgw: Avoid segfault when OPA authz is enabled

When `rgw_use_opa_authz=true`, radosgw would segfault on any request that
didn't target a specific object or bucket, because `s->object` or `s->bucket`
would be `nullptr` in that case, but that code path would try to dereference
them anyway.

This commit only adds the `object_name`, `subuser`, `user_info` and
`bucket_info` JSON objects if the corresponding `s->X` object is defined,
thereby avoiding segfaults in radosgw when Open Policy Agent authorization is
enabled.

Fixes: https://tracker.ceph.com/issues/55286
Signed-off-by: Benoît Knecht <bknecht@protonmail.ch>
(cherry picked from commit ac71916cea04c8bac4baf58bcb9c63d8797f877e)
src/rgw/rgw_opa.cc