Provider error text repeats a secret embedded in the base URL

Open Beginner friendly
#2,136 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
82/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
rust
Domain
backend

Research direction

Read crates/formless-core/src/errors.rs around explain, then compare URL sanitization in crates/formless-core/src/rate_limits.rs (display_endpoint) and the provider identity check in tokens.rs. Update the host and unreachable URL handling to remove userinfo, query, and fragment while preserving path and port; verify the listed credential, localhost, Groq, and plain localhost cases, including messages_name_the_next_step.

Written by the indexing model from the issue text.

Description

What is wrong

Provider error explanations repeat a secret that was embedded in provider.base_url.

For https://user:[email protected]/v1?api_key=secret:

  • An auth failure says The API key was rejected by user:[email protected].
  • A rate limit says user:[email protected] is rate limiting or out of quota.
  • A model or server error names that same user:secret@… host.
  • An unreachable error says Can't reach https://user:[email protected]/v1?api_key=secret. The query and any fragment are included too.

host is whatever sits between :// and the next /. That keeps userinfo. The unreachable line prints ctx.base_url unchanged.

user:secret@localhost:11434 also misses the local-server hint. local is host.starts_with("localhost"), and this host starts with user.

https://api.groq.com/openai/v1 still says api.groq.com. http://localhost:11434/v1 still suggests ollama serve.

Where

crates/formless-core/src/errors.rs, explain. The host split is base_url.split("://").nth(1) then split('/'). The unreachable message is Can't reach {}. with ctx.base_url. messages_name_the_next_step only uses URLs that have no userinfo.

crates/formless-core/src/rate_limits.rs, display_endpoint, already clears the username, password, query, and fragment before a rate-limit line is shown. provider_key in tokens.rs asserts that https://user:[email protected]/v1 does not leave secret in the provider identity.

Why it matters

A proxy or gateway base URL often carries the credential in userinfo or the query. The explanation is what /resume, the TUI, and formless doctor show after a failure. The secret is then on screen and in the explained error, even though the usage line for the same endpoint is redacted.

Suggested fix

Name the host and the unreachable URL with the userinfo, query, and fragment removed, the way display_endpoint does. Keep the path and port. The API key was rejected by example.test. for the URL above, and Can't reach must not contain secret. user:secret@localhost:11434 should still take the Ollama hint. Leave api.groq.com and a plain localhost:11434 URL as they are.

Dominant language
Rust
Stars
0
Forks
0
Avg merge
12h 10m
Merged PRs (30d)
780

Getting set up

  • Ships a Dockerfile or Docker Compose file
  • No pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from athiwatc/formless

All issues in athiwatc/formless

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.