{"action":"created","issue":{"url":"https://api.github.com/repos/mozilla/tls-observatory/issues/92","labels_url":"https://api.github.com/repos/mozilla/tls-observatory/issues/92/labels{/name}","comments_url":"https://api.github.com/repos/mozilla/tls-observatory/issues/92/comments","events_url":"https://api.github.com/repos/mozilla/tls-observatory/issues/92/events","html_url":"https://github.com/mozilla/tls-observatory/issues/92","id":124377533,"number":92,"title":"Search API endpoints to list previous scans and certificates","user":{"login":"jvehent","id":415617,"avatar_url":"https://avatars.githubusercontent.com/u/415617?v=3","gravatar_id":"","url":"https://api.github.com/users/jvehent","html_url":"https://github.com/jvehent","followers_url":"https://api.github.com/users/jvehent/followers","following_url":"https://api.github.com/users/jvehent/following{/other_user}","gists_url":"https://api.github.com/users/jvehent/gists{/gist_id}","starred_url":"https://api.github.com/users/jvehent/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jvehent/subscriptions","organizations_url":"https://api.github.com/users/jvehent/orgs","repos_url":"https://api.github.com/users/jvehent/repos","events_url":"https://api.github.com/users/jvehent/events{/privacy}","received_events_url":"https://api.github.com/users/jvehent/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/mozilla/tls-observatory/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/mozilla/tls-observatory/labels/help%20wanted","name":"help wanted","color":"159818"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-12-30T17:34:03Z","updated_at":"2016-01-14T15:13:38Z","closed_at":null,"body":"Implement search criteria on the `certificate` and `results` endpoints. For example:\r\n* `/api/v1/results?target=www.mozilla.org&limit=1` should return the latest scan of www.mozilla.org\r\n* `/api/v1/certificate?subject=www.mozilla.org&limit=1` should return the latest certificate for www.mozilla.org\r\n\r\nAdditional flags should be added as we improve the API, such as:\r\n* `trusted_{microsoft,mozilla,apple,android}={true,false}` to search by trust\r\n* `signature_algo={SHA1WithRSA,SHA256WithRSA,...}` to search by signature algorithm\r\n* etc..."},"comment":{"url":"https://api.github.com/repos/mozilla/tls-observatory/issues/comments/171668631","html_url":"https://github.com/mozilla/tls-observatory/issues/92#issuecomment-171668631","issue_url":"https://api.github.com/repos/mozilla/tls-observatory/issues/92","id":171668631,"user":{"login":"jvehent","id":415617,"avatar_url":"https://avatars.githubusercontent.com/u/415617?v=3","gravatar_id":"","url":"https://api.github.com/users/jvehent","html_url":"https://github.com/jvehent","followers_url":"https://api.github.com/users/jvehent/followers","following_url":"https://api.github.com/users/jvehent/following{/other_user}","gists_url":"https://api.github.com/users/jvehent/gists{/gist_id}","starred_url":"https://api.github.com/users/jvehent/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jvehent/subscriptions","organizations_url":"https://api.github.com/users/jvehent/orgs","repos_url":"https://api.github.com/users/jvehent/repos","events_url":"https://api.github.com/users/jvehent/events{/privacy}","received_events_url":"https://api.github.com/users/jvehent/received_events","type":"User","site_admin":false},"created_at":"2016-01-14T15:13:38Z","updated_at":"2016-01-14T15:13:38Z","body":"As I'm thinking about this more, I wonder if we should just open an API endpoint to sql injections.\r\n`/search?q=SELECT%20target%20FROM%scans%20WHERE%has_tls='false'%20LIMIT%2010`\r\n\r\nIn the api, we would route those queries to a subroutine that:\r\n* executes one query at a time, to prevent overloading the database\r\n* times out queries after 1 minute, to prevent long running queries\r\n* connects to postgres using a separate DB connection with a read only user, to prevent escalating access to write\r\n* returns results via a channel to the API handler, to respond to the caller"}}