<commit_before>// Auth against a flat file

exports.register = function () {
    this.inherits('auth/auth_base');
}

exports.hook_capabilities = function (next, connection) {
    var config = this.config.get('auth_flat_file.ini');
    var methods = (config.core && config.core.methods ) ? config.core.methods.split(',') : null;
    if(methods && methods.length > 0) {
        connection.capabilities.push('AUTH ' + methods.join(' '));
        connection.notes.allowed_auth_methods = methods;
    }
    next();
};<commit_msg>auth/flat: disallow AUTH unless private IP or TLS<commit_after>// Auth against a flat file

exports.register = function () {
    this.inherits('auth/auth_base');
}

exports.hook_capabilities = function (next, connection) {
    // don't allow AUTH unless private IP or encrypted
    if (!net_utils.is_rfc1918(connection.remote_ip) && !connection.using_tls) return next();
    var config = this.config.get('auth_flat_file.ini');
    var methods = (config.core && config.core.methods ) ? config.core.methods.split(',') : null;
    if(methods && methods.length > 0) {
        connection.capabilities.push('AUTH ' + methods.join(' '));
        connection.notes.allowed_auth_methods = methods;
    }
    next();
};
{'fraction_non_alphanumeric': 0.14853896103896103, 'fraction_numerical': 0.00487012987012987, 'mean_word_length': 3.688212927756654, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6405819', 'n_tokens_mistral': 377, 'n_tokens_neox': 368, 'n_words': 80}