Created
October 4, 2021 01:33
-
-
Save gyrospectre/df3fcfbdda2e075c2fcba1807ef40fb1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_entrypoint(): | |
stack = inspect.stack() | |
entrypoint = { | |
'filename': stack[-1].filename, | |
'code_context': stack[-1].code_context | |
} | |
return entrypoint | |
def check_entrypoint(): | |
entrypoint = get_entrypoint() | |
LOGGER.info(json.dumps(entrypoint)) | |
entry_file = entrypoint.get('filename') | |
if not entry_file.startswith('/var/runtime/'): | |
msg = f'Runtime has been tampered with, aborting! File: {entry_file}' | |
LOGGER.critical(msg) | |
raise Exception(msg) | |
def handler(event, context): | |
try: | |
check_entrypoint() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment