# recorded: semgrep 1.95.0, rulesets p/python and p/security-audit, run 2026-11-19 against nb-support-api with pull request 42 applied
# This is the reference output sast.sh prints when semgrep is not installed. The live tool reports the same two results.

┌──── ○○○ ────┐
│ Semgrep CLI │
└─────────────┘

Scanning 5 files with 214 python rules.

  app.py
  ❯❯❱ python.lang.security.audit.logging.logging-of-raw-user-input
        User-controlled request data is written to the application log without
        neutralization. A crafted value can forge or inject log records (CWE-117,
        Improper Output Neutralization for Logs). Encode or strip newlines before
        logging request fields.

          105┆ logger.info("search query: " + q)

  db.py
  ❯❯❱ python.lang.security.audit.formatted-sql-query.formatted-sql-query
        A request parameter is concatenated into a SQL statement. Tainted input
        reaching an ORDER BY clause can allow SQL injection (CWE-89). Use a
        parameterized query or a validated identifier.

           67┆ sql = "SELECT title, category, year FROM resources WHERE title LIKE ? ORDER BY " + sort

┌──────────────┐
│ Scan Summary │
└──────────────┘
Findings: 2 (2 blocking)
  Rules run: 214
  Targets scanned: 5
  High severity: 1 (logging-of-raw-user-input)
  Medium severity: 1 (formatted-sql-query)

Note: Semgrep reports a pattern. It does not run the code. It cannot tell whether the ORDER BY
value is constrained before it reaches the query, so the formatted-sql-query result requires
reproduction before it becomes a finding.

# TRAINING MATERIAL. Northbridge Technical College, its people, and its systems are fictional.
