<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Erick Javier SALINAS CONDORI</title>
    <description>The latest articles on DEV Community by Erick Javier SALINAS CONDORI (@erick_javiersalinascond).</description>
    <link>https://dev.to/erick_javiersalinascond</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2169217%2Ff24c823a-8a7e-44d8-be31-c73968006283.png</url>
      <title>DEV Community: Erick Javier SALINAS CONDORI</title>
      <link>https://dev.to/erick_javiersalinascond</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/erick_javiersalinascond"/>
    <language>en</language>
    <item>
      <title>Static Application Security Testing with Checkmarx: A Comprehensive Overview</title>
      <dc:creator>Erick Javier SALINAS CONDORI</dc:creator>
      <pubDate>Sat, 05 Oct 2024 07:02:56 +0000</pubDate>
      <link>https://dev.to/erick_javiersalinascond/static-application-security-testing-with-checkmarx-a-comprehensive-overview-37a0</link>
      <guid>https://dev.to/erick_javiersalinascond/static-application-security-testing-with-checkmarx-a-comprehensive-overview-37a0</guid>
      <description>&lt;p&gt;Introduction&lt;br&gt;
In an era where security breaches can have catastrophic consequences, incorporating Static Application Security Testing (SAST) tools into the development lifecycle is crucial. One powerful tool for this purpose is Checkmarx. This article explores Checkmarx, its features, how to set it up, and how it can enhance the security of applications.&lt;/p&gt;

&lt;p&gt;What is Checkmarx?&lt;br&gt;
Checkmarx is a leading SAST tool that helps developers identify and remediate security vulnerabilities in their codebase. It scans source code for security weaknesses and provides actionable recommendations, making it a valuable asset in a secure development lifecycle.&lt;/p&gt;

&lt;p&gt;Key Features of Checkmarx&lt;br&gt;
Comprehensive Scanning: Checkmarx supports multiple programming languages, allowing for a wide range of applications to be analyzed.&lt;br&gt;
Integration Capabilities: It integrates seamlessly with various CI/CD tools, enabling automated security checks throughout the development process.&lt;br&gt;
Detailed Reporting: Provides in-depth reports with insights on vulnerabilities, including their severity and potential impact.&lt;br&gt;
Setting Up Checkmarx&lt;br&gt;
Getting started with Checkmarx involves the following steps:&lt;/p&gt;

&lt;p&gt;Installation: Checkmarx is a commercial tool, so you'll need to acquire a license. After that, you can install it on-premises or use their cloud version.&lt;/p&gt;

&lt;p&gt;Configuration: Configure your application settings within the Checkmarx platform. This includes specifying the programming languages and frameworks used in your project.&lt;/p&gt;

&lt;p&gt;Running a Scan: To initiate a scan, simply upload your source code or link your repository. Checkmarx will analyze the code for vulnerabilities.&lt;/p&gt;

&lt;p&gt;Reviewing Results: After the scan is complete, Checkmarx will provide a detailed report, categorizing issues by severity. You can then prioritize remediation efforts based on the report’s findings.&lt;/p&gt;

&lt;p&gt;Example Application: Scanning a Java Application&lt;br&gt;
Let’s see how Checkmarx can be applied by scanning a simple Java application.&lt;/p&gt;

&lt;p&gt;Create a Sample Java App:&lt;/p&gt;

&lt;p&gt;import java.security.MessageDigest;&lt;/p&gt;

&lt;p&gt;public class HashingExample {&lt;br&gt;
    public String hashInput(String input) throws Exception {&lt;br&gt;
        MessageDigest md = MessageDigest.getInstance("SHA1");&lt;br&gt;
        byte[] messageDigest = md.digest(input.getBytes());&lt;br&gt;
        return bytesToHex(messageDigest);&lt;br&gt;
    }&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;private String bytesToHex(byte[] bytes) {
    StringBuilder sb = new StringBuilder();
    for (byte b : bytes) {
        sb.append(String.format("%02x", b));
    }
    return sb.toString();
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;Scan the Application: Upload the source code to Checkmarx and run the scan. The tool will analyze the code for common vulnerabilities, including the insecure use of SHA1.&lt;/p&gt;

&lt;p&gt;Review the Results: Checkmarx will flag the use of SHA1 as a vulnerability and suggest replacing it with a more secure hashing algorithm like SHA256.&lt;/p&gt;

&lt;p&gt;Benefits of Using Checkmarx&lt;br&gt;
Early Detection: By identifying vulnerabilities early in the development cycle, Checkmarx helps reduce the cost and effort of remediation.&lt;/p&gt;

&lt;p&gt;Enhanced Security Awareness: The detailed reports educate developers about secure coding practices, fostering a culture of security.&lt;br&gt;
Integration with Development Workflow: Seamless integration with CI/CD tools ensures that security becomes a fundamental part of the development process.&lt;/p&gt;

&lt;p&gt;Conclusion&lt;br&gt;
Checkmarx is a robust SAST tool that significantly enhances the security posture of applications. By incorporating Checkmarx into your development lifecycle, you can proactively identify and address security vulnerabilities, resulting in more secure software. &lt;/p&gt;

</description>
    </item>
    <item>
      <title>Applying the Data Mapper Pattern in a Customer Relationship Management System</title>
      <dc:creator>Erick Javier SALINAS CONDORI</dc:creator>
      <pubDate>Sat, 05 Oct 2024 06:53:14 +0000</pubDate>
      <link>https://dev.to/erick_javiersalinascond/implementing-the-data-mapper-pattern-in-a-customer-management-system-3goc</link>
      <guid>https://dev.to/erick_javiersalinascond/implementing-the-data-mapper-pattern-in-a-customer-management-system-3goc</guid>
      <description>&lt;p&gt;Introduction&lt;br&gt;
In the realm of enterprise application development, Martin Fowler's Patterns of Enterprise Application Architecture provides valuable patterns to tackle common challenges. One such pattern, the Data Mapper, effectively separates domain logic from database access, enhancing maintainability and testability. This article presents a real-world example of implementing the Data Mapper pattern within a Customer Management System.&lt;/p&gt;

&lt;p&gt;Overview of the Data Mapper Pattern&lt;br&gt;
The Data Mapper pattern serves to map objects in an application’s domain model to database records. By providing a layer of separation, it ensures that domain objects remain unaware of the database structure or data storage mechanisms. This approach leads to cleaner, more maintainable code.&lt;/p&gt;

&lt;p&gt;Real-World Example: Customer Management System&lt;br&gt;
Step 1: Define the Domain Model First, we establish a Customer class that embodies our domain model:&lt;/p&gt;

&lt;p&gt;public class Customer&lt;br&gt;
{&lt;br&gt;
    public int Id { get; private set; }&lt;br&gt;
    public string FirstName { get; private set; }&lt;br&gt;
    public string LastName { get; private set; }&lt;br&gt;
    public string Email { get; private set; }&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public Customer(int id, string firstName, string lastName, string email)
{
    Id = id;
    FirstName = firstName;
    LastName = lastName;
    Email = email;
}

public void UpdateEmail(string newEmail)
{
    Email = newEmail;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;Step 2: Create the Data Mapper Next, we create the CustomerDataMapper, responsible for handling database interactions:&lt;/p&gt;

&lt;p&gt;using System.Data.SqlClient;&lt;/p&gt;

&lt;p&gt;public class CustomerDataMapper&lt;br&gt;
{&lt;br&gt;
    private readonly string _connectionString;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public CustomerDataMapper(string connectionString)
{
    _connectionString = connectionString;
}

public Customer FindById(int id)
{
    using (var connection = new SqlConnection(_connectionString))
    {
        connection.Open();
        var command = new SqlCommand("SELECT Id, FirstName, LastName, Email FROM Customers WHERE Id = @Id", connection);
        command.Parameters.AddWithValue("@Id", id);

        using (var reader = command.ExecuteReader())
        {
            if (reader.Read())
            {
                return new Customer(
                    (int)reader["Id"],
                    reader["FirstName"].ToString(),
                    reader["LastName"].ToString(),
                    reader["Email"].ToString()
                );
            }
        }
    }
    return null;
}

public void Insert(Customer customer)
{
    using (var connection = new SqlConnection(_connectionString))
    {
        connection.Open();
        var command = new SqlCommand(
            "INSERT INTO Customers (FirstName, LastName, Email) VALUES (@FirstName, @LastName, @Email); SELECT SCOPE_IDENTITY();",
            connection);

        command.Parameters.AddWithValue("@FirstName", customer.FirstName);
        command.Parameters.AddWithValue("@LastName", customer.LastName);
        command.Parameters.AddWithValue("@Email", customer.Email);

        var id = Convert.ToInt32(command.ExecuteScalar());
        typeof(Customer).GetProperty("Id").SetValue(customer, id, null);
    }
}

public void Update(Customer customer)
{
    using (var connection = new SqlConnection(_connectionString))
    {
        connection.Open();
        var command = new SqlCommand(
            "UPDATE Customers SET FirstName = @FirstName, LastName = @LastName, Email = @Email WHERE Id = @Id",
            connection);

        command.Parameters.AddWithValue("@Id", customer.Id);
        command.Parameters.AddWithValue("@FirstName", customer.FirstName);
        command.Parameters.AddWithValue("@LastName", customer.LastName);
        command.Parameters.AddWithValue("@Email", customer.Email);

        command.ExecuteNonQuery();
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;Step 3: Utilizing the Data Mapper in Business Logic The application can now utilize the CustomerDataMapper to handle database interactions seamlessly:&lt;/p&gt;

&lt;p&gt;public class CustomerService&lt;br&gt;
{&lt;br&gt;
    private readonly CustomerDataMapper _customerDataMapper;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public CustomerService(string connectionString)
{
    _customerDataMapper = new CustomerDataMapper(connectionString);
}

public Customer GetCustomerById(int id)
{
    return _customerDataMapper.FindById(id);
}

public void RegisterNewCustomer(string firstName, string lastName, string email)
{
    var customer = new Customer(0, firstName, lastName, email);
    _customerDataMapper.Insert(customer);
}

public void UpdateCustomerEmail(int customerId, string newEmail)
{
    var customer = _customerDataMapper.FindById(customerId);
    if (customer != null)
    {
        customer.UpdateEmail(newEmail);
        _customerDataMapper.Update(customer);
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;Benefits of Using the Data Mapper Pattern&lt;br&gt;
Separation of Concerns: The domain model remains independent of database details, promoting cleaner code.&lt;br&gt;
Testability: Allows for unit testing of the domain model without a database connection.&lt;br&gt;
Scalability: Changes in the database schema do not directly affect the domain model.&lt;/p&gt;

&lt;p&gt;Conclusion&lt;br&gt;
The Data Mapper pattern effectively decouples domain logic from database access, leading to more maintainable, testable, and scalable code. This pattern proves particularly useful in applications with complex domain logic, making it a valuable tool for enterprise developers.&lt;/p&gt;

</description>
      <category>datamapper</category>
      <category>architecture</category>
      <category>enterprisedevelopment</category>
    </item>
  </channel>
</rss>
