Skip to content

genAI for secure code in the Enterprise

Yureshwar Ravuri edited this page Jul 1, 2025 · 8 revisions

genAI can help with Security in 3 distinct and important areas.

  1. Secure Code - validations and input sanitisation (in addition to error handling and unit testing). Suggesting security focused libraries.
  2. Enabling and hardening of built-in security features of frameworks. (TBD)
  3. Hardening infrastructure configuration files like docker. ngnix etc. docker and ngnix
    1. genAi can also help configure WAF (Web Application Firewalls).

For this section, we will focus on incorporating security best practices right during coding i.e. 'shift left' for security.

Introduction

In today's enterprise software development landscape, integrating security practices into the development lifecycle is not only crucial but also challenging. Development teams often struggle to effectively incorporate security measures into their processes due to various factors such as the seniority of developers, their level of experience, awareness of best practices, and the difficulty in keeping up with the latest vulnerabilities. Security is also compromised to prioritise velocity of development and regular business pressures. This article delves into how genAi helps us overcome these challenges to a large extent.

Traditional Challenges of Integrating Security into Enterprise Software Development

Challenge 1: Varying Seniority Levels and Experience

Enterprise development teams often consist of developers with varying levels of seniority and experience. Junior developers may lack the necessary security knowledge and expertise, while senior developers may be more focused on delivering features and meeting deadlines. This disparity in seniority and experience can lead to inconsistencies in the application of security practices.

Challenge 2: Limited Awareness of Security Best Practices

Many developers, regardless of their seniority, may have limited awareness of security best practices. They may not be familiar with secure coding techniques, common vulnerabilities, or the latest security standards and frameworks.

Challenge 3: Difficulty in Keeping Up with Latest Vulnerabilities

The constantly evolving nature of the cybersecurity landscape makes it challenging for developers to stay informed about the latest vulnerabilities and security risks. With new threats emerging regularly, developers may struggle to keep their knowledge up to date and apply appropriate mitigation techniques.

Challenge 4: Balancing Security and Development Priorities

In the face of tight deadlines and pressure to deliver features quickly, developers may find it challenging to prioritize security considerations. The balance between meeting development goals and ensuring robust security can be difficult to achieve.

Incorporating genAI overcomes most of these challenges at a fraction of traditional practices. Asking genAI to incorporate security best practices.

Prompt that can be used for Security

Assume the role of a seasoned software architect specializing in Node.js, JavaScript, React and Typescript security. Analyze the modified functionality, which includes error handling, input validation, and sanitization, with an exclusive focus on security improvements.

Identify and mitigate potential security vulnerabilities, such as injection attacks (SQL, NoSQL, command, and XSS), insecure data handling, improper access controls, and inadequate cryptographic implementations. Ensure that input validation and sanitization are enforced against common attack vectors.

Review how security-related errors are handled within the existing error-handling framework. Ensure that security exceptions are properly classified, logged securely without exposing sensitive information, and propagated safely without leaking internal details.

Limit your analysis strictly to security improvements related to the modified functionality. Do not provide recommendations on performance optimization or documentation.

Provide a detailed report outlining the identified security issues and recommended fixes. At the end of the analysis, combine all security-related changes into a structured final output, presenting the updated secure code or modifications in a clear, easy-to-implement format.

Examples:

  1. Security hardening of the running example of aadhar "generate OTP" method
  2. TBD - Given the importance of security AND the magical benefits of genAI, we will add more real-world examples as and when we get time to document them.
    1. TBD - Secure serialisation and deserialisation of objects

Clone this wiki locally