Code Monkey home page Code Monkey logo

express-saml's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

express-saml's Issues

Generates invalid dates

Note the "+2": date.getUTCHours()+2

This means your timestamps are out of whack and invalid for two hour each day.

This library has all possible SAML related vulnerabilities

Just in case someone is using or considers using this library (or to copy paste code from this library)...

This library has every possible SAML related vulnerability that one could list starting from the fact that it does not validate authentication response signature which means that SW that uses this library / copy paste from this library is open for everyone in the internet. Everyone can scratch authentication response with any NameID and post it to SW that uses this library in order to have authenticated session (impersonate anyone).

I.e. code linked to the end of this issue does not have any security measurements listed e.g. in these documents:

  1. Security and Privacy Considerations for the OASIS Security Assertion Markup Language (SAML) V2.0
    OASIS Standard, 15 March 2005
    https://docs.oasis-open.org/security/saml/v2.0/saml-sec-consider-2.0-os.pdf
  2. https://cheatsheetseries.owasp.org/cheatsheets/SAML_Security_Cheat_Sheet.html
  3. https://sec.okta.com/articles/2020/05/common-pitfalls-custom-saml-implementations

And that code does not follow any processing rules (which are related to security) listed in these specifications (SAML core and SAML Web SSO profile related parts):

  1. Assertions and Protocols for the OASIS Security Assertion Markup Language (SAML) V2.0
    OASIS Standard, 15 March 2005
    https://docs.oasis-open.org/security/saml/v2.0/saml-core-2.0-os.pdf
  2. Profiles for the OASIS Security Assertion Markup Language (SAML) V2.0
    OASIS Standard, 15 March 2005
    https://docs.oasis-open.org/security/saml/v2.0/saml-profiles-2.0-os.pdf

express-saml/saml.js

Lines 5 to 44 in 9c04343

// Receive the SAML Response here
app.post('/saml/consume', function(req, res){
var libxmljs = require("libxmljs");
// Get SAML response
var samlResponse = req.body.SAMLResponse;
// Decode response
var xml = new Buffer(samlResponse, 'base64').toString('ascii');
// Parse ID
var xmlDoc = libxmljs.parseXmlString(xml);
var idNode = xmlDoc.get('/samlp:Response/saml:Assertion/saml:Subject/saml:NameID', {
'samlp':'urn:oasis:names:tc:SAML:2.0:protocol',
'saml' : 'urn:oasis:names:tc:SAML:2.0:assertion'
});
var email = idNode.text();
// User lookup
app.settings.models.User.findOne({email:email}, function(err, user){
if (user) {
// Grant session
req.session.currentUser = user;
req.flash('info', 'You are logged in as ' + email);
res.redirect('/');
return;
} else {
// Redirect
req.flash('error', 'Your account did not match any of our records.');
res.redirect('/login');
return;
}
});
});

Missing license information

Great work on adding SAML support to Node.js! I'm looking to adapt your approach to make a SAML strategy for the Passport authentication library.

I noticed there is no license information in your repository. Is the plan to have this under MIT like most Node.js code, or?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.