Module 5 of 5Free to explore

Fixing in Practice and Retesting

2 hoursTheory and practiceMedium

Study-time guide: 15 min reading and analysis, 65 min core exercises, 40 min review and deliverable. Additional external-platform execution is estimated separately.

Accept a fix by its behavior, not its line count

A retest must demonstrate that the original failure is removed, permitted behavior still works, and nearby operations do not retain the same bypass. A closed ticket or a screenshot of an added code condition is not verification evidence. Preserve the service revision, subjects, objects, requests, and expected responses for reproduction.

In this original case, a report endpoint previously returned an organization B object to an organization A student. The developer adds a 403 response, but the error handler still serializes the original report into its JSON body. The example shows why a correct status code does not by itself demonstrate that protected content is absent.

Compare expected and observed behavior

These are synthetic retest observations. They are supplied as an educational artifact, not a claim that a running API has been tested.

{"case":"owned-report","subject_tenant":"A","object_tenant":"A","status":200,"body":{"id":42,"summary":"training report"},"expected":"allowed"}
{"case":"foreign-report","subject_tenant":"A","object_tenant":"B","status":403,"body":{"error":"denied","report":{"id":43,"summary":"private synthetic note"}},"expected":"denied-no-content"}
{"case":"foreign-export","subject_tenant":"A","object_tenant":"B","status":200,"body":{"download":"/exports/lab-43.csv"},"expected":"denied-no-content"}

The first line provides a positive control: owned material is still accessible. The second demonstrates an incomplete fix because the body still exposes report data. The third reveals an alternative export path. Do not close the issue merely because one interface screen stopped opening.

The second case requires a safe denial response before the protected object enters serialization. The third requires the same authorization policy at export creation and verification of the eventual file delivery. Generating a signed URL is itself a protected operation. An unpredictable URL does not replace permission to receive it.

Exercise: build a retest package

Rewrite the expected responses for all three cases. Add an anonymous subject, a same-tenant administrator, and a previously saved link used after access revocation. For each, identify what to inspect in the status, body, headers, and subsequent file request. Distinguish a permitted export from a denial to an unrelated subject.

Acceptance criteria: the original negative case exposes no protected body; the positive control preserves functionality; export creation and file delivery are separate checks; conclusions identify a specific code revision. If the practice environment cannot test caching or link expiry, record the limitation and next investigation step rather than inventing a passed result.

Work deliverable

Submit a retest record containing the root cause, change reference, case matrix, synthetic request evidence, and remaining risk. Identify the regression check that protects the fix during a later change. The questions below assess artifact interpretation but do not invoke an endpoint. Use OWASP Authorization and OWASP ASVS as verification references.

Lesson: inspect response bodies programmatically and manually

Save the three artifact rows as retest.jsonl. JSONL contains a separate JSON object on each line. With Python 3 installed, run the following local check. It analyzes saved educational observations; it does not perform network requests or automatically retest a real service.

import json
from pathlib import Path
rows = [json.loads(line) for line in Path('retest.jsonl').read_text().splitlines() if line]
failures = []
for row in rows:
    body = row['body']
    if row['expected'] == 'denied-no-content':
        denied = row['status'] in (401, 403)
        no_data = set(body) <= {'error'}
        if not (denied and no_data):
            failures.append(row['case'])
assert failures == ['foreign-report', 'foreign-export']
print('two incomplete fixes identified in the training fixture')

read_text reads the file, splitlines separates rows, and json.loads parses data. set(body) <= {'error'} permits only the field names selected for this simple contract. This is not a universal secret detector: the error string itself needs review, and a real schema can have safe additional fields. Explain those limits with your result.

Create a corrected fixture copy in which both foreign cases return denial and a generic safe error without report data or download links. For that copy, expect an empty failures list. Preserve the allowed owned-report case. Restore a protected field to one denial as a negative control; the check should detect an incomplete fix again. Keep original and corrected artifacts separately to retain before-change observations.

Practice extension: identify remaining service paths

A server may deny correctly while a cache or previously issued link preserves access. Define subject, issue time, link lifetime, permission change, subsequent request, and observed result. Do not promise immediate revocation of every signed link without checking the selected mechanism. Lifetime and revocation procedures belong in the accepted requirement.

Separate local fixture checks, code inspection, and integration requests. Each has different evidence. If only the first occurred, do not report a repaired endpoint. Report a clarified denial contract and a prepared regression check. Closing a real finding requires a specific build, authorized test accounts, and saved responses.

Submit original and corrected fixtures, the check, a positive control, an alternative path, and remaining limits. This lets an owner decide between closure and further work. It is more useful than “there is a 403” and does not confuse interface availability with absence of protected data.

Try the idea yourself

Where to put a check

Change the conditions and observe this training model. It runs in your browser and does not change your computer.

A team is preparing a release. Enable the independent checks and see what remains unknown.

Observation

Choose conditions above to see an explanation of the result.

Independent exercise · Russian

Сервис оптового склада выдаёт упаковочные листы. Контракт обещает прекращение доступа сразу после отзыва роли комплектовщика. Команда исправила кэш разрешений и приложила обезличенный протокол приёмки сборки W19 за 14 января 2027 года.

Evidence

09:01 роль активна, экран и скачивание выдали лист. 09:02 роль у этой учебной учётной записи отозвана. 09:03 экран вернул 403 с пустым телом. В 09:04 та же учётная запись загрузила лист по ранее выданной ссылке, получено 200 и 18 КБ. В 09:05 другой комплектовщик с действующей ролью скачал свой лист.

Assignment

Оформите заключение о готовности W19. Разделите путь через экран и выдачу файла, укажите время спорного события и сформулируйте ожидаемое поведение для следующего протокола.

Compare your reasoning

В 09:04 после отзыва переданы 18 КБ, поэтому исправление пока нельзя принять. При новом ретесте зафиксируйте сборку, момент отзыва и результат выдачи ранее созданной ссылки. При сохранении исходного контракта загрузка должна отказать до передачи содержимого. Рабочая выдача своему действующему комплектовщику остаётся положительным контролем.

Your next step

Choose what you want to do next

First compare your work with the course exercises. Then try the free introductory module of your next topic and check its prerequisites.

Explore every path and focused course
Personal practice environment

Check an excerpt, find matching lines and compute the SHA-256 of the original text. Temporary data expires after 30 minutes or when you close the environment.