Module 3 of 5Free to explore

Personal-data protection levels: roles, threats and FSTEC Order 21 controls

3 hoursTheory and practiceEasy

Lesson 1. Protect an operation rather than buying abstract security

Our fictional club keeps participant and result records. A participant should see their own result, support should resolve a specific enquiry, and an administrator should maintain the system. Those tasks differ. Giving everybody a complete export makes implementation easy at the cost of unnecessary access. Start with the person, operation and record involved, then choose a control.

A threat describes an unwanted outcome and conditions enabling it. For example, a support employee exports every participant through a shared account and forwards the file. Writing hackers is insufficient: the important conditions are export permission, a shared account, no distinguishable actor and a transfer channel. Address particular conditions by removing unnecessary export, assigning individual accounts and reviewing exports. Antivirus does not remove an authorised excessive permission.

A common beginner mistake is treating a password as proof of correct permissions. Authentication identifies an account; authorisation decides whether an operation is permitted. Another person’s record may be exposed after entirely successful sign-in. Disk encryption also does not repair application-level disclosure. Define what must succeed and what must fail before choosing a measure.

Lesson 2. Do not guess a protection level

Article 19 of the official 152-FZ text reviewed for this lesson connects protection to threats and legal, organisational and technical measures. A personal-data information system also needs examination of the procedure for determining its protection level and required measures. Government Resolution 1119 and FSTEC Order 21 are references to verify. Server count, a preferred licence price or describing a company as small does not establish the level.

Prepare system facts for the responsible specialist: data categories, people involved, volume and context, connections and relevant threats. An unknown parameter remains unknown. The program below does not calculate a statutory level, choose a certified product or perform attestation. It tests a narrower product requirement about access.

Government systems and critical infrastructure receive separate attention in the next module. Order 117 must not be described as a replacement for Order 21 across all personal-data systems. Windows/AD, Astra Linux, ALT, Debian, Samba and FreeIPA use different configuration mechanisms. An operating-system name alone does not demonstrate a measure. You need the version, applicable scope, actual setting and test result.

Lesson 3. Run a real local record-access model

Save access_records.py and run it with Python 3. It creates an in-memory SQLite database that disappears when the process finishes. No working data or operating-system permissions are changed. Two records contain fictional identifiers. Examine the sequence: the role is checked before querying, the subject comes from the model’s trusted context, and the query restricts the owner.

# access_records.py: fictional in-memory database and trusted actor context
import sqlite3
connection = sqlite3.connect(':memory:')
connection.execute('CREATE TABLE results(owner TEXT, module TEXT, score INTEGER)')
connection.executemany('INSERT INTO results VALUES (?,?,?)',
 [('S-01','intro',3), ('S-02','intro',2)])
def own_results(actor, requested_owner):
    if actor['role'] != 'student' or actor['id'] != requested_owner:
        return 403, []
    rows = connection.execute(
        'SELECT module,score FROM results WHERE owner=?',
        (actor['id'],)).fetchall()
    return 200, rows
student = {'id':'S-01','role':'student'}
assert own_results(student,'S-01') == (200,[('intro',3)])
assert own_results(student,'S-02') == (403,[])
assert own_results({'id':'agent-1','role':'support'},'S-01') == (403,[])
assert own_results({'id':'anonymous','role':'none'},'S-01') == (403,[])
print('owner:200; other owner:403; unsupported role:403; anonymous:403')
connection.close()
print('four access controls passed; no legal protection level assigned')

Expect one 200 result and three 403 results. The positive control matters: denying everything does not produce a usable service. Parameterised SQL separates data from syntax, while role and owner checks establish permission to read a record. Removing the owner check breaks the access requirement even if SQL remains parameterised. These useful mechanisms solve different problems.

A real application must not trust role and id supplied by the browser. The server establishes them after checking a session. This dictionary is deliberately created within the program so you can study the boundary without building a complete login system. Its results do not demonstrate protection of the Academy API, Windows ACLs or Linux files.

Lesson 4. Evidence, backups and access withdrawal

An access matrix connects a role, action, object and operational need. Support might receive a dedicated minimal view instead of unrestricted database access. Each exception needs an owner, review condition and clear test. When an employee leaves, inspect remaining groups, tokens and permitted copies as well as disabling the account.

Logs help investigate actions, but passwords, recovery tokens and complete participant records should not be included by default. A training log can contain a request identifier, role, operation, result and time. Even these entries may link to a person; define their own purpose, permissions and retention. Hiding an email in a user interface does not remove it from logs.

Backups enable recovery and create additional copies. Test restoration of a fictional record and access restrictions on the backup. A deletion plan considers existing grounds, the primary dataset and backup systems. Do not promise immediate physical disappearance where the process cannot provide it. A control requires an observable result rather than a signed checklist alone.

Practice. Make a matrix and retest

Add S-03 and a test for its own result. In a copy of the source, remove the actor.id versus requested_owner comparison and change the query to use requested_owner. The S-01→S-02 negative test must then fail. Restore the control and confirm that the legitimate owner can still read their result. Only the local fictional source and database are involved.

Create control-evidence.md containing requirement, threat, setting, permitted result, forbidden result and test limits. Add rows for logs, backups and employee departure; mark unperformed experiments as not tested. Acceptance requires preserving the working scenario, detecting exposure in the intentionally broken version, and avoiding a statutory-level claim based on one script.

Sources

152-FZ: official Ministry of Labour text, Article 19. Government Resolution 1119: official verification address. FSTEC: official site and regulatory documents. Python sqlite 3 documentation. Review date:2026-10-06. Later amendments and applicability require verification against current official documents; this model is not a statutory classification calculator.

Try the idea yourself

Which data does this task require

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

In this training form, purpose determines the fields. An account needs email and a display name; shipping a printed guide needs a name, contact email and address. These are example rules; justify every real product field separately.

Observation

Choose conditions above to see an explanation of the result.

Independent exercise · Russian

В сети частных учебных центров куратор перешёл из филиала «Север» в филиал «Юг». По заявке ему открыли доступ к новой группе. При проверке выяснилось, что доступ к старой группе сохраняется через вторую роль.

Evidence

Матрица допуска назначает куратору просмотр только активной группы. На 17 ноября синтетическая запись С-14 относится к «Северу», Ю-29 к «Югу». Прямая роль «Север» отозвана, вложенная группа «подмена Север» действительна до 30 ноября. Отчёт из резервной копии открывает администратор восстановления.

Assignment

Подготовьте три проверки прав после перевода и запишите ожидаемый результат для каждой. Поясните, какие дополнительные сведения нужны ответственному, чтобы обосновать уровень защищённости системы.

Compare your reasoning

В свежей сессии куратор читает Ю-29, получает отказ по С-14 после снятия лишнего членства и получает отказ при открытии резервного отчёта. Зафиксируйте роли, дату, решение и идентификатор каждой проверки. Вопрос уровня защищённости оставьте владельцу системы и специалисту по защите: для обоснования им понадобятся категории и объём данных, состав субъектов и актуальные угрозы. Одна удачная проверка доступа охватывает лишь конкретную меру.

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.