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

Bitbucket tag push and delete is interpreted as a branch push and delete #2658

Open
seanhamlin opened this issue May 17, 2021 · 0 comments
Open
Labels
2-build-deploy Build & Deploy subsystem 9-security Security subsystem bug

Comments

@seanhamlin
Copy link
Contributor

seanhamlin commented May 17, 2021

Describe the bug

It was discovered that if you push a tag into your Bitbucket repo, Lagoon appears to interpret the resulting webhook payload this as a branch, and deploys it. The same with tag deletion, Lagoon will delete any non-production environment with that tag name.

To Reproduce

Steps to reproduce the behavior:

  1. Create a new dev environment called develop, and push this branch
  2. Wait for environment to be created
  3. Push a new tag called develop attached to any other SHA
  4. Wait for environment to be deployed
  5. Notice that you deployed a tag, when this is not supported in Lagoon
  6. Delete the tag develop
  7. Notice how the environment is deleted, but the branch was not deleted

N.B. You cannot delete production environments through this method, as they have an added layer of protection.

Expected behavior

Tag pushes and deletions are ignored

Documentation

The payloads can be found at https://support.atlassian.com/bitbucket-cloud/docs/event-payloads/

Lagoon code in question

https://github.com/amazeeio/lagoon/blob/master/services/webhooks2tasks/src/webhooks/projects.ts#L197-L214

@seanhamlin seanhamlin added bug 9-security Security subsystem 2-build-deploy Build & Deploy subsystem labels May 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2-build-deploy Build & Deploy subsystem 9-security Security subsystem bug
Projects
None yet
Development

No branches or pull requests

1 participant