Urgent.News

the world's headlines, one feed

Tech

The Insecure Default Was the Configuration

I was moving a pile of automation scripts into version control — years of accumulated cron jobs that had only ever existed on one machine — and ran a secret scan before the first commit. It found this, in two files: SERP_API_KEY = os . environ . get ( " SERP_API_KEY " , " a1b2c3d4… " ) A live API key, sitting in source, as the default argument. The fix is so obvious it barely counts as a…

A years-old set of automation scripts underwent a security audit, revealing a hardcoded API key embedded in source code. The scripts utilized the key through an os.environ.get() call, which reads an environment variable if present and falls back to a default value otherwise. The default was initially intended as a safety net, but in this case, it was silently serving as the primary configuration for the jobs, which ran unmodified for months.

The hardcoded key was removed, and the environment variable was populated with the correct value, restoring the system's functionality. However, this simple fix revealed a deeper issue: the scanner used to detect secrets based on patterns of entropy and known key prefixes was not effective at identifying passwords, which are created by humans and have distinct structural characteristics.

Additionally, the auditor overlooked other long strings in the codebase, such as verification keys and JSON Web Tokens, which were mistakenly deemed to be secrets due to their length and complexity. The lesson learned was that security scanning must employ multiple approaches - pattern recognition combined with understanding the context and function of the strings being evaluated, in order to accurately identify and address potential vulnerabilities.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written; read the original for the full account.

Read the original at dev.to →

More in Tech