跳转至

English fallback

This translation is missing; the canonical English reference follows.

Internal original-header predicate

HeaderFieldAbsent is the internal pure version-1 predicate for complete verified original header sections. It compares complete token field names case-insensitively with x-content-type-options; body text, route labels and expected detector outcomes are not inputs. Bounds and complete grammar failure raise NativeResponseHeaderError, rather than producing a negative assessment.

Calling this function directly establishes no source custody, scope, permission, Finding or persistence acknowledgement. Use the owning SDK, which binds the actual original seven-role receipt and independent current PASSIVE admission. The predicate checks field absence; it does not validate arbitrary field values or assert general MIME-sniffing exploitability.

fuzzy1337.native_response_headers

Pure original-header field absence; source custody and authority stay with the workflow.

NativeResponseHeaderError

Bases: ValueError

Original source or interpretation is unadmitted, without raw diagnostic material.

源代码位于: fuzzy1337/native_response_headers.py
24
25
class NativeResponseHeaderError(ValueError):
    """Original source or interpretation is unadmitted, without raw diagnostic material."""

HeaderFieldAbsent(raw_headers: bytes) -> bool

Inspect complete original header names without interpreting or searching a body.

Calling this pure function establishes neither original source custody nor permission. The owning workflow must first verify both original receipt replayers and authority.

参数:

名称 类型 描述 默认
raw_headers bytes

Complete verified version-one header section including final CRLFCRLF.

必需

返回:

类型 描述
bool

Whether the complete x-content-type-options field name is absent.

引发:

类型 描述
NativeResponseHeaderError

Complete bounded header grammar cannot be established.

源代码位于: fuzzy1337/native_response_headers.py
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
def HeaderFieldAbsent(raw_headers: bytes) -> bool:
    """Inspect complete original header names without interpreting or searching a body.

    Calling this pure function establishes neither original source custody nor permission.
    The owning workflow must first verify both original receipt replayers and authority.

    Args:
        raw_headers: Complete verified version-one header section including final CRLFCRLF.

    Returns:
        Whether the complete x-content-type-options field name is absent.

    Raises:
        NativeResponseHeaderError: Complete bounded header grammar cannot be established.
    """

    if type(raw_headers) is not bytes or not 1 <= len(raw_headers) <= MAX_HEADER_BYTES or (
        raw_headers.find(b"\r\n\r\n") != len(raw_headers) - 4
    ):
        raise NativeResponseHeaderError("original response header section is unadmitted")

    lines = raw_headers[:-4].split(b"\r\n")

    if not 2 <= len(lines) <= MAX_HEADER_FIELDS + 1 or (
        lines[0] != b"HTTP/1.1 200 OK"
        or any(len(line) + 2 > MAX_HEADER_LINE_BYTES for line in lines)
    ):
        raise NativeResponseHeaderError("original response header section is unadmitted")

    names: set[bytes] = set()

    for line in lines[1:]:
        name, separator, value = line.partition(b":")

        if not separator or _FIELD_NAME.fullmatch(name) is None or name.lower() in names or any(
            byte != 9 and not 32 <= byte <= 126 for byte in value
        ):
            raise NativeResponseHeaderError("original response header section is unadmitted")

        names.add(name.lower())

    return b"x-content-type-options" not in names