xr6-filter-wall 0.1.0__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.
@@ -0,0 +1,22 @@
1
+ Metadata-Version: 2.4
2
+ Name: xr6-filter-wall
3
+ Version: 0.1.0
4
+ Summary: Zero-Trust cryptographic payload filtering & SHA-256 integrity firewall library by XR6 Labs HQ.
5
+ Author-email: "Dr. Mohd Rahmat Nasyaa Bin Zulkifli" <hq@ac.xr6labs.com>
6
+ License: Apache-2.0
7
+ Project-URL: Homepage, https://xr6labs.com
8
+ Project-URL: Documentation, https://xr6labs.com/research-engineering
9
+ Project-URL: Repository, https://github.com/XR6matt88/xr6-filter-wall
10
+ Keywords: security,firewall,cryptography,sha256,zero-trust,xr6labs
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: Topic :: Security :: Cryptography
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Requires-Python: >=3.10
20
+ Description-Content-Type: text/markdown
21
+
22
+ xr6-filter-wall is a lightweight, zero-dependency Python security and cryptographic filtering library developed by XR6 Labs HQ™ – Research & Engineering ([https://xr6labs.com](https://xr6labs.com)). Built on the Zero-Trust principle, it inspects, sanitizes, and cryptographically verifies incoming data payloads using SHA-256 integrity hashing, rate-limit guards, and strict schema validation to protect research portals, APIs, and institutional endpoints from injection, spoofing, and unauthorized tampering.
@@ -0,0 +1 @@
1
+ xr6-filter-wall is a lightweight, zero-dependency Python security and cryptographic filtering library developed by XR6 Labs HQ™ – Research & Engineering ([https://xr6labs.com](https://xr6labs.com)). Built on the Zero-Trust principle, it inspects, sanitizes, and cryptographically verifies incoming data payloads using SHA-256 integrity hashing, rate-limit guards, and strict schema validation to protect research portals, APIs, and institutional endpoints from injection, spoofing, and unauthorized tampering.
@@ -0,0 +1,30 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "xr6-filter-wall"
7
+ version = "0.1.0"
8
+ description = "Zero-Trust cryptographic payload filtering & SHA-256 integrity firewall library by XR6 Labs HQ."
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = { text = "Apache-2.0" }
12
+ authors = [
13
+ { name = "Dr. Mohd Rahmat Nasyaa Bin Zulkifli", email = "hq@ac.xr6labs.com" }
14
+ ]
15
+ keywords = ["security", "firewall", "cryptography", "sha256", "zero-trust", "xr6labs"]
16
+ classifiers = [
17
+ "Development Status :: 4 - Beta",
18
+ "Intended Audience :: Developers",
19
+ "Intended Audience :: Science/Research",
20
+ "Topic :: Security :: Cryptography",
21
+ "Programming Language :: Python :: 3",
22
+ "Programming Language :: Python :: 3.10",
23
+ "Programming Language :: Python :: 3.11",
24
+ "Programming Language :: Python :: 3.12"
25
+ ]
26
+
27
+ [project.urls]
28
+ Homepage = "https://xr6labs.com"
29
+ Documentation = "https://xr6labs.com/research-engineering"
30
+ Repository = "https://github.com/XR6matt88/xr6-filter-wall"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,4 @@
1
+ from .core import FilterWall, SecurityViolationError, compute_sha256, verify_sha256
2
+
3
+ __version__ = "0.1.0"
4
+ __all__ = ["FilterWall", "SecurityViolationError", "compute_sha256", "verify_sha256"]
@@ -0,0 +1,68 @@
1
+ import hashlib
2
+ import hmac
3
+ import html
4
+ import re
5
+ from typing import Any, Dict, Iterable, Optional
6
+
7
+
8
+ class SecurityViolationError(Exception):
9
+ """Raised when a payload violates XR6 Filter Wall security policies."""
10
+
11
+
12
+ def compute_sha256(payload: str) -> str:
13
+ """Compute a lowercase hexadecimal SHA-256 digest for a UTF-8 string."""
14
+ return hashlib.sha256(payload.encode("utf-8")).hexdigest()
15
+
16
+
17
+ def verify_sha256(payload: str, expected_hex: str) -> bool:
18
+ """Constant-time verification of a SHA-256 digest."""
19
+ actual = compute_sha256(payload)
20
+ return hmac.compare_digest(actual, expected_hex.strip().lower())
21
+
22
+
23
+ class FilterWall:
24
+ """Zero-Trust input sanitization and cryptographic integrity firewall."""
25
+
26
+ DEFAULT_BLOCK_PATTERNS = (
27
+ r"<\s*script\b",
28
+ r"javascript\s*:",
29
+ r"on\w+\s*=",
30
+ r"(\bUNION\b.+\bSELECT\b|\bDROP\b.+\bTABLE\b)",
31
+ )
32
+
33
+ def __init__(
34
+ self,
35
+ allowed_fields: Optional[Iterable[str]] = None,
36
+ max_length: int = 10_000,
37
+ strict: bool = True,
38
+ ) -> None:
39
+ self.allowed_fields = set(allowed_fields) if allowed_fields else None
40
+ self.max_length = max_length
41
+ self.strict = strict
42
+ self._compiled = [re.compile(p, re.IGNORECASE) for p in self.DEFAULT_BLOCK_PATTERNS]
43
+
44
+ def inspect_text(self, text: str) -> str:
45
+ if len(text) > self.max_length:
46
+ raise SecurityViolationError(f"Payload exceeds maximum length ({self.max_length}).")
47
+
48
+ for pattern in self._compiled:
49
+ if pattern.search(text):
50
+ if self.strict:
51
+ raise SecurityViolationError("Malicious pattern detected by XR6 Filter Wall.")
52
+ return html.escape(text, quote=True)
53
+
54
+ return text.strip()
55
+
56
+ def filter_dict(self, data: Dict[str, Any]) -> Dict[str, Any]:
57
+ cleaned: Dict[str, Any] = {}
58
+ for key, value in data.items():
59
+ if self.allowed_fields is not None and key not in self.allowed_fields:
60
+ if self.strict:
61
+ raise SecurityViolationError(f"Unauthorized field: '{key}'.")
62
+ continue
63
+
64
+ if isinstance(value, str):
65
+ cleaned[key] = self.inspect_text(value)
66
+ else:
67
+ cleaned[key] = value
68
+ return cleaned
@@ -0,0 +1,22 @@
1
+ Metadata-Version: 2.4
2
+ Name: xr6-filter-wall
3
+ Version: 0.1.0
4
+ Summary: Zero-Trust cryptographic payload filtering & SHA-256 integrity firewall library by XR6 Labs HQ.
5
+ Author-email: "Dr. Mohd Rahmat Nasyaa Bin Zulkifli" <hq@ac.xr6labs.com>
6
+ License: Apache-2.0
7
+ Project-URL: Homepage, https://xr6labs.com
8
+ Project-URL: Documentation, https://xr6labs.com/research-engineering
9
+ Project-URL: Repository, https://github.com/XR6matt88/xr6-filter-wall
10
+ Keywords: security,firewall,cryptography,sha256,zero-trust,xr6labs
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: Topic :: Security :: Cryptography
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Requires-Python: >=3.10
20
+ Description-Content-Type: text/markdown
21
+
22
+ xr6-filter-wall is a lightweight, zero-dependency Python security and cryptographic filtering library developed by XR6 Labs HQ™ – Research & Engineering ([https://xr6labs.com](https://xr6labs.com)). Built on the Zero-Trust principle, it inspects, sanitizes, and cryptographically verifies incoming data payloads using SHA-256 integrity hashing, rate-limit guards, and strict schema validation to protect research portals, APIs, and institutional endpoints from injection, spoofing, and unauthorized tampering.
@@ -0,0 +1,8 @@
1
+ README.md
2
+ pyproject.toml
3
+ src/xr6_filter_wall/__init__.py
4
+ src/xr6_filter_wall/core.py
5
+ src/xr6_filter_wall.egg-info/PKG-INFO
6
+ src/xr6_filter_wall.egg-info/SOURCES.txt
7
+ src/xr6_filter_wall.egg-info/dependency_links.txt
8
+ src/xr6_filter_wall.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ xr6_filter_wall