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

Should refuse to write to existing, non-Bookkeeper-managed target branch #166

Closed
krancour opened this issue Aug 31, 2023 · 0 comments · Fixed by #168
Closed

Should refuse to write to existing, non-Bookkeeper-managed target branch #166

krancour opened this issue Aug 31, 2023 · 0 comments · Fixed by #168

Comments

@krancour
Copy link
Member

There is a nil pointer dereference that can occur here:

https://github.com/akuity/bookkeeper/blob/main/service.go#L156-L160

Here is the sequence of events for three different scenarios:

  1. Target branch exists and has branch metadata -- no problem
  2. Target branch does not exist -- Bookkeeper creates it and writes blank metadata -- no problem
  3. Target branch exists and has no metadata -- PROBLEM

In the third case, the attempt to load branch metadata returns nil, which is the proximate cause of the nil pointer dereference.

However, there's something worse going on here...

This scenario is reflective of an attempt to write to an existing branch that was not previously managed by Bookkeeper.

That's a problem. We should detect this scenario and return an error indicating a refusal to write to the target branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant