steffow/meteor-accounts-saml

help debugging: SLO SAMLresponse TypeError: First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.

tuxcrafter opened this issue · 14 comments

Thank you in advance for any help.

I am trying to debug code in steffo_meteor-accounts-saml.js in rocketchat to see where my saml intergration with ipsilon goes bad.

This is the error I am receiving:

Sorry, an annoying error occured
TypeError: First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.
Close Window

I have more details here, but the error is thrown from saml.js and not ipsilon.
https://pagure.io/ipsilon/issue/316

Thank you!

Thank you for replying! This is an IdP initiated SLO that seems to go bad. I am using ipsilon-2.1.0-3.fc28 connected to freeipa. If you can help me debug and solve this I can donate to your cause. I can provide you with access to the server and an test account, just sent me a message.

The logs including with debug on are in the URL: https://pagure.io/ipsilon/issue/316 in posted in the OP. I can provide access to the machines as well,

I don't think I know where the settings.js is located in Rocket.Chat.

[root@rocketchat01 Rocket.Chat]# find /etc/ -iname settings.js
[root@rocketchat01 Rocket.Chat]# find -iname settings.js
./programs/server/npm/node_modules/meteor/rocketchat_katex/node_modules/katex/src/Settings.js
./programs/server/npm/node_modules/twit/lib/settings.js

[root@rocketchat01 Rocket.Chat]# cat ./programs/server/npm/node_modules/meteor/rocketchat_katex/node_modules/katex/src/Settings.js
// @flow
/**

  • This is a module for storing settings passed into KaTeX. It correctly handles
  • default settings.
    */

import utils from "./utils";

import type { MacroMap } from "./macros";

export type SettingsOptions = {
displayMode?: boolean;
throwOnError?: boolean;
errorColor?: string;
macros?: MacroMap;
colorIsTextColor?: boolean;
maxSize?: number;
};

/**

  • The main Settings object
  • The current options stored are:
    • displayMode: Whether the expression should be typeset as inline math
  •             (false, the default), meaning that the math starts in
    
  •             \textstyle and is placed in an inline-block); or as display
    
  •             math (true), meaning that the math starts in \displaystyle
    
  •             and is placed in a block with vertical margin.
    

*/
class Settings {
displayMode: boolean;
throwOnError: boolean;
errorColor: string;
macros: MacroMap;
colorIsTextColor: boolean;
maxSize: number;

constructor(options: SettingsOptions) {
    // allow null options
    options = options || {};
    this.displayMode = utils.deflt(options.displayMode, false);
    this.throwOnError = utils.deflt(options.throwOnError, true);
    this.errorColor = utils.deflt(options.errorColor, "#cc0000");
    this.macros = options.macros || {};
    this.colorIsTextColor = utils.deflt(options.colorIsTextColor, false);
    this.maxSize = Math.max(0, utils.deflt(options.maxSize, Infinity));
}

}

export default Settings;
[root@rocketchat01 Rocket.Chat]# cat ./programs/server/npm/node_modules/twit/lib/settings.js
// set of status codes where we don't attempt reconnecting to Twitter
exports.STATUS_CODES_TO_ABORT_ON = [ 400, 401, 403, 404, 406, 410, 413, 422 ];

chat mctest nl_-_2019-03-25_17 07 56

Please sent me an email, its in my gitub profile and I will provide access to the server and a test account. SSO is working fine.

@steffow can you guide me in debugging the error or willing to log into the server. It seems to be server side javascript that is generating the error and I have a hard time debugging the code flow.

@steffow I reached out on RocketChat: RocketChat/Rocket.Chat#13831 and
RocketChat/Rocket.Chat#9545 but no reply in the last two weeks yet.

What is the NameIDFormat steffo_meteor-accounts-saml.js works with?

The metadata indicates:
urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress

But the @ may cause issues in the code?

@steffow I have a javascript developer debugging the code and it seems to be an bug in:

const compressedSAMLResponse = new Buffer(samlResponse, 'base64');

There are more people having issue with SLO: RocketChat/Rocket.Chat#13562

Is there any known to work implementation of SLO with the steffo_meteor-accounts-saml.js code?

Hi @steffow , this was indeed a bug on the Rocket.Chat code, it was fixed about a week after the last comment in here, but I only saw this referenced issue today. I believe you can close it now.