Command Palette

Search for a command to run...

Hectal
Phase 10: Security and Privacy (Defensive)
RAG and Vector Search · Exercise 1 of 6Next
Beginner

A fail-closed access filter

Write visible_ids(chunks, groups). Each chunk is a dict with keys id, label and text. Return the ids, in the original order, of the chunks whose label is in the set groups.

A user with an empty set of groups must see nothing. Do not write a special case for it: the membership test already does the right thing.

What Check tests

  1. A public user sees the public chunks in order
  2. A user with both groups sees everything
  3. An empty set of groups sees nothing
  4. An unknown group sees nothing

Stuck? One hint at a time

The solution unlocks after your first Check. Try first: that is where the learning happens.

main.py
Sign in to run your code.

Output

Press Run to see what your program prints.