code stringlengths 12 2.05k | label_name stringlengths 6 8 | label int64 0 95 |
|---|---|---|
PageantSock.prototype.write = function(buf) {
if (this.buffer === null)
this.buffer = buf;
else {
this.buffer = Buffer.concat([this.buffer, buf],
this.buffer.length + buf.length);
}
// Wait for at least all length bytes
if (this.buffer.length < 4)
... | CWE-78 | 6 |
this.serversUpdatedListener = ({ servers }) => {
// Update status log line with new `garden dashboard` server, if any
for (const { host, command } of servers) {
if (command === "dashboard") {
this.showUrl(host)
return
}
}
// No active explicit dashboard p... | CWE-306 | 79 |
export function setDeepProperty(obj: any, propertyPath: string, value: any): void {
const a = splitPath(propertyPath);
const n = a.length;
for (let i = 0; i < n - 1; i++) {
const k = a[i];
if (!(k in obj)) {
obj[k] = {};
}
obj = obj[k];
}
obj[a[n - 1]] = value;
return;
} | CWE-915 | 35 |
constructor(
private readonly ptarmiganService: PtarmiganService,
private readonly bitcoinService: BitcoinService,
private readonly cacheService: CacheService,
private readonly invoicesGateway: InvoicesGateway
) {
} | CWE-295 | 52 |
}) => Awaitable<void>
/**
* By default, we are generating a random verification token.
* You can make it predictable or modify it as you like with this method.
* @example
* ```js
* Providers.Email({
* async generateVerificationToken() {
* return "ABC123"
* }
* })
* ```
... | CWE-79 | 1 |
[req.locale]: self.getBrowserBundles(req.locale)
};
if (req.locale !== self.defaultLocale) {
i18n[self.defaultLocale] = self.getBrowserBundles(self.defaultLocale);
}
const result = {
i18n,
locale: req.locale,
defaultLocale: self.defaultLo... | CWE-613 | 7 |
text: () => string
): { destroy: () => void; update: (t: () => string) => void } { | CWE-79 | 1 |
servers: servers.map((p) => ({ command: p.command!, host: p.serverHost! })),
}) | CWE-306 | 79 |
function formatMessage(msg, output) {
var output = output;
output.parseTags = true;
msg = output._parseTags(msg);
output.parseTags = false;
return msg;
} | CWE-78 | 6 |
export declare function applyCommandArgs(configuration: any, argv: string[]): void;
export declare function setDeepProperty(obj: any, propertyPath: string, value: any): void; | CWE-915 | 35 |
function detailedDataTableMapper(entry) {
const project = Projects.findOne({ _id: entry.projectId })
const mapping = [project ? project.name : '',
dayjs.utc(entry.date).format(getGlobalSetting('dateformat')),
entry.task,
projectUsers.findOne() ? projectUsers.findOne().users.find((elem) => elem._id === e... | CWE-79 | 1 |
export function render_markdown_timestamp(time: number | Date): {
text: string;
tooltip_content: string;
} {
const hourformat = user_settings.twenty_four_hour_time ? "HH:mm" : "h:mm a";
const timestring = format(time, "E, MMM d yyyy, " + hourformat);
const tz_offset_str = get_tz_with_UTC_offset(tim... | CWE-79 | 1 |
declare function getSetCookie(cookieName: string, value?: string, options?: any): string;
// backw compat, later, do once per file instead (don't want a global 'r').
//
// ReactDOMFactories looks like:
//
// var ReactDOMFactories = {
// a: createDOMFactory('a'),
// abbr: ...
//
// function createDOMFactory(type) ... | CWE-613 | 7 |
export function escape<T>(input: T): T extends SafeValue ? T['value'] : T {
return typeof input === 'string'
? string.escapeHTML(input)
: input instanceof SafeValue
? input.value
: input
} | CWE-843 | 43 |
export const initAuth0: InitAuth0 = (params) => {
const { baseConfig, nextConfig } = getConfig(params);
// Init base layer (with base config)
const getClient = clientFactory(baseConfig, { name: 'nextjs-auth0', version });
const transientStore = new TransientStore(baseConfig);
const cookieStore = new CookieSt... | CWE-601 | 11 |
api.update = async function(req, res) {
const { commentForm } = req.body;
const pageId = commentForm.page_id;
const comment = commentForm.comment;
const isMarkdown = commentForm.is_markdown;
const commentId = commentForm.comment_id;
const author = commentForm.author;
if (comment === '') ... | CWE-639 | 9 |
const createCommand = ({ ref, path }: Input) => {
return `git show ${ref}:${path}`;
}; | CWE-78 | 6 |
async convert(input, options) {
this[_validate]();
options = this[_parseOptions](options);
const output = await this[_convert](input, options);
return output;
} | CWE-94 | 14 |
export function orderLinks<T extends NameAndType>(links: T[]) {
const [provided, unknown] = partition<T>(links, isProvided);
return [
...sortBy(provided, link => PROVIDED_TYPES.indexOf(link.type)),
...sortBy(unknown, link => link.name!.toLowerCase())
];
} | CWE-79 | 1 |
render() {}, | CWE-79 | 1 |
parse(cookieStr) {
let cookie = {};
(cookieStr || '')
.toString()
.split(';')
.forEach(cookiePart => {
let valueParts = cookiePart.split('=');
let key = valueParts
.shift()
.trim()
... | CWE-88 | 3 |
return `1 ${base} = ${c.amount(d.value, quote)}<em>${day(d.date)}</em>`;
},
});
} | CWE-79 | 1 |
export function setupCleanupOnExit(cssPath: string) {
if (!hasSetupCleanupOnExit){
process.on('SIGINT', () => {
console.log('Exiting, running CSS cleanup');
exec(`rm -r ${cssPath}`, function(error) {
if (error) {
console.error(error);
process.exit(1);
}
co... | CWE-78 | 6 |
getDownloadUrl(file) {
return this.importExport.getDownloadUrl(file.id, file.accessToken);
}, | CWE-639 | 9 |
const getCdnMarkup = ({ version, cdnUrl = '//cdn.jsdelivr.net/npm', faviconUrl }) => `
<link rel="stylesheet" href="${cdnUrl}/graphql-playground-react${ | CWE-79 | 1 |
export function escapeCommentText(value: string): string {
return value.replace(END_COMMENT, END_COMMENT_ESCAPED);
} | CWE-79 | 1 |
function checkCredentials(req, res, next) {
if (!sqlInit.isDbInitialized()) {
res.status(400).send('Database is not initialized yet.');
return;
}
if (!passwordService.isPasswordSet()) {
res.status(400).send('Password has not been set yet. Please set a password and repeat the action'... | CWE-79 | 1 |
message: new MockBuilder(
{
from: '[email protected]',
to: '[email protected]'
},
'message\r\nline 2'
)
},
function(err, data) {
expect(e... | CWE-88 | 3 |
function get(target, path) {
"use strict";
try {
return reduce(target, path);
} catch(ex) {
console.error(ex);
return;
}
} | CWE-915 | 35 |
export default function handleLoginFactory(handler: BaseHandleLogin, nextConfig: NextConfig): HandleLogin {
return async (req, res, options = {}): Promise<void> => {
try {
assertReqRes(req, res);
if (req.query.returnTo) {
const returnTo = Array.isArray(req.query.returnTo) ? req.query.returnTo[... | CWE-601 | 11 |
formatMessage() {
if (this.isATweet) {
const withUserName = this.message.replace(
TWITTER_USERNAME_REGEX,
TWITTER_USERNAME_REPLACEMENT
);
const withHash = withUserName.replace(
TWITTER_HASH_REGEX,
TWITTER_HASH_REPLACEMENT
);
const markedDownOutput = ma... | CWE-79 | 1 |
export function cleanObject(obj: any): any {
return Object.entries(obj).reduce(
(obj, [key, value]) =>
value === undefined
? obj
: {
...obj,
[key]: value
},
{}
);
} | CWE-915 | 35 |
export declare function setDeepProperty(obj: any, propertyPath: string, value: any): void;
export declare function getDeepProperty(obj: any, propertyPath: string): any; | CWE-915 | 35 |
userId: projectUsers.findOne().users.find((elem) => elem._id === entry._id.userId)?.profile?.name,
totalHours,
} | CWE-1236 | 12 |
function escapeShellArg(arg) {
return arg.replace(/'/g, `'\\''`);
} | CWE-88 | 3 |
function lazyLoadCustomEmoji(element: HTMLElement): void {
const img = createElement('img', CLASS_CUSTOM_EMOJI) as HTMLImageElement;
if (element.dataset.emoji) {
img.src = element.dataset.emoji;
element.innerText = '';
element.appendChild(img);
}
} | CWE-79 | 1 |
clip: Object.assign({ x: 0, y: 0 }, dimensions)
}, provider.getScreenshotOptions(options)));
return output;
} | CWE-94 | 14 |
function detailedDataTableMapper(entry) {
const project = Projects.findOne({ _id: entry.projectId })
const mapping = [project ? project.name : '',
dayjs.utc(entry.date).format(getGlobalSetting('dateformat')),
entry.task,
projectUsers.findOne() ? projectUsers.findOne().users.find((elem) => elem._id === e... | CWE-79 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.