การแก้ปัญหาเกี่ยวกับรันไทม์ของการป้องกันภัยคุกคามของ JSON

คุณกำลังดูเอกสารประกอบของ Apigee Edge
ไปที่เอกสารประกอบของ Apigee X
info

ExecutionFailed

รหัสข้อผิดพลาด

steps.jsonthreatprotection.ExecutionFailed

เนื้อหาการตอบกลับข้อผิดพลาด

{
    "fault": {
        "faultstring": "JSONThreatProtection[policy_name]:
          Execution failed. reason: JSONThreatProtection[policy_name]: error_description
          at line line_num",
        "detail": {
            "errorcode": "steps.jsonthreatprotection.ExecutionFailed"
        }
    }
}

ประเภทของข้อผิดพลาดและสาเหตุที่เป็นไปได้

นโยบาย JSONThreatProtection สามารถแสดงข้อผิดพลาด ExecutionFailed ได้หลายประเภท ตารางด้านล่างแสดงข้อผิดพลาดประเภทต่างๆ และสาเหตุที่เป็นไปได้

ประเภทข้อผิดพลาด สาเหตุ
ชื่อรายการออบเจ็กต์ยาวเกินไป ความยาวของสตริงสูงสุดที่อนุญาตในชื่อรายการของออบเจ็กต์เกิน
จำนวนรายการออบเจ็กต์เกิน จำนวนรายการสูงสุดที่อนุญาตในออบเจ็กต์เกิน
จำนวนองค์ประกอบอาร์เรย์เกิน จำนวนสูงสุดขององค์ประกอบที่อนุญาตในอาร์เรย์เกินขีดจำกัดแล้ว
ความลึกของคอนเทนเนอร์เกิน ความลึกของการซ้อนเกินขีดจำกัดสูงสุดที่อนุญาต
ความยาวค่าสตริงเกิน ความยาวสูงสุดที่อนุญาตสำหรับค่าสตริงเกิน
ออบเจ็กต์ JSON ไม่ถูกต้อง เพย์โหลด JSON ที่ป้อนไม่ถูกต้อง

ชื่อรายการออบเจ็กต์ยาวเกินไป

เนื้อหาการตอบกลับข้อผิดพลาด

{
    "fault": {
        "faultstring": "JSONThreatProtection[policy_name]:
          Execution failed. reason: JSONThreatProtection[policy_name]:
          Exceeded object entry name length at line line_num",
        "detail": {
            "errorcode": "steps.jsonthreatprotection.ExecutionFailed"
        }
    }
}

ตัวอย่างเนื้อหาการตอบกลับข้อผิดพลาด

{
    "fault": {
        "faultstring": "JSONThreatProtection[JSON-Threat-Protection-1]:
          Execution failed. reason: JSONThreatProtection[JSON-Threat-Protection-1]:
          Exceeded object entry name length at line 2",
        "detail": {
            "errorcode": "steps.jsonthreatprotection.ExecutionFailed"
        }
    }
}

สาเหตุ

ข้อผิดพลาดนี้เกิดขึ้นหากเพย์โหลดของข้อความอินพุตที่ระบุโดยองค์ประกอบ <Source> มีออบเจ็กต์ JSON ที่มีชื่อพร็อพเพอร์ตี้ซึ่งยาวเกินความยาวสูงสุดที่ระบุไว้ในองค์ประกอบ <ObjectEntryNameLength>

เช่น หากระบุองค์ประกอบ <ObjectEntryNameLength> เป็น 5 ในนโยบาย แต่เพย์โหลดข้อความอินพุตมีพร็อพเพอร์ตี้ JSON ที่มีชื่อยาวเกิน 5 อักขระ ระบบจะแสดงข้อผิดพลาดนี้

การวินิจฉัย

  1. ตรวจสอบข้อความแสดงข้อผิดพลาดเพื่อระบุชื่อนโยบาย JSONThreatProtection และหมายเลขบรรทัดที่ชื่อรายการยาวเกิดขึ้น ตัวอย่างเช่น ในข้อความแสดงข้อผิดพลาดต่อไปนี้ ชื่อนโยบาย JSONThreatProtection คือ JSON-Threat-Protection-1 และหมายเลขบรรทัดในเพย์โหลดคือ 2

    JSONThreatProtection[JSON-Threat-Protection-1]: Execution failed. reason:
    JSONThreatProtection[JSON-Threat-Protection-1]: Exceeded object entry name
    length at line 2
    
  2. ตรวจสอบนโยบายที่คุณระบุในขั้นตอนที่ 1 และจดค่าที่ระบุในองค์ประกอบ <ObjectEntryNameLength>

    ตัวอย่างเช่น ในนโยบาย JSONThreatProtection ต่อไปนี้ <ObjectEntryNameLength> จะตั้งค่าเป็น 5

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <JSONThreatProtection async="false" continueOnError="false" enabled="true" name="JSON-Threat-Protection-1">
        <DisplayName>JSON Threat Protection-1</DisplayName>
        <Properties/>
        <ArrayElementCount>3</ArrayElementCount>
        <ContainerDepth>12</ContainerDepth>
        <ObjectEntryCount>5</ObjectEntryCount>
        <ObjectEntryNameLength>5</ObjectEntryNameLength>
        <Source>request</Source>
        <StringValueLength>50</StringValueLength>
    </JSONThreatProtection>
    
  3. ตรวจสอบหมายเลขบรรทัดที่เฉพาะเจาะจง (ระบุในขั้นตอนที่ 1) ของเพย์โหลดอินพุต และดูว่าความยาวของชื่อออบเจ็กต์มากกว่าค่าที่ระบุในองค์ประกอบ <ObjectEntryNameLength> (ระบุในขั้นตอนที่ 2) หรือไม่ หากความยาวของชื่อออบเจ็กต์เกินจำนวนดังกล่าว นั่นคือสาเหตุของข้อผิดพลาด

    ตัวอย่างเพย์โหลดอินพุตมีดังนี้

    {
       "number" : 500,
       "string" : "text"
    }
    

    เพย์โหลด JSON ที่แสดงด้านบนมีพร็อพเพอร์ตี้ชื่อ number ในบรรทัดที่ 2 ซึ่งมีอักขระ 6 ตัว (ความยาวของชื่อคือ 6) เนื่องจากความยาวของชื่อออบเจ็กต์มากกว่า 5 (ค่าที่ระบุสำหรับองค์ประกอบ <ObjectEntryNameLength>) คุณจึงได้รับข้อผิดพลาดต่อไปนี้

    JSONThreatProtection[JSON-Threat-Protection-1]: Execution failed. reason:
    JSONThreatProtection[JSON-Threat-Protection-1]: Exceeded object entry name
    length at line 2
    

ความละเอียด

หากนโยบาย JSONThreatProtection มีไว้เพื่อป้องกันเพย์โหลดที่มีชื่อรายการออบเจ็กต์ที่เกินค่าที่กำหนด ข้อความแสดงข้อผิดพลาดจะปรากฏขึ้น ในกรณีนี้ คุณไม่จำเป็นต้องดำเนินการใดๆ เพิ่มเติม

อย่างไรก็ตาม หากคุณพิจารณาแล้วว่าสามารถระบุชื่อรายการออบเจ็กต์ที่ยาวขึ้นในเพย์โหลดได้โดยไม่มีผลกระทบใดๆ ให้แก้ไข <ObjectEntryNameLength> เป็นค่าที่เหมาะสมตามข้อกำหนดของคุณ

ตัวอย่างเช่น หากคุณคิดว่าอนุญาตให้ชื่อออบเจ็กต์มีความยาวได้ไม่เกิน 10 อักขระ ให้แก้ไขนโยบาย JSONThreatProtection ดังนี้

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<JSONThreatProtection async="false" continueOnError="false" enabled="true" name="JSON-Threat-Protection-1">
    <DisplayName>JSON Threat Protection-1</DisplayName>
    <Properties/>
    <ArrayElementCount>3</ArrayElementCount>
    <ContainerDepth>12</ContainerDepth>
    <ObjectEntryCount>5</ObjectEntryCount>
    <ObjectEntryNameLength>10</ObjectEntryNameLength>
    <Source>request</Source>
    <StringValueLength>50</StringValueLength>
</JSONThreatProtection>

จำนวนรายการออบเจ็กต์เกิน

เนื้อหาการตอบกลับข้อผิดพลาด

{
    "fault": {
        "faultstring": "JSONThreatProtection[policy_name]:
          Execution failed. reason: JSONThreatProtection[policy_name]:
          Exceeded object entry count at line line_num",
        "detail": {
            "errorcode": "steps.jsonthreatprotection.ExecutionFailed"
        }
    }
}

ตัวอย่างเนื้อหาการตอบกลับข้อผิดพลาด

{
    "fault": {
        "faultstring": "JSONThreatProtection[JSON-Threat-Protection-1]:
          Execution failed. reason: JSONThreatProtection[JSON-Threat-Protection-1]:
          Exceeded object entry count at line 7",
        "detail": {
            "errorcode": "steps.jsonthreatprotection.ExecutionFailed"
        }
    }
}

สาเหตุ

ข้อผิดพลาดนี้เกิดขึ้นหากเพย์โหลดของข้อความอินพุตที่ระบุโดยองค์ประกอบ <Source> มีออบเจ็กต์ JSON ที่มีรายการ (พร็อพเพอร์ตี้) มากกว่าค่าที่ระบุในองค์ประกอบ <ObjectEntryCount> ของนโยบาย

เช่น หากองค์ประกอบ <ObjectEntryCount> มีค่าเป็น 5 แต่เพย์โหลด JSON อินพุตมีรายการมากกว่า 5 รายการ ระบบจะแสดงข้อผิดพลาดนี้

การวินิจฉัย

  1. ตรวจสอบข้อความแสดงข้อผิดพลาดเพื่อระบุชื่อนโยบาย JSONThreatProtection และหมายเลขบรรทัดที่มีการเกินจำนวนรายการ ตัวอย่างเช่น ในข้อความแสดงข้อผิดพลาดต่อไปนี้ ชื่อนโยบายคือ JSON-Threat-Protection-1 และหมายเลขบรรทัดในเพย์โหลดคือ 7

    JSONThreatProtection[JSON-Threat-Protection-1]: Execution failed. reason:
    JSONThreatProtection[JSON-Threat-Protection-1]: Exceeded object entry count
    at line 7
    
  2. จดค่าที่ระบุในองค์ประกอบ <ObjectEntryCount> ของนโยบาย (ระบุในขั้นตอนที่ 1)

    ในตัวอย่างนโยบายต่อไปนี้ <ObjectEntryCount> จะตั้งค่าเป็น 5

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <JSONThreatProtection async="false" continueOnError="false" enabled="true" name="JSON-Threat-Protection-1">
        <DisplayName>JSON Threat Protection-1</DisplayName>
        <Properties/>
        <ArrayElementCount>3</ArrayElementCount>
        <ContainerDepth>12</ContainerDepth>
        <ObjectEntryCount>5</ObjectEntryCount>
        <ObjectEntryNameLength>6</ObjectEntryNameLength>
        <Source>request</Source>
        <StringValueLength>50</StringValueLength>
    </JSONThreatProtection>
    
  3. ตรวจสอบหมายเลขบรรทัดที่เฉพาะเจาะจง (ระบุในขั้นตอนที่ 1) ของเพย์โหลดอินพุต และตรวจสอบว่าจำนวนเอนทิตีในเพย์โหลดมากกว่าค่าที่ระบุสำหรับองค์ประกอบ <ObjectEntryCount> (ระบุในขั้นตอนที่ 2) หรือไม่ หากจำนวนออบเจ็กต์เกินจำนวนรายการออบเจ็กต์ แสดงว่านั่นคือสาเหตุของข้อผิดพลาด

    ตัวอย่างเพย์โหลดอินพุตมีดังนี้

    {
    "name" : "John",
    "id" : 234687,
    "age" : 31,
    "city" : "New York",
    "country" : "USA",
    "company" : "Google"
    }
    

    ในเพย์โหลด JSON ที่แสดงด้านบน รายการที่ 6 จะอยู่ที่บรรทัด #7 (company) เนื่องจากจำนวนรายการออบเจ็กต์ในเพย์โหลด JSON ของอินพุตมากกว่า 5 (ค่าที่ระบุสำหรับองค์ประกอบ <ObjectEntryCount>) คุณจึงได้รับข้อผิดพลาดต่อไปนี้

    JSONThreatProtection[JSON-Threat-Protection-1]: Execution failed. reason:
    JSONThreatProtection[JSON-Threat-Protection-1]: Exceeded object entry count at
    line 7
    

ความละเอียด

หากนโยบาย JSONThreatProtection มีไว้เพื่อป้องกันเพย์โหลดที่มีรายการออบเจ็กต์จำนวนมากเกินกว่าเกณฑ์ที่เฉพาะเจาะจง ข้อความแสดงข้อผิดพลาดจะปรากฏขึ้น ในกรณีนี้ คุณไม่จำเป็นต้องดำเนินการใดๆ เพิ่มเติม

อย่างไรก็ตาม หากคุณพิจารณาแล้วว่าสามารถรวมรายการออบเจ็กต์เพิ่มเติมไว้ในเพย์โหลดได้โดยไม่มีผลกระทบใดๆ ให้แก้ไข <ObjectEntryCount> เป็นค่าที่เหมาะสมตามข้อกำหนดของคุณ

ตัวอย่างเช่น หากคุณคิดว่าอนุญาตรายการออบเจ็กต์ได้สูงสุด 10 รายการ ให้แก้ไขนโยบาย JSONThreatProtection ดังนี้

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<JSONThreatProtection async="false" continueOnError="false" enabled="true" name="JSON-Threat-Protection-1">
    <DisplayName>JSON Threat Protection-1</DisplayName>
    <Properties/>
    <ArrayElementCount>3</ArrayElementCount>
    <ContainerDepth>12</ContainerDepth>
    <ObjectEntryCount>10</ObjectEntryCount>
    <ObjectEntryNameLength>6</ObjectEntryNameLength>
    <Source>request</Source>
    <StringValueLength>50</StringValueLength>
</JSONThreatProtection>

จำนวนองค์ประกอบอาร์เรย์เกิน

เนื้อหาการตอบกลับข้อผิดพลาด

{
    "fault": {
        "faultstring": "JSONThreatProtection[policy_name]:
          Execution failed. reason: JSONThreatProtection[policy_name]:
          Exceeded array element count at line line-num",
        "detail": {
            "errorcode": "steps.jsonthreatprotection.ExecutionFailed"
        }
    }
}

ตัวอย่างเนื้อหาการตอบกลับข้อผิดพลาด

{
    "fault": {
        "faultstring": "JSONThreatProtection[JSON-Threat-Protection-1]:
          Execution failed. reason: JSONThreatProtection[JSON-Threat-Protection-1]:
          Exceeded array element count at line 3",
        "detail": {
            "errorcode": "steps.jsonthreatprotection.ExecutionFailed"
        }
    }
}

สาเหตุ

ข้อผิดพลาดนี้เกิดขึ้นหากเพย์โหลดข้อความอินพุตที่ระบุโดยองค์ประกอบ <Source> มีอาร์เรย์ JSON ที่มีจำนวนองค์ประกอบมากกว่าจำนวนที่ระบุในองค์ประกอบ <ArrayElementCount> ของนโยบาย

เช่น หากระบุองค์ประกอบ <ArrayElementCount> เป็น 3 แต่เพย์โหลดอินพุตมีอาร์เรย์ JSON ที่มีองค์ประกอบมากกว่า 3 รายการ ระบบจะแสดงข้อผิดพลาดนี้

การวินิจฉัย

  1. ตรวจสอบข้อความแสดงข้อผิดพลาดเพื่อระบุชื่อนโยบายและหมายเลขบรรทัดที่ความยาวของอาร์เรย์เกิน ตัวอย่างเช่น ในข้อความแสดงข้อผิดพลาดต่อไปนี้ ชื่อนโยบายคือ JSON-Threat-Protection-1 และหมายเลขบรรทัดในเพย์โหลดคือ 3

    JSONThreatProtection[JSON-Threat-Protection-1]: Execution failed. reason:
    JSONThreatProtection[JSON-Threat-Protection-1]: Exceeded array element count at line 3
    
  2. จดค่าที่ระบุสำหรับองค์ประกอบ <ArrayElementCount> ของนโยบาย (ระบุในขั้นตอนที่ 1)

    ในตัวอย่างนโยบาย JSONThreatProtection ต่อไปนี้ <ArrayElementCount> จะตั้งค่าเป็น 3

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <JSONThreatProtection async="false" continueOnError="false" enabled="true" name="JSON-Threat-Protection-1">
        <DisplayName>JSON Threat Protection-1</DisplayName>
        <Properties/>
        <ArrayElementCount>3</ArrayElementCount>
        <ContainerDepth>12</ContainerDepth>
        <ObjectEntryCount>5</ObjectEntryCount>
        <ObjectEntryNameLength>6</ObjectEntryNameLength>
        <Source>request</Source>
        <StringValueLength>50</StringValueLength>
    </JSONThreatProtection>
    
  3. ตรวจสอบหมายเลขบรรทัดที่เฉพาะเจาะจง (ระบุในขั้นตอนที่ 1) ของเพย์โหลดอินพุต และดูว่าอาร์เรย์ที่ระบุไว้มีจำนวนมากกว่าตัวเลขที่ระบุในองค์ประกอบ <ArrayElementCount> (ระบุในขั้นตอนที่ 2) หรือไม่ หากจำนวนองค์ประกอบอาร์เรย์เกินจำนวนนับ นั่นคือสาเหตุของข้อผิดพลาด

    ตัวอย่างเพย์โหลดอินพุตมีดังนี้

    {
     "name":"Ford",
     "models":[
        "Mustang",
        "Endeavour",
        "Fiesta",
        "EcoSport",
        "Focus"
     ]
    }
    

    เพย์โหลด JSON ที่แสดงด้านบนมีองค์ประกอบ 5 รายการในอาร์เรย์ชื่อ models ที่บรรทัด 3 เนื่องจากจำนวนองค์ประกอบอาร์เรย์มากกว่า 3 (ค่าที่ระบุสำหรับองค์ประกอบ <ArrayElementCount>) คุณจึงได้รับข้อผิดพลาดต่อไปนี้

    JSONThreatProtection[JSON-Threat-Protection-1]: Execution failed. reason:
    JSONThreatProtection[JSON-Threat-Protection-1]: Exceeded array element count
    at line 3
    

ความละเอียด

หากนโยบาย JSONThreatProtection มีไว้เพื่อป้องกันเพย์โหลดที่มีเกณฑ์จำนวนอาร์เรย์ที่เฉพาะเจาะจง คุณจะเห็นข้อความแสดงข้อผิดพลาด ในกรณีนี้ คุณไม่จำเป็นต้องดำเนินการใดๆ เพิ่มเติม

อย่างไรก็ตาม หากพิจารณาแล้วว่าอนุญาตให้มีองค์ประกอบในอาร์เรย์ได้มากขึ้น ให้แก้ไข <ArrayElementCount> เป็นค่าที่เหมาะสมตามข้อกำหนดของคุณ

เช่น หากคุณคิดว่าอนุญาตองค์ประกอบอาร์เรย์ได้สูงสุด 5 รายการ ให้แก้ไขนโยบายดังนี้

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<JSONThreatProtection async="false" continueOnError="false" enabled="true" name="JSON-Threat-Protection-1">
    <DisplayName>JSON Threat Protection-1</DisplayName>
    <Properties/>
    <ArrayElementCount>5</ArrayElementCount>
    <ContainerDepth>12</ContainerDepth>
    <ObjectEntryCount>5</ObjectEntryCount>
    <ObjectEntryNameLength>6</ObjectEntryNameLength>
    <Source>request</Source>
    <StringValueLength>50</StringValueLength>
</JSONThreatProtection>

ความลึกของคอนเทนเนอร์เกิน

เนื้อหาการตอบกลับข้อผิดพลาด

การเข้าชมรันไทม์จะแสดงโค้ดตอบกลับ 500 พร้อมข้อผิดพลาดต่อไปนี้

{
    "fault": {
        "faultstring": "JSONThreatProtection[policy_name]:
          Execution failed. reason: JSONThreatProtection[policy_name]:
          Exceeded container depth at line line-num",
        "detail": {
            "errorcode": "steps.jsonthreatprotection.ExecutionFailed"
        }
    }
}

ตัวอย่างเนื้อหาการตอบกลับข้อผิดพลาด

{
    "fault": {
        "faultstring": "JSONThreatProtection[JSON-Threat-Protection-1]:
          Execution failed. reason: JSONThreatProtection[JSON-Threat-Protection-1]:
          Exceeded container depth at line 5",
        "detail": {
            "errorcode": "steps.jsonthreatprotection.ExecutionFailed"
        }
    }
}

สาเหตุ

ข้อผิดพลาดนี้จะเกิดขึ้นหากเพย์โหลดของข้อความอินพุตที่ระบุโดยองค์ประกอบ <Source> มีออบเจ็กต์ JSON ที่มีองค์ประกอบ JSON ที่มีความลึกของคอนเทนเนอร์เกินความลึกของคอนเทนเนอร์สูงสุดที่ระบุไว้ในองค์ประกอบ <ContainerDepth> ของนโยบาย ความลึกของคอนเทนเนอร์คือความลึกที่ซ้อนกันสูงสุดที่อนุญาตสำหรับองค์ประกอบ JSON เช่น อาร์เรย์ที่มีออบเจ็กต์ซึ่งมีออบเจ็กต์จะทำให้ระดับการบรรจุเป็น 3

เช่น หากองค์ประกอบ <ContainerDepth> คือ 3 แต่เพย์โหลดอินพุตมีความลึกของคอนเทนเนอร์เกินขีดจำกัดนี้ ระบบจะแสดงข้อผิดพลาดนี้

การวินิจฉัย

  1. ตรวจสอบข้อความแสดงข้อผิดพลาดเพื่อระบุชื่อนโยบาย JSONThreatProtection และหมายเลขบรรทัดที่เกินความลึกของคอนเทนเนอร์ เช่น ในข้อความแสดงข้อผิดพลาดต่อไปนี้ ชื่อนโยบายคือ JSON-Threat-Protection-1 และหมายเลขบรรทัดในเพย์โหลดคือ 5

    JSONThreatProtection[JSON-Threat-Protection-1]: Execution failed. reason:
    JSONThreatProtection[JSON-Threat-Protection-1]: Exceeded container depth at
    line 5
    
  2. จดค่าที่ระบุสำหรับองค์ประกอบ <ContainerDepth> (ระบุในขั้นตอนที่ 1)

    ในตัวอย่างนโยบาย JSONThreatProtection ต่อไปนี้ <ContainerDepth> จะตั้งค่าเป็น 5

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <JSONThreatProtection async="false" continueOnError="false" enabled="true" name="JSON-Threat-Protection-1">
        <DisplayName>JSON Threat Protection-1</DisplayName>
        <Properties/>
        <ArrayElementCount>3</ArrayElementCount>
        <ContainerDepth>5</ContainerDepth>
        <ObjectEntryCount>5</ObjectEntryCount>
        <ObjectEntryNameLength>20</ObjectEntryNameLength>
        <Source>request</Source>
        <StringValueLength>50</StringValueLength>
    </JSONThreatProtection>
    
  3. ตรวจสอบหมายเลขบรรทัดที่เฉพาะเจาะจง (ระบุในขั้นตอนที่ 1) ของเพย์โหลดอินพุต และดูว่าระดับคอนเทนเนอร์ในเพย์โหลดสูงกว่าค่าที่ระบุในองค์ประกอบ <ContainerDepth> (ระบุในขั้นตอนที่ 2) หรือไม่ หากความลึกของคอนเทนเนอร์เกินจำนวนนับ แสดงว่านั่นคือสาเหตุของข้อผิดพลาด

    ตัวอย่างเพย์โหลดอินพุตมีดังนี้

    {
     "ContainerDepth2":[ {
           "ContainerDepth4":[
              {
                 "ContainerDepth6":[
                    "1",
                    "2"
                 ]
              }
           ]
        }
     ]
    }
    

    เพย์โหลด JSON ที่แสดงด้านบนมีความลึกของคอนเทนเนอร์เป็น 6 ที่บรรทัดที่ 5 เนื่องจาก depth มากกว่า 5 ค่าที่ระบุสำหรับองค์ประกอบ <ContainerDepth> ของนโยบาย JSONThreatProtection คุณจะได้รับข้อผิดพลาดต่อไปนี้

    JSONThreatProtection[JSON-Threat-Protection-1]: Execution failed. reason:
    JSONThreatProtection[JSON-Threat-Protection-1]: Exceeded container depth at
    line 5
    

ความละเอียด

หากนโยบาย JSONThreatProtection มีไว้เพื่อป้องกันเพย์โหลดที่มีระดับคอนเทนเนอร์เกินค่าที่ระบุ ข้อความแสดงข้อผิดพลาดจะปรากฏขึ้นตามที่คาดไว้ ในกรณีนี้ คุณไม่จำเป็นต้องดำเนินการใดๆ เพิ่มเติม

อย่างไรก็ตาม หากพิจารณาแล้วว่ายอมรับความลึกของคอนเทนเนอร์ที่สูงขึ้นได้ ให้แก้ไข <ContainerDepth> เป็นค่าที่เหมาะสมตามข้อกำหนด

เช่น หากคุณคิดว่าอนุญาตความลึกของคอนเทนเนอร์ได้สูงสุด 10 รายการ ให้แก้ไขนโยบายดังนี้

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<JSONThreatProtection async="false" continueOnError="false" enabled="true" name="JSON-Threat-Protection-1">
    <DisplayName>JSON Threat Protection-1</DisplayName>
    <Properties/>
    <ArrayElementCount>3</ArrayElementCount>
    <ContainerDepth>10</ContainerDepth>
    <ObjectEntryCount>5</ObjectEntryCount>
    <ObjectEntryNameLength>20</ObjectEntryNameLength>
    <Source>request</Source>
    <StringValueLength>50</StringValueLength>
</JSONThreatProtection>

ความยาวค่าสตริงเกิน

เนื้อหาการตอบกลับข้อผิดพลาด

{
    "fault": {
        "faultstring": "JSONThreatProtection[policy_name]:
          Execution failed. reason: JSONThreatProtection[policy_name]:
          Exceeded string value length at line line-num",
        "detail": {
            "errorcode": "steps.jsonthreatprotection.ExecutionFailed"
        }
    }
}

ตัวอย่างเนื้อหาการตอบกลับข้อผิดพลาด

{
    "fault": {
        "faultstring": "JSONThreatProtection[JSON-Threat-Protection-1]:
          Execution failed. reason: JSONThreatProtection[JSON-Threat-Protection-1]:
          Exceeded string value length at line 3",
        "detail": {
            "errorcode": "steps.jsonthreatprotection.ExecutionFailed"
        }
    }
}

สาเหตุ

ข้อผิดพลาดนี้เกิดขึ้นหากเพย์โหลดของข้อความนำเข้าที่ระบุโดยองค์ประกอบ <Source> มีองค์ประกอบ JSON ที่มีค่าซึ่งมีอักขระมากกว่าที่องค์ประกอบ <StringValueLength> อนุญาต

ตัวอย่างเช่น หากตั้งค่าองค์ประกอบ <StringValueLength> เป็น 50 ในนโยบาย แต่เพย์โหลดอินพุตมีองค์ประกอบอย่างน้อย 1 รายการที่มีค่าซึ่งมีอักขระมากกว่า 50 ตัว ระบบจะแสดงข้อผิดพลาดนี้

การวินิจฉัย

  1. ตรวจสอบข้อความแสดงข้อผิดพลาดเพื่อระบุชื่อนโยบายและหมายเลขบรรทัดที่สตริงยาวเกินไป ในตัวอย่างต่อไปนี้ ชื่อนโยบายคือ JSON-Threat-Protection-1 andline in the payload 3

    JSONThreatProtection[JSON-Threat-Protection-1]: Execution failed. reason:
    JSONThreatProtection[JSON-Threat-Protection-1]: Exceeded string value length at line 3
    
  2. จดค่าที่ระบุสำหรับองค์ประกอบ <StringValueLength> ใน (ระบุในขั้นตอนที่ 1)

    ในตัวอย่างนโยบาย JSONThreatProtection ต่อไปนี้ <StringValueLength> จะตั้งค่าเป็น 50

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <JSONThreatProtection async="false" continueOnError="false" enabled="true" name="JSON-Threat-Protection-1">
        <DisplayName>JSON Threat Protection-1</DisplayName>
        <Properties/>
        <ArrayElementCount>3</ArrayElementCount>
        <ContainerDepth>5</ContainerDepth>
        <ObjectEntryCount>5</ObjectEntryCount>
        <ObjectEntryNameLength>20</ObjectEntryNameLength>
        <Source>request</Source>
        <StringValueLength>50</StringValueLength>
    </JSONThreatProtection>
    
  3. ตรวจสอบหมายเลขบรรทัดที่เฉพาะเจาะจง (ระบุในขั้นตอนที่ 1) ของเพย์โหลดอินพุต และดูว่าความยาวของค่ามากกว่าจำนวนอักขระที่ระบุสำหรับองค์ประกอบ <StringValueLength> (ระบุในขั้นตอนที่ 2) หรือไม่ หากความยาวของค่าเกินขีดจำกัด นั่นคือสาเหตุของข้อผิดพลาด

    ตัวอย่างเพย์โหลดอินพุตมีดังนี้

    {
      "Country": "New Zealand",
      "Place Name": "Taumatawhakatangihangakoauauotamateaturipukakapikimaungahoronukupokaiwhenuakitanatahu"
    }
    

    เพย์โหลด JSON ที่แสดงด้านบนมีออบเจ็กต์ชื่อ Place Name ซึ่งมีค่า Taumatawhakatangihangakoauauotamateaturipukakapikimaungahoronukupokaiwhenuakitanatahu มีอักขระ 85 ตัวในบรรทัดที่ 3 เนื่องจากค่ามีความยาวมากกว่า 50 ค่าที่ระบุในองค์ประกอบ <StringValueLength> คุณจึงได้รับข้อผิดพลาดต่อไปนี้

    JSONThreatProtection[JSON-Threat-Protection-1]: Execution failed. reason:
    JSONThreatProtection[JSON-Threat-Protection-1]: Exceeded string value length
    at line 3
    

ความละเอียด

หากนโยบาย JSONThreatProtection มีไว้เพื่อป้องกันเพย์โหลดที่มีค่าเกินความยาวสตริงที่เฉพาะเจาะจง ข้อความแสดงข้อผิดพลาดจะปรากฏขึ้น ในกรณีนี้ คุณไม่จำเป็นต้องดำเนินการใดๆ เพิ่มเติม

อย่างไรก็ตาม หากพิจารณาแล้วว่าสามารถระบุความยาวค่าที่ยาวขึ้นในเพย์โหลดได้ ให้แก้ไข <StringValueLength> เป็นค่าที่เหมาะสมตามข้อกำหนด

ตัวอย่างเช่น หากคุณคิดว่าสามารถอนุญาตค่าที่มีความยาวได้สูงสุด 90 ให้แก้ไขนโยบายดังนี้

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<JSONThreatProtection async="false" continueOnError="false" enabled="true" name="JSON-Threat-Protection-1">
    <DisplayName>JSON Threat Protection-1</DisplayName>
    <Properties/>
    <ArrayElementCount>3</ArrayElementCount>
    <ContainerDepth>5</ContainerDepth>
    <ObjectEntryCount>5</ObjectEntryCount>
    <ObjectEntryNameLength>20</ObjectEntryNameLength>
    <Source>request</Source>
    <StringValueLength>90</StringValueLength>
</JSONThreatProtection>

ไม่ใช่ JSON ออบเจ็กต์ที่ถูกต้อง

เนื้อหาการตอบกลับข้อผิดพลาด

{
    "fault": {
        "faultstring": "JSONThreatProtection[policy_name]:
          Execution failed. reason: string: at line line-num",
        "detail": {
            "errorcode": "steps.jsonthreatprotection.ExecutionFailed"
        }
    }
}

ตัวอย่างเนื้อหาการตอบกลับข้อผิดพลาด

{
    "fault": {
        "faultstring": "JSONThreatProtection[JSON-Threat-Protection-1]:
          Execution failed. reason: Expecting : at line 3",
        "detail": {
            "errorcode": "steps.jsonthreatprotection.ExecutionFailed"
        }
    }
}

สาเหตุ

ข้อผิดพลาดนี้จะเกิดขึ้นหากเพย์โหลดของข้อความอินพุตที่ระบุโดยองค์ประกอบ <Source> ในนโยบาย JSONThreatProtection ไม่ใช่ออบเจ็กต์ JSON ที่ถูกต้อง

การวินิจฉัย

  1. ตรวจสอบข้อความแสดงข้อผิดพลาดเพื่อระบุชื่อนโยบายและหมายเลขบรรทัดที่เกิดข้อผิดพลาด ในตัวอย่างต่อไปนี้ ชื่อนโยบายคือ JSON-Threat-Protection-1 andline in the payload 2

    JSONThreatProtection[JSON-Threat-Protection-1]: Execution failed. reason: Expecting : at line 3
    
  2. ตรวจสอบหมายเลขบรรทัดที่เฉพาะเจาะจง (ระบุในขั้นตอนที่ 1) ของเพย์โหลดอินพุต และดูว่าออบเจ็กต์ JSON ที่ส่งในเพย์โหลดเป็นออบเจ็กต์ JSON ที่ถูกต้องจริงหรือไม่

    ตัวอย่างเพย์โหลดอินพุตมีดังนี้

    {
      "Longitude": 6.11499,
      "Latitude"  50.76891
    }
    

    ในเพย์โหลด JSON ที่แสดงด้านบน บรรทัดที่ 3 ไม่มี ":" (โคลอน) เนื่องจากไม่ใช่ออบเจ็กต์ JSON ที่ถูกต้อง คุณจึงได้รับข้อผิดพลาดต่อไปนี้

    JSONThreatProtection[JSON-Threat-Protection-1]: Execution failed. reason:
    Expecting : at line 3
    

ความละเอียด

ตรวจสอบว่าได้ส่งเพย์โหลด JSON อินพุตที่ถูกต้องไปยังพร็อกซี API ที่มีนโยบาย JSONThreatProtection

สำหรับตัวอย่างที่อธิบายไว้ข้างต้น ให้แก้ไขเพย์โหลด JSON ดังนี้

{
    "Longitude": 6.11499,
  "Latitude" : 50.76891
}

SourceUnavailable

รหัสข้อผิดพลาด

steps.jsonthreatprotection.SourceUnavailable

เนื้อหาการตอบกลับข้อผิดพลาด

{
    "fault": {
        "faultstring": "JSONThreatProtection[policy_name]::
          Source[var_name] is not available"
        "detail": {
            "errorcode": "steps.jsonthreatprotection.SourceUnavailable"
        }
    }
}

ตัวอย่างเนื้อหาการตอบกลับข้อผิดพลาด

{
    "fault": {
        "faultstring": "JSONThreatProtection[JSON-Threat-Protection-1]::
          Source requests is not available",
        "detail": {
            "errorcode": "steps.jsonthreatprotection.SourceUnavailable"
        }
    }
}

สาเหตุ

ข้อผิดพลาดนี้จะเกิดขึ้นหากตัวแปร message ที่ระบุในองค์ประกอบ <Source> ของนโยบาย JSONThreatProtection เป็นอย่างใดอย่างหนึ่งต่อไปนี้

  • ไม่อยู่ในขอบเขต (ไม่พร้อมใช้งานในโฟลว์ที่เฉพาะเจาะจงซึ่งมีการบังคับใช้นโยบาย)
  • ไม่ใช่ค่าที่ถูกต้องค่าใดค่าหนึ่ง request, response หรือ message

เช่น ข้อผิดพลาดนี้จะเกิดขึ้นหากตั้งค่าองค์ประกอบ <Source> ในนโยบายเป็นตัวแปรที่ไม่มีอยู่ในโฟลว์ที่เรียกใช้นโยบาย

การวินิจฉัย

  1. ระบุชื่อนโยบายและชื่อตัวแปรแหล่งที่มาจากข้อความแสดงข้อผิดพลาด เช่น ในข้อความแสดงข้อผิดพลาดต่อไปนี้ ชื่อนโยบายคือ JSON-Threat-Protection-1 และตัวแปรแหล่งที่มาคือ requests

    JSONThreatProtection[JSON-Threat-Protection-1]:: Source requests is not available
    
  2. ตรวจสอบค่าที่ระบุสำหรับองค์ประกอบ <Source> ที่ระบุในขั้นตอนที่ 1

    ในตัวอย่างนโยบาย JSONThreatProtection ต่อไปนี้ องค์ประกอบ <Source> จะตั้งค่าเป็น requests

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <JSONThreatProtection async="false" continueOnError="false" enabled="true" name="JSON-Threat-Protection-1">
        <DisplayName>JSON Threat Protection-1</DisplayName>
        <Properties/>
        <ArrayElementCount>3</ArrayElementCount>
        <ContainerDepth>5</ContainerDepth>
        <ObjectEntryCount>5</ObjectEntryCount>
        <ObjectEntryNameLength>20</ObjectEntryNameLength>
        <Source>requests</Source>
        <StringValueLength>50</StringValueLength>
    </JSONThreatProtection>
    

    ค่าที่ใช้ได้สำหรับองค์ประกอบ <Source> คือ request, response หรือ message เนื่องจาก requests ไม่ใช่ค่าที่ถูกต้องและไม่มีอยู่ในโฟลว์ที่นโยบาย กำลังดำเนินการ คุณจึงได้รับข้อผิดพลาดต่อไปนี้

    JSONThreatProtection[JSON-Threat-Protection-1]:: Source requests is not available
    

ความละเอียด

ตรวจสอบว่าตัวแปรที่ตั้งค่าไว้ในองค์ประกอบ <Source> ของนโยบาย JSONThreatProtection ที่ล้มเหลวตั้งค่าเป็น request, response หรือ message และมีอยู่ในโฟลว์ที่นโยบายดำเนินการ

หากต้องการแก้ไขนโยบาย JSONThreatProtection ตัวอย่างที่แสดงด้านบน คุณสามารถแก้ไของค์ประกอบ <Source> เพื่อใช้ตัวแปร request ได้ เนื่องจากตัวแปรนี้มีอยู่ในโฟลว์คำขอ

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<JSONThreatProtection async="false" continueOnError="false" enabled="true" name="JSON-Threat-Protection-1">
    <DisplayName>JSON Threat Protection-1</DisplayName>
    <Properties/>
    <ArrayElementCount>3</ArrayElementCount>
    <ContainerDepth>5</ContainerDepth>
    <ObjectEntryCount>5</ObjectEntryCount>
    <ObjectEntryNameLength>20</ObjectEntryNameLength>
    <Source>request</Source>
    <StringValueLength>50</StringValueLength>
</JSONThreatProtection>

NonMessageVariable

รหัสข้อผิดพลาด

steps.jsonthreatprotection.NonMessageVariable

เนื้อหาการตอบกลับข้อผิดพลาด

{
    "fault": {
        "faultstring": "JSONThreatProtection[policy_name]:
          Variable var_name does not resolve to a Message"
        "detail": {
            "errorcode": "steps.jsonthreatprotection.NonMessageVariable"
        }
    }
}

ตัวอย่างเนื้อหาการตอบกลับข้อผิดพลาด

{
    "fault": {
        "faultstring": "JSONThreatProtection[JSON-Threat-Protection-1]:
          Variable message.content does not resolve to a Message",
        "detail": {
            "errorcode": "steps.jsonthreatprotection.NonMessageVariable"
        }
    }
}

สาเหตุ

ข้อผิดพลาดนี้เกิดขึ้นหากตั้งค่าองค์ประกอบ <Source> ในนโยบาย JSONThreatProtection เป็นตัวแปรที่ไม่ใช่ประเภท message

ตัวแปรประเภทข้อความแสดงถึงคำขอและการตอบกลับ HTTP ทั้งหมด ตัวแปรโฟลว์ Apigee Edge ในตัว request, response และ message มีประเภทเป็น message ดูข้อมูลเพิ่มเติมเกี่ยวกับตัวแปรข้อความได้ที่ข้อมูลอ้างอิงตัวแปร

การวินิจฉัย

  1. ระบุชื่อนโยบาย JSONThreatProtection และชื่อตัวแปรแหล่งที่มา จากข้อความแสดงข้อผิดพลาด เช่น ในข้อความแสดงข้อผิดพลาดต่อไปนี้ ชื่อนโยบาย คือ JSON-Threat-Protection-1 และตัวแปรแหล่งที่มาคือ message.content

    JSONThreatProtection[JSON-Threat-Protection-1]: Variable message.content does not resolve to a Message
    
  2. ตรวจสอบองค์ประกอบ <Source> ของนโยบาย JSONThreatProtection (ระบุในขั้นตอนที่ 1)

    ในตัวอย่างนโยบาย JSONThreatProtection ต่อไปนี้ <Source> จะตั้งค่าเป็น message.content แทน message

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <JSONThreatProtection async="false" continueOnError="false" enabled="true" name="JSON-Threat-Protection-1">
        <DisplayName>JSON Threat Protection-1</DisplayName>
        <Properties/>
        <ArrayElementCount>3</ArrayElementCount>
        <ContainerDepth>5</ContainerDepth>
        <ObjectEntryCount>5</ObjectEntryCount>
        <ObjectEntryNameLength>20</ObjectEntryNameLength>
        <Source>message.content</Source>
        <StringValueLength>50</StringValueLength>
    </JSONThreatProtection>
    

    เนื่องจาก message.content ไม่ใช่ประเภทข้อความ คุณจึงได้รับข้อผิดพลาดต่อไปนี้

    JSONThreatProtection[JSON-Threat-Protection-1]: Variable message.content does
    not resolve to a Message
    

ความละเอียด

ตรวจสอบว่าองค์ประกอบ <Source> ในนโยบาย JSONThreatProtection ที่ล้มเหลว ตั้งค่าเป็นตัวแปรโฟลว์ประเภทข้อความที่มีอยู่ในโฟลว์ที่นโยบายดำเนินการ

หากต้องการแก้ไขนโยบาย คุณสามารถแก้ไของค์ประกอบ <Source> เพื่อระบุตัวแปร ที่มีประเภทเป็นข้อความ เช่น ใน JSONThreatProtection ที่ล้มเหลว คุณสามารถ ระบุองค์ประกอบ <Source> เป็น message ได้

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<JSONThreatProtection async="false" continueOnError="false" enabled="true" name="JSON-Threat-Protection-1">
    <DisplayName>JSON Threat Protection-1</DisplayName>
    <Properties/>
    <ArrayElementCount>3</ArrayElementCount>
    <ContainerDepth>5</ContainerDepth>
    <ObjectEntryCount>5</ObjectEntryCount>
    <ObjectEntryNameLength>20</ObjectEntryNameLength>
    <Source>message</Source>
    <StringValueLength>50</StringValueLength>
</JSONThreatProtection>