From 0d6bafe153cf0a287ebd3e3fa080274b4fcbcb60 Mon Sep 17 00:00:00 2001 From: Komal Dhull Date: Thu, 22 Feb 2024 17:04:49 -0800 Subject: [PATCH] Adds GPLV3 license. Follows instructions provided by GNU here https://www.gnu.org/licenses/gpl-howto.en.html, which requires a COPYING file and a copyright and license notice included in each source code file. Additionally add an eslint plugin that verifies that the copyright notice is present and can be used to add the copyright notice by using --fix. --- .eslintrc.js | 5 +++++ copyright.ts | 10 ++++++++++ package.json | 4 +++- src/commands/__tests__/login.test.ts | 20 +++++++++++++++++++ src/commands/__tests__/ls.test.ts | 20 +++++++++++++++++++ src/commands/__tests__/request.test.ts | 20 +++++++++++++++++++ src/commands/__tests__/ssh.test.ts | 20 +++++++++++++++++++ .../aws/__tests__/__input__/saml-response.ts | 20 +++++++++++++++++++ .../aws/__tests__/__input__/sts-response.ts | 20 +++++++++++++++++++ src/commands/aws/__tests__/role.test.ts | 20 +++++++++++++++++++ src/commands/aws/index.ts | 20 +++++++++++++++++++ src/commands/aws/role.ts | 20 +++++++++++++++++++ src/commands/index.ts | 20 +++++++++++++++++++ src/commands/login.ts | 20 +++++++++++++++++++ src/commands/ls.ts | 20 +++++++++++++++++++ src/commands/request.ts | 20 +++++++++++++++++++ src/commands/ssh.ts | 20 +++++++++++++++++++ src/common/auth/oidc.ts | 20 +++++++++++++++++++ src/common/auth/server.ts | 11 ++++++++++ src/common/fetch.ts | 20 +++++++++++++++++++ src/common/mime.ts | 20 +++++++++++++++++++ src/common/xml.ts | 20 +++++++++++++++++++ src/drivers/__mocks__/auth.ts | 11 +++++++++- src/drivers/api.ts | 11 +++++++++- src/drivers/auth.ts | 11 +++++++++- src/drivers/env.ts | 11 +++++++++- src/drivers/firestore.ts | 11 +++++++++- src/drivers/stdio.ts | 11 +++++++++- src/index.ts | 20 +++++++++++++++++++ src/plugins/__mocks__/login.ts | 11 +++++++++- src/plugins/aws/__mocks__/assumeRole.ts | 11 +++++++++- src/plugins/aws/api.ts | 11 +++++++++- src/plugins/aws/assumeRole.ts | 11 +++++++++- src/plugins/aws/config.ts | 11 +++++++++- src/plugins/aws/ssm.ts | 11 +++++++++- src/plugins/aws/types.ts | 11 +++++++++- src/plugins/google/login.ts | 11 +++++++++- src/plugins/login.ts | 11 +++++++++- src/plugins/okta/aws.ts | 11 +++++++++- src/plugins/okta/login.ts | 11 +++++++++- src/plugins/ssh/types.ts | 11 +++++++++- src/testing/firestore.ts | 20 +++++++++++++++++++ src/testing/yargs.ts | 20 +++++++++++++++++++ src/types/identity.ts | 20 +++++++++++++++++++ src/types/oidc.ts | 20 +++++++++++++++++++ src/types/org.ts | 20 +++++++++++++++++++ src/types/request.ts | 20 +++++++++++++++++++ src/util.ts | 10 ++++++++++ 48 files changed, 719 insertions(+), 19 deletions(-) create mode 100644 copyright.ts diff --git a/.eslintrc.js b/.eslintrc.js index b2becfc..cc66aa1 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -10,6 +10,7 @@ module.exports = { "plugin:@typescript-eslint/recommended", "prettier", ], + plugins:["notice"], rules: { // Allow empty generators "require-yield": "off", @@ -46,6 +47,10 @@ module.exports = { "@typescript-eslint/unbound-method": ["error", { ignoreStatic: true }], // Use `print1` and `print2` instead "no-console": "error", + "notice/notice":["error",{ + "templateFile":"copyright.ts" + }] + }, ignorePatterns: [ ".eslintrc.js", diff --git a/copyright.ts b/copyright.ts new file mode 100644 index 0000000..a3b56a0 --- /dev/null +++ b/copyright.ts @@ -0,0 +1,10 @@ +/** Copyright © 2024 P0 Security + +This file is part of @p0security/p0cli + +@p0security/p0cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. + +@p0security/p0cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with @p0security/p0cli. If not, see . +**/ \ No newline at end of file diff --git a/package.json b/package.json index 4ff2eea..5ab3b44 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,8 @@ "dist", "p0", "README.md", - "CONTRIBUTING.md" + "CONTRIBUTING.md", + "COPYING.md" ], "dependencies": { "@rgrove/parse-xml": "^4.1.0", @@ -41,6 +42,7 @@ "@types/node": "^18.11.7", "@types/yargs": "^17.0.13", "@typescript-eslint/eslint-plugin": "^6.4.0", + "eslint-plugin-notice": "^0.9.10", "@typescript-eslint/parser": "^6.0.0", "eslint": "^8.56.0", "eslint-config-prettier": "^9.1.0", diff --git a/src/commands/__tests__/login.test.ts b/src/commands/__tests__/login.test.ts index f029c7d..63a18b2 100644 --- a/src/commands/__tests__/login.test.ts +++ b/src/commands/__tests__/login.test.ts @@ -1,3 +1,23 @@ +/** Copyright © 2024 P0 Security + +This file is part of @p0security/p0cli + +@p0security/p0cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. + +@p0security/p0cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with @p0security/p0cli. If not, see . +**//* Copyright © 2024 P0 Security + +This file is part of @p0security/p0cli + +@p0security/p0cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. + +@p0security/p0cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with @p0security/p0cli. If not, see . +*/ + import { pluginLoginMap } from "../../plugins/login"; import { mockGetDoc } from "../../testing/firestore"; import { login } from "../login"; diff --git a/src/commands/__tests__/ls.test.ts b/src/commands/__tests__/ls.test.ts index c4c21c9..ba570ef 100644 --- a/src/commands/__tests__/ls.test.ts +++ b/src/commands/__tests__/ls.test.ts @@ -1,3 +1,23 @@ +/** Copyright © 2024 P0 Security + +This file is part of @p0security/p0cli + +@p0security/p0cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. + +@p0security/p0cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with @p0security/p0cli. If not, see . +**//* Copyright © 2024 P0 Security + +This file is part of @p0security/p0cli + +@p0security/p0cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. + +@p0security/p0cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with @p0security/p0cli. If not, see . +*/ + import { fetchCommand } from "../../drivers/api"; import { print1, print2 } from "../../drivers/stdio"; import { failure } from "../../testing/yargs"; diff --git a/src/commands/__tests__/request.test.ts b/src/commands/__tests__/request.test.ts index 7f266e0..cc3876c 100644 --- a/src/commands/__tests__/request.test.ts +++ b/src/commands/__tests__/request.test.ts @@ -1,3 +1,23 @@ +/** Copyright © 2024 P0 Security + +This file is part of @p0security/p0cli + +@p0security/p0cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. + +@p0security/p0cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with @p0security/p0cli. If not, see . +**//* Copyright © 2024 P0 Security + +This file is part of @p0security/p0cli + +@p0security/p0cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. + +@p0security/p0cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with @p0security/p0cli. If not, see . +*/ + import { fetchCommand } from "../../drivers/api"; import { print1, print2 } from "../../drivers/stdio"; import { failure } from "../../testing/yargs"; diff --git a/src/commands/__tests__/ssh.test.ts b/src/commands/__tests__/ssh.test.ts index 440dc59..928a499 100644 --- a/src/commands/__tests__/ssh.test.ts +++ b/src/commands/__tests__/ssh.test.ts @@ -1,3 +1,23 @@ +/** Copyright © 2024 P0 Security + +This file is part of @p0security/p0cli + +@p0security/p0cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. + +@p0security/p0cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with @p0security/p0cli. If not, see . +**//* Copyright © 2024 P0 Security + +This file is part of @p0security/p0cli + +@p0security/p0cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. + +@p0security/p0cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with @p0security/p0cli. If not, see . +*/ + import { fetchCommand } from "../../drivers/api"; import { print1, print2 } from "../../drivers/stdio"; import { ssm } from "../../plugins/aws/ssm"; diff --git a/src/commands/aws/__tests__/__input__/saml-response.ts b/src/commands/aws/__tests__/__input__/saml-response.ts index fd37d49..419d9cb 100644 --- a/src/commands/aws/__tests__/__input__/saml-response.ts +++ b/src/commands/aws/__tests__/__input__/saml-response.ts @@ -1,3 +1,23 @@ +/** Copyright © 2024 P0 Security + +This file is part of @p0security/p0cli + +@p0security/p0cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. + +@p0security/p0cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with @p0security/p0cli. If not, see . +**//* Copyright © 2024 P0 Security + +This file is part of @p0security/p0cli + +@p0security/p0cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. + +@p0security/p0cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with @p0security/p0cli. If not, see . +*/ + export const samlResponse = ` diff --git a/src/commands/aws/__tests__/__input__/sts-response.ts b/src/commands/aws/__tests__/__input__/sts-response.ts index 36acb2a..2ed8346 100644 --- a/src/commands/aws/__tests__/__input__/sts-response.ts +++ b/src/commands/aws/__tests__/__input__/sts-response.ts @@ -1,3 +1,23 @@ +/** Copyright © 2024 P0 Security + +This file is part of @p0security/p0cli + +@p0security/p0cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. + +@p0security/p0cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with @p0security/p0cli. If not, see . +**//* Copyright © 2024 P0 Security + +This file is part of @p0security/p0cli + +@p0security/p0cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. + +@p0security/p0cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with @p0security/p0cli. If not, see . +*/ + export const stsResponse = ` https://signin.aws.amazon.com/saml diff --git a/src/commands/aws/__tests__/role.test.ts b/src/commands/aws/__tests__/role.test.ts index 64f5969..dd5aa5e 100644 --- a/src/commands/aws/__tests__/role.test.ts +++ b/src/commands/aws/__tests__/role.test.ts @@ -1,3 +1,23 @@ +/** Copyright © 2024 P0 Security + +This file is part of @p0security/p0cli + +@p0security/p0cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. + +@p0security/p0cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with @p0security/p0cli. If not, see . +**//* Copyright © 2024 P0 Security + +This file is part of @p0security/p0cli + +@p0security/p0cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. + +@p0security/p0cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with @p0security/p0cli. If not, see . +*/ + import { awsCommand } from ".."; import { print1, print2 } from "../../../drivers/stdio"; import { mockGetDoc } from "../../../testing/firestore"; diff --git a/src/commands/aws/index.ts b/src/commands/aws/index.ts index 6320bc8..85f454a 100644 --- a/src/commands/aws/index.ts +++ b/src/commands/aws/index.ts @@ -1,3 +1,23 @@ +/** Copyright © 2024 P0 Security + +This file is part of @p0security/p0cli + +@p0security/p0cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. + +@p0security/p0cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with @p0security/p0cli. If not, see . +**//* Copyright © 2024 P0 Security + +This file is part of @p0security/p0cli + +@p0security/p0cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. + +@p0security/p0cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with @p0security/p0cli. If not, see . +*/ + import { role } from "./role"; import yargs from "yargs"; diff --git a/src/commands/aws/role.ts b/src/commands/aws/role.ts index 4b3555f..bd5a407 100644 --- a/src/commands/aws/role.ts +++ b/src/commands/aws/role.ts @@ -1,3 +1,23 @@ +/** Copyright © 2024 P0 Security + +This file is part of @p0security/p0cli + +@p0security/p0cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. + +@p0security/p0cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with @p0security/p0cli. If not, see . +**//* Copyright © 2024 P0 Security + +This file is part of @p0security/p0cli + +@p0security/p0cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. + +@p0security/p0cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with @p0security/p0cli. If not, see . +*/ + import { parseXml } from "../../common/xml"; import { authenticate } from "../../drivers/auth"; import { guard } from "../../drivers/firestore"; diff --git a/src/commands/index.ts b/src/commands/index.ts index 8f62806..ab29b7f 100644 --- a/src/commands/index.ts +++ b/src/commands/index.ts @@ -1,3 +1,23 @@ +/** Copyright © 2024 P0 Security + +This file is part of @p0security/p0cli + +@p0security/p0cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. + +@p0security/p0cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with @p0security/p0cli. If not, see . +**//* Copyright © 2024 P0 Security + +This file is part of @p0security/p0cli + +@p0security/p0cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. + +@p0security/p0cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with @p0security/p0cli. If not, see . +*/ + import { print2 } from "../drivers/stdio"; import { awsCommand } from "./aws"; import { loginCommand } from "./login"; diff --git a/src/commands/login.ts b/src/commands/login.ts index 9862680..eb5848a 100644 --- a/src/commands/login.ts +++ b/src/commands/login.ts @@ -1,3 +1,23 @@ +/** Copyright © 2024 P0 Security + +This file is part of @p0security/p0cli + +@p0security/p0cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. + +@p0security/p0cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with @p0security/p0cli. If not, see . +**//* Copyright © 2024 P0 Security + +This file is part of @p0security/p0cli + +@p0security/p0cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. + +@p0security/p0cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with @p0security/p0cli. If not, see . +*/ + import { IDENTITY_FILE_PATH, authenticate } from "../drivers/auth"; import { doc, guard } from "../drivers/firestore"; import { print2 } from "../drivers/stdio"; diff --git a/src/commands/ls.ts b/src/commands/ls.ts index 9a1a0fd..2f7d8d7 100644 --- a/src/commands/ls.ts +++ b/src/commands/ls.ts @@ -1,3 +1,23 @@ +/** Copyright © 2024 P0 Security + +This file is part of @p0security/p0cli + +@p0security/p0cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. + +@p0security/p0cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with @p0security/p0cli. If not, see . +**//* Copyright © 2024 P0 Security + +This file is part of @p0security/p0cli + +@p0security/p0cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. + +@p0security/p0cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with @p0security/p0cli. If not, see . +*/ + import { fetchCommand } from "../drivers/api"; import { authenticate } from "../drivers/auth"; import { guard } from "../drivers/firestore"; diff --git a/src/commands/request.ts b/src/commands/request.ts index 0548ef7..0e7460f 100644 --- a/src/commands/request.ts +++ b/src/commands/request.ts @@ -1,3 +1,23 @@ +/** Copyright © 2024 P0 Security + +This file is part of @p0security/p0cli + +@p0security/p0cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. + +@p0security/p0cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with @p0security/p0cli. If not, see . +**//* Copyright © 2024 P0 Security + +This file is part of @p0security/p0cli + +@p0security/p0cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. + +@p0security/p0cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with @p0security/p0cli. If not, see . +*/ + import { fetchCommand } from "../drivers/api"; import { authenticate } from "../drivers/auth"; import { doc, guard } from "../drivers/firestore"; diff --git a/src/commands/ssh.ts b/src/commands/ssh.ts index c89c8a3..910709c 100644 --- a/src/commands/ssh.ts +++ b/src/commands/ssh.ts @@ -1,3 +1,23 @@ +/** Copyright © 2024 P0 Security + +This file is part of @p0security/p0cli + +@p0security/p0cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. + +@p0security/p0cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with @p0security/p0cli. If not, see . +**//* Copyright © 2024 P0 Security + +This file is part of @p0security/p0cli + +@p0security/p0cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. + +@p0security/p0cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with @p0security/p0cli. If not, see . +*/ + import { authenticate } from "../drivers/auth"; import { doc, guard } from "../drivers/firestore"; import { print2 } from "../drivers/stdio"; diff --git a/src/common/auth/oidc.ts b/src/common/auth/oidc.ts index 4c8618d..24dfa64 100644 --- a/src/common/auth/oidc.ts +++ b/src/common/auth/oidc.ts @@ -1,3 +1,23 @@ +/** Copyright © 2024 P0 Security + +This file is part of @p0security/p0cli + +@p0security/p0cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. + +@p0security/p0cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with @p0security/p0cli. If not, see . +**//* Copyright © 2024 P0 Security + +This file is part of @p0security/p0cli + +@p0security/p0cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. + +@p0security/p0cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with @p0security/p0cli. If not, see . +*/ + import { application } from "../mime"; export const OIDC_HEADERS = { diff --git a/src/common/auth/server.ts b/src/common/auth/server.ts index df5cf83..7ce32e4 100644 --- a/src/common/auth/server.ts +++ b/src/common/auth/server.ts @@ -1,3 +1,14 @@ +/** Copyright © 2024 P0 Security + +This file is part of @p0security/p0cli + +@p0security/p0cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. + +@p0security/p0cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with @p0security/p0cli. If not, see . +**/ + /** Implements a local auth server, which can receive auth tokens from an OIDC app */ import { sleep } from "../../util"; import express from "express"; diff --git a/src/common/fetch.ts b/src/common/fetch.ts index 574b524..ae677c4 100644 --- a/src/common/fetch.ts +++ b/src/common/fetch.ts @@ -1,3 +1,23 @@ +/** Copyright © 2024 P0 Security + +This file is part of @p0security/p0cli + +@p0security/p0cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. + +@p0security/p0cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with @p0security/p0cli. If not, see . +**//* Copyright © 2024 P0 Security + +This file is part of @p0security/p0cli + +@p0security/p0cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. + +@p0security/p0cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with @p0security/p0cli. If not, see . +*/ + /** Converts object data to a URL encoded form */ export const urlEncode = (data: Record) => Object.entries(data) diff --git a/src/common/mime.ts b/src/common/mime.ts index 6b99c3a..d2ec2c8 100644 --- a/src/common/mime.ts +++ b/src/common/mime.ts @@ -1,3 +1,23 @@ +/** Copyright © 2024 P0 Security + +This file is part of @p0security/p0cli + +@p0security/p0cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. + +@p0security/p0cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with @p0security/p0cli. If not, see . +**//* Copyright © 2024 P0 Security + +This file is part of @p0security/p0cli + +@p0security/p0cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. + +@p0security/p0cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with @p0security/p0cli. If not, see . +*/ + export const application = { JSON: "application/json", X_WWW_FORM_URLENCODED: "application/x-www-form-urlencoded", diff --git a/src/common/xml.ts b/src/common/xml.ts index b310f26..64a6212 100644 --- a/src/common/xml.ts +++ b/src/common/xml.ts @@ -1,3 +1,23 @@ +/** Copyright © 2024 P0 Security + +This file is part of @p0security/p0cli + +@p0security/p0cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. + +@p0security/p0cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with @p0security/p0cli. If not, see . +**//* Copyright © 2024 P0 Security + +This file is part of @p0security/p0cli + +@p0security/p0cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. + +@p0security/p0cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with @p0security/p0cli. If not, see . +*/ + // Avoid XXE and friends with a (best-as-we-know) safe XML parser import { parseXml as libParse, XmlElement } from "@rgrove/parse-xml"; import { groupBy, mapValues } from "lodash"; diff --git a/src/drivers/__mocks__/auth.ts b/src/drivers/__mocks__/auth.ts index 66305a9..80e04ee 100644 --- a/src/drivers/__mocks__/auth.ts +++ b/src/drivers/__mocks__/auth.ts @@ -1,4 +1,13 @@ -export const authenticate = async () => ({ +/** Copyright © 2024 P0 Security + +This file is part of @p0security/p0cli + +@p0security/p0cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. + +@p0security/p0cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with @p0security/p0cli. If not, see . +**/export const authenticate = async () => ({ identity: { credential: { access_token: "test-access-token", diff --git a/src/drivers/api.ts b/src/drivers/api.ts index cb4b2d2..f188b2d 100644 --- a/src/drivers/api.ts +++ b/src/drivers/api.ts @@ -1,4 +1,13 @@ -import { config } from "../drivers/env"; +/** Copyright © 2024 P0 Security + +This file is part of @p0security/p0cli + +@p0security/p0cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. + +@p0security/p0cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with @p0security/p0cli. If not, see . +**/import { config } from "../drivers/env"; import { Authn } from "../types/identity"; import * as path from "node:path"; import yargs from "yargs"; diff --git a/src/drivers/auth.ts b/src/drivers/auth.ts index fef09d4..5bdc9b8 100644 --- a/src/drivers/auth.ts +++ b/src/drivers/auth.ts @@ -1,4 +1,13 @@ -import { login } from "../commands/login"; +/** Copyright © 2024 P0 Security + +This file is part of @p0security/p0cli + +@p0security/p0cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. + +@p0security/p0cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with @p0security/p0cli. If not, see . +**/import { login } from "../commands/login"; import { Authn, Identity } from "../types/identity"; import { auth } from "./firestore"; import { print2 } from "./stdio"; diff --git a/src/drivers/env.ts b/src/drivers/env.ts index c5091c1..ed20178 100644 --- a/src/drivers/env.ts +++ b/src/drivers/env.ts @@ -1,4 +1,13 @@ -import dotenv from "dotenv"; +/** Copyright © 2024 P0 Security + +This file is part of @p0security/p0cli + +@p0security/p0cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. + +@p0security/p0cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with @p0security/p0cli. If not, see . +**/import dotenv from "dotenv"; dotenv.config(); diff --git a/src/drivers/firestore.ts b/src/drivers/firestore.ts index 120c402..d5f7c05 100644 --- a/src/drivers/firestore.ts +++ b/src/drivers/firestore.ts @@ -1,4 +1,13 @@ -import { config } from "./env"; +/** Copyright © 2024 P0 Security + +This file is part of @p0security/p0cli + +@p0security/p0cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. + +@p0security/p0cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with @p0security/p0cli. If not, see . +**/import { config } from "./env"; import { initializeApp } from "firebase/app"; import { getAuth } from "firebase/auth"; import { diff --git a/src/drivers/stdio.ts b/src/drivers/stdio.ts index 76224bc..b5b1060 100644 --- a/src/drivers/stdio.ts +++ b/src/drivers/stdio.ts @@ -1,4 +1,13 @@ -/** Functions to handle stdio +/** Copyright © 2024 P0 Security + +This file is part of @p0security/p0cli + +@p0security/p0cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. + +@p0security/p0cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with @p0security/p0cli. If not, see . +**//** Functions to handle stdio * * These are essentially wrappers around console.foo, but allow for * - Better testing diff --git a/src/index.ts b/src/index.ts index 656bc4c..58865bd 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,3 +1,23 @@ +/** Copyright © 2024 P0 Security + +This file is part of @p0security/p0cli + +@p0security/p0cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. + +@p0security/p0cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with @p0security/p0cli. If not, see . +**//* Copyright © 2024 P0 Security + +This file is part of @p0security/p0cli + +@p0security/p0cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. + +@p0security/p0cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with @p0security/p0cli. If not, see . +*/ + import { cli } from "./commands"; import { noop } from "lodash"; diff --git a/src/plugins/__mocks__/login.ts b/src/plugins/__mocks__/login.ts index 4b4b067..ed46f9e 100644 --- a/src/plugins/__mocks__/login.ts +++ b/src/plugins/__mocks__/login.ts @@ -1,4 +1,13 @@ -export const pluginLoginMap = { +/** Copyright © 2024 P0 Security + +This file is part of @p0security/p0cli + +@p0security/p0cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. + +@p0security/p0cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with @p0security/p0cli. If not, see . +**/export const pluginLoginMap = { google: jest.fn().mockResolvedValue({ access_token: "test-access-token", id_token: "test-id-token", diff --git a/src/plugins/aws/__mocks__/assumeRole.ts b/src/plugins/aws/__mocks__/assumeRole.ts index 7e1bb3f..f05c849 100644 --- a/src/plugins/aws/__mocks__/assumeRole.ts +++ b/src/plugins/aws/__mocks__/assumeRole.ts @@ -1,4 +1,13 @@ -import { AwsCredentials } from "../types"; +/** Copyright © 2024 P0 Security + +This file is part of @p0security/p0cli + +@p0security/p0cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. + +@p0security/p0cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with @p0security/p0cli. If not, see . +**/import { AwsCredentials } from "../types"; export const assumeRoleWithSaml = async (): Promise => ({ AWS_ACCESS_KEY_ID: "test-access-key-id", diff --git a/src/plugins/aws/api.ts b/src/plugins/aws/api.ts index 0e35c14..dd71bed 100644 --- a/src/plugins/aws/api.ts +++ b/src/plugins/aws/api.ts @@ -1,3 +1,12 @@ -export const AWS_API_VERSION = "2011-06-15"; +/** Copyright © 2024 P0 Security + +This file is part of @p0security/p0cli + +@p0security/p0cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. + +@p0security/p0cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with @p0security/p0cli. If not, see . +**/export const AWS_API_VERSION = "2011-06-15"; export const arnPrefix = (account: string) => `arn:aws:iam::${account}`; diff --git a/src/plugins/aws/assumeRole.ts b/src/plugins/aws/assumeRole.ts index 2931fc7..4cc0df2 100644 --- a/src/plugins/aws/assumeRole.ts +++ b/src/plugins/aws/assumeRole.ts @@ -1,4 +1,13 @@ -import { urlEncode, validateResponse } from "../../common/fetch"; +/** Copyright © 2024 P0 Security + +This file is part of @p0security/p0cli + +@p0security/p0cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. + +@p0security/p0cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with @p0security/p0cli. If not, see . +**/import { urlEncode, validateResponse } from "../../common/fetch"; import { parseXml } from "../../common/xml"; import { arnPrefix } from "./api"; import { AWS_API_VERSION } from "./api"; diff --git a/src/plugins/aws/config.ts b/src/plugins/aws/config.ts index 62150c5..76e7aea 100644 --- a/src/plugins/aws/config.ts +++ b/src/plugins/aws/config.ts @@ -1,4 +1,13 @@ -import { doc } from "../../drivers/firestore"; +/** Copyright © 2024 P0 Security + +This file is part of @p0security/p0cli + +@p0security/p0cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. + +@p0security/p0cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with @p0security/p0cli. If not, see . +**/import { doc } from "../../drivers/firestore"; import { Authn } from "../../types/identity"; import { AwsConfig } from "./types"; import { getDoc } from "firebase/firestore"; diff --git a/src/plugins/aws/ssm.ts b/src/plugins/aws/ssm.ts index aea0a10..e9f7b12 100644 --- a/src/plugins/aws/ssm.ts +++ b/src/plugins/aws/ssm.ts @@ -1,4 +1,13 @@ -import { print2 } from "../../drivers/stdio"; +/** Copyright © 2024 P0 Security + +This file is part of @p0security/p0cli + +@p0security/p0cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. + +@p0security/p0cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with @p0security/p0cli. If not, see . +**/import { print2 } from "../../drivers/stdio"; import { Authn } from "../../types/identity"; import { Request } from "../../types/request"; import { assumeRoleWithOktaSaml } from "../okta/aws"; diff --git a/src/plugins/aws/types.ts b/src/plugins/aws/types.ts index e5e2fe7..66d9492 100644 --- a/src/plugins/aws/types.ts +++ b/src/plugins/aws/types.ts @@ -1,4 +1,13 @@ -export type AwsCredentials = { +/** Copyright © 2024 P0 Security + +This file is part of @p0security/p0cli + +@p0security/p0cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. + +@p0security/p0cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with @p0security/p0cli. If not, see . +**/export type AwsCredentials = { AWS_ACCESS_KEY_ID: string; AWS_SECRET_ACCESS_KEY: string; AWS_SESSION_TOKEN: string; diff --git a/src/plugins/google/login.ts b/src/plugins/google/login.ts index 4267069..4a49f8d 100644 --- a/src/plugins/google/login.ts +++ b/src/plugins/google/login.ts @@ -1,4 +1,13 @@ -import { OIDC_HEADERS } from "../../common/auth/oidc"; +/** Copyright © 2024 P0 Security + +This file is part of @p0security/p0cli + +@p0security/p0cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. + +@p0security/p0cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with @p0security/p0cli. If not, see . +**/import { OIDC_HEADERS } from "../../common/auth/oidc"; import { withRedirectServer } from "../../common/auth/server"; import { urlEncode, validateResponse } from "../../common/fetch"; import { config } from "../../drivers/env"; diff --git a/src/plugins/login.ts b/src/plugins/login.ts index 3ce7745..bd0c235 100644 --- a/src/plugins/login.ts +++ b/src/plugins/login.ts @@ -1,4 +1,13 @@ -import { TokenResponse } from "../types/oidc"; +/** Copyright © 2024 P0 Security + +This file is part of @p0security/p0cli + +@p0security/p0cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. + +@p0security/p0cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with @p0security/p0cli. If not, see . +**/import { TokenResponse } from "../types/oidc"; import { OrgData } from "../types/org"; import { googleLogin } from "./google/login"; import { oktaLogin } from "./okta/login"; diff --git a/src/plugins/okta/aws.ts b/src/plugins/okta/aws.ts index d06dca7..abac3fa 100644 --- a/src/plugins/okta/aws.ts +++ b/src/plugins/okta/aws.ts @@ -1,4 +1,13 @@ -import { initOktaSaml, rolesFromSaml } from "../../commands/aws/role"; +/** Copyright © 2024 P0 Security + +This file is part of @p0security/p0cli + +@p0security/p0cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. + +@p0security/p0cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with @p0security/p0cli. If not, see . +**/import { initOktaSaml, rolesFromSaml } from "../../commands/aws/role"; import { cached } from "../../drivers/auth"; import { Authn } from "../../types/identity"; import { assumeRoleWithSaml } from "../aws/assumeRole"; diff --git a/src/plugins/okta/login.ts b/src/plugins/okta/login.ts index 1f22c82..c6545d1 100644 --- a/src/plugins/okta/login.ts +++ b/src/plugins/okta/login.ts @@ -1,4 +1,13 @@ -import { OIDC_HEADERS } from "../../common/auth/oidc"; +/** Copyright © 2024 P0 Security + +This file is part of @p0security/p0cli + +@p0security/p0cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. + +@p0security/p0cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with @p0security/p0cli. If not, see . +**/import { OIDC_HEADERS } from "../../common/auth/oidc"; import { urlEncode, validateResponse } from "../../common/fetch"; import { print2 } from "../../drivers/stdio"; import { Identity } from "../../types/identity"; diff --git a/src/plugins/ssh/types.ts b/src/plugins/ssh/types.ts index 5c7846b..2856714 100644 --- a/src/plugins/ssh/types.ts +++ b/src/plugins/ssh/types.ts @@ -1,4 +1,13 @@ -type SshItemConfig = { +/** Copyright © 2024 P0 Security + +This file is part of @p0security/p0cli + +@p0security/p0cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. + +@p0security/p0cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with @p0security/p0cli. If not, see . +**/type SshItemConfig = { alias?: string; identifier: string; state: string; diff --git a/src/testing/firestore.ts b/src/testing/firestore.ts index eec9a2d..bd639e9 100644 --- a/src/testing/firestore.ts +++ b/src/testing/firestore.ts @@ -1,3 +1,23 @@ +/** Copyright © 2024 P0 Security + +This file is part of @p0security/p0cli + +@p0security/p0cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. + +@p0security/p0cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with @p0security/p0cli. If not, see . +**//* Copyright © 2024 P0 Security + +This file is part of @p0security/p0cli + +@p0security/p0cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. + +@p0security/p0cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with @p0security/p0cli. If not, see . +*/ + import { getDoc } from "firebase/firestore"; export const mockGetDoc = (data: any) => diff --git a/src/testing/yargs.ts b/src/testing/yargs.ts index ce7d9b7..8939735 100644 --- a/src/testing/yargs.ts +++ b/src/testing/yargs.ts @@ -1,3 +1,23 @@ +/** Copyright © 2024 P0 Security + +This file is part of @p0security/p0cli + +@p0security/p0cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. + +@p0security/p0cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with @p0security/p0cli. If not, see . +**//* Copyright © 2024 P0 Security + +This file is part of @p0security/p0cli + +@p0security/p0cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. + +@p0security/p0cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with @p0security/p0cli. If not, see . +*/ + import yargs from "yargs"; export const failure = async (spec: yargs.Argv, command: string) => { diff --git a/src/types/identity.ts b/src/types/identity.ts index 16ab8aa..f1f7f04 100644 --- a/src/types/identity.ts +++ b/src/types/identity.ts @@ -1,3 +1,23 @@ +/** Copyright © 2024 P0 Security + +This file is part of @p0security/p0cli + +@p0security/p0cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. + +@p0security/p0cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with @p0security/p0cli. If not, see . +**//* Copyright © 2024 P0 Security + +This file is part of @p0security/p0cli + +@p0security/p0cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. + +@p0security/p0cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with @p0security/p0cli. If not, see . +*/ + import { TokenResponse } from "./oidc"; import { OrgData } from "./org"; import { UserCredential } from "firebase/auth"; diff --git a/src/types/oidc.ts b/src/types/oidc.ts index b46f26d..01a3fa6 100644 --- a/src/types/oidc.ts +++ b/src/types/oidc.ts @@ -1,3 +1,23 @@ +/** Copyright © 2024 P0 Security + +This file is part of @p0security/p0cli + +@p0security/p0cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. + +@p0security/p0cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with @p0security/p0cli. If not, see . +**//* Copyright © 2024 P0 Security + +This file is part of @p0security/p0cli + +@p0security/p0cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. + +@p0security/p0cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with @p0security/p0cli. If not, see . +*/ + export type AuthorizeRequest = { client_id: string; code_challenge: string; diff --git a/src/types/org.ts b/src/types/org.ts index 95da342..43359c1 100644 --- a/src/types/org.ts +++ b/src/types/org.ts @@ -1,3 +1,23 @@ +/** Copyright © 2024 P0 Security + +This file is part of @p0security/p0cli + +@p0security/p0cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. + +@p0security/p0cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with @p0security/p0cli. If not, see . +**//* Copyright © 2024 P0 Security + +This file is part of @p0security/p0cli + +@p0security/p0cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. + +@p0security/p0cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with @p0security/p0cli. If not, see . +*/ + /** Publicly readable organization data */ export type OrgData = { clientId: string; diff --git a/src/types/request.ts b/src/types/request.ts index 1576146..74efc9f 100644 --- a/src/types/request.ts +++ b/src/types/request.ts @@ -1,3 +1,23 @@ +/** Copyright © 2024 P0 Security + +This file is part of @p0security/p0cli + +@p0security/p0cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. + +@p0security/p0cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with @p0security/p0cli. If not, see . +**//* Copyright © 2024 P0 Security + +This file is part of @p0security/p0cli + +@p0security/p0cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. + +@p0security/p0cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with @p0security/p0cli. If not, see . +*/ + export const DONE_STATUSES = ["DONE", "DONE_NOTIFIED"] as const; export const DENIED_STATUSES = ["DENIED", "DENIED_NOTIFIED"] as const; export const ERROR_STATUSES = [ diff --git a/src/util.ts b/src/util.ts index 5c09893..89d2bd1 100644 --- a/src/util.ts +++ b/src/util.ts @@ -1,3 +1,13 @@ +/** Copyright © 2024 P0 Security + +This file is part of @p0security/p0cli + +@p0security/p0cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. + +@p0security/p0cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with @p0security/p0cli. If not, see . +**/ /** Waits the specified delay (in ms) * * The returned promise is cancelable: