McTaba Labs logo
Software EngineeringThe WhiteboardProjectsEventsMasterclassesWebinarsLearn
Book Call

500+ developers already in the community

Get answers, find accountability partners, and stay ahead

Join Discord →
McTaba Labs logo

Educating 1 million students in tech by 2030.

Programs

  • HighSchool Graduates Launchpad
  • AI & Business Automation
  • Corporate Training
  • McTaba Story & Mission
  • Full-Stack Curriculum
  • Course Pricing & Plans
  • Frequently Asked Questions

Resources

  • Join Discord Community
  • Tech Events in Nairobi
  • Masterclasses
  • Free Resources
  • Learn
  • Campus
  • Africa Tech Talent Report
  • Partner With Us
  • Start a Project
  • Our Work

Contact Us

  • 124 Manyani East Road, Lavington, Nairobi
  • +254727795603
  • Book a Discovery Call

Office Hours:

Mon-Fri: 9am - 2pm EAT

Sat: 10am - 12pm EAT

© 2027 McTaba Labs - A product of Edtech Industries. All rights reserved.

Privacy PolicyTerms of ServiceRefund Policy
  1. Learn
  2. Learning to Code
  3. Cybersecurity Basics Every New Kenyan Developer Should Know
Bonaventure OgetoBy Bonaventure Ogeto|Updated July 20, 2026

Cybersecurity Basics Every New Kenyan Developer Should Know

New developers should learn five security fundamentals: never store passwords in plain text (use bcrypt or argon2 hashing), always use HTTPS, validate and sanitise all user input to prevent SQL injection and XSS attacks, keep dependencies updated, and never commit secrets like API keys or database passwords to GitHub. These practices prevent the most common attacks and are expected knowledge in any professional developer role in Kenya.

In this article

  1. 1. Why This Matters Before You Ship
  2. 2. Rule 1: Never Store Passwords in Plain Text
  3. 3. Rule 2: Always Use HTTPS
  4. 4. Rule 3: Validate and Sanitise All User Input
  5. 5. Rule 4: Keep Your Dependencies Updated
  6. 6. Rule 5: Never Commit Secrets to GitHub
  7. 7. Security in the McTaba Curriculum

Why This Matters Before You Ship

Imagine you build a chama app. Members log in, record contributions, and check balances. One member uses the same password for your app and their M-Pesa account. You stored passwords in plain text. Someone accesses your database. Now they have a password that might unlock an M-Pesa account.

This is not a hypothetical. It happens. And when it happens, the developer is responsible.

Security is not a feature you add later. It is a practice you follow from the first line of code. The basics are not hard. They are habits. Learn them once and they become automatic.

Rule 1: Never Store Passwords in Plain Text

When a user creates an account, you receive their password. You need to store it so you can verify it when they log in. But you must never store the actual password.

Instead, you hash it. Hashing runs the password through a one-way mathematical function that produces a fixed-length string. "mypassword123" becomes something like "$2b$10$xJ3kE...". The important property: you cannot reverse the hash to get the original password. Even if someone steals your database, they get hashes, not passwords.

When the user logs in, you hash the password they enter and compare it to the stored hash. If they match, the password is correct. You never see or store the actual password after initial hashing.

Use bcrypt or argon2. Both are available as npm packages for Node.js and pip packages for Python. They are industry standard. Do not use MD5 or SHA-256 for passwords. They are fast, which is bad for password hashing because attackers can try billions of guesses per second.

Get weekly developer tips

Join 25,000+ developers. Practical guides, job tips, and new content — straight to your inbox.

No spam. Unsubscribe anytime.

Rule 2: Always Use HTTPS

HTTP sends data in plain text. Anyone on the same network (a Wi-Fi hotspot at Java House, a shared network at a co-working space) can see everything: login credentials, personal data, payment information.

HTTPS encrypts the connection between the browser and your server. Even if someone intercepts the traffic, they see scrambled data. It is the difference between passing a note in plain sight and sealing it in an envelope.

Every modern hosting provider (Vercel, Netlify, Railway) gives you HTTPS for free. There is no excuse for running an app over plain HTTP in 2026. If you use a custom domain, set up SSL certificates through Let's Encrypt (free) or your hosting provider's built-in SSL.

Rule 3: Validate and Sanitise All User Input

SQL injection. If your app takes user input and inserts it directly into a database query, an attacker can type SQL commands instead of normal input and manipulate your database. Delete records. Dump your user table. Change account balances. This is one of the oldest and most common web attacks, and it is completely preventable.

The fix: never build SQL queries by concatenating strings with user input. Use parameterised queries or an ORM (like Prisma, Sequelize, or SQLAlchemy) that handles escaping for you.

Cross-site scripting (XSS). If your app displays user input on a page without escaping it, an attacker can inject JavaScript that runs in other users' browsers. Steal cookies. Redirect to phishing pages. Modern frameworks like React escape output by default, but if you use dangerouslySetInnerHTML or build templates manually, you are exposed.

The fix: escape all user input before rendering it in HTML. Use your framework's built-in protections. Never trust user input.

General principle. Treat every piece of data from the user as potentially malicious. Validate that it matches expected formats (is this actually an email? is this a number within range?). Sanitise it before storing or displaying.

Rule 4: Keep Your Dependencies Updated

Your Node.js app might use 200 npm packages. Each package is code written by someone else. If one of those packages has a security vulnerability, your app has a security vulnerability.

Run npm audit regularly. It tells you which packages have known vulnerabilities and suggests updates. Run npm update to apply safe updates. For major version changes, test before upgrading.

GitHub's Dependabot does this automatically. Enable it on your repositories. It creates pull requests when it finds vulnerable dependencies. Review and merge them.

This is not busywork. Some of the biggest security breaches in history happened because a company did not update a library with a known vulnerability for months. The fix was available. They just did not apply it.

Rule 5: Never Commit Secrets to GitHub

Your database password, your M-Pesa API consumer key, your JWT secret, your email API key. These are secrets. They live in environment variables, not in your code.

Create a .env file for local development. Add .env to your .gitignore file so Git never tracks it. On your hosting provider, set environment variables through the dashboard.

If you accidentally commit a secret to GitHub, changing the .env file is not enough. The secret is in your Git history. Anyone who clones the repository can see it. You need to rotate the key (generate a new one) immediately and use a tool like git filter-branch or BFG Repo-Cleaner to remove it from history.

Bots scan public GitHub repositories constantly, looking for exposed API keys. If you commit an AWS key, expect unauthorised charges on your account within hours. This is not a theoretical risk. It happens every day.

Security in the McTaba Curriculum

At McTaba, security practices are woven into every project, not taught as a separate module. You hash passwords from your first app with user accounts. You use HTTPS from your first deployment. You learn to validate input, manage environment variables, and handle M-Pesa credentials securely.

When you build 8 production-grade apps, security becomes a habit, not a checklist. That is the goal. Secure code should feel as natural as writing a function.

Key Takeaways

  • ✓Security is not a separate topic. It is part of every feature you build. Writing secure code from the start is easier than fixing a breach after launch.
  • ✓The five non-negotiable basics: hash passwords, use HTTPS, validate input, update dependencies, never commit secrets.
  • ✓Most security breaches exploit simple mistakes, not sophisticated hacking. SQL injection, exposed API keys, and plain-text passwords cause more damage than "hackers in hoodies."
  • ✓In Kenya, where M-Pesa and mobile banking are central to daily life, a security flaw in a payment app can cost real people real money.
  • ✓You do not need to be a security expert. You need to know the basics and follow them consistently.

Frequently Asked Questions

Do I need to learn cybersecurity deeply as a web developer?
Not deeply, unless you want to specialise in it. But every web developer needs to know the basics covered in this article. Secure coding is part of professional development, not a separate field. Think of it like a driver knowing traffic rules: you do not need to be a traffic officer, but you need to know the basics to drive safely.
What if I already committed secrets to a public repository?
Rotate the secret immediately. Generate new API keys, change passwords, update credentials. Then remove the secret from your Git history using BFG Repo-Cleaner or git filter-branch. Assume the old secret has been compromised and act accordingly.
Is HTTPS really necessary for a small app with few users?
Yes. HTTPS is free, takes minutes to set up, and protects every user regardless of how many there are. Search engines also rank HTTPS sites higher. There is no good reason to skip it.

Go Full-Stack

KES 120,000

The complete Full-Stack Software & AI Engineering course. From zero code to AI-powered products in 16 weeks. 16 modules, 208 lessons, with career support until placement.

Enrol in Full-Stack AI

Not ready? Create Free Account

Keep reading

From Idea to Live App: The Real Steps Nobody Explains

You know HTML, CSS, JavaScript. Maybe React. Maybe some Node.js. But you have never taken an idea from "I want to build this" to "here is the link, try it." This guide fills that gap with the real steps, in order, without skipping the parts tutorials always skip.

Read more

Web Development in Kenya: Skills, Tools and First Projects

Web development is the most accessible entry point into tech for Kenyan beginners. The tools are free, the demand is high, and you can see results in a browser within your first week. Here is what to learn, in what order, and what to build first.

Read more

What Is Cloud Hosting and How Much Does It Cost in Kenya?

Your app works on your laptop. Now you want the world to see it. That means hosting. This guide explains cloud hosting in plain language, compares the options available to Kenyan developers, and tells you what it actually costs.

Read more

Explore related topics

Breaking Into Tech

Practical, no-nonsense guides for anyone looking to start or change their career in tech. From choosing your first language to acing interviews.

AI Skills & Tools

Practical AI knowledge for developers. Build your first agent, get good at RAG, and pick the right AI coding tools for real work.

Reviews & Comparisons

Honest reviews and head-to-head comparisons to help you choose the right learning path.

Bonaventure Ogeto

Bonaventure Ogeto

Founder, McTaba Labs

Bonaventure is the founder of McTaba Labs, a coding bootcamp in Nairobi, Kenya. He has spent years building products for the African market and mentoring the next generation of developers across the continent.