syslog2cef 0.2.0__tar.gz → 0.2.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. {syslog2cef-0.2.0/syslog2cef.egg-info → syslog2cef-0.2.1}/PKG-INFO +1 -1
  2. {syslog2cef-0.2.0 → syslog2cef-0.2.1}/pyproject.toml +1 -1
  3. {syslog2cef-0.2.0 → syslog2cef-0.2.1/syslog2cef.egg-info}/PKG-INFO +1 -1
  4. {syslog2cef-0.2.0 → syslog2cef-0.2.1}/syslog2cef.egg-info/SOURCES.txt +2 -1
  5. {syslog2cef-0.2.0 → syslog2cef-0.2.1}/syslogcef/dictionary.py +9 -5
  6. {syslog2cef-0.2.0 → syslog2cef-0.2.1}/syslogcef/mappings/__init__.py +1 -1
  7. syslog2cef-0.2.1/tests/test_zipapp_safe.py +47 -0
  8. {syslog2cef-0.2.0 → syslog2cef-0.2.1}/LICENSE +0 -0
  9. {syslog2cef-0.2.0 → syslog2cef-0.2.1}/README.md +0 -0
  10. {syslog2cef-0.2.0 → syslog2cef-0.2.1}/setup.cfg +0 -0
  11. {syslog2cef-0.2.0 → syslog2cef-0.2.1}/syslog2cef.egg-info/dependency_links.txt +0 -0
  12. {syslog2cef-0.2.0 → syslog2cef-0.2.1}/syslog2cef.egg-info/entry_points.txt +0 -0
  13. {syslog2cef-0.2.0 → syslog2cef-0.2.1}/syslog2cef.egg-info/requires.txt +0 -0
  14. {syslog2cef-0.2.0 → syslog2cef-0.2.1}/syslog2cef.egg-info/top_level.txt +0 -0
  15. {syslog2cef-0.2.0 → syslog2cef-0.2.1}/syslogcef/__init__.py +0 -0
  16. {syslog2cef-0.2.0 → syslog2cef-0.2.1}/syslogcef/__main__.py +0 -0
  17. {syslog2cef-0.2.0 → syslog2cef-0.2.1}/syslogcef/adaptive.py +0 -0
  18. {syslog2cef-0.2.0 → syslog2cef-0.2.1}/syslogcef/api.py +0 -0
  19. {syslog2cef-0.2.0 → syslog2cef-0.2.1}/syslogcef/cef.py +0 -0
  20. {syslog2cef-0.2.0 → syslog2cef-0.2.1}/syslogcef/cli.py +0 -0
  21. {syslog2cef-0.2.0 → syslog2cef-0.2.1}/syslogcef/custom.py +0 -0
  22. {syslog2cef-0.2.0 → syslog2cef-0.2.1}/syslogcef/dictionary.json +0 -0
  23. {syslog2cef-0.2.0 → syslog2cef-0.2.1}/syslogcef/mappings/cisco_asa.json +0 -0
  24. {syslog2cef-0.2.0 → syslog2cef-0.2.1}/syslogcef/mappings/cisco_ios.json +0 -0
  25. {syslog2cef-0.2.0 → syslog2cef-0.2.1}/syslogcef/mappings/f5.json +0 -0
  26. {syslog2cef-0.2.0 → syslog2cef-0.2.1}/syslogcef/mappings/fortinet.json +0 -0
  27. {syslog2cef-0.2.0 → syslog2cef-0.2.1}/syslogcef/mappings/linux.json +0 -0
  28. {syslog2cef-0.2.0 → syslog2cef-0.2.1}/syslogcef/mappings/sophos.json +0 -0
  29. {syslog2cef-0.2.0 → syslog2cef-0.2.1}/syslogcef/mappings/vmware.json +0 -0
  30. {syslog2cef-0.2.0 → syslog2cef-0.2.1}/syslogcef/net.py +0 -0
  31. {syslog2cef-0.2.0 → syslog2cef-0.2.1}/syslogcef/normalizer.py +0 -0
  32. {syslog2cef-0.2.0 → syslog2cef-0.2.1}/syslogcef/parsers.py +0 -0
  33. {syslog2cef-0.2.0 → syslog2cef-0.2.1}/syslogcef/utils.py +0 -0
  34. {syslog2cef-0.2.0 → syslog2cef-0.2.1}/syslogcef/validation.py +0 -0
  35. {syslog2cef-0.2.0 → syslog2cef-0.2.1}/tests/test_adaptive.py +0 -0
  36. {syslog2cef-0.2.0 → syslog2cef-0.2.1}/tests/test_cef.py +0 -0
  37. {syslog2cef-0.2.0 → syslog2cef-0.2.1}/tests/test_cli.py +0 -0
  38. {syslog2cef-0.2.0 → syslog2cef-0.2.1}/tests/test_custom_parsers.py +0 -0
  39. {syslog2cef-0.2.0 → syslog2cef-0.2.1}/tests/test_dictionary.py +0 -0
  40. {syslog2cef-0.2.0 → syslog2cef-0.2.1}/tests/test_fuzz_grammar.py +0 -0
  41. {syslog2cef-0.2.0 → syslog2cef-0.2.1}/tests/test_fuzz_properties.py +0 -0
  42. {syslog2cef-0.2.0 → syslog2cef-0.2.1}/tests/test_net.py +0 -0
  43. {syslog2cef-0.2.0 → syslog2cef-0.2.1}/tests/test_normalizer.py +0 -0
  44. {syslog2cef-0.2.0 → syslog2cef-0.2.1}/tests/test_parsers.py +0 -0
  45. {syslog2cef-0.2.0 → syslog2cef-0.2.1}/tests/test_parsers_extra.py +0 -0
  46. {syslog2cef-0.2.0 → syslog2cef-0.2.1}/tests/test_pipeline.py +0 -0
  47. {syslog2cef-0.2.0 → syslog2cef-0.2.1}/tests/test_real_world.py +0 -0
  48. {syslog2cef-0.2.0 → syslog2cef-0.2.1}/tests/test_utils.py +0 -0
  49. {syslog2cef-0.2.0 → syslog2cef-0.2.1}/tests/test_validation.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: syslog2cef
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: Convert RFC3164/RFC5424 syslog lines into ArcSight CEF
5
5
  Author-email: Tamir Suliman <allamiro@gmail.com>
6
6
  Project-URL: Homepage, https://github.com/allamiro/syslogcef
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "syslog2cef"
7
- version = "0.2.0"
7
+ version = "0.2.1"
8
8
  description = "Convert RFC3164/RFC5424 syslog lines into ArcSight CEF"
9
9
  authors = [{name = "Tamir Suliman", email = "allamiro@gmail.com"}]
10
10
  readme = "README.md"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: syslog2cef
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: Convert RFC3164/RFC5424 syslog lines into ArcSight CEF
5
5
  Author-email: Tamir Suliman <allamiro@gmail.com>
6
6
  Project-URL: Homepage, https://github.com/allamiro/syslogcef
@@ -65,4 +65,5 @@ tests/test_parsers_extra.py
65
65
  tests/test_pipeline.py
66
66
  tests/test_real_world.py
67
67
  tests/test_utils.py
68
- tests/test_validation.py
68
+ tests/test_validation.py
69
+ tests/test_zipapp_safe.py
@@ -21,18 +21,22 @@ from __future__ import annotations
21
21
 
22
22
  import json
23
23
  from functools import lru_cache
24
- from pathlib import Path
24
+ from importlib import resources
25
25
  from typing import Dict, FrozenSet, Tuple
26
26
 
27
- _DICTIONARY_PATH = Path(__file__).parent / "dictionary.json"
28
-
29
27
 
30
28
  @lru_cache(maxsize=1)
31
29
  def _load() -> dict:
32
- with _DICTIONARY_PATH.open(encoding="utf-8") as fp:
30
+ # importlib.resources, not a filesystem path: the package also runs
31
+ # from the standalone zipapp, where package files are inside the
32
+ # archive and Path(__file__)-style access fails (mappings/__init__.py
33
+ # uses the same mechanism for the same reason).
34
+ with resources.files("syslogcef").joinpath("dictionary.json").open(
35
+ "r", encoding="utf-8"
36
+ ) as fp:
33
37
  data = json.load(fp)
34
38
  if not isinstance(data.get("keys"), dict) or not isinstance(data.get("aliases"), dict):
35
- raise ValueError(f"{_DICTIONARY_PATH}: expected 'keys' and 'aliases' objects")
39
+ raise ValueError("dictionary.json: expected 'keys' and 'aliases' objects")
36
40
  return data
37
41
 
38
42
 
@@ -17,7 +17,7 @@ __all__ = [
17
17
 
18
18
 
19
19
  def _load(name: str) -> Mapping[str, Any]:
20
- with resources.files(__package__).joinpath(f"{name}.json").open("r", encoding="utf-8") as fp:
20
+ with resources.files("syslogcef.mappings").joinpath(f"{name}.json").open("r", encoding="utf-8") as fp:
21
21
  return json.load(fp)
22
22
 
23
23
 
@@ -0,0 +1,47 @@
1
+ """The package must work when imported from inside a zip archive.
2
+
3
+ The release workflow ships a standalone zipapp (.pyz). Any package data
4
+ read via a filesystem path (Path(__file__)...) works from a normal
5
+ install but raises NotADirectoryError inside the archive — exactly the
6
+ failure that broke the v0.2.0 zipapp build when dictionary.json was
7
+ first added. This test zips the package and converts a line through it,
8
+ so every package-data access path is exercised under zipimport.
9
+ """
10
+
11
+ from __future__ import annotations
12
+
13
+ import subprocess
14
+ import sys
15
+ import zipfile
16
+ from pathlib import Path
17
+
18
+ PACKAGE_DIR = Path(__file__).resolve().parent.parent / "syslogcef"
19
+
20
+
21
+ def test_convert_line_works_under_zipimport(tmp_path: Path):
22
+ archive = tmp_path / "app.zip"
23
+ with zipfile.ZipFile(archive, "w") as zf:
24
+ for path in sorted(PACKAGE_DIR.rglob("*")):
25
+ if path.is_file() and "__pycache__" not in path.parts:
26
+ zf.write(path, Path("syslogcef") / path.relative_to(PACKAGE_DIR))
27
+
28
+ # A fresh interpreter with ONLY the zip on sys.path: dictionary,
29
+ # mappings, and every other package-data file must load from inside
30
+ # the archive. Exercise kv aliasing + validation so both data files
31
+ # are actually read.
32
+ code = (
33
+ "import sys; sys.path.insert(0, sys.argv[1]); "
34
+ "from syslogcef import convert_line; "
35
+ "cef = convert_line('srcip=10.0.0.1 dstip=10.0.0.2 action=x', validate=True); "
36
+ "assert cef.startswith('CEF:0|'), cef; "
37
+ "print('ZIPAPP_OK')"
38
+ )
39
+ result = subprocess.run(
40
+ [sys.executable, "-c", code, str(archive)],
41
+ capture_output=True,
42
+ text=True,
43
+ timeout=60,
44
+ )
45
+
46
+ assert result.returncode == 0, f"stderr: {result.stderr[-800:]}"
47
+ assert "ZIPAPP_OK" in result.stdout
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes