Skip to content

Neosec fix time format bug #24509

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

Merged
merged 8 commits into from
Feb 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions Packs/Neosec/Integrations/Neosec/Neosec.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,6 @@ def build_filter(
return [{"name": name, "operator": operator, "value": value} for value in values]


def neosec_datetime_to_timestamp(date_str: str) -> int:
return int(
datetime.strptime(date_str, NEOSEC_DATE_FORMAT).replace(tzinfo=timezone.utc).timestamp()
)


def timestamp_to_neosec_datetime(timestamp: int) -> str:
return datetime.utcfromtimestamp(timestamp).strftime(NEOSEC_DATE_FORMAT)

Expand Down Expand Up @@ -273,10 +267,14 @@ def fetch_incidents(
if incident_created_time <= last_fetch:
continue

alert_timestamp = dateparser.parse(alert.get("timestamp")) # type: ignore
if not alert_timestamp:
raise ValueError("Alert's timestamp is not valid")

incident = {
"name": alert["name"],
"occurred": timestamp_to_datestring(
neosec_datetime_to_timestamp(alert["timestamp"]) * 1000,
int(alert_timestamp.timestamp() * 1000),
date_format=DATE_FORMAT,
is_utc=True,
),
Expand Down
2 changes: 1 addition & 1 deletion Packs/Neosec/Integrations/Neosec/Neosec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ script:
script: "-"
type: python
subtype: python3
dockerimage: demisto/python3:3.10.9.42476
dockerimage: demisto/python3:3.10.10.47713
feed: false
longRunning: false
longRunningPort: false
Expand Down
5 changes: 5 additions & 0 deletions Packs/Neosec/ReleaseNotes/1_0_2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

#### Integrations
##### Neosec
- Fixed time formatting bug.
- Updated the Docker image to: *demisto/python3:3.10.10.47713*.
2 changes: 1 addition & 1 deletion Packs/Neosec/pack_metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "Neosec",
"description": "Utilize Neosec behavioral analytics to protect your API estate from OWSP top 10 vulnerabilities and suspicious user behavior.",
"support": "partner",
"currentVersion": "1.0.1",
"currentVersion": "1.0.2",
"author": "Neosec",
"url": "",
"email": "[email protected]",
Expand Down