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

Add a config to control if authgear verify the signature of saml elements from SP #4812

Merged
merged 7 commits into from
Oct 14, 2024

Conversation

tung2744
Copy link
Contributor

@tung2744 tung2744 commented Oct 9, 2024

ref DEV-2145

@louischan-oursky
Copy link
Collaborator

Test failed.

@@ -39,7 +39,8 @@ var _ = Schema.Add("SAMLServiceProviderConfig", `
"assertion_valid_duration": { "$ref": "#/$defs/DurationString" },
"slo_enabled": { "type": "boolean" },
"slo_callback_url": { "type": "string", "format": "uri" },
"slo_binding": { "$ref": "#/$defs/SAMLSLOBinding" }
"slo_binding": { "$ref": "#/$defs/SAMLSLOBinding" },
"should_verify_signature": { "type": "boolean" }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename this to signature_verification_enabled

// Signing cert not configured, nothing to verify
return nil
// This should be prevented by config validation. Therefore it is a programming error.
panic("SP certificates not configured but signature verification is required")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

panic with error. I will study whether there is golangci-lint rule to address this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious, what is the advantage of panic with error instead of string?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So that when you call recover(), you can get an error. Otherwise, you will get a string. With golang error chaining, recover() will give you an error that you can further call errors.As and errors.Is on the recovered error.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated that link to include this rationale.

// Signing cert not configured, nothing to verify
return nil
// This should be prevented by config validation. Therefore it is a programming error.
panic("SP certificates not configured but signature verification is required")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tung2744
Copy link
Contributor Author

Updated, thanks!

@louischan-oursky
Copy link
Collaborator

Build failed.

@tung2744
Copy link
Contributor Author

Fixed, thanks!

@louischan-oursky louischan-oursky self-requested a review October 14, 2024 02:44
@louischan-oursky louischan-oursky merged commit 1589984 into authgear:main Oct 14, 2024
7 checks passed
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