Computer science | Building safer systems

Cybersecurity: protect systems, data, and people

A beginner's guide to security goals, threat thinking, identity and access, cryptography concepts, safer software, and practical ways to reduce risk.

COMPUTER SCIENCESECURITY FOUNDATIONSBeginner to intermediate
A security improvement cycleIdentify important assets, consider threats and weaknesses, choose protections, monitor results, and update the design as conditions change. AssetsThreatsControlsMonitorImprove review risk as software and circumstances change
Figure 1. Security is continuous work: protections must evolve as systems, users, and threats change.

What cybersecurity protects

Cybersecurity is the practice of protecting systems, networks, software, and data from unauthorized access, disruption, or change. Security supports people and organizations; it is not simply a matter of installing one tool or preventing every possible failure.

A common starting point is the CIA triad:

These goals can conflict. Stronger access checks may reduce convenience; encrypting data protects confidentiality but requires careful key management; keeping a service online at all costs may risk integrity. Security design makes trade-offs explicit and considers the impact of failure.

AssetExample concernPossible impact
Account credentialsSomeone else signs inPrivacy loss or account misuse
Customer recordsUnauthorized reading or alterationHarm to people and loss of trust
Service availabilityUsers cannot complete an important taskOperational or financial disruption
Software updatesUntrusted changes are installedLoss of control over a system

Think in threats, weaknesses, and risk

A threat is a possible cause of harm; a vulnerability is a weakness that could be used or triggered; and risk considers the likelihood and impact of an adverse event. These terms help teams reason about priorities rather than treating every concern as equally urgent.

A small threat-modeling exercise

  1. List assets: identify what matters, such as accounts, personal information, or service availability.
  2. Identify trust boundaries: note where data crosses from users, devices, or services you do not fully control.
  3. Ask what could go wrong: consider accidental mistakes, misuse, outages, and unauthorized access.
  4. Estimate impact: ask who could be affected and how severely.
  5. Choose proportionate controls: reduce likelihood or limit consequences.
  6. Review assumptions: revisit the model after changes to the system or its use.

For a library account service, relevant assets might include credentials and borrowing records. Risks could include someone viewing another person's record or a user being locked out. Controls might include authentication, careful authorization checks, rate limits, backups, and clear recovery processes.

Threat modeling is not about assuming every user is malicious. It is a structured way to discover where a design depends on trust and whether that trust is justified.

Common risk patterns

These patterns show why security requires technical and organizational controls. Training can help people recognize suspicious requests, but systems should not rely on every person making a perfect decision under pressure. Clear reporting channels, limited privileges, and safe defaults provide additional protection.

Prioritize by impact, not by drama

A useful risk review asks how likely a situation is, how serious the harm would be, and how much uncertainty remains. A low-likelihood event with severe consequences may still deserve attention; a dramatic-sounding issue with no realistic path to impact may be lower priority. Record assumptions so they can be revisited rather than treating a risk score as an exact prediction.

Authentication and authorization

Authentication asks “Who or what are you?” Authorization asks “What are you allowed to do?” A system must make both decisions appropriately. Signing in as a user should not automatically grant access to every record or administrative action.

Authentication factors

Authentication can use something a person knows (a password or PIN), has (a registered device or security key), or is (a biometric characteristic). Multi-factor authentication combines different factor types, making a stolen password alone less useful. Two passwords are not two independent factors.

Recovery is part of authentication design. If a person loses a device, the service needs a safe way to restore access without making account takeover easy. Recovery codes should be stored privately, and unexpected sign-in approvals should be denied and reported.

Authorization and least privilege

Authorization rules should be checked on the server or trusted service for every protected action, not only hidden in the interface. A user who can view one record should not be able to change an identifier and view another person's record. Use roles or permissions that match real tasks, and give accounts only the access they need.

Session tokens represent authenticated sessions. Keep them out of URLs and logs, protect them in transit, and expire or revoke them when appropriate. Never treat a user-controlled identifier as proof of permission.

Protect account recovery and sessions

Account recovery can be as sensitive as sign-in because it may let someone replace a password or remove a registered factor. Recovery procedures should verify identity proportionately, notify the account owner of important changes, and avoid relying only on easily guessed personal facts.

On shared devices, sign out when finished. Services can reduce session risk by limiting token lifetime, allowing users to revoke active sessions, and requiring renewed authentication for especially sensitive actions. A session should not remain valid forever merely because a browser is still open.

Cryptography: protect data and identity

Encryption transforms readable data into ciphertext using a key so that only someone with the right key can recover it. Encryption in transit protects data moving between systems; encryption at rest protects stored data when storage media or backups are exposed. Both depend on secure key handling.

Hashing maps data to a fixed-size digest. A cryptographic hash is designed to make it impractical to reconstruct the original input or find a different input with the same digest, but ordinary hashes are too fast for storing passwords. Password storage should use a dedicated, slow password-hashing scheme with a unique salt, provided by a reputable library.

A digital signature uses a private key to create a value that others can verify with a corresponding public key. Signatures can help establish authenticity and integrity; they do not hide the signed message.

ToolUseful propertyCommon misunderstanding
EncryptionConfidentiality for data protected by a keyIt does not prove an application is trustworthy by itself
Cryptographic hashCompact integrity fingerprintA plain hash is not suitable password storage
Password hashingMakes guessing stored passwords more costlyIt cannot make weak passwords impossible to guess
Digital signatureEvidence of integrity and signing-key useIt does not encrypt or conceal the content

Cryptographic algorithms and protocols are easy to misuse. Use established, maintained libraries and secure defaults; do not design your own encryption, invent a password scheme, or keep secret keys in source code.

Keys are the critical secret

Strong encryption cannot protect data if the decryption key is stored beside it with the same permissions. Keys need controlled access, rotation procedures, secure backups where appropriate, and a plan for what happens if a key is lost or exposed. A key-management service can help, but configuration and operator access still matter.

Public-key systems use a related public and private key. The public key can be shared; the private key must remain protected. A certificate binds a public key to an identity under a trust system. Applications need to validate that certificate chain and the intended server name; encrypted traffic to an unauthenticated endpoint may still reach the wrong party.

Build safer software

Security should be included in design, implementation, review, and maintenance. Many failures happen when software trusts input, confuses data with instructions, or grants broader access than a task requires.

Input validation is not a substitute for context-specific protections. A string that is valid as a name might still need to be encoded safely before it is inserted into HTML. Treat data according to where it will be used.

Secure defaults and defense in depth

A secure default protects users who never open a settings page. Defense in depth uses multiple complementary safeguards so one missed check does not become the only barrier. For example, an account service can combine strong authentication, per-record authorization, monitoring, and tested backups.

More controls are not always better: a confusing warning can train people to ignore warnings, and excessive permissions make administration harder. Choose controls that reduce meaningful risk and are usable by the people who depend on them.

Review code and dependencies

Code review can catch missing authorization checks, unsafe defaults, accidental secret exposure, and confusing error behavior. Automated tools can find known vulnerable dependency versions or suspicious patterns, but they produce incomplete results. Review findings in context and keep tools updated.

Every dependency expands the set of code a project relies on. Prefer packages with clear maintainers, a relevant purpose, and a sustainable update path. Remove unused dependencies and apply security updates through tests and review. A lockfile records exact dependency versions for repeatable builds; it does not guarantee those versions are safe indefinitely.

Keep errors useful but not revealing

An application should tell a user what they can do next without displaying database details, file paths, access tokens, or internal stack traces. Detailed diagnostics belong in access-controlled logs, and even logs should avoid secrets and unnecessary personal data. Distinguish an expected validation failure from an unexpected server failure so each can be handled appropriately.

Secure systems and networks

Systems need routine maintenance. Install security updates from trusted sources, remove services and accounts that are no longer needed, use device locks, and configure firewalls and permissions according to the actual purpose of the system.

For web connections, TLS can encrypt traffic and help authenticate a server when certificates are validated correctly. Users should not bypass certificate warnings casually. Developers should use current platform-supported configurations and avoid handling cryptographic details manually.

Network segmentation can limit which systems communicate with each other. Monitoring helps detect unusual activity, but logs should avoid storing passwords, session tokens, or unnecessary personal information. Protect access to logs because they may reveal operational and user details.

Updates and configuration are ongoing work

Security updates correct defects in operating systems, applications, and embedded devices. A practical update process identifies supported systems, applies updates in a reasonable time, and verifies that important services still work. Devices that no longer receive updates may need to be isolated, replaced, or removed from service.

Configuration should match the system's purpose. Disable unused accounts and features, restrict administrative interfaces to trusted networks where possible, and review default credentials. Document exceptions so that temporary access or test settings do not quietly become permanent.

People, privacy, and recovery

Security is a human and organizational concern as well as a technical one. Deceptive messages may pressure someone into sharing a password or approving an unexpected sign-in. Verify unusual requests through a known, separate channel; do not use contact details supplied only in a suspicious message.

Collect and retain only the data that a service needs. Explain how information is used, restrict access, and delete it when it is no longer needed. Privacy and security overlap, but they are not identical: data can be securely stored and still be collected or used inappropriately.

Plan for incidents before they happen. A response plan identifies who to contact, how to contain a problem safely, how to preserve relevant evidence, and how to communicate with affected people. Backups and recovery steps should be tested so that restoring service is more than an assumption.

If you suspect an account or device is compromised, use a known-clean device and official channels to change credentials, revoke sessions, and ask the responsible support team for help. Preserve relevant details such as timestamps and messages, but do not forward sensitive information widely or attempt risky investigation on your own. For organizations, follow the incident-response roles and reporting requirements established in advance.

Recovery planning should include people whose access needs or circumstances differ. A single recovery option may exclude someone who has lost a device, cannot receive a text message, or needs an accessible alternative. Secure recovery needs to be both resistant to abuse and usable by legitimate account owners.

A practical security workflow

  1. Understand the system: list its users, data, services, and external dependencies.
  2. Identify important risks: consider likely failures and their impact on people.
  3. Reduce exposure: minimize stored data, privileges, and unnecessary interfaces.
  4. Build protections: use safe libraries, secure defaults, and clear access rules.
  5. Review and test: check assumptions, permissions, error cases, and recovery.
  6. Maintain: patch dependencies, monitor relevant signals, and revisit the design.

Security testing should be authorized, scoped, and performed in environments where the tester has permission. For a beginner project, focus on your own code and test setup: confirm that users cannot access data they are not entitled to, that invalid input is rejected safely, and that secrets do not appear in output or version control.

Compact glossary

Asset
Data, service, or capability that needs protection.
Threat
A possible cause of harm to a system or its users.
Vulnerability
A weakness that could contribute to an adverse outcome.
Authentication
Establishing which user or system is making a request.
Authorization
Deciding what an authenticated identity may do.
Least privilege
Giving only the minimum access needed for a task.

References and further reading

  1. National Institute of Standards and Technology. NIST Cybersecurity Framework 2.0. Framework resources.
  2. OWASP Foundation. OWASP Top 10:2021. Web application security awareness.
  3. OWASP Foundation. Password Storage Cheat Sheet. Defensive implementation guidance.
  4. Cybersecurity and Infrastructure Security Agency. Secure Our World. Everyday security guidance.

Try it yourself

  1. For a small notes app, list three assets and a possible confidentiality, integrity, or availability concern for each.
  2. Explain the difference between authentication and authorization using a library account.
  3. Why should password storage use a dedicated password-hashing scheme rather than encryption or a fast hash?
  4. Describe one secure default for a new account or service.
  5. Write a short recovery checklist for a lost device that has an account signed in.

Remember: protect people and important assets by reducing unnecessary exposure, limiting access, and reviewing security as systems change.

Keep exploring

Try another topic

A fresh topic suggestion is ready for you.

Explore a topic
0% read