Skip to content
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

fix int handling and workflow #20

Merged
merged 1 commit into from
Nov 3, 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
fix int handling and workflow
  • Loading branch information
kamushadenes committed Nov 3, 2023
commit bf2adbcd627bb981596b9772bc053fef05fae252
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"],
)
Loading