Skip to content

fix(config): normalize api_endpoint to strip trailing slashes#125

Merged
ashishkurmi merged 2 commits into
step-security:mainfrom
swarit-stepsecurity:swarit/fix/normalize-api-endpoint
May 29, 2026
Merged

fix(config): normalize api_endpoint to strip trailing slashes#125
ashishkurmi merged 2 commits into
step-security:mainfrom
swarit-stepsecurity:swarit/fix/normalize-api-endpoint

Conversation

@swarit-stepsecurity
Copy link
Copy Markdown
Member

Every backend call composes URLs as fmt.Sprintf("%s/v1/...", APIEndpoint, ...). A user-supplied api_endpoint with a trailing slash would compose to "//v1/..." — some gateways tolerate it, others return 403/500. Customers hit this in production with a bootstrap.json that had a trailing slash in the URL; removing the slash made requests start returning 200.

Normalize once at the config boundary (Load() reads, save() writes) so:

  • existing config.json files with a trailing slash are forgiven without re-running configure
  • new configs written via inline flags or --from-file are sanitised before persistence
  • every URL-building callsite in telemetry/run_status/aiagents stays as-is

What does this PR do?

Type of change

  • Bug fix
  • Enhancement
  • Documentation

Testing

  • Tested on macOS (version: ___)
  • Binary runs without errors: ./stepsecurity-dev-machine-guard --verbose
  • JSON output is valid: ./stepsecurity-dev-machine-guard --json | python3 -m json.tool
  • No secrets or credentials included
  • Lint passes: make lint
  • Tests pass: make test

Related Issues

swarit-stepsecurity and others added 2 commits May 29, 2026 23:20
Every backend call composes URLs as fmt.Sprintf("%s/v1/...", APIEndpoint, ...).
A user-supplied api_endpoint with a trailing slash would compose to
"//v1/..." — some gateways tolerate it, others return 403/500. Customers
hit this in production with a bootstrap.json that had a trailing slash
in the URL; removing the slash made requests start returning 200.

Normalize once at the config boundary (Load() reads, save() writes) so:
- existing config.json files with a trailing slash are forgiven without
  re-running configure
- new configs written via inline flags or --from-file are sanitised before
  persistence
- every URL-building callsite in telemetry/run_status/aiagents stays as-is
@ashishkurmi ashishkurmi merged commit 4adfd33 into step-security:main May 29, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants