From 1b31b8c26a8f5f86e88e6bfba1f8a5c83bec2465 Mon Sep 17 00:00:00 2001 From: Aditya Mahendrakar Date: Wed, 1 Sep 2021 21:10:49 -0700 Subject: [PATCH] license fixes (#109) - add license header to files that didn't have it - add license check github action --- .github/workflows/codeql-analysis.yml | 14 +++++++ .github/workflows/golangci-lint.yml | 14 +++++++ .github/workflows/license.yml | 38 +++++++++++++++++++ .github/workflows/linux.yml | 14 +++++++ .github/workflows/release.yml | 14 +++++++ api/log.go | 14 +++++++ api/log_test.go | 14 +++++++ codecov.yml | 14 +++++++ docker-softhsm/Dockerfile | 14 +++++++ docker-softhsm/gen-crt.sh | 14 +++++++ docker-softhsm/init_hsm.sh | 14 +++++++ gen.sh | 14 +++++++ keyid.go | 14 +++++++ pkcs11/ecdsa.go | 14 +++++++ pkcs11/login.go | 14 +++++++ pkcs11/login_test.go | 14 +++++++ pkcs11/p11signer_test.go | 14 +++++++ pkcs11/rsa.go | 14 +++++++ pkcs11/signer.go | 14 +++++++ pkcs11/signer_test.go | 14 +++++++ pkcs11/signerpool_test.go | 14 +++++++ server/interceptor/access_log_interceptor.go | 14 +++++++ .../access_log_interceptor_test.go | 14 +++++++ server/interceptor/interceptor.go | 14 +++++++ server/interceptor/interceptor_test.go | 14 +++++++ server/interceptor/shutdown.go | 14 +++++++ 26 files changed, 388 insertions(+) create mode 100644 .github/workflows/license.yml diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 1550cfbd..7193f4c2 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -1,3 +1,17 @@ +# Copyright 2021 Yahoo. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + name: "CodeQL" on: diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index b94ba8c3..b92fc3d7 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -1,3 +1,17 @@ +# Copyright 2021 Yahoo. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + name: golangci-lint on: push: diff --git a/.github/workflows/license.yml b/.github/workflows/license.yml new file mode 100644 index 00000000..4dd6c614 --- /dev/null +++ b/.github/workflows/license.yml @@ -0,0 +1,38 @@ +# Copyright 2021 Yahoo. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: license + +on: + push: + branches: + - main + pull_request: + +jobs: + license-check: + runs-on: ubuntu-latest + + steps: + - name: Setup Go + uses: actions/setup-go@v2 + with: + go-version: 1.17.0 + - name: Install addlicense + run: go install github.com/google/addlicense@latest + - name: Check license headers + run: | + set -e + addlicense -l apache -c 'Yahoo.' -v * + git diff --exit-code diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index c10f668c..874d52d4 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -1,3 +1,17 @@ +# Copyright 2021 Yahoo. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + name: Linux on: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index dbac95ce..ae54e09d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,3 +1,17 @@ +# Copyright 2021 Yahoo. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + name: create release and upload binary on: diff --git a/api/log.go b/api/log.go index c9500fa7..b1ede78f 100644 --- a/api/log.go +++ b/api/log.go @@ -1,3 +1,17 @@ +// Copyright 2021 Yahoo. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package api import ( diff --git a/api/log_test.go b/api/log_test.go index e2619f46..a1a7abbe 100644 --- a/api/log_test.go +++ b/api/log_test.go @@ -1,3 +1,17 @@ +// Copyright 2021 Yahoo. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package api import ( diff --git a/codecov.yml b/codecov.yml index ef9de36a..2e83ad2d 100644 --- a/codecov.yml +++ b/codecov.yml @@ -1,3 +1,17 @@ +# Copyright 2021 Yahoo. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + ignore: - "**/*.pb.go" # ignore generated protos - "**/*.pb.gw.go" # ignore generated protos diff --git a/docker-softhsm/Dockerfile b/docker-softhsm/Dockerfile index 69fb861c..33836dd2 100644 --- a/docker-softhsm/Dockerfile +++ b/docker-softhsm/Dockerfile @@ -1,3 +1,17 @@ +# Copyright 2021 Yahoo. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + FROM golang:1.16.2 ENV CRYPKI_DIR /go/src/github.com/theparanoids/crypki COPY . ${CRYPKI_DIR} diff --git a/docker-softhsm/gen-crt.sh b/docker-softhsm/gen-crt.sh index 8dadd9be..aa4efbda 100755 --- a/docker-softhsm/gen-crt.sh +++ b/docker-softhsm/gen-crt.sh @@ -1,4 +1,18 @@ #! /usr/bin/env bash +# Copyright 2021 Yahoo. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + # This file generates the rsa certificates and keys for demonstration set -euo pipefail diff --git a/docker-softhsm/init_hsm.sh b/docker-softhsm/init_hsm.sh index 1319cfa3..b3e2b6b0 100755 --- a/docker-softhsm/init_hsm.sh +++ b/docker-softhsm/init_hsm.sh @@ -1,4 +1,18 @@ #!/bin/bash +# Copyright 2021 Yahoo. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + set -euo pipefail umask 022 diff --git a/gen.sh b/gen.sh index 1098c0e3..41d5a8e2 100755 --- a/gen.sh +++ b/gen.sh @@ -1,4 +1,18 @@ #!/usr/bin/env bash +# Copyright 2021 Yahoo. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + # # This script does 2 things: # 1. Install all the tool binaries required to generate code. diff --git a/keyid.go b/keyid.go index 2a2a0988..c95654c3 100644 --- a/keyid.go +++ b/keyid.go @@ -1,3 +1,17 @@ +// Copyright 2021 Yahoo. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package crypki // KeyIDProcessor is a interface containing all the possible operations on keyID. diff --git a/pkcs11/ecdsa.go b/pkcs11/ecdsa.go index 517c8efe..3df9a938 100644 --- a/pkcs11/ecdsa.go +++ b/pkcs11/ecdsa.go @@ -1,3 +1,17 @@ +// Copyright 2021 Yahoo. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package pkcs11 import ( diff --git a/pkcs11/login.go b/pkcs11/login.go index 301e1bb4..1cd776e8 100644 --- a/pkcs11/login.go +++ b/pkcs11/login.go @@ -1,3 +1,17 @@ +// Copyright 2021 Yahoo. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package pkcs11 import ( diff --git a/pkcs11/login_test.go b/pkcs11/login_test.go index 711ae156..2ae34f05 100644 --- a/pkcs11/login_test.go +++ b/pkcs11/login_test.go @@ -1,3 +1,17 @@ +// Copyright 2021 Yahoo. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package pkcs11 import ( diff --git a/pkcs11/p11signer_test.go b/pkcs11/p11signer_test.go index 8bd13d12..7db8f615 100644 --- a/pkcs11/p11signer_test.go +++ b/pkcs11/p11signer_test.go @@ -1,3 +1,17 @@ +// Copyright 2021 Yahoo. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package pkcs11 import ( diff --git a/pkcs11/rsa.go b/pkcs11/rsa.go index a06a3242..0fe9ff41 100644 --- a/pkcs11/rsa.go +++ b/pkcs11/rsa.go @@ -1,3 +1,17 @@ +// Copyright 2021 Yahoo. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package pkcs11 import ( diff --git a/pkcs11/signer.go b/pkcs11/signer.go index 73abd371..fb6acaf8 100644 --- a/pkcs11/signer.go +++ b/pkcs11/signer.go @@ -1,3 +1,17 @@ +// Copyright 2021 Yahoo. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package pkcs11 import ( diff --git a/pkcs11/signer_test.go b/pkcs11/signer_test.go index 54928fca..524e5ae9 100644 --- a/pkcs11/signer_test.go +++ b/pkcs11/signer_test.go @@ -1,3 +1,17 @@ +// Copyright 2021 Yahoo. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package pkcs11 import ( diff --git a/pkcs11/signerpool_test.go b/pkcs11/signerpool_test.go index 5a7551ac..f5563d39 100644 --- a/pkcs11/signerpool_test.go +++ b/pkcs11/signerpool_test.go @@ -1,3 +1,17 @@ +// Copyright 2021 Yahoo. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package pkcs11 import ( diff --git a/server/interceptor/access_log_interceptor.go b/server/interceptor/access_log_interceptor.go index 5fd39283..86c1647e 100644 --- a/server/interceptor/access_log_interceptor.go +++ b/server/interceptor/access_log_interceptor.go @@ -1,3 +1,17 @@ +// Copyright 2021 Yahoo. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package interceptor import ( diff --git a/server/interceptor/access_log_interceptor_test.go b/server/interceptor/access_log_interceptor_test.go index a2162fc7..0b599f8a 100644 --- a/server/interceptor/access_log_interceptor_test.go +++ b/server/interceptor/access_log_interceptor_test.go @@ -1,3 +1,17 @@ +// Copyright 2021 Yahoo. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package interceptor import ( diff --git a/server/interceptor/interceptor.go b/server/interceptor/interceptor.go index bbae53d5..71f25c3a 100644 --- a/server/interceptor/interceptor.go +++ b/server/interceptor/interceptor.go @@ -1,3 +1,17 @@ +// Copyright 2021 Yahoo. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package interceptor import ( diff --git a/server/interceptor/interceptor_test.go b/server/interceptor/interceptor_test.go index 10be4469..7af24f45 100644 --- a/server/interceptor/interceptor_test.go +++ b/server/interceptor/interceptor_test.go @@ -1,3 +1,17 @@ +// Copyright 2021 Yahoo. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package interceptor import ( diff --git a/server/interceptor/shutdown.go b/server/interceptor/shutdown.go index ed453870..e4b543a9 100644 --- a/server/interceptor/shutdown.go +++ b/server/interceptor/shutdown.go @@ -1,3 +1,17 @@ +// Copyright 2021 Yahoo. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package interceptor import (