Command Palette

Search for a command to run...

Hectal
Phase 9: Prompt Injection and Safe Frontends
AI Frontend · Exercise 2 of 4 PreviousNext
Intermediate

Block the Quiet Leak

The reply below contains four image addresses. Write imageAllowed(url) so it returns true only when the address uses https:, has no user name or password, and the host is exactly chai.example or cdn.chai.example.

The page lists each address in #images with the word allowed or blocked in a <li>. Do not change the list code.

What Check tests

  1. The own CDN image is allowed
  2. The outside address is blocked
  3. The user-info trick is blocked
  4. The look-alike host is blocked

Stuck? One hint at a time

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

Runs in your browser. Your code is saved here.

Your page

Press Run to see the page.

Console

Nothing logged yet.