Skip to content

Commit

Permalink
Merge pull request #20 from kamushadenes/fix/int_handling
Browse files Browse the repository at this point in the history
fix int handling and workflow
  • Loading branch information
kamushadenes authored Nov 3, 2023
2 parents 7ebc1e3 bf2adbc commit b18dad3
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 8,10 @@ jobs:

steps:
- name: Check out repository code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: "3.x"

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 9,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: '3.x'

Expand Down
12 changes: 12 additions & 0 deletions cefevent/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 48,20 @@ def load(self, headers: List[AnyStr], fields: List[Any]):
def _validate_field_value(self, field: AnyStr, value: Any):
obj = self._reverse_extension_dictionary[field]

# Handle special case of ports
if obj["full_name"].endswith("Port"):
try:
value = int(value)
except:
return False
if not 0 <= value <= 65535:
return False
return value

for dt in obj["data_type"]:
if dt in ["Integer", "Long"]:
if dt == "Integer" and value > 2**31-1:
continue
try:
return int(value)
except:
Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 8,13 @@
setup(
name="cefevent",
packages=["cefevent"],
version="0.5.4",
version="0.5.6",
description="ArcSight Common Event Format library",
long_description=long_description,
long_description_content_type="text/markdown",
author="Kamus Hadenes",
author="Henrique Goncalves",
author_email="[email protected]",
url="https://github.com/kamushadenes/cefevent",
download_url="https://github.com/kamushadenes/cefevent/tarball/0.5.4",
download_url="https://github.com/kamushadenes/cefevent/tarball/0.5.6",
keywords=["logging", "cef", "arcsight", "event", "security"],
)

0 comments on commit b18dad3

Please sign in to comment.