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

503 error, API outage? #93

Open
bigbizze opened this issue Feb 5, 2019 · 7 comments
Open

503 error, API outage? #93

bigbizze opened this issue Feb 5, 2019 · 7 comments
Assignees

Comments

@bigbizze
Copy link

bigbizze commented Feb 5, 2019

Hey, we started receiving a bunch of 503 responses this afternoon, is the API experiencing any outages?

thanks!

It says in your status codes that 503 means the service is unavailable, is this potentially something on my end? Or are we experiencing issues that are expected?

@alexwoz
Copy link
Collaborator

alexwoz commented Feb 7, 2019

Hey @bigbizze -- are you still experiencing this? We are not aware of any existing service outages. Please let me know and I'll continue to dig in.

@bigbizze
Copy link
Author

bigbizze commented Feb 10, 2019

Hey @alexwoz sorry for the delayed response , I am still apparently getting the same error as I was then.

I am getting 503 responses peppered in with 200 ones which is why I initially thought it had to be something on my end.

Here are some examples of the POST requests I'm sending to the Safe Browsing API with the status code of the JSON printed below each JSON block (it's too long for github): https://pastebin.com/iZhnKgE5

Let me know if there's any other attributed of the response that could help you or anything else in general that could help!

@colonelxc
Copy link
Contributor

Both URL and hash lookups are limited to 500 entries per API call. It looks like you're way over that. I'm not sure why it is returning 503 though, it should return a 4xx error of sorts.

https://developers.google.com/safe-browsing/v4/lookup-api#checking-urls

It also looks like something weird is happening with your entry types/platforms/etc with a bunch of duplication. I don't think there is any issue with that, but might as well fix them anyways.

@colonelxc
Copy link
Contributor

Ah, I didn't see that there were multiple requests in that paste, that might not be the problem. I'd try removing the deduplication on your threat types/etc, and see if that helps.

@bigbizze
Copy link
Author

I am certainly open to trying that but hopefully you can clear up some confusion on something that by my perusing wasn't particularly clear in the documentation before then...

I was under the impression that the lists found in "threats["threatLists"]" were directories or paths to separate lists or "bins" of different threats and that the duplication of threat types, threat entry types etc. were all unique to a specific list which is why I was using this function:

def reload_lists(p_load):
    re = requests.request("GET", "https://safebrowsing.googleapis.com/v4/threatLists", data="", headers=headers, params=querystring)
    threats = re.json()
    p_load["client"]["clientId"] = 'malicioussiteschoolproj'
    p_load["client"]["clientVersion"] = '1.0'
    p_load["threatInfo"]["threatTypes"] = list()
    p_load["threatInfo"]["platformTypes"] = list()
    p_load["threatInfo"]["threatEntryTypes"] = list()
    p_load["threatInfo"]["threatEntries"] = list()
    for items in threats["threatLists"]:
        p_load["threatInfo"]["threatTypes"].append(items["threatType"])
        p_load["threatInfo"]["platformTypes"].append(items["platformType"])
        p_load["threatInfo"]["threatEntryTypes"].append(items["threatEntryType"])
    with open("url_req.json", "w") as f:
        json.dump(p_load, f)
    return p_load

to ensure that I could make use of all of the safe browsing threat lists possible, it's also why there's so much duplication.

If there's a more efficient way of making reference to all of the threatlists I'd certainly be interested in using that.

@colonelxc
Copy link
Contributor

You're right that we generally treat them as 3 part tuples. However, it's a bit different in the API when looking up specific values (either a full hash lookup, or the url lookups, as you are doing), it is just a list of the threatTypes, etc that you are interested in. Internally it will create every combination that you may be interested in.

See this example:
https://developers.google.com/safe-browsing/v4/lookup-api#example-threatmatchesfind
In the example, there are two threat types (malware, software engineering), and one of each of the other types. On the server, it will pass back any results for url/windows/malware and url/windows/social_engineering.

I agree that it is a bit odd.

@bigbizze
Copy link
Author

bigbizze commented Mar 21, 2019

Thank you, it appears to be working well now!

My only concern is that I initially did it this way with a list of known malicious URLs and it returned almost no matches whereas loading every combination it returned a large number of malicious matches, is this something I should be concerned about?

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

No branches or pull requests

4 participants
@colonelxc @alexwoz @bigbizze and others