English · Русский · Қазақша

English

Verify a defensive policy

Worked example and independent check

Use a detector stub with fixed scores 0.1 and 0.9. Give it a timeout and test a response with a harmless internal label split between two chunks. Verify that the protection decision and the bytes delivered agree with the written policy.

Implementation stages

  1. XD5 · Add a detector interface that returns a numeric score. Use a local stub with fixed scores. Implement a response deadline and a documented failure policy. Test deterministic scores of 0.1 and 0.9, an invalid response and a timeout. Record which decision came from the score and which came from your failure policy.
  2. SI3 · Set separate thresholds for two routes and evaluate them against labelled synthetic examples. Count false positives and false negatives by route. Define a fallback for unknown routes. Keep the synthetic inputs and scores fixed. Change one threshold and recalculate both error counts; record which sample changed classification and why.
  3. QE5 · Inspect supported JSON and form bodies with a configured size bound. Validate media type and parsing results. Preserve the original body for requests your policy lets through. Use a valid colour field, an empty body, malformed JSON and a body exactly one byte over the limit. Verify the documented outcome and whether the upstream received any bytes.
  4. AS4 · Hold the upstream response until inspection completes within a fixed limit. Match the harmless output marker INTERNAL-DEMO and produce an appropriate replacement response when policy requires it. Test clean and marked responses, a marker that crosses a chunk boundary and an oversized response. Confirm the client receives no marked bytes.
  5. MU9 · Use an allowlist to restrict fields on a local demonstration export route. Allow public fields such as title and colour. Define decisions for unknown or repeated fields and record the reason. Prepare a table of allowed, unknown and mixed field selections using synthetic data. Assert the response and decision log. Keep the same cases as regression tests for the upstream fix.

SynQ discussion

Show SynQ the input, your prediction and what actually happened. Ask which intermediate value to inspect first.

Code and test examples

Русский

Проверка правил защиты

Разбор примера и самостоятельная проверка

Возьмите заглушку с оценками 0.1 и 0.9. Имитируйте тайм-аут и ответ, где учебная метка разделена между фрагментами. Сверьте журнал решения и байты, дошедшие до клиента, с описанием правила.

Этапы реализации

  1. XD5 · Подайте в локальную заглушку оценки 0.1 и 0.9. Проверьте решения при некорректной оценке и при тайм-ауте.
  2. SI3 · Установите отдельный порог для двух маршрутов. Посчитайте ложные срабатывания и пропуски до и после изменения одного порога.
  3. QE5 · Примите тестовый JSON с полем colour, пустое тело и ошибочный JSON. Проверьте также тело на байт больше разрешённого.
  4. AS4 · Проверьте ответ до передачи клиенту. Маркер INTERNAL-DEMO на границе двух фрагментов не должен попасть клиенту.
  5. MU9 · Разрешите локальному экспорту только title и colour. Для неизвестного и повторённого поля проверьте ответ и причину в журнале.

Вопрос для SynQ

Покажите SynQ входные данные, ваш прогноз и фактический результат. Спросите, какое промежуточное значение проверить первым.

Примеры кода и проверок

Қазақша

Қорғаныс ережесін тексеру

Мысал және өзіндік тексеру

0.1 және 0.9 мәндерін беретін сынақ детекторын қолданыңыз. Күту уақыты асқан жағдай мен белгі екі бөлікке бөлінген жауапты тексеріңіз. Шешім журналы мен клиентке жеткен байттарды жазбаша ережемен салыстырыңыз.

Іске асыру кезеңдері

  1. XD5 · Жергілікті сынақ детекторына 0.1 және 0.9 мәндерін беріңіз. Жарамсыз баға мен күту уақыты асқандағы шешімді тексеріңіз.
  2. SI3 · Екі бағытқа бөлек шек қойыңыз. Бір шекті өзгерткенге дейінгі және кейінгі жалған дабыл мен өткізіп алу санын есептеңіз.
  3. QE5 · colour өрісі бар JSON, бос дене және жарамсыз JSON жіберіңіз. Шектен бір байт үлкен денені де тексеріңіз.
  4. AS4 · Клиентке бермес бұрын жауапты тексеріңіз. Екі бөліктің шекарасындағы INTERNAL-DEMO белгісі клиентке жетпеуі тиіс.
  5. MU9 · Жергілікті экспортқа тек title және colour өрістерін рұқсат етіңіз. Бөгде немесе қайталанған өріс үшін жауап пен журналдағы себебін тексеріңіз.

SynQ-ға сұрақ

SynQ-ға кіріс деректі, өз болжамыңызды және нақты нәтижені көрсетіңіз. Алдымен қай аралық мәнді тексеру керегін сұраңыз.

Код пен тексеру мысалдары