Pricing Insights
Book a demo

Secure Code

What a developer should know so that vulnerabilities do not appear in code: distrust of input, access, secrets, dependencies, working with scanner findings.

27 topics7 stages stagetopicalso in another route
Start
1.1Think like an attacker

Everything that comes from outside could have been sent by an attacker: parameters, headers, files, responses of other APIs. Find the trust boundaries in the service: checks are needed exactly there.

1.2OWASP Proactive Controls

Ten practices a developer applies on their own: input validation, access, cryptography, logging, safe libraries. A view from the other side of the OWASP Top 10: what to do rather than what to fear.

1.3OWASP Top 10 1

OWASP Top 10 is a regularly updated list of the most critical web application security risks from the OWASP community.

Stage 1Mindset3 topics
2.1Input validation

Check type, length, format and allowed values on the server. An allowlist is more reliable than a denylist.

2.2Injections

SQL, OS commands, LDAP, templates. The defense is essentially the same: data separate from the command, that is, parameterized queries and safe APIs.

2.3XSS and output

User data gets into the page and runs in the victim's browser. Encode output by context and do not disable the template engine's protection.

2.4Files and deserialization

Foreign serialized objects and uploaded files allow code execution or planting a malicious file. Accept only expected formats and check the content.

2.5AI and LLM vulnerabilities 1

Prompt injection, data leakage through the model, data poisoning, unsafe output. If a product uses LLMs or agents, this is an attacker's input like any other.

Stage 2Input and output5 topics
3.1API security 1

API security is the protection of the programming interfaces through which mobile apps, frontends and services communicate.

3.2Login and sessions

Password storage, MFA, brute-force protection, session lifetime and revocation.

3.3Object permissions

Check permissions on every object, not only at the entrance to a section. Id substitution in a request (IDOR, BOLA) is a frequent finding in bank APIs.

Stage 3Access3 topics
4.1Secrets in code 13

Secret detection is a check of code and repository history for passwords, tokens, API keys, connection strings and private keys that ended up there.

4.2Passwords and cryptography

Hash passwords with slow functions (Argon2id, bcrypt), protect traffic with TLS, and do not write your own cryptography.

Stage 4Secrets and cryptography2 topics
5.1SCA 13

SCA is a check of the libraries and dependencies an application is built from: whether the versions in use have known vulnerabilities (CVEs) and under which licenses the code is distributed.

5.2CVE

CVE is the generally accepted identifier of a publicly known vulnerability in a specific product, for example CVE-2021-44228 (Log4Shell).

5.3Dependency versions

Pin versions in lock files, update deliberately, take packages from a trusted mirror.

5.4Supply chain

A supply chain attack compromises not the application itself but what and with what it is built: libraries, build tools, package repositories, updates.

Stage 5Dependencies4 topics
6.1Secure code standard 3

A short corporate document: what is mandatory in code and what is forbidden. The basis is the free OWASP Cheat Sheets and recommendations for your language. Secure code is a standard, not an option.

6.2Findings in the IDE and MR

See findings in the editor and in the merge request, before review and release. SAST on every merge request, not a report before release: fixing a line right away is cheaper than returning to it a month later.

6.3Security linters

The cheapest first step: security rules in a linter catch typical mistakes right as the code is written, for example eslint-plugin-security for JavaScript and bandit for Python.

6.4Code written by AI

AI writes code faster but does not know the security context. Its code goes through the same SAST, SCA and secret detection, dependencies only through your own repository, critical places get human review. Secrets and personal data are not sent in a prompt.

6.5False positives 1

A false positive is a scanner finding that is not actually a vulnerability: the data is already validated, the code is unreachable or the context makes the attack impossible.

6.6Quality gate 13

A Quality Gate is an automatic checkpoint in the pipeline: if the check results do not meet the policy, the build does not go further.

Stage 6Tools6 topics
7.1Labs 1

Breaking practice applications is the fastest way to understand a vulnerability. Free: OWASP Juice Shop and PortSwigger Web Security Academy; then HackTheBox, TryHackMe and CTFs.

7.2Safe failure

If an external service or a check fails, the system must deny, not let through (CWE-636). This applies to captcha, OAuth, antifraud and security steps in CI.

7.3Errors without details

Give the user a short message and put the details in the log. A stack trace in the response tells the attacker how the system is built.

7.4Logs without secrets

Log logins, access denials and money operations. Do not write passwords, tokens and excess personal data to the log.

Stage 7Failures and logs4 topics