Cybersecurity4 min read
Security by design, from the first commit
Security is cheapest when it is built in from day one. A practical baseline for new projects: threat modelling, secrets, dependency scanning, least privilege and the UAE PDPL.
Written by the OddBit Tech team
Security added after launch is expensive. Retrofitting authentication, rotating credentials that leaked months ago and untangling over-privileged service accounts all cost far more than getting the defaults right at the start. Security by design means the secure way is the default way, from the first commit.
It does not require a large security team. It requires a few habits set early and enforced by tooling rather than memory. Here is the baseline we recommend for any new project:
- A short threat model for the first architecture, stored with the code.
- A secrets manager, with secret scanning in pre-commit hooks and in CI.
- Dependency and container image scanning on every pull request, with an agreed policy on what blocks a merge.
- Branch protection and required review on the main branch.
- Least-privilege roles, multi-factor authentication and no shared accounts.
- Central logs for sign-ins and administrative actions, kept long enough to investigate an incident.
Start with a threat model
Before writing much code, spend an hour or two with the people building the system. Sketch the main components and data flows, mark where trust changes, such as between the internet and your API, and list what is worth protecting: personal data, credentials, payment details and intellectual property.
Then work through four plain questions. What are we building? What could go wrong? What will we do about it? Did we do enough? Prompts such as spoofing, tampering, information disclosure and privilege escalation help with the second question. Record the answers next to the code and revisit them whenever the architecture changes.
Keep secrets out of code
Treat any credential committed to a repository as compromised, even in a private repository, because Git history lives on in every clone, fork and backup. Store secrets in a dedicated secrets manager, inject them at runtime and give each environment its own.
Better still, avoid long-lived secrets where you can. Workload identity and short-lived tokens, such as federated credentials between your CI system and your cloud provider, remove whole categories of leaks. Add secret scanning to pre-commit hooks and CI. If a secret does leak, rotate it first; deleting the commit is not enough.
The cheapest vulnerability to fix is the one that never gets committed.
Know what you ship
Much of the code in a modern application comes from open-source packages and base images you did not write. Treat them as part of your attack surface. Lock dependency versions, scan them on every pull request and use automated update tools so patches arrive as small, reviewable changes rather than painful upgrades.
Scan container images as well as application dependencies, and generate a software bill of materials (SBOM) for each release so you can quickly answer 'are we affected?' when a new vulnerability is announced. Agree on what blocks a merge. Blocking on everything creates alert fatigue; blocking on nothing turns scanning into decoration.
Least privilege for people and machines
Start from deny by default. Give people and services only the permissions their task needs, in the environments where they need them. Use separate accounts or projects for production, require multi-factor authentication everywhere and retire shared admin logins. Elevated access should be requested, time-limited and logged.
Define permissions in infrastructure as code so they are reviewed in pull requests like any other change. Review access on a schedule, and remove it when people change roles or leave. Least privilege is not a one-time setup; it erodes unless someone checks.
Personal data and the UAE PDPL
If your system handles personal data about people in the UAE, the Personal Data Protection Law (Federal Decree-Law No. 45 of 2021) is likely to apply. It expects personal data to be processed for clear purposes, limited to what is necessary, kept accurate and protected with appropriate technical and organisational measures.
It also gives individuals rights over their data, such as access, correction and erasure, and requires breaches that put personal data at risk to be reported to the UAE Data Office and, in some cases, to the people affected.
Security by design maps well onto these expectations. The threat model is where you record what personal data you hold and why. Collecting less reduces what can leak. Least privilege limits who can see it. Good logging lets you detect a breach and report it with facts rather than guesses.
Some organisations fall under different rules, such as companies in the DIFC and ADGM free zones, which have their own data protection laws, and sectors like health and banking that have specific legislation. Treat this as engineering guidance, not legal advice, and involve your legal adviser early.
Done this way, compliance stops being a separate project. The same automated baseline that protects your systems also produces the evidence that auditors and customers ask for, and it runs on every change without anyone needing to remember.