This is article 8 of 10 in the Mercado Tech Brasil series on solutions architecture. The topic is security by design: treating protection as a requirement from the very first sketch, not as a rushed review on the eve of go-live.
Why security by design costs less
Fixing a security flaw in the design means erasing a few lines on a diagram. Fixing it after the solution is in production may require changing integrations, migrating data and explaining what happened to customers and to Brazil's National Data Protection Authority. The earlier security comes in, the smaller the effort and the stronger the protection.
Principles of security by design in solutions architecture
Least privilege
Every person, service and integration gets only the permissions it needs. The bot that reads orders in the ERP should not be able to change customer records. If a credential leaks, the damage stays limited.
Defense in depth
No control is perfect. Combine strong authentication with MFA, authorization checked on every call, network segmentation, encryption in transit and at rest, and monitoring. If one layer fails, another holds.
Secure defaults and minimal surface
The default should be closed: ports, endpoints and features are only available when there is a reason. Every component exposed to the internet is one more thing to protect, update and monitor.
Secrets out of the code
Passwords, API keys and certificates should never live in the source code or the repository. They are injected into the environment at runtime, preferably from a secrets vault, with periodic rotation. Each environment, whether development, staging or production, has its own credentials, and real production data is not copied into testing without anonymization.
Privacy and the LGPD from the design stage
The LGPD asks for personal data protection to be considered from conception. In the architecture, that translates into objective questions:
- Is this personal data really necessary for the flow?
- Who can access it, and is that access logged?
- How long will it be kept, and how will it be deleted?
- Does it leave Brazil or pass through vendors? Under what contract?
Collecting less is the most efficient way to protect.
Threat modeling in solutions architecture
Threat modeling is a structured conversation about what could go wrong. With the solution diagram in hand, the team walks through each data flow and asks: could someone impersonate another person? Change data without authorization? Deny having performed an operation? See what they should not? Make the service unavailable? Gain extra permissions? Each answer becomes a control or an accepted, recorded risk.
Other safeguards are built into the delivery process itself: automated scanning for vulnerable dependencies, code review, per-client request limits on APIs, protection against abusive traffic at the edge and backups tested with periodic restores.
In practice
As an automation consultant focused on cybersecurity, I bring the security team and the data protection officer into the very first architecture workshop. A short threat-modeling session per critical flow, secrets in a vault and minimal permissions for every bot and integration are the minimum I get agreed before any automation goes into production.
Translated from the original in Portuguese. Read the original.