๐—ง๐˜„๐—ผ ๐—•๐˜‚๐—ด๐˜€ ๐—ง๐—ต๐—ฎ๐˜ ๐—ง๐—ฎ๐˜‚๐—ด๐—ต๐˜ ๐— ๐—ฒ ๐— ๐—ผ๐—ฟ๐—ฒ ๐—ง๐—ต๐—ฎ๐—ป ๐—”๐—ป๐˜† ๐—ง๐˜‚๐˜๐—ผ๐—ฟ๐—ถ๐—ฎ๐—น

I learned two lessons during my internship. Both lessons came from bugs that passed my local tests but failed in production.

Bug 1: The PKCE Auth Failure

I built a CLI tool for GitHub authorization. The flow worked like this:

The issue: The redirect failed because of how the state parameter behaved during the handoff. I assumed the state would always return exactly as I sent it. It did not.

Bug 2: The Argon2 Database Trap

I worked on a team project for session management. We used Argon2 to hash refresh tokens for security.

The logic looked correct:

The failure: Argon2 is non-deterministic. This means the same input produces a different hash every time. You cannot use a hashed token to search a database. A lookup query will always fail.

The fix: I changed the logic to use a unique ID instead.

The lesson:

Both bugs happened because of one thing. I made assumptions about how my tools worked.

I assumed the state parameter was a constant. I assumed the hash would be predictable.

Do not just read documentation. Build a habit of asking one question: What assumptions am I making about this library?

Asking this question saves more time than any tutorial.

Source: https://dev.to/clinztouch/two-bugs-that-taught-me-more-than-any-tutorial-2jh7