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

fix: Enforce explicitly setting SHA in API requests #5146

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lukaspj
Copy link

@lukaspj lukaspj commented Dec 7, 2024

what

I propose adding the Commit SHA as a required field on API requests.

why

When running API Requests, we are currently only requiring the following fields:

type APIRequest struct {
	Repository string `validate:"required"`
	Ref          string `validate:"required"`
	Type       string `validate:"required"`
	PR           int
	Projects  []string
	Paths      []struct {
		Directory string
		Workspace string
	}
}

However, this is not sufficient information as many operations rely on knowing the exact commit we are working on and not just the Ref, which is a moving target.

Furthermore, it's more reliable to explicitly state the SHA you want to perform actions on, otherwise you could get unexpected results as the pipeline you are currently working with locally might be pointing to a different version of the Ref than the one that Atlantis fetches.

tests

I would like guidance on how to appropriately testing this change as I'm fairly unfamiliar with the Atlantis codebase.

references

closes #5143

@lukaspj lukaspj requested review from a team as code owners December 7, 2024 22:47
@lukaspj lukaspj requested review from chenrui333, lukemassa and X-Guardian and removed request for a team December 7, 2024 22:47
@github-actions github-actions bot added the go Pull requests that update Go code label Dec 7, 2024
@lukaspj lukaspj force-pushed the feat/explicitly-set-sha-in-api branch from 6f80b59 to 940222c Compare December 7, 2024 22:49
@lukaspj lukaspj changed the title Enforce explicitly setting SHA in API requests fix: Enforce explicitly setting SHA in API requests Dec 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
go Pull requests that update Go code security
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Atlantis API fails to execute for GitHub projects
2 participants