Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NotificationSqlDao should provide search on both keys #7

Open
pierre opened this issue Sep 2, 2014 · 6 comments
Open

NotificationSqlDao should provide search on both keys #7

pierre opened this issue Sep 2, 2014 · 6 comments

Comments

@pierre
Copy link
Member

pierre commented Sep 2, 2014

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 pierre added the bug label Sep 2, 2014
@sbrossie
Copy link
Member

sbrossie commented Sep 2, 2014

Confused, isn't it the case already?

@pierre
Copy link
Member Author

pierre commented Sep 2, 2014

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

return getFutureNotificationsInternal(type, (NotificationSqlDao) dao.getSqlDao(), "search_key1", searchKey1);
.

@sbrossie
Copy link
Member

sbrossie commented Sep 2, 2014

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.

@pierre
Copy link
Member Author

pierre commented Sep 2, 2014

[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.

@sbrossie sbrossie added the Queue label Jul 27, 2015
@sbrossie
Copy link
Member

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

@pierre
Copy link
Member Author

pierre commented Feb 24, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants