Skip to content

Case sensitivity issue when unmarshalling struct with opsection tag #99

@port-43

Description

@port-43

Your environment

SDK Version: v1.5.3

Connect Server Version: 1.7.3

OS: Ubuntu 22.04.3 LTS

Go Version: go1.24.3 linux/amd64

What happened?

When using the struct tag opsection to load a field from a specific section in a 1Password item, the SDK appears to require the section name to be lowercase. If the actual section name in 1Password contains uppercase letters or mixed casing, the field is not populated.

After reviewing the source code, it looks like section names are lowercased before being compared, which causes a mismatch if the user provides a tag value matching the case used in 1Password.

What did you expect to happen?

I expected the SDK to use a case-insensitive match when resolving section names, or at minimum, to preserve the case as provided in the opsection tag so that values from properly cased sections in 1Password can be loaded correctly.

Steps to reproduce

  1. In 1Password, create an item with a custom section named Details and a text field named hostname.
  2. Create the struct like the following:
type Config struct {
    Host string `opsection:"Details" opfield:"hostname"`
}
  1. Attempt to unmarshal the item into struct using client.LoadStructFromItem(&c, "<item uuid>", "<vault uuid>").
  2. Observe that the Host field is not populated.
  3. Change opsection:"Details" to opsection:"details" (lowercase).
  4. Observe that the field is now populated correctly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working as expected. Has never worked before. When it has, use "regression" instead.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions