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B,CAAE,SAAQ,QAAS,EAAmB,UAAS,MAC1E,6BAA6B,CAAE,SAAQ,QAAS,EAAmB,UAAS,KAChF,EAER","file":"/npm/@secretlint/secretlint-rule-slack@11.2.4/module/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/@secretlint/secretlint-rule-slack@11.2.4/module/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","import { matchPatterns } from \"@textlint/regexp-string-matcher\";\nexport const messages = {\n    SLACK_TOKEN: {\n        en: (props) => `found slack token: ${props.TOKEN}`,\n        ja: (props) => `Slackトークン: ${props.TOKEN} がみつかりました`,\n    },\n    IncomingWebhook: {\n        en: (props) => `found Slack Incoming Webhook: ${props.URL}`,\n        ja: (props) => `SlackのIncoming Webhooks: ${props.TOKEN} がみつかりました`,\n    },\n};\nfunction reportIfFoundRawPrivateKey({ source, options, context, t, }) {\n    // Based on https://docs.cribl.io/docs/regexesyml\n    // https://api.slack.com/docs/token-types\n    // Bot user token strings begin with xoxb-\n    // User token strings begin with xoxp-\n    // App token strings begin with xapp-\n    // Workspace access token strings begin with xoxa-2\n    // Workspace refresh token strings begin with xoxr\n    // Pattern: {prefix}-(\\d-)-xxxx-xxxx\n    const SLACK_TOKEN_PATTERN = /\\b(?:xoxb|xoxp|xapp|xoxa|xoxo|xoxr)-(?:\\d-)?(?:[a-zA-Z0-9]{1,40}-)+[a-zA-Z0-9]{1,40}\\b/g;\n    const results = source.content.matchAll(SLACK_TOKEN_PATTERN);\n    for (const result of results) {\n        const index = result.index || 0;\n        const match = result[0] || \"\";\n        const range = [index, index + match.length];\n        const allowedResults = matchPatterns(match, options.allows);\n        if (allowedResults.length > 0) {\n            continue;\n        }\n        context.report({\n            message: t(\"SLACK_TOKEN\", {\n                TOKEN: match,\n            }),\n            range,\n        });\n    }\n}\n/**\n * Report if found Incoming Webhooks\n * https://api.slack.com/messaging/webhooks\n * @param source\n * @param options\n * @param context\n * @param t\n */\nfunction reportIfFoundIncomingWebhook({ source, options, context, t, }) {\n    // Based on https://hooks.slack.com/TXXXXX/BXXXXX/XXXXXXXXXX\n    // https://api.slack.com/messaging/webhooks\n    const IncomingWebhooksPattern = /https:\\/\\/hooks\\.slack\\.com\\/services\\/T[a-zA-Z0-9]{1,40}\\/B[a-zA-Z0-9]{1,40}\\/[a-zA-Z0-9]{1,40}/gi;\n    const results = source.content.matchAll(IncomingWebhooksPattern);\n    for (const result of results) {\n        const index = result.index || 0;\n        const match = result[0] || \"\";\n        const range = [index, index + match.length];\n        const allowedResults = matchPatterns(match, options.allows);\n        if (allowedResults.length > 0) {\n            continue;\n        }\n        context.report({\n            message: t(\"IncomingWebhook\", {\n                URL: match,\n            }),\n            range,\n        });\n    }\n}\nexport const creator = {\n    messages,\n    meta: {\n        id: \"@secretlint/secretlint-rule-slack\",\n        recommended: true,\n        type: \"scanner\",\n        supportedContentTypes: [\"text\"],\n        docs: {\n            url: \"https://github.com/secretlint/secretlint/blob/master/packages/%40secretlint/secretlint-rule-slack/README.md\",\n        },\n    },\n    create(context, options) {\n        const t = context.createTranslator(messages);\n        const normalizedOptions = {\n            allows: options.allows || [],\n        };\n        return {\n            file(source) {\n                reportIfFoundRawPrivateKey({ source, options: normalizedOptions, context, t });\n                reportIfFoundIncomingWebhook({ source, options: normalizedOptions, context, t });\n            },\n        };\n    },\n};\n"]}