Skip to content

[Bug]: WMS connection bug #1979

Closed
Closed

Description

@arielsrossi

Before you start

  • I searched the existing issues and did not find a duplicate.
  • This is a bug report, not a usage question (questions belong in Discussions).

What happened?

I have access to a WMS connection containing data from the PLANET constellation.
The connection includes an embedded API_KEY.
Authentication is not required each time I connect, as the connection request itself handles the authentication.
When I save this connection in RUSTGis, close the session, and reopen it, the WMS link loses the portion containing the API_KEY (the part following the "?").

Ideally, RUSTGis should not modify the link after it has been saved.

The link contains an API key, but there’s no issue with accessing it, which is why I’ve shared it here.

Clique para ver o link (Spoiler)

LINK HERE

Steps to reproduce

Add Data, from Service, conect, save as conection.
Close RUSTGis. Open RUSTGis, Try conect... error.

The screenshot shows how the link is altered and loses the api key.
image

Expected behavior

Connection remains active, without changing the link containing the API_key

How are you running RustGIS?

Desktop app (downloaded release)

Version

v0.6

Operating system, browser and graphics

w10

Sample data

No response

Screenshots or logs

No response

Activity

  1. pick2510 commented on Nov 14, 2026

    @pick2510
    Contributor

    Thanks for the report. First, and most important: the API key in your link is public now, spoiler or not. Please revoke it in your Planet account and create a new one.

    The key is removed on purpose. A saved connection never keeps passwords or keys in its address: they would end up in your settings and in projects you share. Instead, a connection keeps how it logs in, and the secret is given separately, see Web-service logins. Two things are missing for your case:

    1. An API key in the URL. The login offers Basic authentication or an API key in a header, but not a key as a query parameter, as Planet's ?api_key= link uses. So the key is stripped, and there's no way to give it back.
    2. Remembering the key. Web-service logins last only for the session. S3 connections can already keep their keys in the system's credential store (Windows Credential Manager, macOS Keychain, Secret Service on Linux) with Remember on this computer; web services can't yet.

    I'd propose both: a login option API key in a query parameter (the parameter name saved with the connection, the key never), and Remember on this computer for web-service logins, using the same credential store as S3. Then the connection works after a restart without the key being stored anywhere else. @opengeos/rustgis-maintainers, does that fit?

    Until then, you can add the layer for the session from the full link, without saving the connection.

  2. Mavrick-F commented on Nov 14, 2026

    @Mavrick-F
    Member

    Both proposed changes are already specified in #757 Part B: query-parameter authentication and optional credential-store persistence. Although that issue is closed, its handoff comment records those deferred pieces and preserved implementation branches.

    Could you check those snapshots before starting a separate implementation? They need extracting onto the current code rather than bringing back the old combined change wholesale. We can use this report as the concrete reconnect case and track the remaining scope explicitly.

    The saved address should remain free of secrets; the fix is to restore the key through the connection’s authentication settings.

  3. deniial00 commented on Nov 14, 2026

    @deniial00
    Member

    I'll take this one; it's the rest of #757 Part B, which I left parked. It follows the design @pick2510 proposed above, and, as @Mavrick-F asked, it builds on the existing snapshots instead of starting a separate implementation.

    What's on main today is step 1 (#1223): session-only logins with basic auth or an API-key header. This report needs the two remaining pieces:

    1. API key in a query parameter. A connection saves the method and the parameter name (api_key for Planet), never the key. The key is added only to requests to the connection's own origin, including tiles fetched later, and stays out of the saved address, projects, preferences, History and error messages. The saved address stays free of secrets.
    2. Remember on this computer for web-service logins, using the same credential store as S3 and database connections (off by default, with Forget Saved Login, and the CLI --use-saved-secrets / Python use_saved_secrets opt-in). With this, the Planet connection works again after a restart without asking for the key.

    I'll send them as two pull requests, in that order, and use this report's reconnect as the acceptance case for both.

    On the snapshots: both are on my fork. The query-parameter method is at deniial00/RustGIS@2eb53868 (parked locally as feature-757-query-auth), and remembering is at deniial00/RustGIS@b1e67463 (parked as feature-757-service-login-keychain), which had the query method taken out. Both predate #1223 and the later login-boundary and request-destination fixes (#1464, #1473, #1560). I'm taking code from them onto current main rather than merging them back, so those fixes stay as they are.

    Still out of scope, as in #757: ArcGIS tokens and OAuth, Part C (moving a token pasted into a layer address into a connection), Earthdata, and remembered secrets in the web app, which keeps service logins for the session only.

  4. self-assigned this
    on Nov 14, 2026
  5. arielsrossi commented on Nov 14, 2026

    @arielsrossi
    Author

    Thanks for the report. First, and most important: the API key in your link is public now, spoiler or not. Please revoke it in your Planet account and create a new one.

    The key is removed on purpose. A saved connection never keeps passwords or keys in its address: they would end up in your settings and in projects you share. Instead, a connection keeps how it logs in, and the secret is given separately, see Web-service logins. Two things are missing for your case:

    1. An API key in the URL. The login offers Basic authentication or an API key in a header, but not a key as a query parameter, as Planet's ?api_key= link uses. So the key is stripped, and there's no way to give it back.
    2. Remembering the key. Web-service logins last only for the session. S3 connections can already keep their keys in the system's credential store (Windows Credential Manager, macOS Keychain, Secret Service on Linux) with Remember on this computer; web services can't yet.

    I'd propose both: a login option API key in a query parameter (the parameter name saved with the connection, the key never), and Remember on this computer for web-service logins, using the same credential store as S3. Then the connection works after a restart without the key being stored anywhere else. @opengeos/rustgis-maintainers, does that fit?

    Until then, you can add the layer for the session from the full link, without saving the connection.

    It is a "public" key that allows access—via WMS—only to data from Brazil. There is no need to revoke access, etc.

  6. deniial00 commented on Nov 14, 2026

    @deniial00
    Member

    Thanks for clarifying that the key is intended to be public. The two planned changes should make this connection work after a restart without keeping the key in the saved URL: API-key authentication in a query parameter (#2064), followed by optional Remember on this computer, using the OS credential store. With Remember enabled, you should not need to enter the key each session.

    Separately, we should consider whether to offer an explicit option to keep an intentionally public key in a saved URL, with a warning that it will be included in saved settings and shared projects. RustGIS cannot determine whether a key is public or what access it grants, so removing keys should remain the default. Any exception would need to be an explicit choice; it is not part of #2064.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions