killbill-commons icon indicating copy to clipboard operation
killbill-commons copied to clipboard

NotificationSqlDao should provide search on both keys

Open pierre opened this issue 11 years ago • 6 comments

NotificationSqlDao should provide getReadyQueueEntriesForSearchKeyS, not only because it is required for Kill Bill (to search by account_record_id and tenant_record_id), but also because the only index present today is a composite on both keys.

pierre avatar Sep 02 '14 12:09 pierre

Confused, isn't it the case already?

sbrossie avatar Sep 02 '14 15:09 sbrossie

No, we only search on one key. See https://github.com/killbill/killbill-commons/blob/master/queue/src/main/resources/org/killbill/notificationq/dao/NotificationSqlDao.sql.stg#L31 and https://github.com/killbill/killbill-commons/blob/dc64043e28e4fcaaec93508b369c6e8df1281a93/queue/src/main/java/org/killbill/notificationq/DefaultNotificationQueue.java#L102.

pierre avatar Sep 02 '14 15:09 pierre

Ah got it, you mean searching for both searchKeys at once....

Still confused why we would need it though (for Kill Bill): Once we specify searching by account_record_id, it will implicitly return only one tenant so then tenant_record_id becomes irrelevant.

I suppose from an API point of view (for the queue itself) it may make sense to search by both keys at once.

sbrossie avatar Sep 02 '14 16:09 sbrossie

[We talked about it IRL, but just for the records]

Still confused why we would need it though (for Kill Bill): Once we specify searching by account_record_id, it will implicitly return only one tenant so then tenant_record_id becomes irrelevant.

account_record_id is eventually specified by the user via API (e.g. by specifying accountId) which is a security risk. tenant_record_id is set by Shiro looking at the tenant credentials. Searching by both prevents API users to peek at other tenants' data.

pierre avatar Sep 02 '14 18:09 pierre

@pierre Seems like we search for both keys here. Should this be closed?

sbrossie avatar Feb 23 '22 21:02 sbrossie

We should just double check we've updated Kill Bill to use it (see my comment about security issue above).

pierre avatar Feb 24 '22 08:02 pierre