🐉 Boss: the stolen keys

Exercise 6 of 6 in chapter 4 · 250 XP · 4 objectives checked by tests

Topics covered: Debuggingaccess_controlRole hierarchyVoter

After the business with the board, Pippin felt guilty. He decided to “tighten security” all by himself, during the night, “tidying up a bit” along the way.

In the morning, here is what Gorm hears:

Your mission

Three bugs are hiding in the security configuration and in the code: find them and fix them, without breaking anything else.

Detective method

Security bugs almost never raise an error: a door stays open, or closes without warning. To investigate:

  1. Reproduce each symptom in the preview. The demo accounts are displayed by app:embaucher in the console: bruna@drunken-dragon.me / cauldron, gorm@drunken-dragon.me / barrel, pippin@drunken-dragon.me / potato.
  2. Read the 403 page: its stack trace shows who denied access, an access_control rule or an #[IsGranted]. Sometimes the title also says why.
  3. Reread security.yaml line by line: order of the rules, names of the roles.
  4. Ask yourself who is voting: a voter that never casts a vote makes no noise.

And this time, nobody touches the keys without telling the boss.