Add MVC formatted output for early configuration errors

Problem

DAST configuration validation errors currently output generic, technical log messages that don't match the improved DAST console styling and are difficult for users to understand.

This issue is the MVC for Add clear error messaging when DAST template is... (#579000) • Hannah Baker • 18.6

Current error output

$ if [[ -f "environment_url.txt" ]]; then DAST_WEBSITE="${DAST_WEBSITE:-$(cat environment_url.txt)}"; export DAST_WEBSITE; fi
$ /analyze
2025-10-16T10:06:24.432 ERR MAIN  configuration validation failed error="the required field URL was not set"
2025-10-16T10:06:24.432 FTL MAIN  failed to initialize configuration: failed to create configuration: configuration validation failed

Issues with current output:

  • Generic log format doesn't match the improved DAST console styling
  • Not user-friendly or visually consistent with other DAST messages
  • No links to documentation for troubleshooting
  • Doesn't provide clear guidance on the issue

Proposed Solution

Implement formatted error output for early configuration validation failures that matches the styling of other DAST console messages.

Technical approach

  1. Create an errorformatter to handle early configuration errors (since scanSummaryObserver is not initialized at this stage)
  2. Introduce a ConfigValidationError type to distinguish between:
    • Early config/initialization errors (use FormatError)
    • Runtime scan errors (use scanSummaryObserver.NotifyFailure())
  3. Format errors with consistent styling (boxes, separators, proper structure)
  4. Include relevant documentation links

Expected output

For invalid configuration:

┌────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│                                               GitLab DAST                                              │
│                                        Dynamic Security Testing                                        │
└────────────────────────────────────────────────────────────────────────────────────────────────────────┘

DAST Scanner vdevelopment
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Failure Report:
   • Error: invalid DAST_TARGET_URL: h: failed to parse URL h

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Getting started guide: https://docs.gitlab.com/user/application_security/dast/browser/#getting-started
Troubleshooting guide: https://docs.gitlab.com/user/application_security/dast/browser/troubleshooting

Process finished with the exit code 1

For missing configuration:

┌────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│                                               GitLab DAST                                              │
│                                        Dynamic Security Testing                                        │
└────────────────────────────────────────────────────────────────────────────────────────────────────────┘

DAST Scanner vdevelopment
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Failure Report:
   • Error: the required field DAST_TARGET_URL was not set

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Getting started guide: https://docs.gitlab.com/user/application_security/dast/browser/#getting-started
Troubleshooting guide: https://docs.gitlab.com/user/application_security/dast/browser/troubleshooting

Process finished with the exit code 1

Benefits

  • Consistent styling with other DAST console messages
  • Professional, polished error output
  • Documentation links help users resolve issues faster
  • Better user experience during configuration failures

Implementation tasks

  • Create errorformatter for early configuration errors
  • Introduce ConfigValidationError type
  • Format missing field errors with styled output
  • Format invalid field errors with styled output
  • Add documentation links to error output
  • Test with missing required fields
  • Test with invalid configuration values
Edited by Hannah Baker