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

Status
REPORTED
Submitter
~sircmpwn
Assigned to
No-one
Submitted
2 years ago
Updated
1 year, 4 months ago
Labels
No labels applied.

~whynothugo 1 year, 6 months 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 1 year, 6 months ago

Probably needs an error, since we have to assume

private!=foo
private!=bar

are the same key

~whynothugo 1 year, 6 months ago

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

~sircmpwn 1 year, 6 months ago

A flag would probably be good, yeah.

~whynothugo 1 year, 4 months 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 1 year, 4 months ago

yes

sure

no

fail, unless -au are both provided

~whynothugo 1 year, 4 months 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.