Blog (page 3)

Base64 shenanigans in Python

This error occurs when you try to base64 encode or decode a string instead of an appropriate bytes-like object. This is a common issue and originates from when Python changed some of its string mechanics from version 2 to 3. To solve this, make sure you are handling the casting correctly, summarized below. Encoding a String …

Switching Homebrew between x86 and ARM

When installing and configuring Homebrew on a MacBook that has an M1 / M2 (ARM) chip, you will need to have a separate version of Homebrew for any packages that rely on x86. Keep in mind, if you already have only installed Homebrew using the default (ARM) version, trying to compile anything that relies on …

Spring4Shell remediation guide

Two new (and unrelated) vulnerabilities (CVE-2022-22965) and (CVE-2022-22963) have been published at the same time, creating confusion and headaches for all involved trying to remediate them. It is important to understand that these two vulnerabilities are not related. They affect different libraries and require different vectors of attack. What exactly are these vulnerabilities? CVE-2022-22965 - identifies the ability …

AWS EMR Log4j2 workaround for CVE-2021-44228

Last updated: December 20, 2021 The following is a workaround in order to patch the CVE-2021-44228 Remote Code Execution (RCE) vulnerability inside of Amazon AWS’s EMR service using bootstrap scripts that have been provided by the AWS team. These remediation steps are also applicable to CVE-2021-45046. A short note on CVE-2021-44228 This vulnerability affects Log4j2 versions 2.15 …

Base64 Stream Examples in Java

The following examples use Apache’s Commons Codec library which is available on Maven Central by using the following dependency in your pom.xml file. Reading and Writing a Base64 String Example The following code will allow you to read or decode a Base64 encoded String in Java. This is useful for data that is short or limited in …

Enabling host verification in Netty

By default, Netty version 4 and lower are configured with Host verification disabled. While this is helpful during debugging or developing an application, it can become a security issue if brought in production. There are a number of steps involved in certificate verification, one of these is to compare the hostname of the client or …

Spring JdbcAggregateTemplate Example

Spring’s JdbcAggregateTemplate gives you more granular control over the operations that are being performed on your database. JdbcAggregateTemplate exposes operations that are used by Spring Repositories internally, allowing you to invoke database operations that would not otherwise be available using a standard JDBC Repository. This template can be useful for situations when you want to …