Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add security incident response process #3675

Merged
merged 21 commits into from
Dec 16, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
javascript files fix
cartersocha committed Dec 13, 2023
commit 23c6560d3552040b4aeacbfa35b4a6a766be9963
14 changes: 7 additions & 7 deletions assets/js/registrySearch.js
Original file line number Diff line number Diff line change
@@ -41,13 +41,13 @@ if (pathName.includes('registry')) {
if (selectedLanguage !== 'all') {
document.getElementById('languageDropdown').textContent =
document.getElementById(
`language-item-${selectedLanguage}`
`language-item-${selectedLanguage}`,
).textContent;
}
if (selectedComponent !== 'all') {
document.getElementById('componentDropdown').textContent =
document.getElementById(
`component-item-${selectedComponent}`
`component-item-${selectedComponent}`,
).textContent;
}
updateFilters();
@@ -97,8 +97,8 @@ function populateResults(results) {
snippetHighlights.push(
match.value.substring(
match.indices[0][0],
match.indices[0][1] - mvalue.indices[0][0] + 1
)
match.indices[0][1] - mvalue.indices[0][0] + 1,
),
);
}
});
@@ -110,7 +110,7 @@ function populateResults(results) {

// Pull template from hugo template definition
let templateDefinition = document.querySelector(
'#search-result-template'
'#search-result-template',
).innerHTML;

// Replace values from template with search results
@@ -176,7 +176,7 @@ if (pathName.includes('registry')) {
evt.target.textContent;
setInput('language', val);
updateFilters();
})
}),
);
typeList.forEach((element) =>
element.addEventListener('click', function (evt) {
@@ -186,7 +186,7 @@ if (pathName.includes('registry')) {
evt.target.textContent;
setInput('component', val);
updateFilters();
})
}),
);
});
}
Original file line number Diff line number Diff line change
@@ -103,7 +103,7 @@ Zipkin backend. The following steps are required to be done.
add the following text

```html
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<title>PHP Test Page</title>
2 changes: 1 addition & 1 deletion content/en/docs/instrumentation/js/propagation.md
Original file line number Diff line number Diff line change
@@ -87,7 +87,7 @@ let span = tracer.startSpan(
{
attributes: {},
},
activeContext
activeContext,
);

// Set the created span as active in the deserialized context.
4 changes: 2 additions & 2 deletions content/en/docs/instrumentation/js/serverless.md
Original file line number Diff line number Diff line change
@@ -70,7 +70,7 @@ const collectorOptions = {
};

const spanProcessor = new BatchSpanProcessor(
new OTLPTraceExporter(collectorOptions)
new OTLPTraceExporter(collectorOptions),
);

provider.addSpanProcessor(spanProcessor);
@@ -255,7 +255,7 @@ const collectorOptions = {
};
const spanProcessor = new BatchSpanProcessor(
new OTLPTraceExporter(collectorOptions)
new OTLPTraceExporter(collectorOptions),
);
provider.addSpanProcessor(spanProcessor);
2 changes: 1 addition & 1 deletion gulp-src/_md-rules/trim-code-block-and-unindent.js
Original file line number Diff line number Diff line change
@@ -32,7 +32,7 @@ function processToken(token) {
(line) =>
line.trim().length === 0
? '' // Blank-only lines
: line.substring(minIndent) // Unindent
: line.substring(minIndent), // Unindent
);
fixedLines = trimBlankLinesFromArray(fixedLines);
const fixedContent = fixedLines.join('\n');
8 changes: 4 additions & 4 deletions gulp-src/prune.js
Original file line number Diff line number Diff line change
@@ -68,7 +68,7 @@ async function pruneTask() {
const entriesWith4xxStatus = Object.keys(entries)
.map((url) => [url, entries[url].LastSeen, entries[url].StatusCode])
.filter(
([url, date, statusCode]) => 400 <= statusCode && statusCode <= 499
([url, date, statusCode]) => 400 <= statusCode && statusCode <= 499,
);

var msg = `INFO: ${entriesWith4xxStatus.length} entries with 4XX status.`;
@@ -106,14 +106,14 @@ async function pruneTask() {
`INFO: ${
pruneCandidatesByDate__sorted.length
} entries as prune candidates for before-date ${formattedDate(
beforeDate
)}.`
beforeDate,
)}.`,
);
}

if (n == 0) {
console.log(
`WARN: num is ${n} so no entries will be pruned by date. Specify number of entries to prune as --num <n>.`
`WARN: num is ${n} so no entries will be pruned by date. Specify number of entries to prune as --num <n>.`,
);
if (numEntriesWith4xxStatus == 0) return;
}
46 changes: 23 additions & 23 deletions scripts/registry-scanner/index.mjs
Original file line number Diff line number Diff line change
@@ -50,7 +50,7 @@ const ignoreList = [
if (process.argv.length < 3) {
console.log(
`USAGE: ${path.basename(process.argv[0])} ${path.basename(
process.argv[1]
process.argv[1],
)} <list>
<list> is a comma separated list of the following options:
- collector
@@ -65,8 +65,8 @@ if (process.argv.length < 3) {
Use 'all' if you want to run all of them (except go).
Example: ${path.basename(process.argv[0])} ${path.basename(
process.argv[1]
)} python,ruby,erlang`
process.argv[1],
)} python,ruby,erlang`,
);
process.exit();
}
@@ -76,7 +76,7 @@ const selection = process.argv[2].split(',').map((x) => x.trim());
const scanners = {
collector: () => {
['receiver', 'exporter', 'processor', 'extension'].forEach(
async (component) => scanCollectorComponent(component)
async (component) => scanCollectorComponent(component),
);
},
js: () => {
@@ -85,7 +85,7 @@ const scanners = {
'resource-detector',
'js',
'detectors/node',
'resource-detector'
'resource-detector',
);
},
java: () => {
@@ -94,7 +94,7 @@ const scanners = {
'java',
'instrumentation',
'md',
'opentelemetry-java-instrumentation'
'opentelemetry-java-instrumentation',
);
},
ruby: () => {
@@ -111,7 +111,7 @@ const scanners = {
'python',
'exporter',
'rst',
'opentelemetry-python'
'opentelemetry-python',
);
},
dotnet: () => {
@@ -128,7 +128,7 @@ const scanners = {
'md',
repo,
(item) => item.name.toLowerCase().includes(registryType),
(name) => name.split('.').splice(2, 3).join('').toLowerCase()
(name) => name.split('.').splice(2, 3).join('').toLowerCase(),
);
});
},
@@ -143,7 +143,7 @@ const scanners = {
'md',
'opentelemetry-php-contrib',
() => true,
(name) => name.toLowerCase()
(name) => name.toLowerCase(),
);
},
all: () => {
@@ -167,15 +167,15 @@ async function scanForNew(
repo,
filter = () => true,
keyMapper = (x) => x,
owner = 'open-telemetry'
owner = 'open-telemetry',
) {
const result = await octokit.request(
'GET /repos/{owner}/{repo}/contents/{path}',
{
owner,
repo,
path,
}
},
);
return result.data.reduce((carry, current) => {
if (filter(current) && current.type === 'dir') {
@@ -188,7 +188,7 @@ async function scanForNew(

async function scanForExisting(type, noDash = false) {
const result = await octokit.request(
'GET /repos/open-telemetry/opentelemetry.io/contents/data/registry'
'GET /repos/open-telemetry/opentelemetry.io/contents/data/registry',
);
return result.data.reduce((carry, current) => {
if (current.name.startsWith(type)) {
@@ -207,7 +207,7 @@ function createYaml(
language,
registryType,
repo,
description
description,
) {
return `title: ${title}
registryType: ${registryType}
@@ -261,15 +261,15 @@ async function createFilesFromScanResult(existing, found, settings) {
};
try {
const result = await octokit.request(
`GET ${new URL(current.url).pathname}/README.${readmeFormat}`
`GET ${new URL(current.url).pathname}/README.${readmeFormat}`,
);
parsedReadme = parseReadme(
Buffer.from(result.data.content, 'base64').toString(),
readmeFormat
readmeFormat,
);
} catch (e) {
console.warn(
`Request error while fetching README.md for ${currentKey}: ${e.message}`
`Request error while fetching README.md for ${currentKey}: ${e.message}`,
);
}
const yaml = createYaml(
@@ -278,7 +278,7 @@ async function createFilesFromScanResult(existing, found, settings) {
language,
registryType,
current.html_url,
parsedReadme.description
parsedReadme.description,
);
// collector entries are named reverse (collector-{registryTpe}) compared to languages ({registryTpe}-{language}), we fix this here.
const fileName = (
@@ -306,9 +306,9 @@ async function scanByLanguage(
.filter(
(y) =>
!['opentelemetry', registryType].includes(y) &&
!y.match(/^[0-9]+.[0-9]+$/)
!y.match(/^[0-9]+.[0-9]+$/),
)
.join('')
.join(''),
) {
// https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/
const found = await scanForNew(path, repo, filter, keyMapper);
@@ -329,8 +329,8 @@ async function scanCollectorComponent(component) {
component,
'opentelemetry-collector-contrib',
filter,
keyMapper
)
keyMapper,
),
);
const existing = await scanForExisting(`collector-${component}`, true);
createFilesFromScanResult(existing, found, {
@@ -343,7 +343,7 @@ async function scanCollectorComponent(component) {
async function scanForGo() {
const response = await (
await fetch(
'https://pkg.go.dev/search?limit=100&m=package&q=go.opentelemetry.io%2Fcontrib%2Finstrumentation'
'https://pkg.go.dev/search?limit=100&m=package&q=go.opentelemetry.io%2Fcontrib%2Finstrumentation',
)
).text();
const $ = cheerioLoad(response);
@@ -387,7 +387,7 @@ async function scanForGo() {
language,
registryType,
current.url,
current.description
current.description,
);
const fileName = `${registryType}-${language}-${current.title}.yml`;
if (!ignoreList.includes(fileName)) {