~comcloudway/builds.sr.ht

12bb3fd8a9e80d7f4341fa394138c5936fa547e6 — Simon Ser 1 year, 1 month ago 9910ba3
api/graph: validate OAuth grants when submitting build

An OAuth grants string can be supplied when submitting a build
manifest. Validate it to make sure it's well-formed.
1 files changed, 7 insertions(+), 0 deletions(-)

M api/graph/schema.resolvers.go
M api/graph/schema.resolvers.go => api/graph/schema.resolvers.go +7 -0
@@ 299,6 299,13 @@ func (r *mutationResolver) Submit(ctx context.Context, manifest string, tags []s
		return nil, secretsErr
	}

	if man.OAuth != "" {
		_, err := auth.DecodeGrants(ctx, man.OAuth)
		if err != nil {
			return nil, err
		}
	}

	var job model.Job
	if err := database.WithTx(ctx, nil, func(tx *sql.Tx) error {
		tags := strings.Join(tags, "/")