Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/* eslint-disable @typescript-eslint/camelcase */
current_authorization_id: substitutions.currentAuthorizationId,
current_user_id: substitutions.currentUserId,
current_grant_id: substitutions.currentGrantId,
current_client_id: substitutions.currentClientId
/* eslint-enable @typescript-eslint/camelcase */
});
if (injection === null) {
continue;
}
templateScope = injection;
}
for (const { query, result, parameters } of extract(
templateScope,
scopes
)) {
// Apply dynamic substitutions to the description.
let description = template.description;
for (const [variableKey, variableValue] of Object.entries(parameters)) {
const domain = new RegExp(`(\\(${escapeRegExp(variableKey)}\\))`, "g");
description = description.replace(domain, variableValue);
}
explanationsByScope[result] = explanationsByScope[result] || [];
explanationsByScope[result].push({
scope: result,
description: description,
// TODO: I don't believe these are necessarily correct. However, they
substituteDescriptionMap(realm, variables),
substituteDescriptionMap(context, variables),
substituteDescriptionMap(action, variables)
];
});
const resultScopes: string[] = [];
const resultText: string[] = [];
// Create combinations.
for (const [realm, context, action] of configs) {
for (const [rk, rv] of Object.entries(realm)) {
for (const [ck, cv] of Object.entries(context)) {
for (const [ak, av] of Object.entries(action)) {
// Test and extract variables from each scope.
for (const { scope, parameters } of extract(
`${rk}:${ck}:${ak}`,
scopes
)) {
// Assemble the human readable text.
let text = `${rv}: ${av.slice(0, 1).toUpperCase()}${av.slice(
1
)} ${cv}.`;
// Apply dynamic substitutions to the text.
for (const [variableKey, variableValue] of Object.entries(
parameters
)) {
const pattern = new RegExp(
`(?