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

More Accurate Google Maps API Key Testing #63

Merged
merged 1 commit into from
Mar 23, 2020
Merged

More Accurate Google Maps API Key Testing #63

merged 1 commit into from
Mar 23, 2020

Conversation

m-q-t
Copy link
Contributor

@m-q-t m-q-t commented Mar 23, 2020

Hi team,

I've noticed the current method for testing Google Maps API keys is inaccurate as it doesn't show if the key is inactive or if the key is restricted by the Referer header.

We can issue the following command to confirm if the keys are indeed active and not restricted by the Referer header:

curl -H "referer: http://example.com" "https://maps.googleapis.com/maps/api/directions/json?origin=Stockholm&destination=Kalmar&key=KEY_HERE"

Different types of responses:

Vulnerable: Key is valid & active with no restrictions:

<long snippet>
         "warnings" : [],
         "waypoint_order" : []
      }
   ],
   "status" : "OK"
}

Not Vulnerable: Key is valid & active but restricted by Referer:

{
   "error_message" : "API keys with referer restrictions cannot be used with this API.",
   "routes" : [],
   "status" : "REQUEST_DENIED"
}

Not Vulnerable: Key is valid, but not active:

{
   "error_message" : "This API project is not authorized to use this API.",
   "routes" : [],
   "status" : "REQUEST_DENIED"
}

Not Vulnerable: Key is invalid:

{
   "error_message" : "The provided API key is invalid.",
   "routes" : [],
   "status" : "REQUEST_DENIED"
}

More information about different ways the keys can be restricted:
https://developers.google.com/maps/api-key-best-practices

Thank you,
- mqt

@codingo codingo merged commit 620fbf4 into streaak:master Mar 23, 2020
@codingo
Copy link
Collaborator

codingo commented Mar 23, 2020

Thank-you!

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

Successfully merging this pull request may close these issues.

None yet

2 participants