Security Notes When Working on a Software Development Project
On this page
“Security is everyone’s responsibility.” – A familiar saying, but in the reality of a project, it is the thing most often forgotten.
In software projects today, security is not only the responsibility of the Security team but the responsibility of the entire development team, from Developer, DevOps, QA and project management through to the organisation. Most security incidents do not come from supremely sophisticated hackers; they start from basic human error: committing an API token to a public repository by mistake, sharing configuration files over email, opening a test port and forgetting to close it, or testing the system with real data and not deleting it afterwards.
For security to become a culture and a habit, it has to be integrated from the design stage and applied throughout the software development lifecycle (SDLC). This article analyses in detail the roles, the common risks, the supporting tools, best practices and how to prevent them, in order to build a software project that is genuinely secure.
1. Developer – Security responsibility in code
Developers are the front line of software security, because all data and system logic starts with code. One insecure line of code can lead to serious risk affecting the whole application.
-
Do not expose sensitive information
- Problem: Accidentally committing a
.env,appsettings.jsonorconfig.ymlfile containing a database password, API key or secret key to GitHub is one of the most common and most serious mistakes. - Solution:
- Use
.gitignorethoroughly to exclude configuration files. - Use environment variables on the local machine and in the CI/CD pipeline.
- Use professional secret managers such as AWS Secrets Manager, HashiCorp Vault, Azure Key Vault to store and manage sensitive information centrally and securely.
- Regularly scan the repository with tools such as GitGuardian or TruffleHog to detect credentials that were committed by accident.
- Use
- Problem: Accidentally committing a
-
Validate input data
- Problem: Trusting user input absolutely is a disaster. Both SQL Injection and Cross-Site Scripting (XSS) originate here.
- Solution:
- Server side: Always validate and sanitize data. Use Prepared Statements (Parameterized Queries) or an ORM (such as Hibernate, Eloquent) to prevent SQL Injection.
- Client & server side: Escape data before rendering it to HTML to prevent XSS. Modern frameworks (React, Vue, Angular) usually have automatic mechanisms, but you should not rely on them.
- API: Validate the schema of the request body (using libraries such as Joi, Yup, Pydantic).
-
Use secure libraries
- Problem: "Supply Chain Attack" — an attacker plants malicious code in a popular open-source library that you are using.
- Solution:
- Scan dependencies periodically with tools such as OWASP Dependency Check, Snyk, GitHub Dependabot. These tools warn you as soon as a new vulnerability appears in a library you are using.
- Prefer well-maintained libraries with a large community.
- Update (patch) immediately when a security fix is released.
-
Log properly
- Problem: Logging passwords, credit card numbers or JWT tokens turns the log file into a treasure chest for hackers.
- Solution:
- Never log sensitive information (PII - Personally Identifiable Information).
- Only return generic error messages to end users; do not expose detailed stack traces (which can reveal code and database structure) to the production environment.
-
Code review and security review
- Solution: Every Pull Request/Merge Request should be reviewed by at least one other person, against a specific security checklist. Combine this with Static Application Security Testing (SAST) tools such as SonarQube, Checkmarx to automate the search for potential vulnerabilities in the code.
2. DevOps / Infrastructure – Security responsibility for infrastructure and pipeline
-
Pipeline security (CI/CD)
- Problem: Hardcoding secrets in CI/CD scripts.
- Solution: Use the secret storage built into the CI/CD system (GitHub Secrets, GitLab CI Variables, Azure DevOps Secret Variables). Configure manual approval for the deploy step to the production environment.
-
Environment access control (Principle of Least Privilege)
- Solution:
- Developers only have read/write permission on the Dev environment.
- Only the CI/CD system and a small number of people (Team Lead) have permission to deploy to Production.
- Strictly avoid using root/service accounts with overly broad permissions. Apply Role-Based Access Control (RBAC) tightly.
- Solution:
-
Secure containers and infrastructure
- Solution:
- Scan container images before deploying with Trivy or Grype to find vulnerabilities.
- Do not run containers as the root user. Create a dedicated non-root user.
- Enable TLS/SSL for every connection. Configure Security Groups/Firewalls to allow traffic only from the sources that need it.
- Solution:
-
Monitoring and incident response
- Solution: Deploy monitoring systems (Prometheus, Datadog) and centralised logging (ELK Stack). Set up alerts for abnormal behaviour: repeated failed logins, sudden traffic spikes. Have an Incident Response Plan ready to handle incidents when they occur.
3. Project management – Security responsibility for process and people
-
Establish a security process
- Action: Make "Security Review" a mandatory item in the Definition of Done (DoD) of every user story. Create a simple, easy-to-understand security checklist for the whole team.
-
Managing people and access
- Action: Adopt Single Sign-On (SSO). Revoke access immediately when an employee changes team or leaves the company. Review access permissions quarterly.
-
Training and awareness
- Action: Hold internal sharing sessions on the OWASP Top 10 and how to recognise phishing emails. Encourage a culture of reporting mistakes without fear of punishment.
4. QA / Tester – Security responsibility for testing and data
-
Basic security testing
- Action: Play the attacker. Try entering script snippets (
<script>alert('XSS')</script>) into forms, or SQL special characters (' OR '1'='1) into the search box. Use tools such as OWASP ZAP to automate vulnerability scanning.
- Action: Play the attacker. Try entering script snippets (
-
Testing by user role
- Action: Ensure User A cannot view User B's information by changing the ID in the URL (Insecure Direct Object Reference - IDOR). Check the ordinary admin/user authorisation features thoroughly.
-
Environment testing
- Action: Never use real data (especially customer information) in the Staging/Test environment. Use generated fake data.
5. Organisation – Security responsibility for building culture and policy
-
Security policy and process
- Action: Build a clear Security Policy document covering passwords, data handling and incident response.
-
Periodic audit and assessment
- Action: Hire an independent third party to perform a Penetration Test at least once a year, for an objective and in-depth view.
-
"Security First" culture
- Action: Leadership must be the ones leading and championing the security culture. Reward the people who find serious vulnerabilities.
6. Threat Modeling – Analysing risk from the start
This is the process of identifying and assessing potential threats right from the start of the project.
- Step 1: Identify assets: Customer data, databases, API keys, source code.
- Step 2: Draw a Data Flow Diagram: Illustrate how data moves through the system.
- Step 3: List the threats: Use the STRIDE framework (Spoofing, Tampering, Repudiation, Information Disclosure, Denial of Service, Elevation of Privilege) for a comprehensive view.
- Step 4: Assess risk: For each threat, assess the level of damage (Impact) and the likelihood of occurrence (Likelihood) in order to prioritise what to handle first.
- Step 5: Plan mitigations: For example, the "Spoofing" threat is mitigated with strong authentication (MFA).
7. Secure Development Lifecycle (SDL) – the secure software development lifecycle
This is the framework that integrates security into each stage of the software lifecycle.
-
Stage 1: Planning & Design
- "Security by Design": Security must be a non-functional requirement from the outset. Perform Threat Modeling to understand the risks clearly.
- Apply secure design principles: "Principle of Least Privilege" (each component has only the minimum permission it needs), "Defense in Depth" (defence across multiple layers).
-
Stage 2: Implementation
- Secure Coding: Follow secure coding rules, use libraries that have been vetted.
- Automate checks: Integrate SAST (Static Analysis) and SCA (Software Composition Analysis) tools into the pipeline to automatically scan for code defects and dependency vulnerabilities.
-
Stage 3: Testing
- Security Testing: Combine several forms of testing: DAST (Dynamic Analysis) such as OWASP ZAP to scan the running application, manual Penetration Testing, and authorisation testing.
- QA & Security Collaboration: The QA team and the Security team (if there is one) work closely together to write test scenarios for attack situations.
-
Stage 4: Deployment
- Secure pipeline: Ensure the CI/CD pipeline is secured (secret management, approval step).
- Secure infrastructure: Configure infrastructure (cloud, containers) in a hardened way. Scan container images before deploying. Apply RBAC for Kubernetes and cloud services.
-
Stage 5: Maintenance & Operation
- Continuous monitoring: Use a SIEM (Security Information and Event Management) system to monitor and detect anomalies in real time.
- Vulnerability management: Continuously update patches for the OS, frameworks and libraries. Have a process for handling new vulnerability reports (CVE) quickly.
8. Useful Tips You Can Apply Right Away
- Turn on MFA (Multi-Factor Authentication) whenever possible: For both end-user accounts and internal accounts (cloud, repository, CI/CD). This is the strongest layer of protection against a lost password.
- The "never trust" principle: Apply Zero Trust in a practical way: do not trust the network, do not trust the user (verify them instead), and always validate input.
- Update, update and update: Do not postpone updating security patches for the OS, frameworks and libraries. Delay is an opportunity for attackers.
- Principle of Least Privilege: Apply it to everything: users, service accounts, database users, API permissions. Grant only the permission needed to do the job.
- Encrypt data: Encrypt data "at-rest" (while stored) and "in-transit" (while in transit - using TLS).
- Smart logging and monitoring: Do not just write logs — set up alerts for important events (such as logins from unfamiliar IPs, mass data deletion).
- Use fake/anonymized data for the dev/test environment: Minimise the risk of leaking real data.
- Have a Security Checklist for Pull Requests: For example: [ ] Input validated? [ ] No hardcoded secrets? [ ] Dependencies updated? [ ] Authorisation tested?
9. Other Important Notes to Remember
- Session and Token management:
- Set a reasonable timeout for sessions.
- Use JWT safely: set a short expiration time, use refresh tokens safely (stored securely, revocable).
- API security:
- Rate Limiting: Prevent DDoS or brute force attacks.
- Strong authentication: Use OAuth 2.0, API keys combined with a secret.
- Validate API input and output carefully.
- Data Protection:
- Masking/Anonymization: Hide part of sensitive data (for example, only showing the last 4 digits of a credit card).
- Secure deletion: When the data is no longer needed, delete it thoroughly.
- Separating Environments and Configuration:
- Configuration for Dev, Staging and Production must be completely separated, using different secrets and environment variables.
- Incident Response:
- Have a clear playbook ready: Who gets notified? How is the incident isolated? How are customers informed? What are the lessons learned?
- People are the decisive factor:
- Train people against Social Engineering. A single click on a phishing link can neutralise every technical layer of defence.
10. AI-assisted Coding – Security considerations when developing software with AI
With the spread of AI-assisted coding such as GitHub Copilot, ChatGPT, Tabnine or Codeium, using AI to suggest code increases productivity but also carries security risks of its own. Below are the important considerations:
-
Review code suggested by AI carefully
- AI can generate code that is not yet secure or that contains vulnerabilities (SQL Injection, XSS, hardcoded secrets).
- Do not copy-paste AI-suggested code directly into a production repository. Every line of code must be reviewed as carefully as code written by a developer.
-
Do not expose sensitive information
- Avoid pasting credentials, API keys, tokens or sensitive data into public AI (such as free ChatGPT).
- When you need to use AI with internal data, prefer local AI or enterprise AI that has security mechanisms and does not store data externally.
-
Audit AI-generated code
- All code generated by AI needs to be scanned with SAST, dependency scan and secret scan before merging.
- Pay particular attention to code related to input/output, logging, authentication and permissions.
-
Establish a policy for AI usage
- Set clear rules: which types of data may be used with AI, how suggested code is checked.
- Restrict AI tools' access to repos or production.
- Train developers to recognise prompt injection, and the risk of AI disclosing internal information.
-
Integrate into the CI/CD pipeline
- If you use AI to generate code or tests automatically, make sure the security check pipeline includes automated scan steps.
- Keep an audit trail so that the origin of AI-generated code can be traced if needed.
By applying these principles, you both take advantage of AI to speed up development and ensure a high level of safety and security for the project.
11. Conclusion
Security is a continuous journey, not a destination. It cannot be "added on" at the end of a project; it has to be "woven" into every thread of the development process.
- Developers write code with a security mindset.
- DevOps build secure infrastructure and monitor proactively.
- Management create the process and environment that encourage security.
- QA are the watchful eyes, checking every corner.
- The organisation builds a culture in which "security is everyone's responsibility".
Only when all of these pieces work together will your software product be genuinely resilient and worthy of trust in the face of increasingly sophisticated threats.
"Security isn’t something you build once. It’s something you maintain every single day."
Also available in Tiếng Việt Tiếng Việt →
— Keep reading
Related notes
AI-Native Security: Building a Proactive Defense System in the AI Era
For years, the software security process has usually relied on a fairly familiar model: developers write code, the CI/CD system runs security scanning tools, the security team assesses the results…
When an AI Agent Becomes a Security Hole
You hand an AI Coding Agent a very familiar task: “Fix this bug, update the tests and open a Pull Request.” The Agent starts working like any other day.
Understanding Zero Trust in 5 Minutes
If you work in technology, you have almost certainly heard of Zero Trust – a modern security model that helps stop hackers and protect important data.