1
0
mirror of https://github.com/laurivosandi/certidude synced 2025-10-30 17:09:19 +00:00

Add tests for API calls

This commit is contained in:
2017-04-25 13:06:59 +03:00
parent d5edbe50c5
commit ba9dca910f
2 changed files with 60 additions and 1 deletions

View File

@@ -35,7 +35,11 @@ class AttributeResource(object):
current = current[component]
current[key] = value
whitelist = ip_address(attribs.get("user").get("lease").get("address").decode("ascii"))
try:
whitelist = ip_address(attribs.get("user").get("lease").get("address").decode("ascii"))
except AttributeError: # TODO: probably race condition
raise falcon.HTTPForbidden("Forbidden",
"Attributes only accessible to the machine")
if req.context.get("remote_addr") != whitelist:
logger.info("Attribute access denied from %s, expected %s for %s",