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

[tuist] don't validate security requirements #828

Merged
merged 5 commits into from
Jan 21, 2025
Merged

Conversation

fkorotkov
Copy link
Contributor

Since we are running a local server proxy which handles security differently.

@fkorotkov fkorotkov requested a review from edigaryev January 21, 2025 16:36
@fkorotkov
Copy link
Contributor Author

@edigaryev please check commits separately. This one is the most interesting 6b273f0.

@edigaryev
Copy link
Contributor

But we already use "no security":

server, err := tuistapi.NewServer(tc, NoSecurity{})

We have a test that doesn't use any security either and it passes. What does this PR this change in this regard? 🤔

@fkorotkov
Copy link
Contributor Author

It seems it's still failing validations when I try to use it. See Slack for more details. The following thing:

curl https://cloud.tuist.io/api/spec | jq 'del(.security, .components.securitySchemes)' > openapi.json

Removes security requirements from the schema so there are not checks what's so ever.

Will take a look tomorrow why existing test passes.

@fkorotkov
Copy link
Contributor Author

@edigaryev probably because test is not actually testing no authorization header:

func (s *Client) securityAuthorization(ctx context.Context, operationName string, req *http.Request) error {
t, err := s.sec.Authorization(ctx, operationName)
if err != nil {
return errors.Wrap(err, "security source \"Authorization\"")
}
req.Header.Set("Authorization", "Bearer "+t.Token)
return nil
}

@edigaryev
Copy link
Contributor

edigaryev commented Jan 21, 2025

Will take a look tomorrow why existing test passes.

Thank you.

It feels to me that there's an easier way to get around this, for example, by returning an ogenerrors.ErrSkipClientSecurity from our NoSecurity implementation.

Nope, ogenerrors.ErrSkipClientSecurity is for the client.

@edigaryev
Copy link
Contributor

edigaryev commented Jan 21, 2025

OK, so this error:

{"error_message":"operation DownloadCacheArtifact: security \"\": security requirement is not satisfied"}

Is coming from this template, from ogenerrors.SecurityError{}.

It seems that there's no way to disable it via ogen.yaml.

@fkorotkov fkorotkov merged commit 43d4b10 into master Jan 21, 2025
11 checks passed
@fkorotkov fkorotkov deleted the tuist-cache-fixes branch January 21, 2025 17:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants