CtrlK
BlogDocsLog inGet started
Tessl Logo

golikovichev/secure-log2test

Turn a Kibana JSON log export into a runnable pytest suite using the secure-log2test CLI. Use when the user has a Kibana or Elasticsearch JSON export of API traffic and wants a regression suite from production logs, when extracting test cases from staging traffic, when scrubbing auth headers or secret-looking body fields before logs leave the laptop, when bridging Kibana-captured requests into a pytest-based suite for CI, when the user mentions Kibana logs, Elasticsearch JSON export, log-to-test conversion, log replay tests, auth header redaction, PII in logs, or regression tests from production traffic.

92

1.00x
Quality

100%

Does it follow best practices?

Impact

93%

1.00x

Average score across 2 eval scenarios

SecuritybySnyk

Passed

No known issues

Overview
Quality
Evals
Security
Files

task.mdevals/scenario-2/

API Traffic Regression Suite with Custom Redaction

Background

Your team has captured a week of staging API traffic from Kibana and wants to turn it into a pytest regression suite before the next release. The ops security policy requires that any generated test files never contain the literal string ***REDACTED*** — instead, the team's internal convention is to use [SCRUBBED] as the placeholder for sanitized credentials, so that grep searches for the old default marker still come back clean.

A Kibana Elasticsearch JSON export has already been provided inline below. The export contains a mix of API calls: some use JSON request bodies (e.g. creating a user record or updating a profile), and one uses a plain-text body (a status update). Several requests carry sensitive headers such as Authorization, X-Api-Key, and Cookie.

Your Task

Install the secure-log2test CLI (available on PyPI) and use it to convert the log export into a pytest module. The generated file must use [SCRUBBED] as the redaction placeholder throughout — not the tool's default value.

Write the generated test file to tests_generated.py.

After generation, inspect the file and write a short analysis to analysis.md covering:

  • How many test functions were generated and whether the count matches the number of log entries
  • Whether [SCRUBBED] appears throughout (and the default placeholder does not)
  • What import statements appear at the top of the file and what additional files or configuration, if any, would be needed to run pytest on it
  • How the test function names are structured (include 2–3 example names from the file)
  • How request bodies are handled for the JSON-body requests vs. the plain-text body request (describe the differences in the generated code)
  • How string values sourced from the original log entries are represented in the Python source (e.g. are they raw strings, escaped, quoted in a particular way?)

Output Files

  • tests_generated.py — the generated pytest suite
  • analysis.md — your written analysis of the generated file's structure and contents

Provided input file: kibana_export.json

The export referenced above is provided inline here (no separate file is shipped):

{
  "hits": {
    "hits": [
      {
        "_source": {
          "method": "POST",
          "url": "/api/v1/users",
          "status": 201,
          "headers": {
            "Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.secret",
            "Content-Type": "application/json",
            "X-Request-ID": "req-001"
          },
          "body": {"name": "Alice Smith", "email": "alice@example.com", "role": "editor"}
        }
      },
      {
        "_source": {
          "method": "GET",
          "url": "/api/v1/products?category=electronics&sort=price",
          "status": 200,
          "headers": {
            "X-Api-Key": "sk-prod-abc123def456",
            "Accept": "application/json"
          }
        }
      },
      {
        "_source": {
          "method": "PUT",
          "url": "/api/v1/orders/42/status",
          "status": 200,
          "headers": {
            "Authorization": "Bearer token-xyz-789",
            "Content-Type": "text/plain"
          },
          "body": "shipped"
        }
      },
      {
        "_source": {
          "method": "DELETE",
          "url": "/api/v1/sessions/abc-def-ghi",
          "status": 204,
          "headers": {
            "Cookie": "session_id=secret-session-value-123",
            "Accept": "*/*"
          }
        }
      },
      {
        "_source": {
          "method": "PATCH",
          "url": "/api/v1/users/99/profile",
          "status": 200,
          "headers": {
            "Authorization": "Bearer patch-token-secret",
            "Content-Type": "application/json"
          },
          "body": {"bio": "Senior developer", "location": "Berlin", "password": "s3cr3tp@ss"}
        }
      }
    ]
  }
}

CHANGELOG.md

CONTRIBUTING.md

README.md

REFERENCE.md

RELEASING.md

requirements.txt

SECURITY.md

SKILL.md

tessl.json

tile.json