Skip to content

Product1 publisher3 min readPublished

An Airflow weather pipeline goes green only after its security audit task passes

A devops.com SecMLOps experiment adds encrypted secrets, pattern-checked inputs and SHA-256 hashing to an Apache Airflow pipeline, then lets a final audit task decide whether the run counts as done.

The Product Desk · Product desk

Illustration accompanying An Airflow weather pipeline goes green only after its security audit task passes

What happened

  • devops.com published a SecMLOps experiment that extends a simple Apache Airflow weather pipeline with DevSecOps-style controls over secrets, runtime inputs, external calls, artifact integrity and audit evidence.
  • The underlying workflow collects weather data from OpenWeatherMap, stores raw JSON, generates CSV datasets, trains regression models, selects the best one and saves a model artifact.
  • The API key is loaded from Airflow Variables instead of being written in Python source or committed to GitHub, and in the validated run those Variables are encrypted with Fernet.
  • The selected model is hashed with SHA-256 and paired with a metadata report recording its name, score, features, training row count and timestamp.
  • The workflow reaches its final success state only once a security audit task at the end of the DAG has passed, putting the audit inside the pipeline instead of in an external checklist.

Compiled by The Product DeskSomething wrong?How this is made

Why it matters

  • decision Once the audit is the last node, a green run becomes a claim about files on disk, and each team has to decide whether missing evidence fails the run outright or only warns the owner.
  • cost Every one of the added checks is another way a scheduled run stops overnight, and the on-call engineer absorbs that cost before the model's owner sees any benefit from the evidence.
  • exposure Taking the key out of source code changes who can reach it: repo access is no longer enough, and Airflow access or the Fernet key is what you control now.
  • constraint A per-run artifact identity still stops short of run-to-run lineage, so a team that needs to answer which dataset trained which deployed model has to build or buy a registry anyway.

Each added control sits at the point where bad input would otherwise pass through. The city list is a runtime variable, and the DAG checks those values against an expected pattern before any of them become an API call or a filename [5]. At the external boundary there is a timeout and an explicit status check, so a failing call stops the task instead of quietly handing corrupted inputs to everything downstream [6]. Empty CSV files are rejected at the transformation step, ahead of training, which keeps a scheduled run from fitting a model to nothing after an upstream problem [7].

What the audit asserts is narrower than the word suggests. devops.com describes the task as verifying the expected files and producing a security_audit.json report [10]. Presence of a file is a weaker statement than a match between the bytes on disk and the SHA-256 hash recorded beside them, and a team copying this pattern has to decide which of the two it wants at the end of its DAG. The article is candid about a related limit, calling the metadata report "not a full model registry" while crediting it with giving the artifact a verifiable identity [9].

Counting the takeaway list, the experiment adds six controls and the audit task on top of the base pipeline [14]. Seven new places for a run to fail. A pipeline that previously broke on API errors can now break on a malformed city string, an empty dataset or a missing evidence file. I think the exchange is worth making, because a run that stops before training costs less than a model trained on an empty CSV and then read by whatever consumes it.

devops.com wrote "A green DAG is not enough. A task can succeed while still producing an untrusted artifact" [11]. The failure modes the article puts behind such a run are specific: a mishandled API key, malformed runtime values, incomplete data from the external API, a model saved without metadata, a pipeline with no evidence except its own success state [12]. That last one is the version most teams are living with, and it is the one the audit node addresses directly.

The evidence here is a single experiment, labelled Experiment 13 SecMLOps Airflow Weather Pipeline, presented through code listings and figures including Airflow cluster activity [16]. The article does not report how much the added tasks cost in runtime [17]. So an engineer proposing this on Monday is arguing from failure modes, not from measured overhead, and should expect the platform team to ask what the extra tasks do to the schedule.

The part worth borrowing is a two-question pass over your own DAG. For each task, ask what a zero exit code actually proves about that task's output, and ask whether anything downstream would notice if the honest answer were "nothing". The tasks where success only means the code did not raise, and where no later step checks, are the ones that need an assertion inside the task. In the weather pipeline the assertion is one JSON file the DAG will not finish without [10].

What to watch

  • Whether a later version of the audit task recomputes the SHA-256 hash and compares it with the recorded one.
  • Whether anyone publishes this pattern with runtime overhead numbers from a production-scale DAG rather than a single weather pipeline.
  • Whether the metadata report grows into registry entries that answer lineage questions across runs.
Loading claim ledger
Loading source directory links
Loading share composer
Loading topic controls
Loading related stories