Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
var mozlog = require('mozlog');
var config = require('../config').get('log');
mozlog.config(config);
var root = mozlog('logging');
if (root.isEnabledFor('debug')) {
root.warn(
'\t*** CAREFUL! Louder logs (less than INFO)' + ' may include SECRETS! ***'
);
}
module.exports = mozlog;
#!/usr/bin/env node
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
var url = require('url');
var mozlog = require('mozlog');
var request = require('request');
var config = require('../lib/configuration');
mozlog.config(config.get('logging'));
var logger = require('mozlog')('server.basketproxy');
// Side effect - Adds default_fxa and dev_fxa to express.logger formats
var routeLogging = require('../lib/logging/route_logging');
var express = require('express');
var bodyParser = require('body-parser');
var cors = require('cors');
var CORS_ORIGIN = config.get('public_url');
var API_KEY = config.get('basket.api_key');
var API_URL = config.get('basket.api_url');
var API_TIMEOUT = config.get('basket.api_timeout');
var VERIFY_URL = config.get('oauth_url') + '/v1/verify';
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
'use strict'
var mozlog = require('mozlog')
var logConfig = require('../../config').get('log')
mozlog.config(logConfig)
module.exports = mozlog
#!/usr/bin/env node
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
var fs = require('fs');
var mozlog = require('mozlog');
var config = require('../lib/configuration');
mozlog.config(config.get('logging'));
var logger = require('mozlog')('server.main');
var express = require('express');
var bodyParser = require('body-parser');
function makeApp() {
var violations = fs.createWriteStream('violations.txt', {flags: 'a'});
var app = express();
app.use(bodyParser.json());
app.get('/index.html', function (req, res) {
res.json({result: 'ok'});
});
app.post('/_/csp-violation', function (req, res) {
logger.warn('VIOLATION REPORT');
var data = {
#!/usr/bin/env node
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
var url = require('url');
var mozlog = require('mozlog');
var config = require('../lib/configuration');
mozlog.config(config.get('logging'));
var logger = require('mozlog')('server.nullbasket');
var express = require('express');
var bodyParser = require('body-parser');
var API_KEY = config.get('basket.api_key');
var API_URL = config.get('basket.api_url');
// Error codes are defined in:
// https://github.com/mozilla/basket-client/blob/master/basket/errors.py
/* eslint-disable sorting/sort-object-props */
var BASKET_ERRORS = {
NETWORK_FAILURE: 1,
INVALID_EMAIL: 2,
* Logging
*/
logging: {
default: {
app: 'fxa-oauth-console',
},
},
});
var envConfig = path.join(__dirname, '..', 'config', conf.get('env') + '.json');
var files = (envConfig + ',' + process.env.CONFIG_FILES)
.split(',')
.filter(fs.existsSync);
conf.loadFile(files);
require('mozlog').config(conf.get('logging'));
process.env.NODE_ENV = conf.get('env');
conf.validate();
module.exports = conf;
function Lug(options) {
EventEmitter.call(this)
this.name = options.name || 'fxa-auth-server'
mozlog.config({
app: this.name,
level: options.level,
stream: options.stderr || process.stderr,
fmt: options.fmt
})
this.logger = mozlog()
this.stdout = options.stdout || process.stdout
this.notifier = require('./notifier')(this)
}
util.inherits(Lug, EventEmitter)