Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function resolveSchema(root, ref) {
/* jshint validthis: true */
var p = URI.parse(ref)
, refPath = _getFullPath(p)
, baseId = getFullPath(this._getId(root.schema));
if (Object.keys(root.schema).length === 0 || refPath !== baseId) {
var id = normalizeId(refPath);
var refVal = this._refs[id];
if (typeof refVal == 'string') {
return resolveRecursive.call(this, root, refVal, p);
} else if (refVal instanceof SchemaObject) {
if (!refVal.validate) this._compile(refVal);
root = refVal;
} else {
refVal = this._schemas[id];
if (refVal instanceof SchemaObject) {
if (!refVal.validate) this._compile(refVal);
if (id == normalizeId(ref))
return { schema: refVal, root: root, baseId: baseId };
function download(url, spinnerID, spinners) {
// if url scheme is undetected, slap an http in front and retry
if (!uri.parse(url).scheme) {
return download('http://' + url, spinnerID, spinners)
}
// GET request promise
return axios
.get(url)
.then(success => {
spinners.success(spinnerID)
return [spinnerID, success]
})
.catch(err => {
// follow redirects
if (300 < err.status && err.status < 400) {
return download(err.headers.location, spinnerID, spinners)
}
spinners.error(spinnerID)
get_authorization_redirect_uri(uri) {
const plugin = this;
const query = {};
if (plugin.config.redirect_uri) {
uri = plugin.config.redirect_uri;
} else {
// set this in the /oauth/callback endpoint manually to avoid sending non-standard params to providers
// ie: okta pukes when it sees this
query[HANDLER_INDICATOR_PARAM_NAME] = "authorization_callback";
}
const parsedURI = URI.parse(uri);
if (Object.keys(query).length) {
parsedURI.query = queryString.stringify(query);
}
return URI.serialize(parsedURI);
}
doDeepLink (url: string) {
const parsedUri = URI.parse(url)
const query = parsedUri.query
if (!query || !query.includes('token=')) {
return
}
const splitArray = query.split('token=')
const nextString = splitArray[1]
const finalArray = nextString.split('&')
const token = finalArray[0]
this.props.urlReceived(token)
}
handleOpenURL = (event: Object) => {
function correctUrl(url) {
var u = URI.parse(url);
if(isChrome()) {
u.host = "localhost";
}
return URI.serialize(u);
}
doDeepLink (url: string) {
const parsedUri = URI.parse(url)
switch (parsedUri.scheme) {
case 'edge':
case 'airbitz':
case 'edge-ret':
case 'airbitz-ret':
case 'https':
if (parsedUri.host === 'recovery' || parsedUri.host === 'recovery.edgesecure.co') {
this.handleRecoveryToken(parsedUri)
} else {
this.handleAddress(parsedUri, url)
}
break
case 'bitcoin':
case 'bitcoincash':
case 'ethereum':
function withDefaultScheme(url) {
return URI.parse(url).scheme ? url : "http://" + url;
}
function iaEmbed({ type, children }) {
if (type === 'paragraph'
&& children.length === 1
&& children[0].type === 'link'
&& URI.parse(children[0].url).reference === 'absolute') {
return URI.parse(children[0].url);
}
return false;
}
try {
let state = server.utils.decrypt(
issuer_encrypt_secret,
req.query.state,
"hex"
);
state = jwt.verify(state, issuer_sign_secret);
const state_redirect_uri = state.request_uri;
const parsedStateRedirectURI = URI.parse(state_redirect_uri);
server.logger.verbose(
"parsed state redirect uri: %j",
parsedStateRedirectURI
);
const parsedRequestURI = URI.parse(req.url);
server.logger.verbose("parsed request uri: %j", parsedRequestURI);
const parsedRedirectURI = Object.assign({}, parsedStateRedirectURI);
const parsedQuery = queryString.parse(parsedRequestURI.query);
parsedQuery[HANDLER_INDICATOR_PARAM_NAME] = "authorization_callback";
parsedRedirectURI.query = queryString.stringify(parsedQuery);
server.logger.verbose("parsed redirect uri: %j", parsedRedirectURI);
const redirect_uri = URI.serialize(parsedRedirectURI);
server.logger.info("redirecting browser to: %j", redirect_uri);
res.statusCode = 302;
res.setHeader("Location", redirect_uri);
res.end();
return;
} catch (e) {
function imgEmbed({ type, children }) {
if (type === 'paragraph'
&& children.length === 1
&& children[0].type === 'image'
&& URI.parse(children[0].url).reference === 'absolute'
&& !URI.parse(children[0].url).path.match(/(jpe?g)|png|gif|webm$/i)) {
return URI.parse(children[0].url);
}
return false;
}