~sircmpwn/himitsu#27: 
Prevent insertion of duplicate keys

Status
REPORTED
Submitter
~sircmpwn
Assigned to
No-one
Submitted
2 years ago
Updated
2 years ago
Labels
No labels applied.

~whynothugo 2 years ago

Affects git-credential-himitsu, since git uses its credential helpers to inserts any keys that it uses back into the store, creating a new duplicate on each run.

I would like to try an address this. Does simply yielding the same result that is returned for non-duplicates sound good, or would you prefer a dedicated error response?

~sircmpwn 2 years ago

Probably needs an error, since we have to assume

private!=foo
private!=bar

are the same key

~whynothugo 2 years ago

What would the mechanic to update an existing key? Could we have a flag to insert-or-update?

~sircmpwn 2 years ago

A flag would probably be good, yeah.

~whynothugo 2 years ago

I've a WIP changes for this here, but am missing the most important parts in exec_add.

https://git.sr.ht/~whynothugo/himitsu/commit/6eac52e42bbcd8f80498bb753119f8768d0e8ffa

Some early questions before proceeding:

  • For a duplicate entry, should I add a new error type to cmderror (e.g.: duplicate_entry)?
  • When the update flag is provided, is deleted-then-insert okay? I think it's much simpler than implementing rewriting at a lower layer.
  • Should we prompt users to confirm updates?
  • In case the -u flag (update) is provided, and no matching entry exists: should I fail, or simply proceed with insertion?

~sircmpwn 2 years ago

yes

sure

no

fail, unless -au are both provided

~whynothugo 2 years ago

Oh, so I guess it should be possible to specify -u without specifying -a. I had not accounted for that.

Register here or Log in to comment, or comment via email.