{"action":"created","issue":{"url":"https://api.github.com/repos/StackStorm/st2/issues/2654","repository_url":"https://api.github.com/repos/StackStorm/st2","labels_url":"https://api.github.com/repos/StackStorm/st2/issues/2654/labels{/name}","comments_url":"https://api.github.com/repos/StackStorm/st2/issues/2654/comments","events_url":"https://api.github.com/repos/StackStorm/st2/issues/2654/events","html_url":"https://github.com/StackStorm/st2/issues/2654","id":151667837,"number":2654,"title":"Split off rule criteria","user":{"login":"etern4ever","id":7612193,"avatar_url":"https://avatars.githubusercontent.com/u/7612193?v=3","gravatar_id":"","url":"https://api.github.com/users/etern4ever","html_url":"https://github.com/etern4ever","followers_url":"https://api.github.com/users/etern4ever/followers","following_url":"https://api.github.com/users/etern4ever/following{/other_user}","gists_url":"https://api.github.com/users/etern4ever/gists{/gist_id}","starred_url":"https://api.github.com/users/etern4ever/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/etern4ever/subscriptions","organizations_url":"https://api.github.com/users/etern4ever/orgs","repos_url":"https://api.github.com/users/etern4ever/repos","events_url":"https://api.github.com/users/etern4ever/events{/privacy}","received_events_url":"https://api.github.com/users/etern4ever/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-04-28T15:11:23Z","updated_at":"2016-04-30T07:52:56Z","closed_at":null,"body":"It would be nice to split off the rule criteria so we can code our own and return a true/false back into the rule engine.  This would allow more advanced checking that could be included in packs.\r\n\r\nExample.  Check to see if an open ticket already exists in your ticketing system.\r\n\r\nI know I can do this in either a custom sensor or action, but it makes more sense to be in the criteria section of the rules.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/StackStorm/st2/issues/comments/215945091","html_url":"https://github.com/StackStorm/st2/issues/2654#issuecomment-215945091","issue_url":"https://api.github.com/repos/StackStorm/st2/issues/2654","id":215945091,"user":{"login":"Kami","id":125088,"avatar_url":"https://avatars.githubusercontent.com/u/125088?v=3","gravatar_id":"","url":"https://api.github.com/users/Kami","html_url":"https://github.com/Kami","followers_url":"https://api.github.com/users/Kami/followers","following_url":"https://api.github.com/users/Kami/following{/other_user}","gists_url":"https://api.github.com/users/Kami/gists{/gist_id}","starred_url":"https://api.github.com/users/Kami/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kami/subscriptions","organizations_url":"https://api.github.com/users/Kami/orgs","repos_url":"https://api.github.com/users/Kami/repos","events_url":"https://api.github.com/users/Kami/events{/privacy}","received_events_url":"https://api.github.com/users/Kami/received_events","type":"User","site_admin":false},"created_at":"2016-04-30T07:52:56Z","updated_at":"2016-04-30T07:52:56Z","body":"Thanks for the feedback.\r\n\r\nThat's indeed an interesting idea (allowing user to provide a callable / path to the module with a callable) and something we have already briefly discussed in the past.\r\n\r\nAs you have pointed out, you can already achieve that inside the action (workflow), but yes, having it inside the rule could make more sense in some situations.\r\n\r\nIn general, I would be OK with supporting like that in the future, we would just need to be careful users don't abuse this feature and start putting stuff inside this comparison function which should really belong elsewhere.\r\n\r\nAnother potential problem with this approach is negative security implications and performance overhead. If we decided to support that, it's unlikely that we would introduce sandboxing in the first iteration so this could have negative security complications.\r\n\r\nFor example, now the user which can create rules can also execute arbitrary code in the scope of the rules engine - in fact, that's why we decided to go with a custom DSL to begin with - to avoid potential negative security implications.\r\n\r\nSo having said that, doing it the right way (with sandboxing and all) would be quite a decently sized task, but we could maybe introduce some feature flags (e.g. user can opt-in into this feature in the config and / or we introduce another RBAC permission type) to begin with."}}