Skip to content

Windows: setting / retrieving keys with case differences #155

@sambtalcott

Description

@sambtalcott

I'm on Windows, R 4.4.2, keyring v1.3.2

It seems that key_set() and key_get() act unpredictably when the provided service parameter matches a stored value but with different casing.

Reproducible example:

library(keyring)
key_set_with_value("example", password = "pass1")
key_get("example")
# [1] "pass1"

key_set_with_value("EXAMPLE", password = "pass2")
key_get("EXAMPLE")
# [1] "pass1"

Looking in the Windows Credential Manager after running this code, I only see the :example: credential (no :EXAMPLE:). If I remove the :example: credential, THEN I see an :EXAMPLE: credential appear (with password "pass2")

I'm not sure what's possible, but I think the expected behavior would be (in order of desirability):

  1. Service is case-sensitive (so both "example" and "EXAMPLE" can be set/accessed separately). It seems like this may not be possible with Windows
  2. Service is case-insensitive on both set and get (so setting "EXAMPLE" overwrites "example")
  3. key_set() throws an error if attempting to set a credential that is a different casing of a currently stored value

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions