Commit Graph

6 Commits

Author SHA1 Message Date
Fabrizio Salmi
a8c59b99b4 chore(license): attribute third-party sources for derived WAF data
The generated data (owasp_rules.json, waf_patterns/**) is derived from
third-party projects but was implicitly covered by the blanket MIT LICENSE
with no NOTICE. Add the missing attribution — additively and reversibly:

- THIRD_PARTY_NOTICES.md (new): per-source attribution
  - OWASP CoreRuleSet          -> Apache-2.0    (owasp_rules.json + waf_patterns/**)
  - JayBizzle/Crawler-Detect   -> MIT           (bad-bot list)
  - mitchellkrogza/...bad-bot  -> MIT           (bad-bot list)
  - matomo/referrer-spam-...   -> Public Domain (referrer spam)
- LICENSES/Apache-2.0.txt (new): canonical license copy (Apache-2.0 §4a).
- README: License section now scopes MIT to the original project code; the
  generated data is redistributed under its upstream licenses. Resources now
  credit the real bad-bot sources (removed the unused ai.robots.txt mention).
- Converters (owasp2json, json2nginx, json2apache, json2traefik, json2haproxy)
  emit a provenance header on every generated file (Apache-2.0 §4b "state
  changes"); owasp_rules.json gains a top-level _provenance key. Loaders accept
  both the {_provenance, rules} object and the legacy bare-array form.
- owasp_rules.json wrapped as {_provenance, rules} (rule content unchanged).
- update_patterns.yml jq updated for the object shape.

LICENSE stays MIT (GitHub detection unaffected). Propagation of the headers to
waf_patterns/** is left to the daily update_patterns workflow.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-19 08:06:56 +02:00
fab
ed0c2e736e Update json2apache.py 2025-02-28 11:26:45 +01:00
fab
1a3c968ba2 Update json2apache.py 2025-02-28 11:17:52 +01:00
fab
f90caf30d9 Update json2apache.py
JSON bug fixed.
2025-02-22 11:41:33 +01:00
codeflash-ai[bot]
7eef3f8fa7 ️ Speed up function validate_regex by 162%
Here is an optimized version of the provided Python program. The optimizations focus on improving the I/O operations, avoiding unnecessary checks, and caching the regex pattern validation.



### Explanation of Optimizations.
1. **Caching with `@lru_cache`**: The `validate_regex` function is wrapped with `@lru_cache` to cache the results of previously validated regex patterns. This prevents repeated compilation of the same regex patterns.
2. **Reading the JSON file**: I/O operations were optimized by using the `with` statement to handle file reading and writing.
3. **Avoiding repeated checks**: The unsupported patterns are checked just once per pattern, eliminating redundant operations.
4. **Batch writing**: All rules are collected in a list and written to the output file in a single operation, reducing the overhead of multiple write operations.
2025-02-09 13:59:51 +00:00
fabriziosalmi
e8da4c3d28 nginx snippets generation fix + others minor improvements. 2025-01-16 14:02:19 +01:00