Rullst AcademyRullst Academy/Lesson
Applications with Rullst I · Lesson 11 / 14

Useful errors, explicit limits

Users need to know what to do without receiving internal details.

Learning paths18 min

Let's discover together

  1. 1

    In this contract, broken JSON receives 400, invalid rules 422, missing targets 404 and database failure 503. Wrong content type can receive 415. These are not student grades: they communicate different HTTP outcomes and help the client respond.

  2. 2

    DefaultBodyLimit caps the body at 4,096 bytes. A 5,000-letter title does not reach validation like a small field: the request receives 413. Body and title limits measure different things. Invalid parameter types can also be rejected before the handler.

  3. 3

    Writes carrying an external Origin receive 403; the same-origin client uses the local address. This reduces one kind of browser request but neither authenticates people nor blocks local programs omitting Origin. Loopback and headers do not replace authorization.

  4. 4

    A database failure returns storage_unavailable. Logs do not print titles, SQL, paths or credentials. The kit uses CSP and nosniff but promises no complete protection, per-person limits, auditing or availability. Lab tests check specific behavior, not security certification.

Your application workbench

The kit includes a complete app to investigate and modify. The excerpt below explains this step; the editor contains the indicated file. Rullst Academy does not compile or run this server in your browser.

File to study and modify

src/routes.rs

400  invalid JSON syntax
422  invalid title or priority
403  external Origin on a write
404  missing mission
413  body over 4096 bytes
503  storage unavailable

Extract the kit to a new folder and open a terminal beside Cargo.toml. Use Rust 1.96+; the first build may download dependencies and take time. Then open http://127.0.0.1:3010. Stop with Ctrl+C and run again after editing.

cargo test --locked
cargo run --locked
My files and GitHub

Download your draft and replace the indicated file in your extracted copy. The editor saves one file in this browser; your account saves assessments and XP. The ZIP excludes your edits. GitHub sends only the confirmed file; use Git manually for the whole app, excluding databases, backups and secrets.

Official links and next step

✦
YOUR MISSION

Distinguish format, rule, origin, target and storage errors.

Now it's your turn

Discovery workshop

Decide before running

Distinguish format, rule, origin, target and storage errors.
Build your answers and check when you are ready.
A moment to understand

What does the Origin check prove?

I need a hint

Defenses have scope. Separating origin, identity and permission avoids publishing a lab as a complete service.

Loading your journey…

Take it with you

Build a table with input, expected status and the user’s next action for three failures. Run one in a local test and check the mission count did not increase.

At your own pace

My files and GitHub

Every lesson can become your own record: code, notes or a practice plan. Saving a file to GitHub is optional and does not change your XP.

Student guide

The editor and downloads open when this lesson is available to your account. Check access below or return to the track map.

Checking your access to this lesson…

Rullstpetbot

AI can make mistakes. Check the lesson material.