Skip to content

fix: don't apply ambient .netrc credentials to backend requests #449

Closed

Description

@uniqueg

Follow-up of #436 (raised in the review of #448).

Requests to configured TES backends go through requests with its defaults, which reads a .netrc file of the environment (~/.netrc, or NETRC):

  • Requests without credentials (auth: none, and anonymous version probes) get the Basic credentials of a matching .netrc entry.
  • Requests with proTES' access token (auth: client_credentials) get them too: requests replaces the Authorization header with Basic credentials of a matching entry.
  • When requests follows a redirect (GET requests, e.g., /service-info and /tasks/{id}), it looks up .netrc again for the new URL, whatever auth the first request had.

Requests to discovered backends use FOCA's guarded client, which ignores .netrc already. A no-op auth for requests without credentials alone doesn't cover redirects or the token (tried and reverted in #448).

Possible fix: send all requests to configured backends through a session of their own that never reads .netrc (e.g., a requests.Session subclass whose rebuild_auth only strips credentials on host changes, and a no-op session auth), keeping the proxy and TLS settings of the environment; the token as an auth callable.

Acceptance criteria

  • No request to a TES backend gets credentials from .netrc: not without credentials, not with the token or Basic credentials, not after redirects.
  • Proxy and CA settings of the environment still apply.
  • Tests cover the first request and a redirect; the docs (credentials of TES instances) say so.

Activity

  1. added this to the v0.6.0 milestone on Nov 6, 2026
  2. added
    priority: low
    status: triage
    type: bug
    workload: hours
    status: in progress
    and removed
    status: triage
    on Nov 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority: lowstatus: in progresstype: bugworkload: hours

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions