Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot set the Password field when creating new Items #108

Open
IAreKyleW00t opened this issue Nov 13, 2023 · 0 comments
Open

Cannot set the Password field when creating new Items #108

IAreKyleW00t opened this issue Nov 13, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@IAreKyleW00t
Copy link

IAreKyleW00t commented Nov 13, 2023

Your environment

SDK Version: 1.4.0

Connect Server Version: 1.7.2

OS: Ubuntu 22.04.3 LTS (Jammy Jellyfish) (WSL2)

Node Version: 18.18.2

Context: Building a Backstage plugin for interacting with 1Password via Scaffolding actions.

What happened?

There is no way to set the username or password fields when creating a new Item. Attempting to include a field to set the password results in a similar field with the same name (but not the actual password field) being made, or it being completely ignored. In both cases the password remains blank. This is with the ItemBuilder and by manually creating an object with the necessary details (see below).

This appears to be the case for all "special" fields in across all Items, but I'm specifically using the "Login" item for my use-case.

What did you expect to happen?

I expect to be able to set the password (and any other fields) at creation time, as well as being able to effectively update these.

Steps to reproduce

  1. Create an item using the ItemBuilder as described in the documentation.
  2. Try to use ItemBuilder.addField() to add fields for Password, Username, etc.
  3. There is no option to set the password, username, or notesPlain - adding fields with similar labels/configurations are treated as separate fields with similar labels.
  4. Use ItemBuilder to build Item without any fields. Instead, manually create each FullItemAllOfFields and add it the built FullItem object (including a password field, as seen below).
  5. Use op.createItem() with the newly built Item with manual fields.
  6. New item is created in 1Password, but the password field that was manually put in is completely ignored. New item has everything except the password field, which is blank in 1Password.

Notes & Logs

Example Input

This is what is sent to the op.createItem() function.

{
  "fields": [
    {
      "section": {
        "id": "Section_SomeRandomSectionID",
        "label": "test section"
      },
      "type": "String",
      "label": "some label",
      "value": "static value!",
      "recipe": {}
    },
    {
      "id": "password",
      "type": "Concealed",
      "purpose": "Password",
      "label": "password",
      "generate": true,
      "recipe": { "length": 20, "characterSets": ["Letters", "Digits"] }
    }
  ],
  "tags": [],
  "title": "Test Item",
  "category": "LOGIN",
  "sections": [
    { "id": "Section_SomeRandomSectionID", "label": "test section" }
  ],
  "urls": [{ "href": "https://example.com/, Opens in a new window" }]
}

Output

This is the FullItem response from the op.createItem().

{
  "id": "SomeUniqueAndRandomItemId",
  "title": "Test Item",
  "vault": { "id": "REDACTED" },
  "category": "LOGIN",
  "urls": [{ "href": "https://example.com/" }],
  "createdAt": "2023-11-13T16:33:08.305Z",
  "updatedAt": "2023-11-13T16:33:08.305Z",
  "sections": [
    {
      "id": "Section_SomeRandomSectionID",
      "label": "test section"
    }
  ],
  "fields": [
    {
      "id": "username",
      "type": "STRING",
      "purpose": "USERNAME",
      "label": "username"
    },
    {
      "id": "password",
      "type": "CONCEALED",
      "purpose": "PASSWORD",
      "label": "password"
    },
    {
      "id": "notesPlain",
      "type": "STRING",
      "purpose": "NOTES",
      "label": "notesPlain"
    },
    {
      "id": "SomeUniqueAndRandomFieldId",
      "section": { "id": "Section_SomeRandomSectionID" },
      "type": "STRING",
      "label": "some label",
      "value": "static value!"
    }
  ]
}

Thanks, and appreciate any other guidance on this as well! 😸

@IAreKyleW00t IAreKyleW00t added the bug Something isn't working label Nov 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant