Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
snseventd
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OTDI Middleware
snseventd
Commits
d0ea95df
Commit
d0ea95df
authored
4 years ago
by
Edward Hicks
Browse files
Options
Downloads
Patches
Plain Diff
true/false != True/False
parent
5f86eac1
No related branches found
No related tags found
No related merge requests found
Pipeline
#91828
passed
4 years ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
snseventd.py
+10
-10
10 additions, 10 deletions
snseventd.py
with
10 additions
and
10 deletions
snseventd.py
+
10
−
10
View file @
d0ea95df
...
...
@@ -114,50 +114,50 @@ def sanityCheckMessage(body, payload):
# Make sure message came from the right SNS channel
if
body
[
'
TopicArn
'
]
!=
Session
[
'
topicArn
'
]:
printLog
(
"
Message came from an invalid SNS topic
"
)
return
f
alse
return
F
alse
# Make sure message subject matches what we're expecting
try
:
if
not
re
.
match
(
'
^WHAWS
'
,
body
[
'
Subject
'
]):
printLog
(
"
Message has invalid subject
'"
+
str
(
body
[
'
Subject
'
])
+
"'"
)
return
f
alse
return
F
alse
except
KeyError
:
printLog
(
"
Message is missing a subject
"
)
return
f
alse
return
F
alse
# Verify that the payload includes a valid operation to perform
try
:
if
payload
[
'
operation
'
]
not
in
Config
[
'
events
'
]:
printLog
(
"
Message has invalid operation
'"
+
str
(
payload
[
'
operation
'
])
+
"'"
)
return
f
alse
return
F
alse
except
KeyError
:
printLog
(
"
Message is missing an operation to perform
"
)
return
f
alse
return
F
alse
# Verify that the payload includes a timestamp
try
:
if
not
isinstance
(
payload
[
'
timestamp
'
],
numbers
.
Number
)
or
payload
[
'
timestamp
'
]
<
0
:
printLog
(
"
Message has invalid timestamp
'"
+
str
(
payload
[
'
timestamp
'
])
+
"'"
)
return
f
alse
return
F
alse
except
KeyError
:
printLog
(
"
Message is missing a timestamp
"
)
return
f
alse
return
F
alse
# If the data section includes a UID (i.e. kill_my_phpcgi) then make sure it's valid
try
:
uid
=
payload
[
'
params
'
][
'
uid
'
]
if
not
isinstance
(
uid
,
numbers
.
Number
):
printLog
(
"
UID provided is not a number
"
)
return
f
alse
return
F
alse
if
uid
>
65535
or
uid
<
100
:
printLog
(
"
UID provided is an invalid user
"
)
return
f
alse
return
F
alse
except
KeyError
:
# payload['params']['uid'] doesn't exist to be invalid
pass
# If we got this far then it's good
return
t
rue
return
T
rue
parser
=
argparse
.
ArgumentParser
(
description
=
bcolors
.
HEADER
+
'
Amazon SNS event daemon
'
+
bcolors
.
ENDC
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment