Skip to content

Add error for wrong SignatureAlgorithm#124

Merged
Sgtpluck merged 11 commits intomainfrom
dmm/add-sig-alg-error
Nov 13, 2024
Merged

Add error for wrong SignatureAlgorithm#124
Sgtpluck merged 11 commits intomainfrom
dmm/add-sig-alg-error

Conversation

@Sgtpluck
Copy link
Copy Markdown

@Sgtpluck Sgtpluck commented Nov 1, 2024

If a SAML request to Login.gov is signed, it is only considered valid if it has been signed using a SignatureAlgorithm of SHA256. This is the most consistent error we see, but we don't return a specific error for it.

While attempting to make this change, I got frustrated at how hard it was to create meaningful tests because our test suite relies heavily on bespoke XML that is hard to read, understand, or easily change.

This change:

  • Refactors our saml request helpers to make it easier to create a bespoke authn or logout request
  • Updates several test suites that were using raw XML
  • Adds an error to be more explicit about SigAlg errors
  • Removes an unused method
  • Updates the default config to use SHA256 (note: this is possible because the IdP sets this value as SHA256

request['ForceAuthn'] == 'true'
end

def requested_authn_context
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

this method is unused in this gem and in the IdP

@Sgtpluck Sgtpluck force-pushed the dmm/add-sig-alg-error branch from 55163b5 to 5db679f Compare November 7, 2024 18:46
@Sgtpluck Sgtpluck changed the title Refactor test helpers Add error for wrong SignatureAlgorithm Nov 7, 2024
"\n-----END CERTIFICATE-----\n"
end

def xml_cert_text(cert)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

(suggestion, non-blocking): Consider renaming this method remove_cert_boundaries

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

thank you for helping me with my terrible naming, updated in 8658a88

Copy link
Copy Markdown

@lmgeorge lmgeorge left a comment

Choose a reason for hiding this comment

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

A few non-blocking suggestions, but overall looks great!

Sgtpluck and others added 2 commits November 13, 2024 11:32
Co-authored-by: Mitchell Henke <mitchell.henke@gsa.gov>
@Sgtpluck Sgtpluck merged commit 4a0631a into main Nov 13, 2024
@Sgtpluck Sgtpluck deleted the dmm/add-sig-alg-error branch November 13, 2024 19:45
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.

4 participants