From 3d6b2f6cf1e505ceddd2d442af28398f2fb776e3 Mon Sep 17 00:00:00 2001 From: "opensearch-trigger-bot[bot]" <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Date: Mon, 13 Mar 2023 12:25:19 -0700 Subject: [PATCH] =?UTF-8?q?[Manual=20backport=201.x]=20Updates=20NOTICE=20?= =?UTF-8?q?file,=20adds=20validation=20to=20GitHub=20CI=20&=20Corrects=20N?= =?UTF-8?q?OTICE=20f=E2=80=A6=20(#3453)=20(#3596)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Updates NOTICE file, adds validation to GitHub CI (#3051) * Aligns NOTICE with rules outlined in https://github.com/opensearch-project/.github/issues/21. * Adds NOTICE validation to the build and test workflow. * Fixes product name discrepancies between repository NOTICE file and the generated NOTICE file for the build. * Skips template-izing the build and test workflow since that's being worked on in #2991. Resolves #765 * Corrects NOTICE file copyright date range (#3308) * Corrects NOTICE file copyright date range * Follow-up on #3051 Resolves #765 * Update CHANGELOG.md --------- (cherry picked from commit bf1c65fd3ec177f639ff7e8176ee36d9b311366e) Signed-off-by: Tommy Markley <5437176+tmarkley@users.noreply.github.com> Signed-off-by: github-actions[bot] Co-authored-by: github-actions[bot] Co-authored-by: Tommy Markley <5437176+tmarkley@users.noreply.github.com> Co-authored-by: Anan Zhuang Co-authored-by: Zhongnan Su Co-authored-by: Miki Co-authored-by: Ashwin P Chandran --- .github/workflows/build_and_test_workflow.yml | 8 ++ NOTICE.txt | 124 ++---------------- package.json | 2 + src/dev/build/tasks/notice_file_task.ts | 2 +- src/dev/notice/cli.js | 2 +- src/dev/notice/generate_notice_from_source.ts | 34 ++--- 6 files changed, 42 insertions(+), 130 deletions(-) diff --git a/.github/workflows/build_and_test_workflow.yml b/.github/workflows/build_and_test_workflow.yml index 39df9a5f30f..7788a2ed7f4 100644 --- a/.github/workflows/build_and_test_workflow.yml +++ b/.github/workflows/build_and_test_workflow.yml @@ -65,6 +65,10 @@ jobs: id: linter run: yarn lint + - name: Validate NOTICE file + id: notice-validate + run: yarn notice:validate + - name: Run unit tests with coverage id: unit-tests run: yarn test:jest:ci:coverage @@ -138,6 +142,10 @@ jobs: id: linter run: yarn lint + - name: Validate NOTICE file + id: notice-validate + run: yarn notice:validate + - name: Run unit tests with coverage id: unit-tests run: yarn test:jest:ci:coverage diff --git a/NOTICE.txt b/NOTICE.txt index edd87ef8de7..34da5d0a6f4 100644 --- a/NOTICE.txt +++ b/NOTICE.txt @@ -1,7 +1,15 @@ -OpenSearch -Copyright 2021 OpenSearch Contributors -This product includes software, including Kibana source code, developed by Elasticsearch (http://www.elastic.co). -Copyright 2012-2021 Elasticsearch B.V. +OpenSearch (https://opensearch.org/) +Copyright OpenSearch Contributors + +This product includes software, including Kibana source code, +developed by Elasticsearch (http://www.elastic.co). +Copyright 2009-2021 Elasticsearch B.V. + +This product includes software developed by The Apache Software +Foundation (http://www.apache.org/) + +This product includes software developed by +Joda.org (http://www.joda.org/). --- Pretty handling of logarithmic axes. Copyright (c) 2007-2014 IOLA and Ole Laursen. @@ -115,10 +123,6 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ---- -This product uses Noto fonts that are licensed under the SIL Open -Font License, Version 1.1. - --- Based on the scroll-into-view-if-necessary module from npm https://github.com/stipsan/compute-scroll-into-view/blob/master/src/index.ts#L269-L340 @@ -145,70 +149,6 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ---- -Detection Rules -Copyright 2020 Elasticsearch B.V. - ---- -This product bundles rules based on https://github.com/BlueTeamLabs/sentinel-attack -which is available under a "MIT" license. The files based on this license are: - -- defense_evasion_via_filter_manager -- discovery_process_discovery_via_tasklist_command -- persistence_priv_escalation_via_accessibility_features -- persistence_via_application_shimming -- defense_evasion_execution_via_trusted_developer_utilities - -MIT License - -Copyright (c) 2019 Edoardo Gerosa, Olaf Hartong - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - ---- -This product bundles rules based on https://github.com/FSecureLABS/leonidas -which is available under a "MIT" license. The files based on this license are: - -- credential_access_secretsmanager_getsecretvalue.toml - -MIT License - -Copyright (c) 2020 F-Secure LABS - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - --- MIT License @@ -306,43 +246,3 @@ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ---- -This product includes code in the function applyCubicBezierStyles that was -inspired by a public Codepen, which was available under a "MIT" license. - -Copyright (c) 2020 by Guillaume (https://codepen.io/guillaumethomas/pen/xxbbBKO) -MIT License http://www.opensource.org/licenses/mit-license - ---- -This product includes code that is adapted from mapbox-gl-js, which is -available under a "BSD-3-Clause" license. -https://github.com/mapbox/mapbox-gl-js/blob/master/src/util/image.js - -Copyright (c) 2016, Mapbox - -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of Mapbox GL JS nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - diff --git a/package.json b/package.json index 5cd03a61045..fd53784c84b 100644 --- a/package.json +++ b/package.json @@ -56,6 +56,8 @@ "test:ftr:server": "node scripts/functional_tests_server", "test:ftr:runner": "node scripts/functional_test_runner", "checkLicenses": "node scripts/check_licenses --dev", + "notice:validate": "node scripts/notice --validate", + "notice:generate": "node scripts/notice", "build-platform": "node scripts/build", "build": "node scripts/build --all-platforms", "start": "node scripts/opensearch_dashboards --dev", diff --git a/src/dev/build/tasks/notice_file_task.ts b/src/dev/build/tasks/notice_file_task.ts index 75602776ff4..32c5f94da68 100644 --- a/src/dev/build/tasks/notice_file_task.ts +++ b/src/dev/build/tasks/notice_file_task.ts @@ -39,7 +39,7 @@ export const CreateNoticeFile: Task = { log.info('Generating notice from source'); log.indent(4); const noticeFromSource = await generateNoticeFromSource({ - productName: 'OpenSearch', + productName: 'OpenSearch (https://opensearch.org/)', directory: build.resolvePath(), log, }); diff --git a/src/dev/notice/cli.js b/src/dev/notice/cli.js index 1feb175be6c..e81321c5344 100644 --- a/src/dev/notice/cli.js +++ b/src/dev/notice/cli.js @@ -82,7 +82,7 @@ if (opts.help) { (async function run() { const path = resolve(REPO_ROOT, 'NOTICE.txt'); const newContent = await generateNoticeFromSource({ - productName: 'OpenSearch Dashboards source code', + productName: 'OpenSearch (https://opensearch.org/)', directory: REPO_ROOT, log, }); diff --git a/src/dev/notice/generate_notice_from_source.ts b/src/dev/notice/generate_notice_from_source.ts index 5c08e127868..ab2ccefa049 100644 --- a/src/dev/notice/generate_notice_from_source.ts +++ b/src/dev/notice/generate_notice_from_source.ts @@ -35,6 +35,17 @@ import { ToolingLog } from '@osd/dev-utils'; const NOTICE_COMMENT_RE = /\/\*[\s\n\*]*@notice([\w\W]+?)\*\//g; const NEWLINE_RE = /\r?\n/g; +const NOTICE_TEXT = `Copyright OpenSearch Contributors + +This product includes software, including Kibana source code, +developed by Elasticsearch (http://www.elastic.co). +Copyright 2009-2021 Elasticsearch B.V. + +This product includes software developed by The Apache Software +Foundation (http://www.apache.org/) + +This product includes software developed by +Joda.org (http://www.joda.org/).`; interface Options { /** @@ -91,17 +102,10 @@ export async function generateNoticeFromSource({ productName, directory, log }: .on('end', resolve); }); - let noticeText = ''; - noticeText += `${productName}\n`; - noticeText += `Copyright ${new Date().getUTCFullYear()} OpenSearch Contributors\n\n`; - noticeText += `This product includes software developed by Elasticsearch (http://www.elastic.co).\n`; - noticeText += `Copyright 2009-2018 Elasticsearch\n\n`; - noticeText += `This product includes software developed by The Apache Software Foundation (http://www.apache.org/)\n\n`; - noticeText += `This product includes software developed by Joda.org (http://www.joda.org/).\n`; - + let notice = `${productName}\n` + NOTICE_TEXT; for (const comment of noticeComments.sort()) { - noticeText += '\n---\n'; - noticeText += comment + notice += '\n---\n'; + notice += comment .split(NEWLINE_RE) .map((line) => line @@ -112,11 +116,9 @@ export async function generateNoticeFromSource({ productName, directory, log }: ) .join('\n') .trim(); - noticeText += '\n'; + notice += '\n'; } - - noticeText += '\n'; - - log.debug(`notice text:\n\n${noticeText}`); - return noticeText; + notice += '\n'; + log.debug(`notice text:\n\n${notice}`); + return notice; }