تحديد المشاكل وحلّها في وقت تشغيل ميزة "الحماية من التهديدات باستخدام JSON"

يتم الآن عرض مستندات Apigee Edge.
انتقِل إلى مستندات Apigee X.
المعلومات

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 إلى عدّة أنواع مختلفة من أخطاء التنفيذ الناجح. يسرد الجدول التالي الأنواع المختلفة من الأخطاء وأسبابها المحتملة:

نوع الخطأ السبب
تم تجاوز طول اسم إدخال العنصر تم تجاوز الحد الأقصى لطول السلسلة المسموح به في اسم إدخال العنصر.
تم تجاوز عدد إدخالات العناصر تم تجاوز الحد الأقصى لعدد الإدخالات المسموح بها في العنصر.
تم تجاوز عدد عناصر الصفيف تم تجاوز الحد الأقصى لعدد العناصر المسموح بها في مصفوفة.
تم تجاوز عمق الحاوية تم تجاوز الحد الأقصى المسموح به لعمق البيانات المتداخلة.
تم تجاوز طول قيمة السلسلة تم تجاوز الحد الأقصى للطول المسموح به لقيمة السلسلة.
كائن 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 الموضحة أعلاه، يظهر الإدخال السادس في السطر رقم 7 (الشركة). بما أنّ عدد إدخالات العنصر في حمولة 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. بما أنّ العمق أكبر من 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 في السياسة، ولكن تحتوي حمولة البيانات على عنصر واحد أو أكثر تحتوي قيمه على أكثر من 50 حرفًا، يتم عرض هذا الخطأ.

التشخيص

  1. افحص رسالة الخطأ لتحديد اسم السياسة ورقم السطر الذي تم تجاوز طول السلسلة فيه. في المثال التالي، يكون اسم السياسة هو JSON-Threat-Protection-1 andالسطر في الحمولة 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 غير صالحة.

التشخيص

  1. افحص رسالة الخطأ لتحديد اسم السياسة ورقم السطر الذي حدث فيه الخطأ. في المثال التالي، يكون اسم السياسة هو JSON-Threat-Protection-1 andالسطر في الحمولة 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 صالحة للإدخال إلى أي خادم وكيل لواجهة برمجة التطبيقات يتضمّن سياسة 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. نظرًا لأن الطلبات ليست قيمة صالحة وغير متوفرة في التدفق حيث يتم تنفيذ السياسة، ستظهر لك رسالة الخطأ:

    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 والاستجابة والرسالة المضمّنة من نوع الرسالة. لمعرفة المزيد من المعلومات عن متغيّرات الرسائل، اطّلِع على مرجع المتغيرات.

التشخيص

  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 على متغيّر تدفق من النوع message المتوفّر في المسار الذي يتم تنفيذ السياسة فيه.

لتصحيح السياسة، يمكنك تعديل العنصر <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>