File size: 748 Bytes
ac27b1b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | from pathlib import Path
from app import nuclei_catalog
def test_nuclei_catalog_uses_commit_reference_not_tree_sha():
source = Path("app/nuclei_catalog.py").read_text()
assert '/git/ref/heads/main' in source
assert 'sha=commit_sha' in source
def test_nuclei_catalog_rejects_unsafe_protocols_and_posts():
valid = """id: safe-http-check
info:
name: Safe check
severity: info
http:
- method: GET
path:
- "{{BaseURL}}/robots.txt"
matchers:
- type: status
status: [200]
"""
assert nuclei_catalog.validate_template(valid)=="safe-http-check"
bad = valid.replace("method: GET", "method: POST")
import pytest
with pytest.raises(ValueError):
nuclei_catalog.validate_template(bad)
|