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

TT-1322-Fix SAML vuln and broken tests #147

Merged
merged 8 commits into from
Mar 24, 2021

Conversation

jlucktay
Copy link
Contributor

@jlucktay jlucktay commented Jan 12, 2021

Description

Dependencies

configuration package (41633ee)

  • TestOverrideConfigWithEnvVars was looking for a non-existent config file, so added one to its testdata subdirectory

data_loader package (e1f3016)

  • MongoLoader.Flush: simplified type assertion in switch statement
  • TestCreateDataMongoLoader:
    • depends on an external running instance of MongoDB, so it is now behind a test_mongo tag; run this test with something like go test -tags=test_mongo instead of just go test
    • simplified type assertion

providers package (4fd5888)

  • TestProxyProvider_GoodRegex was looking for a string that wasn't there any more

Related Issue

https://www.bleepingcomputer.com/news/security/critical-golang-xml-parser-bugs-can-cause-saml-authentication-bypass/

Motivation and Context

Security vulnerabilities are bad!

How This Has Been Tested

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Refactoring or add test (improvements in base code or adds test coverage to functionality)

Checklist

  • Make sure you are requesting to pull a topic/feature/bugfix branch (right side). If pulling from your own
    fork, don't request your master!
  • Make sure you are making a pull request against the master branch (left side). Also, you should start
    your branch off our latest master.
  • My change requires a change to the documentation.
    • If you've changed APIs, describe what needs to be updated in the documentation.
    • If new config option added, ensure that it can be set via ENV variable
  • I have updated the documentation accordingly.
  • Modules and vendor dependencies have been updated; run go mod tidy && go mod vendor
  • When updating library version must provide reason/explanation for this update.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • Check your code additions will not fail linting checks:

@jlucktay jlucktay self-assigned this Jan 12, 2021
@jlucktay jlucktay force-pushed the fix/saml-vuln-and-broken-tests branch from 223e33e to 89c3947 Compare January 12, 2021 11:16
@jlucktay jlucktay force-pushed the fix/saml-vuln-and-broken-tests branch from 89c3947 to 4fd5888 Compare January 12, 2021 11:25
MongoLoader.Flush: simplify type assertion in `switch` statement
TestCreateDataMongoLoader:
- put behind 'test_mongo' tag, as it requires a running MongoDB instance
- simplified type assertion
@jlucktay jlucktay marked this pull request as ready for review January 12, 2021 12:39
@jlucktay jlucktay removed their assignment Jan 12, 2021
@jlucktay jlucktay requested a review from a team January 12, 2021 12:39
@sredxny sredxny self-requested a review March 22, 2021 17:54
Copy link
Contributor

@sredxny sredxny left a comment

Choose a reason for hiding this comment

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

LGTM!

Just for reference, this issue was fixed by integrating github.com/mattermost/xml-roundtrip-validator into the SAML project. Currently there's no native fix in the go language.

@sredxny
Copy link
Contributor

sredxny commented Mar 22, 2021

@matiasinsaurralde please review 😬 ...We will need a release of Tib, and then include this release in dashboard (for embeded tib users)

@jlucktay
Copy link
Contributor Author

Just for reference, this issue was fixed by integrating github.com/mattermost/xml-roundtrip-validator into the SAML project. Currently there's no native fix in the go language.

There's a good writeup from Mattermost here, and I think this quote is the most salient:

The Go security team has chosen this path after determining that the encoding/xml package and its data structures were not designed to make safe round-trips possible. The new API allows them to lower developers’ expectations to a more manageable level, as the support for round-trips in the most problematic cases can be explicitly dropped.

There was plenty of discussion on this proposal but ultimately it didn't go ahead, and I found another good quote to summarise there:

It's not being fixed in a security release because round-trip stability is not a currently supported security property of encoding/xml, and we don't believe these fixes would be sufficient to reliably guarantee it in the future.

@sredxny sredxny changed the title Fix SAML vuln and broken tests TT-13322-Fix SAML vuln and broken tests Mar 24, 2021
@sredxny sredxny merged commit 46f7042 into master Mar 24, 2021
@gregdelhon gregdelhon changed the title TT-13322-Fix SAML vuln and broken tests TT-1322-Fix SAML vuln and broken tests Mar 29, 2021
@jlucktay jlucktay deleted the fix/saml-vuln-and-broken-tests branch May 13, 2021 06:37
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.

3 participants