code
stringlengths 14
2.05k
| label
int64 0
1
| programming_language
stringclasses 7
values | cwe_id
stringlengths 6
14
| cwe_name
stringlengths 5
98
⌀ | description
stringlengths 36
379
⌀ | url
stringlengths 36
48
⌀ | label_name
stringclasses 2
values |
---|---|---|---|---|---|---|---|
const updateFormValue = (update) => {
setValue((prev) => {
let newValue = { ...prev, ...update };
validateInputs(newValue, true);
let user = newValue.user.replace(/[^a-zA-Z0-9]/g, Config.EVENT_EMAIL_SUBST);
if (newValue.eventId !== "")
newValue.principalId = newValue.eventId + Config.EVENT_PRINCIPAL_SEPARATOR + user;
else newValue.principalId = user;
return newValue;
});
}; | 0 | TypeScript | CWE-269 | Improper Privilege Management | The product does not properly assign, modify, track, or check privileges for an actor, creating an unintended sphere of control for that actor. | https://cwe.mitre.org/data/definitions/269.html | vulnerable |
paramJson: JSON.stringify({
budgetAmount: parseInt(budgetAmount),
expiresOn,
principalId,
budgetNotificationEmails,
user,
budgetCurrency: config.BUDGET_CURRENCY
})
})
).then((response) => { | 0 | TypeScript | CWE-284 | Improper Access Control | The product does not restrict or incorrectly restricts access to a resource from an unauthorized actor. | https://cwe.mitre.org/data/definitions/284.html | vulnerable |
paramJson: JSON.stringify({
budgetAmount: parseInt(budgetAmount),
expiresOn,
principalId,
budgetNotificationEmails,
user,
budgetCurrency: config.BUDGET_CURRENCY
})
})
).then((response) => { | 0 | TypeScript | CWE-269 | Improper Privilege Management | The product does not properly assign, modify, track, or check privileges for an actor, creating an unintended sphere of control for that actor. | https://cwe.mitre.org/data/definitions/269.html | vulnerable |
eventId: item.principalId.includes(action.config.EVENT_PRINCIPAL_SEPARATOR) ? item.principalId.substring(0, action.config.EVENT_ID_LENGTH) : ""
}); | 0 | TypeScript | CWE-284 | Improper Access Control | The product does not restrict or incorrectly restricts access to a resource from an unauthorized actor. | https://cwe.mitre.org/data/definitions/284.html | vulnerable |
eventId: item.principalId.includes(action.config.EVENT_PRINCIPAL_SEPARATOR) ? item.principalId.substring(0, action.config.EVENT_ID_LENGTH) : ""
}); | 0 | TypeScript | CWE-269 | Improper Privilege Management | The product does not properly assign, modify, track, or check privileges for an actor, creating an unintended sphere of control for that actor. | https://cwe.mitre.org/data/definitions/269.html | vulnerable |
value: inputs.json ? value : value.join(inputs.separator),
writeOutputFiles: inputs.writeOutputFiles,
outputDir: inputs.outputDir,
json: inputs.json,
shouldEscape: inputs.escapeJson
})
} | 0 | TypeScript | CWE-77 | Improper Neutralization of Special Elements used in a Command ('Command Injection') | The product constructs all or part of a command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/77.html | vulnerable |
}): Promise<void> => {
let cleanedValue
if (json) {
cleanedValue = jsonOutput({value, shouldEscape})
} else {
cleanedValue = value.toString().trim()
}
// if safeOutput is true, escape special characters for bash shell
if (safeOutput) {
cleanedValue = cleanedValue.replace(/[$()`|&;]/g, '\\$&')
}
core.setOutput(key, cleanedValue)
if (writeOutputFiles) {
const extension = json ? 'json' : 'txt'
const outputFilePath = path.join(outputDir, `${key}.${extension}`)
if (!(await exists(outputDir))) {
await fs.mkdir(outputDir, {recursive: true})
}
await fs.writeFile(outputFilePath, cleanedValue.replace(/\\"/g, '"'))
}
} | 0 | TypeScript | CWE-77 | Improper Neutralization of Special Elements used in a Command ('Command Injection') | The product constructs all or part of a command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/77.html | vulnerable |
}): Promise<void> => {
let cleanedValue
if (json) {
cleanedValue = jsonOutput({value, shouldEscape})
} else {
cleanedValue = value.toString().trim()
}
// if safeOutput is true, escape special characters for bash shell
if (safeOutput) {
cleanedValue = cleanedValue.replace(
/[^\x20-\x7E]|[:*?"<>|;`$()&!]/g,
'\\$&'
)
}
core.setOutput(key, cleanedValue)
if (writeOutputFiles) {
const extension = json ? 'json' : 'txt'
const outputFilePath = path.join(outputDir, `${key}.${extension}`)
if (!(await exists(outputDir))) {
await fs.mkdir(outputDir, {recursive: true})
}
await fs.writeFile(outputFilePath, cleanedValue.replace(/\\"/g, '"'))
}
} | 0 | TypeScript | CWE-77 | Improper Neutralization of Special Elements used in a Command ('Command Injection') | The product constructs all or part of a command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/77.html | vulnerable |
origin(origin, callback) {
if (!origin || origin === "null") {
callback(null, true);
return;
}
const { hostname } = new URL(origin);
const appHostname = new URL(fastify.config.PUBLIC_APP_URL).hostname;
if (
hostname === "localhost" ||
hostname.endsWith(appHostname) ||
(fastify.config.VRITE_CLOUD && hostname.endsWith("swagger.io"))
) {
callback(null, true);
return;
}
callback(new Error("Not allowed"), false);
} | 0 | TypeScript | CWE-20 | Improper Input Validation | The product receives input or data, but it does
not validate or incorrectly validates that the input has the
properties that are required to process the data safely and
correctly. | https://cwe.mitre.org/data/definitions/20.html | vulnerable |
origin(origin, callback) {
if (!origin || origin === "null") {
callback(null, true);
return;
}
const { hostname } = new URL(origin);
const appHostname = new URL(fastify.config.PUBLIC_APP_URL).hostname;
if (
hostname === "localhost" ||
hostname.endsWith(appHostname) ||
(fastify.config.VRITE_CLOUD && hostname.endsWith("swagger.io"))
) {
callback(null, true);
return;
}
callback(new Error("Not allowed"), false);
} | 0 | TypeScript | CWE-918 | Server-Side Request Forgery (SSRF) | The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination. | https://cwe.mitre.org/data/definitions/918.html | vulnerable |
origin(origin, callback) {
if (!origin || origin === "null") {
callback(null, true);
return;
}
const { hostname } = new URL(origin);
const appHostname = new URL(fastify.config.PUBLIC_APP_URL).hostname;
if (
hostname === "localhost" ||
hostname.endsWith(appHostname) ||
(fastify.config.VRITE_CLOUD && hostname.endsWith("swagger.io"))
) {
callback(null, true);
return;
}
callback(new Error("Not allowed"), false);
} | 0 | TypeScript | CWE-770 | Allocation of Resources Without Limits or Throttling | The product allocates a reusable resource or group of resources on behalf of an actor without imposing any restrictions on the size or number of resources that can be allocated, in violation of the intended security policy for that actor. | https://cwe.mitre.org/data/definitions/770.html | vulnerable |
const renderPage = async (reply: FastifyReply): Promise<void> => {
return reply.view("index.html", {
PUBLIC_APP_URL: fastify.config.PUBLIC_APP_URL,
PUBLIC_API_URL: fastify.config.PUBLIC_API_URL,
PUBLIC_COLLAB_URL: fastify.config.PUBLIC_COLLAB_URL,
PUBLIC_ASSETS_URL: fastify.config.PUBLIC_ASSETS_URL,
PUBLIC_DISABLE_ANALYTICS: fastify.config.PUBLIC_DISABLE_ANALYTICS,
PUBLIC_APP_TYPE: fastify.config.PUBLIC_APP_TYPE
});
}; | 0 | TypeScript | CWE-20 | Improper Input Validation | The product receives input or data, but it does
not validate or incorrectly validates that the input has the
properties that are required to process the data safely and
correctly. | https://cwe.mitre.org/data/definitions/20.html | vulnerable |
const renderPage = async (reply: FastifyReply): Promise<void> => {
return reply.view("index.html", {
PUBLIC_APP_URL: fastify.config.PUBLIC_APP_URL,
PUBLIC_API_URL: fastify.config.PUBLIC_API_URL,
PUBLIC_COLLAB_URL: fastify.config.PUBLIC_COLLAB_URL,
PUBLIC_ASSETS_URL: fastify.config.PUBLIC_ASSETS_URL,
PUBLIC_DISABLE_ANALYTICS: fastify.config.PUBLIC_DISABLE_ANALYTICS,
PUBLIC_APP_TYPE: fastify.config.PUBLIC_APP_TYPE
});
}; | 0 | TypeScript | CWE-918 | Server-Side Request Forgery (SSRF) | The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination. | https://cwe.mitre.org/data/definitions/918.html | vulnerable |
const renderPage = async (reply: FastifyReply): Promise<void> => {
return reply.view("index.html", {
PUBLIC_APP_URL: fastify.config.PUBLIC_APP_URL,
PUBLIC_API_URL: fastify.config.PUBLIC_API_URL,
PUBLIC_COLLAB_URL: fastify.config.PUBLIC_COLLAB_URL,
PUBLIC_ASSETS_URL: fastify.config.PUBLIC_ASSETS_URL,
PUBLIC_DISABLE_ANALYTICS: fastify.config.PUBLIC_DISABLE_ANALYTICS,
PUBLIC_APP_TYPE: fastify.config.PUBLIC_APP_TYPE
});
}; | 0 | TypeScript | CWE-770 | Allocation of Resources Without Limits or Throttling | The product allocates a reusable resource or group of resources on behalf of an actor without imposing any restrictions on the size or number of resources that can be allocated, in violation of the intended security policy for that actor. | https://cwe.mitre.org/data/definitions/770.html | vulnerable |
private publishGitDataEvent = createEventPublisher<GitDataEvent>((workspaceId) => {
return `gitData:${workspaceId}`;
}); | 0 | TypeScript | CWE-20 | Improper Input Validation | The product receives input or data, but it does
not validate or incorrectly validates that the input has the
properties that are required to process the data safely and
correctly. | https://cwe.mitre.org/data/definitions/20.html | vulnerable |
private publishGitDataEvent = createEventPublisher<GitDataEvent>((workspaceId) => {
return `gitData:${workspaceId}`;
}); | 0 | TypeScript | CWE-918 | Server-Side Request Forgery (SSRF) | The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination. | https://cwe.mitre.org/data/definitions/918.html | vulnerable |
private publishGitDataEvent = createEventPublisher<GitDataEvent>((workspaceId) => {
return `gitData:${workspaceId}`;
}); | 0 | TypeScript | CWE-770 | Allocation of Resources Without Limits or Throttling | The product allocates a reusable resource or group of resources on behalf of an actor without imposing any restrictions on the size or number of resources that can be allocated, in violation of the intended security policy for that actor. | https://cwe.mitre.org/data/definitions/770.html | vulnerable |
async onAuthenticate(data) {
const cookies = fastify.parseCookie(data.requestHeaders.cookie || "");
if (!cookies.accessToken) {
throw unauthorized();
}
const token = fastify.unsignCookie(cookies.accessToken || "")?.value || "";
if (!token) {
throw unauthorized();
}
const { sessionId } = fastify.jwt.verify<{ sessionId: string }>(token);
const sessionCache = await fastify.redis.get(`session:${sessionId}`);
const sessionData = JSON.parse(sessionCache || "{}") as SessionData;
if (sessionData.baseType !== "admin" && !sessionData.permissions.includes("editContent")) {
data.connection.readOnly = true;
}
return sessionData;
}, | 0 | TypeScript | CWE-20 | Improper Input Validation | The product receives input or data, but it does
not validate or incorrectly validates that the input has the
properties that are required to process the data safely and
correctly. | https://cwe.mitre.org/data/definitions/20.html | vulnerable |
async onAuthenticate(data) {
const cookies = fastify.parseCookie(data.requestHeaders.cookie || "");
if (!cookies.accessToken) {
throw unauthorized();
}
const token = fastify.unsignCookie(cookies.accessToken || "")?.value || "";
if (!token) {
throw unauthorized();
}
const { sessionId } = fastify.jwt.verify<{ sessionId: string }>(token);
const sessionCache = await fastify.redis.get(`session:${sessionId}`);
const sessionData = JSON.parse(sessionCache || "{}") as SessionData;
if (sessionData.baseType !== "admin" && !sessionData.permissions.includes("editContent")) {
data.connection.readOnly = true;
}
return sessionData;
}, | 0 | TypeScript | CWE-918 | Server-Side Request Forgery (SSRF) | The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination. | https://cwe.mitre.org/data/definitions/918.html | vulnerable |
async onAuthenticate(data) {
const cookies = fastify.parseCookie(data.requestHeaders.cookie || "");
if (!cookies.accessToken) {
throw unauthorized();
}
const token = fastify.unsignCookie(cookies.accessToken || "")?.value || "";
if (!token) {
throw unauthorized();
}
const { sessionId } = fastify.jwt.verify<{ sessionId: string }>(token);
const sessionCache = await fastify.redis.get(`session:${sessionId}`);
const sessionData = JSON.parse(sessionCache || "{}") as SessionData;
if (sessionData.baseType !== "admin" && !sessionData.permissions.includes("editContent")) {
data.connection.readOnly = true;
}
return sessionData;
}, | 0 | TypeScript | CWE-770 | Allocation of Resources Without Limits or Throttling | The product allocates a reusable resource or group of resources on behalf of an actor without imposing any restrictions on the size or number of resources that can be allocated, in violation of the intended security policy for that actor. | https://cwe.mitre.org/data/definitions/770.html | vulnerable |
createContext({ req, res }: { req: FastifyRequest; res: FastifyReply }) {
return createContext({ req, res }, fastify);
} | 0 | TypeScript | CWE-20 | Improper Input Validation | The product receives input or data, but it does
not validate or incorrectly validates that the input has the
properties that are required to process the data safely and
correctly. | https://cwe.mitre.org/data/definitions/20.html | vulnerable |
createContext({ req, res }: { req: FastifyRequest; res: FastifyReply }) {
return createContext({ req, res }, fastify);
} | 0 | TypeScript | CWE-918 | Server-Side Request Forgery (SSRF) | The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination. | https://cwe.mitre.org/data/definitions/918.html | vulnerable |
createContext({ req, res }: { req: FastifyRequest; res: FastifyReply }) {
return createContext({ req, res }, fastify);
} | 0 | TypeScript | CWE-770 | Allocation of Resources Without Limits or Throttling | The product allocates a reusable resource or group of resources on behalf of an actor without imposing any restrictions on the size or number of resources that can be allocated, in violation of the intended security policy for that actor. | https://cwe.mitre.org/data/definitions/770.html | vulnerable |
const loadParserPlugins = async (language: string): Promise<Plugin[] | null> => {
switch (language as SupportedLanguages) {
case "javascript":
case "typescript":
return [
await import("prettier/plugins/babel"),
(await import("prettier/plugins/estree")) as Plugin
];
case "graphql":
return [await import("prettier/plugins/graphql")];
case "html":
case "vue":
return [await import("prettier/plugins/html")];
case "markdown":
return [await import("prettier/plugins/markdown")];
case "yaml":
case "json":
return [await import("prettier/plugins/yaml")];
case "css":
case "less":
case "scss":
return [await import("prettier/plugins/postcss")];
default:
return null;
}
}; | 0 | TypeScript | CWE-20 | Improper Input Validation | The product receives input or data, but it does
not validate or incorrectly validates that the input has the
properties that are required to process the data safely and
correctly. | https://cwe.mitre.org/data/definitions/20.html | vulnerable |
const loadParserPlugins = async (language: string): Promise<Plugin[] | null> => {
switch (language as SupportedLanguages) {
case "javascript":
case "typescript":
return [
await import("prettier/plugins/babel"),
(await import("prettier/plugins/estree")) as Plugin
];
case "graphql":
return [await import("prettier/plugins/graphql")];
case "html":
case "vue":
return [await import("prettier/plugins/html")];
case "markdown":
return [await import("prettier/plugins/markdown")];
case "yaml":
case "json":
return [await import("prettier/plugins/yaml")];
case "css":
case "less":
case "scss":
return [await import("prettier/plugins/postcss")];
default:
return null;
}
}; | 0 | TypeScript | CWE-918 | Server-Side Request Forgery (SSRF) | The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination. | https://cwe.mitre.org/data/definitions/918.html | vulnerable |
const loadParserPlugins = async (language: string): Promise<Plugin[] | null> => {
switch (language as SupportedLanguages) {
case "javascript":
case "typescript":
return [
await import("prettier/plugins/babel"),
(await import("prettier/plugins/estree")) as Plugin
];
case "graphql":
return [await import("prettier/plugins/graphql")];
case "html":
case "vue":
return [await import("prettier/plugins/html")];
case "markdown":
return [await import("prettier/plugins/markdown")];
case "yaml":
case "json":
return [await import("prettier/plugins/yaml")];
case "css":
case "less":
case "scss":
return [await import("prettier/plugins/postcss")];
default:
return null;
}
}; | 0 | TypeScript | CWE-770 | Allocation of Resources Without Limits or Throttling | The product allocates a reusable resource or group of resources on behalf of an actor without imposing any restrictions on the size or number of resources that can be allocated, in violation of the intended security policy for that actor. | https://cwe.mitre.org/data/definitions/770.html | vulnerable |
...(language === "json" && {
trailingComma: "none",
singleQuote: false
})
});
}
return code;
}; | 0 | TypeScript | CWE-20 | Improper Input Validation | The product receives input or data, but it does
not validate or incorrectly validates that the input has the
properties that are required to process the data safely and
correctly. | https://cwe.mitre.org/data/definitions/20.html | vulnerable |
...(language === "json" && {
trailingComma: "none",
singleQuote: false
})
});
}
return code;
}; | 0 | TypeScript | CWE-918 | Server-Side Request Forgery (SSRF) | The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination. | https://cwe.mitre.org/data/definitions/918.html | vulnerable |
...(language === "json" && {
trailingComma: "none",
singleQuote: false
})
});
}
return code;
}; | 0 | TypeScript | CWE-770 | Allocation of Resources Without Limits or Throttling | The product allocates a reusable resource or group of resources on behalf of an actor without imposing any restrictions on the size or number of resources that can be allocated, in violation of the intended security policy for that actor. | https://cwe.mitre.org/data/definitions/770.html | vulnerable |
): ((query: string) => string[]) => {
const languageIds = getLanguageIds(languages);
const engine =
searchEngine() ||
new MiniSearch({
fields: ["id"],
searchOptions: {
prefix: true
}
});
if (!searchEngine()) {
engine.addAll(languageIds);
setSearchEngine(engine);
}
return (query: string) => {
const suggestions = engine.autoSuggest(query, { prefix: true });
return suggestions
.filter((v) => v)
.map(({ suggestion }) => {
return suggestion;
});
};
}; | 0 | TypeScript | CWE-20 | Improper Input Validation | The product receives input or data, but it does
not validate or incorrectly validates that the input has the
properties that are required to process the data safely and
correctly. | https://cwe.mitre.org/data/definitions/20.html | vulnerable |
): ((query: string) => string[]) => {
const languageIds = getLanguageIds(languages);
const engine =
searchEngine() ||
new MiniSearch({
fields: ["id"],
searchOptions: {
prefix: true
}
});
if (!searchEngine()) {
engine.addAll(languageIds);
setSearchEngine(engine);
}
return (query: string) => {
const suggestions = engine.autoSuggest(query, { prefix: true });
return suggestions
.filter((v) => v)
.map(({ suggestion }) => {
return suggestion;
});
};
}; | 0 | TypeScript | CWE-918 | Server-Side Request Forgery (SSRF) | The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination. | https://cwe.mitre.org/data/definitions/918.html | vulnerable |
): ((query: string) => string[]) => {
const languageIds = getLanguageIds(languages);
const engine =
searchEngine() ||
new MiniSearch({
fields: ["id"],
searchOptions: {
prefix: true
}
});
if (!searchEngine()) {
engine.addAll(languageIds);
setSearchEngine(engine);
}
return (query: string) => {
const suggestions = engine.autoSuggest(query, { prefix: true });
return suggestions
.filter((v) => v)
.map(({ suggestion }) => {
return suggestion;
});
};
}; | 0 | TypeScript | CWE-770 | Allocation of Resources Without Limits or Throttling | The product allocates a reusable resource or group of resources on behalf of an actor without imposing any restrictions on the size or number of resources that can be allocated, in violation of the intended security policy for that actor. | https://cwe.mitre.org/data/definitions/770.html | vulnerable |
command({ editor, range }) {
return editor.chain().focus().deleteRange(range).setWrapper().run();
} | 0 | TypeScript | CWE-20 | Improper Input Validation | The product receives input or data, but it does
not validate or incorrectly validates that the input has the
properties that are required to process the data safely and
correctly. | https://cwe.mitre.org/data/definitions/20.html | vulnerable |
command({ editor, range }) {
return editor.chain().focus().deleteRange(range).setWrapper().run();
} | 0 | TypeScript | CWE-918 | Server-Side Request Forgery (SSRF) | The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination. | https://cwe.mitre.org/data/definitions/918.html | vulnerable |
command({ editor, range }) {
return editor.chain().focus().deleteRange(range).setWrapper().run();
} | 0 | TypeScript | CWE-770 | Allocation of Resources Without Limits or Throttling | The product allocates a reusable resource or group of resources on behalf of an actor without imposing any restrictions on the size or number of resources that can be allocated, in violation of the intended security policy for that actor. | https://cwe.mitre.org/data/definitions/770.html | vulnerable |
): Context => {
const { db } = fastify.mongo;
if (!db) {
throw new Error("Database not connected");
}
return { req, res, db, fastify };
}; | 0 | TypeScript | CWE-20 | Improper Input Validation | The product receives input or data, but it does
not validate or incorrectly validates that the input has the
properties that are required to process the data safely and
correctly. | https://cwe.mitre.org/data/definitions/20.html | vulnerable |
): Context => {
const { db } = fastify.mongo;
if (!db) {
throw new Error("Database not connected");
}
return { req, res, db, fastify };
}; | 0 | TypeScript | CWE-918 | Server-Side Request Forgery (SSRF) | The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination. | https://cwe.mitre.org/data/definitions/918.html | vulnerable |
): Context => {
const { db } = fastify.mongo;
if (!db) {
throw new Error("Database not connected");
}
return { req, res, db, fastify };
}; | 0 | TypeScript | CWE-770 | Allocation of Resources Without Limits or Throttling | The product allocates a reusable resource or group of resources on behalf of an actor without imposing any restrictions on the size or number of resources that can be allocated, in violation of the intended security policy for that actor. | https://cwe.mitre.org/data/definitions/770.html | vulnerable |
...(date && { date: new Date(date) }), | 0 | TypeScript | CWE-20 | Improper Input Validation | The product receives input or data, but it does
not validate or incorrectly validates that the input has the
properties that are required to process the data safely and
correctly. | https://cwe.mitre.org/data/definitions/20.html | vulnerable |
...(date && { date: new Date(date) }), | 0 | TypeScript | CWE-918 | Server-Side Request Forgery (SSRF) | The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination. | https://cwe.mitre.org/data/definitions/918.html | vulnerable |
...(date && { date: new Date(date) }), | 0 | TypeScript | CWE-770 | Allocation of Resources Without Limits or Throttling | The product allocates a reusable resource or group of resources on behalf of an actor without imposing any restrictions on the size or number of resources that can be allocated, in violation of the intended security policy for that actor. | https://cwe.mitre.org/data/definitions/770.html | vulnerable |
...(tags && { tags: tags.map((tagId) => new ObjectId(tagId)) }) | 0 | TypeScript | CWE-20 | Improper Input Validation | The product receives input or data, but it does
not validate or incorrectly validates that the input has the
properties that are required to process the data safely and
correctly. | https://cwe.mitre.org/data/definitions/20.html | vulnerable |
...(tags && { tags: tags.map((tagId) => new ObjectId(tagId)) }) | 0 | TypeScript | CWE-918 | Server-Side Request Forgery (SSRF) | The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination. | https://cwe.mitre.org/data/definitions/918.html | vulnerable |
...(tags && { tags: tags.map((tagId) => new ObjectId(tagId)) }) | 0 | TypeScript | CWE-770 | Allocation of Resources Without Limits or Throttling | The product allocates a reusable resource or group of resources on behalf of an actor without imposing any restrictions on the size or number of resources that can be allocated, in violation of the intended security policy for that actor. | https://cwe.mitre.org/data/definitions/770.html | vulnerable |
process() {
return Promise.resolve("");
}, | 0 | TypeScript | CWE-20 | Improper Input Validation | The product receives input or data, but it does
not validate or incorrectly validates that the input has the
properties that are required to process the data safely and
correctly. | https://cwe.mitre.org/data/definitions/20.html | vulnerable |
process() {
return Promise.resolve("");
}, | 0 | TypeScript | CWE-918 | Server-Side Request Forgery (SSRF) | The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination. | https://cwe.mitre.org/data/definitions/918.html | vulnerable |
process() {
return Promise.resolve("");
}, | 0 | TypeScript | CWE-770 | Allocation of Resources Without Limits or Throttling | The product allocates a reusable resource or group of resources on behalf of an actor without imposing any restrictions on the size or number of resources that can be allocated, in violation of the intended security policy for that actor. | https://cwe.mitre.org/data/definitions/770.html | vulnerable |
): Promise<OutputContentProcessor> => {
if (gitData.provider === "github") {
return await createOutputContentProcessorGitHub(ctx, gitData);
}
return {
process() {
return Promise.resolve("");
},
processBatch(input) {
return Promise.resolve(input.map(() => ""));
}
};
}; | 0 | TypeScript | CWE-20 | Improper Input Validation | The product receives input or data, but it does
not validate or incorrectly validates that the input has the
properties that are required to process the data safely and
correctly. | https://cwe.mitre.org/data/definitions/20.html | vulnerable |
): Promise<OutputContentProcessor> => {
if (gitData.provider === "github") {
return await createOutputContentProcessorGitHub(ctx, gitData);
}
return {
process() {
return Promise.resolve("");
},
processBatch(input) {
return Promise.resolve(input.map(() => ""));
}
};
}; | 0 | TypeScript | CWE-918 | Server-Side Request Forgery (SSRF) | The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination. | https://cwe.mitre.org/data/definitions/918.html | vulnerable |
): Promise<OutputContentProcessor> => {
if (gitData.provider === "github") {
return await createOutputContentProcessorGitHub(ctx, gitData);
}
return {
process() {
return Promise.resolve("");
},
processBatch(input) {
return Promise.resolve(input.map(() => ""));
}
};
}; | 0 | TypeScript | CWE-770 | Allocation of Resources Without Limits or Throttling | The product allocates a reusable resource or group of resources on behalf of an actor without imposing any restrictions on the size or number of resources that can be allocated, in violation of the intended security policy for that actor. | https://cwe.mitre.org/data/definitions/770.html | vulnerable |
processBatch(input) {
return Promise.resolve(input.map(() => ""));
} | 0 | TypeScript | CWE-20 | Improper Input Validation | The product receives input or data, but it does
not validate or incorrectly validates that the input has the
properties that are required to process the data safely and
correctly. | https://cwe.mitre.org/data/definitions/20.html | vulnerable |
processBatch(input) {
return Promise.resolve(input.map(() => ""));
} | 0 | TypeScript | CWE-918 | Server-Side Request Forgery (SSRF) | The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination. | https://cwe.mitre.org/data/definitions/918.html | vulnerable |
processBatch(input) {
return Promise.resolve(input.map(() => ""));
} | 0 | TypeScript | CWE-770 | Allocation of Resources Without Limits or Throttling | The product allocates a reusable resource or group of resources on behalf of an actor without imposing any restrictions on the size or number of resources that can be allocated, in violation of the intended security policy for that actor. | https://cwe.mitre.org/data/definitions/770.html | vulnerable |
const jsonToBuffer = (json: DocJSON): Buffer => {
const doc = TiptapTransformer.toYdoc(json, "default", [
Document,
Paragraph,
Text,
HardBreak,
Bold,
Italic,
Strike,
Code,
Link,
Highlight,
Subscript,
Superscript,
Heading,
BulletList,
OrderedList,
TaskList,
Blockquote,
Wrapper,
CodeBlock,
HorizontalRule,
Image,
Embed,
TaskItem,
ListItem,
Comment,
Table,
TableCell,
TableHeader,
TableRow
]);
return Buffer.from(Y.encodeStateAsUpdate(doc));
}; | 0 | TypeScript | CWE-20 | Improper Input Validation | The product receives input or data, but it does
not validate or incorrectly validates that the input has the
properties that are required to process the data safely and
correctly. | https://cwe.mitre.org/data/definitions/20.html | vulnerable |
const jsonToBuffer = (json: DocJSON): Buffer => {
const doc = TiptapTransformer.toYdoc(json, "default", [
Document,
Paragraph,
Text,
HardBreak,
Bold,
Italic,
Strike,
Code,
Link,
Highlight,
Subscript,
Superscript,
Heading,
BulletList,
OrderedList,
TaskList,
Blockquote,
Wrapper,
CodeBlock,
HorizontalRule,
Image,
Embed,
TaskItem,
ListItem,
Comment,
Table,
TableCell,
TableHeader,
TableRow
]);
return Buffer.from(Y.encodeStateAsUpdate(doc));
}; | 0 | TypeScript | CWE-918 | Server-Side Request Forgery (SSRF) | The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination. | https://cwe.mitre.org/data/definitions/918.html | vulnerable |
const jsonToBuffer = (json: DocJSON): Buffer => {
const doc = TiptapTransformer.toYdoc(json, "default", [
Document,
Paragraph,
Text,
HardBreak,
Bold,
Italic,
Strike,
Code,
Link,
Highlight,
Subscript,
Superscript,
Heading,
BulletList,
OrderedList,
TaskList,
Blockquote,
Wrapper,
CodeBlock,
HorizontalRule,
Image,
Embed,
TaskItem,
ListItem,
Comment,
Table,
TableCell,
TableHeader,
TableRow
]);
return Buffer.from(Y.encodeStateAsUpdate(doc));
}; | 0 | TypeScript | CWE-770 | Allocation of Resources Without Limits or Throttling | The product allocates a reusable resource or group of resources on behalf of an actor without imposing any restrictions on the size or number of resources that can be allocated, in violation of the intended security policy for that actor. | https://cwe.mitre.org/data/definitions/770.html | vulnerable |
const htmlToJSON = (html: string): DocJSON => {
return generateJSON(html, [
Document,
Paragraph,
Text,
HardBreak,
Bold,
Italic,
Strike,
Code,
Link,
Highlight,
Subscript,
Superscript,
Heading,
BulletList,
OrderedList,
TaskList,
Blockquote,
Wrapper,
CodeBlock,
HorizontalRule,
Image,
Embed,
TaskItem,
ListItem,
Comment,
Table,
TableCell,
TableHeader,
TableRow
]) as DocJSON;
}; | 0 | TypeScript | CWE-20 | Improper Input Validation | The product receives input or data, but it does
not validate or incorrectly validates that the input has the
properties that are required to process the data safely and
correctly. | https://cwe.mitre.org/data/definitions/20.html | vulnerable |
const htmlToJSON = (html: string): DocJSON => {
return generateJSON(html, [
Document,
Paragraph,
Text,
HardBreak,
Bold,
Italic,
Strike,
Code,
Link,
Highlight,
Subscript,
Superscript,
Heading,
BulletList,
OrderedList,
TaskList,
Blockquote,
Wrapper,
CodeBlock,
HorizontalRule,
Image,
Embed,
TaskItem,
ListItem,
Comment,
Table,
TableCell,
TableHeader,
TableRow
]) as DocJSON;
}; | 0 | TypeScript | CWE-918 | Server-Side Request Forgery (SSRF) | The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination. | https://cwe.mitre.org/data/definitions/918.html | vulnerable |
const htmlToJSON = (html: string): DocJSON => {
return generateJSON(html, [
Document,
Paragraph,
Text,
HardBreak,
Bold,
Italic,
Strike,
Code,
Link,
Highlight,
Subscript,
Superscript,
Heading,
BulletList,
OrderedList,
TaskList,
Blockquote,
Wrapper,
CodeBlock,
HorizontalRule,
Image,
Embed,
TaskItem,
ListItem,
Comment,
Table,
TableCell,
TableHeader,
TableRow
]) as DocJSON;
}; | 0 | TypeScript | CWE-770 | Allocation of Resources Without Limits or Throttling | The product allocates a reusable resource or group of resources on behalf of an actor without imposing any restrictions on the size or number of resources that can be allocated, in violation of the intended security policy for that actor. | https://cwe.mitre.org/data/definitions/770.html | vulnerable |
...(webhook.extensionId && {
headers: {
"X-Vrite-Extension-ID": `${webhook.extensionId}`
}
})
});
} catch (error) {
// eslint-disable-next-line no-console
console.error("Failed to run webhook", error);
}
}
}; | 0 | TypeScript | CWE-20 | Improper Input Validation | The product receives input or data, but it does
not validate or incorrectly validates that the input has the
properties that are required to process the data safely and
correctly. | https://cwe.mitre.org/data/definitions/20.html | vulnerable |
...(webhook.extensionId && {
headers: {
"X-Vrite-Extension-ID": `${webhook.extensionId}`
}
})
});
} catch (error) {
// eslint-disable-next-line no-console
console.error("Failed to run webhook", error);
}
}
}; | 0 | TypeScript | CWE-918 | Server-Side Request Forgery (SSRF) | The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination. | https://cwe.mitre.org/data/definitions/918.html | vulnerable |
...(webhook.extensionId && {
headers: {
"X-Vrite-Extension-ID": `${webhook.extensionId}`
}
})
});
} catch (error) {
// eslint-disable-next-line no-console
console.error("Failed to run webhook", error);
}
}
}; | 0 | TypeScript | CWE-770 | Allocation of Resources Without Limits or Throttling | The product allocates a reusable resource or group of resources on behalf of an actor without imposing any restrictions on the size or number of resources that can be allocated, in violation of the intended security policy for that actor. | https://cwe.mitre.org/data/definitions/770.html | vulnerable |
html: renderEmail(email.template, email.data),
text: renderEmail(email.template, email.data, true)
});
} catch (error) {
// eslint-disable-next-line no-console
console.error(error);
throw errors.serverError();
}
};
}
return async () => {
// eslint-disable-next-line no-console
console.error("No email service configured");
throw errors.serverError();
};
}; | 0 | TypeScript | CWE-20 | Improper Input Validation | The product receives input or data, but it does
not validate or incorrectly validates that the input has the
properties that are required to process the data safely and
correctly. | https://cwe.mitre.org/data/definitions/20.html | vulnerable |
html: renderEmail(email.template, email.data),
text: renderEmail(email.template, email.data, true)
});
} catch (error) {
// eslint-disable-next-line no-console
console.error(error);
throw errors.serverError();
}
};
}
return async () => {
// eslint-disable-next-line no-console
console.error("No email service configured");
throw errors.serverError();
};
}; | 0 | TypeScript | CWE-918 | Server-Side Request Forgery (SSRF) | The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination. | https://cwe.mitre.org/data/definitions/918.html | vulnerable |
html: renderEmail(email.template, email.data),
text: renderEmail(email.template, email.data, true)
});
} catch (error) {
// eslint-disable-next-line no-console
console.error(error);
throw errors.serverError();
}
};
}
return async () => {
// eslint-disable-next-line no-console
console.error("No email service configured");
throw errors.serverError();
};
}; | 0 | TypeScript | CWE-770 | Allocation of Resources Without Limits or Throttling | The product allocates a reusable resource or group of resources on behalf of an actor without imposing any restrictions on the size or number of resources that can be allocated, in violation of the intended security policy for that actor. | https://cwe.mitre.org/data/definitions/770.html | vulnerable |
text: renderEmail(email.template, email.data, true)
});
} catch (error) {
// eslint-disable-next-line no-console
console.error(error);
throw errors.serverError();
}
}; | 0 | TypeScript | CWE-20 | Improper Input Validation | The product receives input or data, but it does
not validate or incorrectly validates that the input has the
properties that are required to process the data safely and
correctly. | https://cwe.mitre.org/data/definitions/20.html | vulnerable |
text: renderEmail(email.template, email.data, true)
});
} catch (error) {
// eslint-disable-next-line no-console
console.error(error);
throw errors.serverError();
}
}; | 0 | TypeScript | CWE-918 | Server-Side Request Forgery (SSRF) | The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination. | https://cwe.mitre.org/data/definitions/918.html | vulnerable |
text: renderEmail(email.template, email.data, true)
});
} catch (error) {
// eslint-disable-next-line no-console
console.error(error);
throw errors.serverError();
}
}; | 0 | TypeScript | CWE-770 | Allocation of Resources Without Limits or Throttling | The product allocates a reusable resource or group of resources on behalf of an actor without imposing any restrictions on the size or number of resources that can be allocated, in violation of the intended security policy for that actor. | https://cwe.mitre.org/data/definitions/770.html | vulnerable |
salt: await generateSalt(),
external: {
github: { id: userData.data.id }
}
};
await users.insertOne(newUser);
const workspaceId = await createWorkspace(newUser, fastify, {
defaultContent: true
});
await userSettingsCollection.insertOne({
_id: new ObjectId(),
userId: newUser._id,
codeEditorTheme: "dark",
uiTheme: "auto",
accentColor: "energy",
currentWorkspaceId: workspaceId
});
await createSession({ req, res, db, fastify }, `${newUser._id}`);
}
return res.redirect("/");
} catch (error) {
// eslint-disable-next-line no-console
console.error(error);
return res.redirect("/auth");
}
});
fastify.register(fastifyOAuth2, oAuthConfig.github);
}; | 0 | TypeScript | CWE-20 | Improper Input Validation | The product receives input or data, but it does
not validate or incorrectly validates that the input has the
properties that are required to process the data safely and
correctly. | https://cwe.mitre.org/data/definitions/20.html | vulnerable |
salt: await generateSalt(),
external: {
github: { id: userData.data.id }
}
};
await users.insertOne(newUser);
const workspaceId = await createWorkspace(newUser, fastify, {
defaultContent: true
});
await userSettingsCollection.insertOne({
_id: new ObjectId(),
userId: newUser._id,
codeEditorTheme: "dark",
uiTheme: "auto",
accentColor: "energy",
currentWorkspaceId: workspaceId
});
await createSession({ req, res, db, fastify }, `${newUser._id}`);
}
return res.redirect("/");
} catch (error) {
// eslint-disable-next-line no-console
console.error(error);
return res.redirect("/auth");
}
});
fastify.register(fastifyOAuth2, oAuthConfig.github);
}; | 0 | TypeScript | CWE-918 | Server-Side Request Forgery (SSRF) | The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination. | https://cwe.mitre.org/data/definitions/918.html | vulnerable |
salt: await generateSalt(),
external: {
github: { id: userData.data.id }
}
};
await users.insertOne(newUser);
const workspaceId = await createWorkspace(newUser, fastify, {
defaultContent: true
});
await userSettingsCollection.insertOne({
_id: new ObjectId(),
userId: newUser._id,
codeEditorTheme: "dark",
uiTheme: "auto",
accentColor: "energy",
currentWorkspaceId: workspaceId
});
await createSession({ req, res, db, fastify }, `${newUser._id}`);
}
return res.redirect("/");
} catch (error) {
// eslint-disable-next-line no-console
console.error(error);
return res.redirect("/auth");
}
});
fastify.register(fastifyOAuth2, oAuthConfig.github);
}; | 0 | TypeScript | CWE-770 | Allocation of Resources Without Limits or Throttling | The product allocates a reusable resource or group of resources on behalf of an actor without imposing any restrictions on the size or number of resources that can be allocated, in violation of the intended security policy for that actor. | https://cwe.mitre.org/data/definitions/770.html | vulnerable |
_id: new ObjectId(),
userId: newUser._id,
codeEditorTheme: "dark",
uiTheme: "auto",
accentColor: "energy",
currentWorkspaceId: workspaceId
});
await createSession({ req, res, db, fastify }, `${newUser._id}`);
}
return res.redirect("/");
} catch (error) {
// eslint-disable-next-line no-console
console.error(error);
return res.redirect("/auth");
}
}); | 0 | TypeScript | CWE-20 | Improper Input Validation | The product receives input or data, but it does
not validate or incorrectly validates that the input has the
properties that are required to process the data safely and
correctly. | https://cwe.mitre.org/data/definitions/20.html | vulnerable |
_id: new ObjectId(),
userId: newUser._id,
codeEditorTheme: "dark",
uiTheme: "auto",
accentColor: "energy",
currentWorkspaceId: workspaceId
});
await createSession({ req, res, db, fastify }, `${newUser._id}`);
}
return res.redirect("/");
} catch (error) {
// eslint-disable-next-line no-console
console.error(error);
return res.redirect("/auth");
}
}); | 0 | TypeScript | CWE-918 | Server-Side Request Forgery (SSRF) | The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination. | https://cwe.mitre.org/data/definitions/918.html | vulnerable |
_id: new ObjectId(),
userId: newUser._id,
codeEditorTheme: "dark",
uiTheme: "auto",
accentColor: "energy",
currentWorkspaceId: workspaceId
});
await createSession({ req, res, db, fastify }, `${newUser._id}`);
}
return res.redirect("/");
} catch (error) {
// eslint-disable-next-line no-console
console.error(error);
return res.redirect("/auth");
}
}); | 0 | TypeScript | CWE-770 | Allocation of Resources Without Limits or Throttling | The product allocates a reusable resource or group of resources on behalf of an actor without imposing any restrictions on the size or number of resources that can be allocated, in violation of the intended security policy for that actor. | https://cwe.mitre.org/data/definitions/770.html | vulnerable |
_id: new ObjectId(input.id),
workspaceId: ctx.auth.workspaceId
});
if (!existingComment) throw errors.notFound("comment");
const existingThread = await commentThreadsCollection.findOne({
_id: existingComment.threadId,
workspaceId: ctx.auth.workspaceId
});
if (!existingThread) throw errors.notFound("commentThread");
await commentsCollection.updateOne(
{ _id: existingComment._id },
{ $set: { content: input.content } }
);
publishEvent(ctx, `${existingThread.contentPieceId}`, {
action: "updateComment",
data: {
content: input.content,
id: `${existingComment._id}`
}
});
}), | 0 | TypeScript | CWE-20 | Improper Input Validation | The product receives input or data, but it does
not validate or incorrectly validates that the input has the
properties that are required to process the data safely and
correctly. | https://cwe.mitre.org/data/definitions/20.html | vulnerable |
_id: new ObjectId(input.id),
workspaceId: ctx.auth.workspaceId
});
if (!existingComment) throw errors.notFound("comment");
const existingThread = await commentThreadsCollection.findOne({
_id: existingComment.threadId,
workspaceId: ctx.auth.workspaceId
});
if (!existingThread) throw errors.notFound("commentThread");
await commentsCollection.updateOne(
{ _id: existingComment._id },
{ $set: { content: input.content } }
);
publishEvent(ctx, `${existingThread.contentPieceId}`, {
action: "updateComment",
data: {
content: input.content,
id: `${existingComment._id}`
}
});
}), | 0 | TypeScript | CWE-918 | Server-Side Request Forgery (SSRF) | The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination. | https://cwe.mitre.org/data/definitions/918.html | vulnerable |
_id: new ObjectId(input.id),
workspaceId: ctx.auth.workspaceId
});
if (!existingComment) throw errors.notFound("comment");
const existingThread = await commentThreadsCollection.findOne({
_id: existingComment.threadId,
workspaceId: ctx.auth.workspaceId
});
if (!existingThread) throw errors.notFound("commentThread");
await commentsCollection.updateOne(
{ _id: existingComment._id },
{ $set: { content: input.content } }
);
publishEvent(ctx, `${existingThread.contentPieceId}`, {
action: "updateComment",
data: {
content: input.content,
id: `${existingComment._id}`
}
});
}), | 0 | TypeScript | CWE-770 | Allocation of Resources Without Limits or Throttling | The product allocates a reusable resource or group of resources on behalf of an actor without imposing any restrictions on the size or number of resources that can be allocated, in violation of the intended security policy for that actor. | https://cwe.mitre.org/data/definitions/770.html | vulnerable |
_id: new ObjectId(input.id)
});
if (!contentGroup) throw errors.notFound("contentGroup");
if (contentGroup.ancestors.length > 0) {
const ancestor = await contentGroupsCollection.findOne({
_id: contentGroup.ancestors[contentGroup.ancestors.length - 1]
});
if (!ancestor) throw errors.notFound("contentGroup");
const newDescendants = [...ancestor.descendants];
newDescendants.splice(
newDescendants.findIndex((newDescendantId) => {
return newDescendantId.equals(contentGroup._id);
}),
1
);
newDescendants.splice(input.index, 0, contentGroup._id);
await contentGroupsCollection.updateOne(
{ _id: ancestor._id },
{ $set: { descendants: newDescendants } }
);
} else {
const workspace = await workspacesCollection.findOne({
_id: ctx.auth.workspaceId
});
if (!workspace) throw errors.notFound("workspace");
const newContentGroups = [...workspace.contentGroups];
newContentGroups.splice(
newContentGroups.findIndex((newContentGroupId) => {
return newContentGroupId.equals(contentGroup._id);
}),
1
);
newContentGroups.splice(input.index, 0, contentGroup._id);
await workspacesCollection.updateOne(
{ _id: ctx.auth.workspaceId },
{ $set: { contentGroups: newContentGroups } }
);
}
publishEvent(ctx, `${ctx.auth.workspaceId}`, {
action: "reorder",
data: input
});
}), | 0 | TypeScript | CWE-20 | Improper Input Validation | The product receives input or data, but it does
not validate or incorrectly validates that the input has the
properties that are required to process the data safely and
correctly. | https://cwe.mitre.org/data/definitions/20.html | vulnerable |
_id: new ObjectId(input.id)
});
if (!contentGroup) throw errors.notFound("contentGroup");
if (contentGroup.ancestors.length > 0) {
const ancestor = await contentGroupsCollection.findOne({
_id: contentGroup.ancestors[contentGroup.ancestors.length - 1]
});
if (!ancestor) throw errors.notFound("contentGroup");
const newDescendants = [...ancestor.descendants];
newDescendants.splice(
newDescendants.findIndex((newDescendantId) => {
return newDescendantId.equals(contentGroup._id);
}),
1
);
newDescendants.splice(input.index, 0, contentGroup._id);
await contentGroupsCollection.updateOne(
{ _id: ancestor._id },
{ $set: { descendants: newDescendants } }
);
} else {
const workspace = await workspacesCollection.findOne({
_id: ctx.auth.workspaceId
});
if (!workspace) throw errors.notFound("workspace");
const newContentGroups = [...workspace.contentGroups];
newContentGroups.splice(
newContentGroups.findIndex((newContentGroupId) => {
return newContentGroupId.equals(contentGroup._id);
}),
1
);
newContentGroups.splice(input.index, 0, contentGroup._id);
await workspacesCollection.updateOne(
{ _id: ctx.auth.workspaceId },
{ $set: { contentGroups: newContentGroups } }
);
}
publishEvent(ctx, `${ctx.auth.workspaceId}`, {
action: "reorder",
data: input
});
}), | 0 | TypeScript | CWE-918 | Server-Side Request Forgery (SSRF) | The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination. | https://cwe.mitre.org/data/definitions/918.html | vulnerable |
_id: new ObjectId(input.id)
});
if (!contentGroup) throw errors.notFound("contentGroup");
if (contentGroup.ancestors.length > 0) {
const ancestor = await contentGroupsCollection.findOne({
_id: contentGroup.ancestors[contentGroup.ancestors.length - 1]
});
if (!ancestor) throw errors.notFound("contentGroup");
const newDescendants = [...ancestor.descendants];
newDescendants.splice(
newDescendants.findIndex((newDescendantId) => {
return newDescendantId.equals(contentGroup._id);
}),
1
);
newDescendants.splice(input.index, 0, contentGroup._id);
await contentGroupsCollection.updateOne(
{ _id: ancestor._id },
{ $set: { descendants: newDescendants } }
);
} else {
const workspace = await workspacesCollection.findOne({
_id: ctx.auth.workspaceId
});
if (!workspace) throw errors.notFound("workspace");
const newContentGroups = [...workspace.contentGroups];
newContentGroups.splice(
newContentGroups.findIndex((newContentGroupId) => {
return newContentGroupId.equals(contentGroup._id);
}),
1
);
newContentGroups.splice(input.index, 0, contentGroup._id);
await workspacesCollection.updateOne(
{ _id: ctx.auth.workspaceId },
{ $set: { contentGroups: newContentGroups } }
);
}
publishEvent(ctx, `${ctx.auth.workspaceId}`, {
action: "reorder",
data: input
});
}), | 0 | TypeScript | CWE-770 | Allocation of Resources Without Limits or Throttling | The product allocates a reusable resource or group of resources on behalf of an actor without imposing any restrictions on the size or number of resources that can be allocated, in violation of the intended security policy for that actor. | https://cwe.mitre.org/data/definitions/770.html | vulnerable |
...(ancestorContentGroup && {
ancestors: [...ancestorContentGroup.ancestors, ancestorContentGroup._id]
})
}
}
);
if (ancestorContentGroup) {
const descendants = await contentGroupsCollection
.find({
ancestors: contentGroup._id
})
.toArray();
await contentGroupsCollection.bulkWrite([
{
updateOne: {
filter: { _id: contentGroup.ancestors[contentGroup.ancestors.length - 1] },
update: { $pull: { descendants: contentGroupId } }
}
},
{
updateOne: {
filter: { _id: ancestorContentGroup._id },
update: { $push: { descendants: contentGroupId } }
}
},
...descendants.map((descendant) => {
const descendantAncestors = [
...ancestorContentGroup.ancestors,
...descendant.ancestors.slice(
descendant.ancestors.findIndex((_id) => contentGroup._id.equals(_id))
)
];
return {
updateOne: {
filter: { _id: descendant._id },
update: { $set: { ancestors: descendantAncestors } }
}
};
})
]);
}
runGitSyncHook(ctx, "contentGroupUpdated", {
contentGroup,
ancestor: "ancestor" in input ? input.ancestor : undefined,
name: "name" in input ? input.name : undefined
});
publishEvent(ctx, `${ctx.auth.workspaceId}`, { action: "update", data: { id, ...update } });
}), | 0 | TypeScript | CWE-20 | Improper Input Validation | The product receives input or data, but it does
not validate or incorrectly validates that the input has the
properties that are required to process the data safely and
correctly. | https://cwe.mitre.org/data/definitions/20.html | vulnerable |
...(ancestorContentGroup && {
ancestors: [...ancestorContentGroup.ancestors, ancestorContentGroup._id]
})
}
}
);
if (ancestorContentGroup) {
const descendants = await contentGroupsCollection
.find({
ancestors: contentGroup._id
})
.toArray();
await contentGroupsCollection.bulkWrite([
{
updateOne: {
filter: { _id: contentGroup.ancestors[contentGroup.ancestors.length - 1] },
update: { $pull: { descendants: contentGroupId } }
}
},
{
updateOne: {
filter: { _id: ancestorContentGroup._id },
update: { $push: { descendants: contentGroupId } }
}
},
...descendants.map((descendant) => {
const descendantAncestors = [
...ancestorContentGroup.ancestors,
...descendant.ancestors.slice(
descendant.ancestors.findIndex((_id) => contentGroup._id.equals(_id))
)
];
return {
updateOne: {
filter: { _id: descendant._id },
update: { $set: { ancestors: descendantAncestors } }
}
};
})
]);
}
runGitSyncHook(ctx, "contentGroupUpdated", {
contentGroup,
ancestor: "ancestor" in input ? input.ancestor : undefined,
name: "name" in input ? input.name : undefined
});
publishEvent(ctx, `${ctx.auth.workspaceId}`, { action: "update", data: { id, ...update } });
}), | 0 | TypeScript | CWE-918 | Server-Side Request Forgery (SSRF) | The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination. | https://cwe.mitre.org/data/definitions/918.html | vulnerable |
...(ancestorContentGroup && {
ancestors: [...ancestorContentGroup.ancestors, ancestorContentGroup._id]
})
}
}
);
if (ancestorContentGroup) {
const descendants = await contentGroupsCollection
.find({
ancestors: contentGroup._id
})
.toArray();
await contentGroupsCollection.bulkWrite([
{
updateOne: {
filter: { _id: contentGroup.ancestors[contentGroup.ancestors.length - 1] },
update: { $pull: { descendants: contentGroupId } }
}
},
{
updateOne: {
filter: { _id: ancestorContentGroup._id },
update: { $push: { descendants: contentGroupId } }
}
},
...descendants.map((descendant) => {
const descendantAncestors = [
...ancestorContentGroup.ancestors,
...descendant.ancestors.slice(
descendant.ancestors.findIndex((_id) => contentGroup._id.equals(_id))
)
];
return {
updateOne: {
filter: { _id: descendant._id },
update: { $set: { ancestors: descendantAncestors } }
}
};
})
]);
}
runGitSyncHook(ctx, "contentGroupUpdated", {
contentGroup,
ancestor: "ancestor" in input ? input.ancestor : undefined,
name: "name" in input ? input.name : undefined
});
publishEvent(ctx, `${ctx.auth.workspaceId}`, { action: "update", data: { id, ...update } });
}), | 0 | TypeScript | CWE-770 | Allocation of Resources Without Limits or Throttling | The product allocates a reusable resource or group of resources on behalf of an actor without imposing any restrictions on the size or number of resources that can be allocated, in violation of the intended security policy for that actor. | https://cwe.mitre.org/data/definitions/770.html | vulnerable |
...(isId && { _id: new ObjectId(variantIdOrName) }),
...(!isId && { name: variantIdOrName })
}); | 0 | TypeScript | CWE-20 | Improper Input Validation | The product receives input or data, but it does
not validate or incorrectly validates that the input has the
properties that are required to process the data safely and
correctly. | https://cwe.mitre.org/data/definitions/20.html | vulnerable |
...(isId && { _id: new ObjectId(variantIdOrName) }),
...(!isId && { name: variantIdOrName })
}); | 0 | TypeScript | CWE-918 | Server-Side Request Forgery (SSRF) | The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination. | https://cwe.mitre.org/data/definitions/918.html | vulnerable |
...(isId && { _id: new ObjectId(variantIdOrName) }),
...(!isId && { name: variantIdOrName })
}); | 0 | TypeScript | CWE-770 | Allocation of Resources Without Limits or Throttling | The product allocates a reusable resource or group of resources on behalf of an actor without imposing any restrictions on the size or number of resources that can be allocated, in violation of the intended security policy for that actor. | https://cwe.mitre.org/data/definitions/770.html | vulnerable |
_id: new ObjectId(input.id),
workspaceId: ctx.auth.workspaceId
});
if (!contentPiece) throw errors.notFound("contentPiece");
await contentPiecesCollection.deleteOne({ _id: contentPiece._id });
await contentsCollection.deleteOne({ contentPieceId: contentPiece._id });
await contentPieceVariantsCollection.deleteMany({
contentPieceId: contentPiece._id,
workspaceId: ctx.auth.workspaceId
});
await contentVariantsCollection.deleteMany({
contentPieceId: contentPiece._id
});
runGitSyncHook(ctx, "contentPieceRemoved", { contentPiece });
runWebhooks(ctx, "contentPieceRemoved", webhookPayload(contentPiece));
publishEvent(ctx, `${contentPiece.contentGroupId}`, {
action: "delete",
userId: `${ctx.auth.userId}`,
data: { id: input.id }
});
ctx.fastify.search.deleteContent({
contentPieceId: contentPiece._id,
workspaceId: ctx.auth.workspaceId
});
return { id: input.id };
}), | 0 | TypeScript | CWE-20 | Improper Input Validation | The product receives input or data, but it does
not validate or incorrectly validates that the input has the
properties that are required to process the data safely and
correctly. | https://cwe.mitre.org/data/definitions/20.html | vulnerable |
_id: new ObjectId(input.id),
workspaceId: ctx.auth.workspaceId
});
if (!contentPiece) throw errors.notFound("contentPiece");
await contentPiecesCollection.deleteOne({ _id: contentPiece._id });
await contentsCollection.deleteOne({ contentPieceId: contentPiece._id });
await contentPieceVariantsCollection.deleteMany({
contentPieceId: contentPiece._id,
workspaceId: ctx.auth.workspaceId
});
await contentVariantsCollection.deleteMany({
contentPieceId: contentPiece._id
});
runGitSyncHook(ctx, "contentPieceRemoved", { contentPiece });
runWebhooks(ctx, "contentPieceRemoved", webhookPayload(contentPiece));
publishEvent(ctx, `${contentPiece.contentGroupId}`, {
action: "delete",
userId: `${ctx.auth.userId}`,
data: { id: input.id }
});
ctx.fastify.search.deleteContent({
contentPieceId: contentPiece._id,
workspaceId: ctx.auth.workspaceId
});
return { id: input.id };
}), | 0 | TypeScript | CWE-918 | Server-Side Request Forgery (SSRF) | The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination. | https://cwe.mitre.org/data/definitions/918.html | vulnerable |
_id: new ObjectId(input.id),
workspaceId: ctx.auth.workspaceId
});
if (!contentPiece) throw errors.notFound("contentPiece");
await contentPiecesCollection.deleteOne({ _id: contentPiece._id });
await contentsCollection.deleteOne({ contentPieceId: contentPiece._id });
await contentPieceVariantsCollection.deleteMany({
contentPieceId: contentPiece._id,
workspaceId: ctx.auth.workspaceId
});
await contentVariantsCollection.deleteMany({
contentPieceId: contentPiece._id
});
runGitSyncHook(ctx, "contentPieceRemoved", { contentPiece });
runWebhooks(ctx, "contentPieceRemoved", webhookPayload(contentPiece));
publishEvent(ctx, `${contentPiece.contentGroupId}`, {
action: "delete",
userId: `${ctx.auth.userId}`,
data: { id: input.id }
});
ctx.fastify.search.deleteContent({
contentPieceId: contentPiece._id,
workspaceId: ctx.auth.workspaceId
});
return { id: input.id };
}), | 0 | TypeScript | CWE-770 | Allocation of Resources Without Limits or Throttling | The product allocates a reusable resource or group of resources on behalf of an actor without imposing any restrictions on the size or number of resources that can be allocated, in violation of the intended security policy for that actor. | https://cwe.mitre.org/data/definitions/770.html | vulnerable |
...(workspaceSettings?.metadata?.canonicalLinkPattern &&
typeof newContentPiece.canonicalLink !== "string" && {
canonicalLink: getCanonicalLinkFromPattern(
workspaceSettings.metadata.canonicalLinkPattern,
{ slug: newContentPiece.slug, variant: variantName }
)
}),
id: `${newContentPiece._id}`,
contentGroupId: `${newContentPiece.contentGroupId}`,
workspaceId: `${newContentPiece.workspaceId}`,
date: newContentPiece.date?.toISOString() || null,
tags,
members,
...(variantId ? { variantId } : {})
}
}); | 0 | TypeScript | CWE-20 | Improper Input Validation | The product receives input or data, but it does
not validate or incorrectly validates that the input has the
properties that are required to process the data safely and
correctly. | https://cwe.mitre.org/data/definitions/20.html | vulnerable |
...(workspaceSettings?.metadata?.canonicalLinkPattern &&
typeof newContentPiece.canonicalLink !== "string" && {
canonicalLink: getCanonicalLinkFromPattern(
workspaceSettings.metadata.canonicalLinkPattern,
{ slug: newContentPiece.slug, variant: variantName }
)
}),
id: `${newContentPiece._id}`,
contentGroupId: `${newContentPiece.contentGroupId}`,
workspaceId: `${newContentPiece.workspaceId}`,
date: newContentPiece.date?.toISOString() || null,
tags,
members,
...(variantId ? { variantId } : {})
}
}); | 0 | TypeScript | CWE-918 | Server-Side Request Forgery (SSRF) | The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination. | https://cwe.mitre.org/data/definitions/918.html | vulnerable |
...(workspaceSettings?.metadata?.canonicalLinkPattern &&
typeof newContentPiece.canonicalLink !== "string" && {
canonicalLink: getCanonicalLinkFromPattern(
workspaceSettings.metadata.canonicalLinkPattern,
{ slug: newContentPiece.slug, variant: variantName }
)
}),
id: `${newContentPiece._id}`,
contentGroupId: `${newContentPiece.contentGroupId}`,
workspaceId: `${newContentPiece.workspaceId}`,
date: newContentPiece.date?.toISOString() || null,
tags,
members,
...(variantId ? { variantId } : {})
}
}); | 0 | TypeScript | CWE-770 | Allocation of Resources Without Limits or Throttling | The product allocates a reusable resource or group of resources on behalf of an actor without imposing any restrictions on the size or number of resources that can be allocated, in violation of the intended security policy for that actor. | https://cwe.mitre.org/data/definitions/770.html | vulnerable |
...(workspaceSettings?.metadata?.canonicalLinkPattern &&
typeof contentPiece.canonicalLink !== "string" && {
canonicalLink: getCanonicalLinkFromPattern(
workspaceSettings.metadata.canonicalLinkPattern,
{ slug: contentPiece.slug, variant: variantName }
)
}), | 0 | TypeScript | CWE-20 | Improper Input Validation | The product receives input or data, but it does
not validate or incorrectly validates that the input has the
properties that are required to process the data safely and
correctly. | https://cwe.mitre.org/data/definitions/20.html | vulnerable |
...(workspaceSettings?.metadata?.canonicalLinkPattern &&
typeof contentPiece.canonicalLink !== "string" && {
canonicalLink: getCanonicalLinkFromPattern(
workspaceSettings.metadata.canonicalLinkPattern,
{ slug: contentPiece.slug, variant: variantName }
)
}), | 0 | TypeScript | CWE-918 | Server-Side Request Forgery (SSRF) | The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination. | https://cwe.mitre.org/data/definitions/918.html | vulnerable |
...(workspaceSettings?.metadata?.canonicalLinkPattern &&
typeof contentPiece.canonicalLink !== "string" && {
canonicalLink: getCanonicalLinkFromPattern(
workspaceSettings.metadata.canonicalLinkPattern,
{ slug: contentPiece.slug, variant: variantName }
)
}), | 0 | TypeScript | CWE-770 | Allocation of Resources Without Limits or Throttling | The product allocates a reusable resource or group of resources on behalf of an actor without imposing any restrictions on the size or number of resources that can be allocated, in violation of the intended security policy for that actor. | https://cwe.mitre.org/data/definitions/770.html | vulnerable |
{ _id: new ObjectId(input.id) },
{
$set: {
config: input.config
}
}
);
if (!matchedCount) {
throw errors.notFound("extension");
}
publishEvent(ctx, `${ctx.auth.workspaceId}`, {
action: "update",
data: {
id: input.id,
config: input.config
}
});
}), | 0 | TypeScript | CWE-20 | Improper Input Validation | The product receives input or data, but it does
not validate or incorrectly validates that the input has the
properties that are required to process the data safely and
correctly. | https://cwe.mitre.org/data/definitions/20.html | vulnerable |
{ _id: new ObjectId(input.id) },
{
$set: {
config: input.config
}
}
);
if (!matchedCount) {
throw errors.notFound("extension");
}
publishEvent(ctx, `${ctx.auth.workspaceId}`, {
action: "update",
data: {
id: input.id,
config: input.config
}
});
}), | 0 | TypeScript | CWE-918 | Server-Side Request Forgery (SSRF) | The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination. | https://cwe.mitre.org/data/definitions/918.html | vulnerable |
{ _id: new ObjectId(input.id) },
{
$set: {
config: input.config
}
}
);
if (!matchedCount) {
throw errors.notFound("extension");
}
publishEvent(ctx, `${ctx.auth.workspaceId}`, {
action: "update",
data: {
id: input.id,
config: input.config
}
});
}), | 0 | TypeScript | CWE-770 | Allocation of Resources Without Limits or Throttling | The product allocates a reusable resource or group of resources on behalf of an actor without imposing any restrictions on the size or number of resources that can be allocated, in violation of the intended security policy for that actor. | https://cwe.mitre.org/data/definitions/770.html | vulnerable |
_id: new ObjectId(),
workspaceId: ctx.auth.workspaceId,
name: input.name,
description: input.description,
permissions: input.permissions
};
await rolesCollection.insertOne(role);
publishEvent(ctx, `${ctx.auth.workspaceId}`, {
action: "create",
data: {
...input,
id: `${role._id}`
}
});
return { id: `${role._id}` };
}), | 0 | TypeScript | CWE-20 | Improper Input Validation | The product receives input or data, but it does
not validate or incorrectly validates that the input has the
properties that are required to process the data safely and
correctly. | https://cwe.mitre.org/data/definitions/20.html | vulnerable |
_id: new ObjectId(),
workspaceId: ctx.auth.workspaceId,
name: input.name,
description: input.description,
permissions: input.permissions
};
await rolesCollection.insertOne(role);
publishEvent(ctx, `${ctx.auth.workspaceId}`, {
action: "create",
data: {
...input,
id: `${role._id}`
}
});
return { id: `${role._id}` };
}), | 0 | TypeScript | CWE-918 | Server-Side Request Forgery (SSRF) | The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination. | https://cwe.mitre.org/data/definitions/918.html | vulnerable |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.