File size: 891 Bytes
910a8c4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from pathlib import Path

def test_nuclei_configuration_is_preflighted_before_queuing():
    source=Path("app/index.html").read_text()
    scan=source.split("async function scan(){",1)[1].split("async function inspectJwt()",1)[0]
    assert "scanOptions=pipelineOptions()" in scan
    assert "if(modules.includes('nuclei'))" in scan
    assert "await api('/nuclei/validate'" in scan
    assert scan.index("await api('/nuclei/validate'") < scan.index("api('/scans'")
    assert "options:scanOptions" in scan
    assert "Nuclei preflight failed before queuing" in scan


def test_preflight_blocks_overbudget_selection_without_enqueueing():
    source=Path("app/index.html").read_text()
    scan=source.split("async function scan(){",1)[1].split("async function inspectJwt()",1)[0]
    assert "if(!check.valid){" in scan
    assert "return message('Nuclei preflight blocked this scan:" in scan