← All work

Automating firewall policy change review

A browser automation that walks a firewall policy review queue, opens each revision and saves screenshot evidence with a step log.

Problem

Firewall policy changes reach reviewers as tickets in a policy management platform. Reviewing one means signing in, opening the review queue, following a ticket’s link to the policy revision, opening the list of changes, finding the rule the ticket is about, and capturing it as evidence. Each step is easy. Across a queue the work is slow and the evidence inconsistent: different crops, different file names, no record of what was looked at.

Approach

Treat the review as a pipeline that leaves a trace at every stage, not as a series of clicks.

How it works

A review that leaves a trace at every step

A run starts with one command. Settings come from environment variables or a local environment file, and flags override them. A --config option prints the effective settings, showing the password only as set or not set.

  1. Start a Chromium-based browser, optionally headless. If its driver fails, fall back to the other supported browser.
  2. Sign in, locating the username, password and submit controls through ordered selector lists.
  3. Open the review module and read the first two tickets in the queue.
  4. For each ticket, extract the rule identifier and revision link, open the revision in a new tab and click the control that shows changes.
  5. Find the row whose rule matches the ticket exactly, scroll to it and save an element screenshot named with the ticket position, the rule identifier and a timestamp. With no match, save a full-page screenshot.
  6. Close the tab, return to the queue, and list every file captured.

Every step writes a timestamped line to the console and a log file. A companion script reads a revision’s change-log text and lists which members were added and removed, so a reviewer reads the difference, not two long lists.

Results

Lessons