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

spire-server: Better status codes from BatchCreateEntry API #5444

Closed
sorindumitru opened this issue Aug 30, 2024 · 1 comment · Fixed by #5506
Closed

spire-server: Better status codes from BatchCreateEntry API #5444

sorindumitru opened this issue Aug 30, 2024 · 1 comment · Fixed by #5506
Labels
help wanted Issues with this label are ready to start work but are in need of someone to do it priority/backlog Issue is approved and in the backlog

Comments

@sorindumitru
Copy link
Contributor

The BatchCreateEntry currently returns some status codes, InvalidArgument, InternalError (for most database issues), AlreadyExists. If I try to create an entry with some invalid parameters, e.g. entry id too long or empty list of selectors, I get back an InternalError status code. This makes it hard to differentiate between user errors (invalid entry) and database entries. I'd like to be able to differentiate between them to know if I need to retry creating a registration entry at a later time or know that it will never work.

  • Version: 1.10.1
  • Platform: linux
  • Subsystem: server
@amartinezfayo amartinezfayo added the triage/in-progress Issue triage is in progress label Aug 30, 2024
@MarcosDY MarcosDY added priority/backlog Issue is approved and in the backlog help wanted Issues with this label are ready to start work but are in need of someone to do it and removed triage/in-progress Issue triage is in progress labels Sep 3, 2024
@sorindumitru
Copy link
Contributor Author

An example error message, using spire-server with the example config in the repo:

➜  spire git:(main) ✗ ./bin/spire-server entry create -entryID invalid-entry== -parentID spiffe://example.org/spire/server -spiffeID spiffe://example.org/workload -selector unix:user:root
Failed to create the following entry (code: Internal, msg: "failed to create entry: datastore-sql: invalid registration entry: entry ID contains invalid characters"):
Entry ID         : invalid-entry==
SPIFFE ID        : spiffe://example.org/workload
Parent ID        : spiffe://example.org/spire/server
Revision         : 0
X509-SVID TTL    : default
JWT-SVID TTL     : default
Selector         : unix:user:root

Error: failed to create one or more entries

I could parse the error message, but I'd like to stay away from that. Also happy to work on this if we agree this is something we want improved.

sorindumitru added a commit to sorindumitru/spire that referenced this issue Oct 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Issues with this label are ready to start work but are in need of someone to do it priority/backlog Issue is approved and in the backlog
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants