diff --git a/.github/workflows/gateway-release.yml b/.github/workflows/gateway-release.yml index 4bd5ca629..493a7a41f 100644 --- a/.github/workflows/gateway-release.yml +++ b/.github/workflows/gateway-release.yml @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: © 2025 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + name: Gateway Release on: diff --git a/.github/workflows/kms-release.yml b/.github/workflows/kms-release.yml index f21f6b2a4..f3f45e4fa 100644 --- a/.github/workflows/kms-release.yml +++ b/.github/workflows/kms-release.yml @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: © 2025 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + name: KMS Release on: diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index ed90ee451..93ee18285 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: © 2024-2025 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + name: Rust checks on: diff --git a/.github/workflows/sdk.yaml b/.github/workflows/sdk.yaml index 12c7e4fc3..2663fb895 100644 --- a/.github/workflows/sdk.yaml +++ b/.github/workflows/sdk.yaml @@ -1,3 +1,8 @@ +# SPDX-FileCopyrightText: © 2025 Daniel Sharifi +# SPDX-FileCopyrightText: © 2025 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + name: SDK tests permissions: contents: read diff --git a/.github/workflows/spdx-check.yml b/.github/workflows/spdx-check.yml new file mode 100644 index 000000000..2839a74bb --- /dev/null +++ b/.github/workflows/spdx-check.yml @@ -0,0 +1,24 @@ +# SPDX-FileCopyrightText: © 2025 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + +name: SPDX License Check + +on: + push: + branches: [ master, main ] + pull_request: + branches: [ master, main ] + +jobs: + reuse-lint: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: REUSE Compliance Check + uses: fsfe/reuse-action@v5 + with: + args: lint \ No newline at end of file diff --git a/.gitignore b/.gitignore index 0149d458d..42567eedf 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ generated/ node_modules/ /.cargo .venv +/tmp diff --git a/.mailmap b/.mailmap new file mode 100644 index 000000000..f6dc5cb37 --- /dev/null +++ b/.mailmap @@ -0,0 +1,29 @@ +# Phala Network contributors +Kevin Wang Kevin Wang +Yan Yan Leechael Yim +Yan Yan Leechael +Hang Yin h4x3rotab +Hang Yin Hang Yin +Jianwei Zhu Jianwei Zhu +Joshua Waller Joshua <64296537+HashWarlock@users.noreply.github.com> +Shawn Tian Shawn TIAN +Shelven Zhou Shelven Zhou +Shelven Zhou Shunfan Zhou +Wenfeng Wang Wenfeng Wang + +# Other contributors +Andrew MacPherson Andrew MacPherson +Daniel Sharifi --local +Daniel Sharifi Daniel Sharifi <40335219+DSharifi@users.noreply.github.com> +Franco Barpp Gomes Franco Barpp Gomes +Franco Barpp Gomes Franco Barpp Gomes +Nitanshu Lokhande nlok5923 +Nitanshu Lokhande Nitanshu Lokhande <56120084+nlok5923@users.noreply.github.com> +Pierre Le Guen Pierre Le Guen <26087574+PierreLeGuen@users.noreply.github.com> +Tei Im Tei Im <40449056+ImTei@users.noreply.github.com> +Tei Im Tei Im +Created-for-a-purpose Created-for-a-purpose +crStiv crStiv +near-bookrock near-bookrock +Olexandr88 Olexandr88 +tuddman tuddman diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e1e8c9c4a..4f5f60267 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -35,3 +35,19 @@ git-cliff --output CHANGELOG.md ``` The changelog follows the [Keep a Changelog](https://keepachangelog.com/) format and includes GitHub integration for PR links and contributor recognition. + +## License + +This project uses SPDX headers for license compliance. You should add appropriate SPDX headers to all your source files. + +We have a script to automatically add SPDX headers based on git blame data: + +```bash +python3 scripts/add-spdx-attribution.py --file path/to/file.rs +``` + +Before submitting your changes, verify SPDX compliance using the [REUSE tool](https://github.com/fsfe/reuse-tool): + +```bash +reuse lint +``` diff --git a/Cargo.toml b/Cargo.toml index 8f175309f..bf828b690 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,3 +1,9 @@ +# SPDX-FileCopyrightText: © 2024-2025 Phala Network +# SPDX-FileCopyrightText: © 2025 Created-for-a-purpose +# SPDX-FileCopyrightText: © 2025 Daniel Sharifi +# +# SPDX-License-Identifier: Apache-2.0 + [workspace.package] version = "0.5.3" authors = ["Kevin Wang ", "Leechael "] diff --git a/LICENSES/Apache-2.0.txt b/LICENSES/Apache-2.0.txt new file mode 100644 index 000000000..261eeb9e9 --- /dev/null +++ b/LICENSES/Apache-2.0.txt @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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. diff --git a/LICENSES/BSD-3-Clause.txt b/LICENSES/BSD-3-Clause.txt new file mode 100644 index 000000000..ea890afbc --- /dev/null +++ b/LICENSES/BSD-3-Clause.txt @@ -0,0 +1,11 @@ +Copyright (c) . + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +2. 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. + +3. Neither the name of the copyright holder 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 HOLDER 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/LICENSES/CC0-1.0.txt b/LICENSES/CC0-1.0.txt new file mode 100644 index 000000000..0e259d42c --- /dev/null +++ b/LICENSES/CC0-1.0.txt @@ -0,0 +1,121 @@ +Creative Commons Legal Code + +CC0 1.0 Universal + + CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE + LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN + ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS + INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES + REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS + PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM + THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED + HEREUNDER. + +Statement of Purpose + +The laws of most jurisdictions throughout the world automatically confer +exclusive Copyright and Related Rights (defined below) upon the creator +and subsequent owner(s) (each and all, an "owner") of an original work of +authorship and/or a database (each, a "Work"). + +Certain owners wish to permanently relinquish those rights to a Work for +the purpose of contributing to a commons of creative, cultural and +scientific works ("Commons") that the public can reliably and without fear +of later claims of infringement build upon, modify, incorporate in other +works, reuse and redistribute as freely as possible in any form whatsoever +and for any purposes, including without limitation commercial purposes. +These owners may contribute to the Commons to promote the ideal of a free +culture and the further production of creative, cultural and scientific +works, or to gain reputation or greater distribution for their Work in +part through the use and efforts of others. + +For these and/or other purposes and motivations, and without any +expectation of additional consideration or compensation, the person +associating CC0 with a Work (the "Affirmer"), to the extent that he or she +is an owner of Copyright and Related Rights in the Work, voluntarily +elects to apply CC0 to the Work and publicly distribute the Work under its +terms, with knowledge of his or her Copyright and Related Rights in the +Work and the meaning and intended legal effect of CC0 on those rights. + +1. Copyright and Related Rights. A Work made available under CC0 may be +protected by copyright and related or neighboring rights ("Copyright and +Related Rights"). Copyright and Related Rights include, but are not +limited to, the following: + + i. the right to reproduce, adapt, distribute, perform, display, + communicate, and translate a Work; + ii. moral rights retained by the original author(s) and/or performer(s); +iii. publicity and privacy rights pertaining to a person's image or + likeness depicted in a Work; + iv. rights protecting against unfair competition in regards to a Work, + subject to the limitations in paragraph 4(a), below; + v. rights protecting the extraction, dissemination, use and reuse of data + in a Work; + vi. database rights (such as those arising under Directive 96/9/EC of the + European Parliament and of the Council of 11 March 1996 on the legal + protection of databases, and under any national implementation + thereof, including any amended or successor version of such + directive); and +vii. other similar, equivalent or corresponding rights throughout the + world based on applicable law or treaty, and any national + implementations thereof. + +2. Waiver. To the greatest extent permitted by, but not in contravention +of, applicable law, Affirmer hereby overtly, fully, permanently, +irrevocably and unconditionally waives, abandons, and surrenders all of +Affirmer's Copyright and Related Rights and associated claims and causes +of action, whether now known or unknown (including existing as well as +future claims and causes of action), in the Work (i) in all territories +worldwide, (ii) for the maximum duration provided by applicable law or +treaty (including future time extensions), (iii) in any current or future +medium and for any number of copies, and (iv) for any purpose whatsoever, +including without limitation commercial, advertising or promotional +purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each +member of the public at large and to the detriment of Affirmer's heirs and +successors, fully intending that such Waiver shall not be subject to +revocation, rescission, cancellation, termination, or any other legal or +equitable action to disrupt the quiet enjoyment of the Work by the public +as contemplated by Affirmer's express Statement of Purpose. + +3. Public License Fallback. Should any part of the Waiver for any reason +be judged legally invalid or ineffective under applicable law, then the +Waiver shall be preserved to the maximum extent permitted taking into +account Affirmer's express Statement of Purpose. In addition, to the +extent the Waiver is so judged Affirmer hereby grants to each affected +person a royalty-free, non transferable, non sublicensable, non exclusive, +irrevocable and unconditional license to exercise Affirmer's Copyright and +Related Rights in the Work (i) in all territories worldwide, (ii) for the +maximum duration provided by applicable law or treaty (including future +time extensions), (iii) in any current or future medium and for any number +of copies, and (iv) for any purpose whatsoever, including without +limitation commercial, advertising or promotional purposes (the +"License"). The License shall be deemed effective as of the date CC0 was +applied by Affirmer to the Work. Should any part of the License for any +reason be judged legally invalid or ineffective under applicable law, such +partial invalidity or ineffectiveness shall not invalidate the remainder +of the License, and in such case Affirmer hereby affirms that he or she +will not (i) exercise any of his or her remaining Copyright and Related +Rights in the Work or (ii) assert any associated claims and causes of +action with respect to the Work, in either case contrary to Affirmer's +express Statement of Purpose. + +4. Limitations and Disclaimers. + + a. No trademark or patent rights held by Affirmer are waived, abandoned, + surrendered, licensed or otherwise affected by this document. + b. Affirmer offers the Work as-is and makes no representations or + warranties of any kind concerning the Work, express, implied, + statutory or otherwise, including without limitation warranties of + title, merchantability, fitness for a particular purpose, non + infringement, or the absence of latent or other defects, accuracy, or + the present or absence of errors, whether or not discoverable, all to + the greatest extent permissible under applicable law. + c. Affirmer disclaims responsibility for clearing rights of other persons + that may apply to the Work or any use thereof, including without + limitation any person's Copyright and Related Rights in the Work. + Further, Affirmer disclaims responsibility for obtaining any necessary + consents, permissions or other rights required for any use of the + Work. + d. Affirmer understands and acknowledges that Creative Commons is not a + party to this document and has no duty or obligation with respect to + this CC0 or use of the Work. diff --git a/LICENSES/GPL-2.0-only.txt b/LICENSES/GPL-2.0-only.txt new file mode 100644 index 000000000..17cb28643 --- /dev/null +++ b/LICENSES/GPL-2.0-only.txt @@ -0,0 +1,117 @@ +GNU GENERAL PUBLIC LICENSE +Version 2, June 1991 + +Copyright (C) 1989, 1991 Free Software Foundation, Inc. +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + +Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. + +Preamble + +The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. + +When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. + +To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. + +For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. + +We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. + +Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. + +Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. + +The precise terms and conditions for copying, distribution and modification follow. + +TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + +0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. + +1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. + +You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. + +2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. + + c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. + +3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. + +If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. + +4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. + +5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. + +6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. + +7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. + +This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. + +8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. + +9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. + +10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. + +NO WARRANTY + +11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +END OF TERMS AND CONDITIONS + +How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. + +To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. + + one line to give the program's name and an idea of what it does. Copyright (C) yyyy name of author + + This program 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; either version 2 of the License, or (at your option) any later version. + + This program 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 this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. + +signature of Ty Coon, 1 April 1989 Ty Coon, President of Vice diff --git a/LICENSES/Linux-syscall-note.txt b/LICENSES/Linux-syscall-note.txt new file mode 100644 index 000000000..fcd056364 --- /dev/null +++ b/LICENSES/Linux-syscall-note.txt @@ -0,0 +1,12 @@ + NOTE! This copyright does *not* cover user programs that use kernel + services by normal system calls - this is merely considered normal use + of the kernel, and does *not* fall under the heading of "derived work". + Also note that the GPL below is copyrighted by the Free Software + Foundation, but the instance of code that it refers to (the Linux + kernel) is copyrighted by me and others who actually wrote it. + + Also note that the only valid version of the GPL as far as the kernel + is concerned is _this_ particular version of the license (ie v2, not + v2.2 or v3.x or whatever), unless explicitly otherwise stated. + + Linus Torvalds diff --git a/LICENSES/MIT.txt b/LICENSES/MIT.txt new file mode 100644 index 000000000..d817195da --- /dev/null +++ b/LICENSES/MIT.txt @@ -0,0 +1,18 @@ +MIT License + +Copyright (c) + +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. diff --git a/Makefile b/Makefile index f7947f667..0d04c03a9 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: © 2024 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + DOMAIN := local TO := ./certs diff --git a/README.md b/README.md index 1ec0efc61..b8ff0f17f 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ [![GitHub Stars](https://img.shields.io/github/stars/dstack-tee/dstack?style=flat-square&logo=github)](https://github.com/Dstack-TEE/dstack/stargazers) [![License](https://img.shields.io/github/license/dstack-tee/dstack?style=flat-square)](https://github.com/Dstack-TEE/dstack/blob/master/LICENSE) +[![REUSE status](https://api.reuse.software/badge/github.com/fsfe/reuse-tool)](https://api.reuse.software/info/github.com/fsfe/reuse-tool) [![Telegram](https://img.shields.io/badge/Community-blue?style=flat-square&logo=telegram&logoColor=fff)](https://t.me/+UO4bS4jflr45YmUx) [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/Dstack-TEE/dstack) diff --git a/REUSE.toml b/REUSE.toml new file mode 100644 index 000000000..e48336edb --- /dev/null +++ b/REUSE.toml @@ -0,0 +1,159 @@ +version = 1 +SPDX-PackageName = "dstack" +SPDX-PackageSupplier = "Phala Network " +SPDX-PackageDownloadLocation = "https://github.com/Dstack-TEE/dstack" + +# Non source files + +[[annotations]] +path = "**/*.md" +SPDX-FileCopyrightText = "Copyright (c) 2024-2025 The Project Contributors" +SPDX-License-Identifier = "Apache-2.0" + +[[annotations]] +path = "**/requirements.txt" +SPDX-FileCopyrightText = "Copyright (c) 2024-2025 The Project Contributors" +SPDX-License-Identifier = "Apache-2.0" + +[[annotations]] +path = [ + "**/package.json", + "**/openapi.json", + "**/tsconfig.json", + "**/tsconfig.node.json", + "**/tsconfig.browser.json", + "kms/auth-eth-bun/.oxlintrc.json", + "package-lock.json", + "**/package-lock.json", + "kms/auth-eth/.openzeppelin/unknown-2035.json", + "kms/auth-mock/.oxlintrc.json", + "sdk/simulator/*.json", + "sdk/go/go.sum", + "kms/dstack-app/builder/shared/kms-pinned-packages.txt", + "kms/dstack-app/builder/shared/qemu-pinned-packages.txt", + "gateway/dstack-app/builder/shared/builder-pinned-packages.txt", + "gateway/dstack-app/builder/shared/pinned-packages.txt", +] +SPDX-FileCopyrightText = "Copyright (c) 2024-2025 The Project Contributors" +SPDX-License-Identifier = "Apache-2.0" + +[[annotations]] +path = [ + "gateway/templates/wg.conf", + "guest-agent/templates/metrics.tpl", + "key-provider-build/sgx_default_qcnl.conf", +] +SPDX-FileCopyrightText = "Copyright (c) 2024-2025 The Project Contributors" +SPDX-License-Identifier = "Apache-2.0" + +[[annotations]] +path = [ + ".cursorrules", + ".mailmap", + "**/.gitignore", + "**/.npmignore", +] +SPDX-FileCopyrightText = "Copyright (c) 2024-2025 The Project Contributors" +SPDX-License-Identifier = "Apache-2.0" + +[[annotations]] +path = "basefiles/*" +SPDX-FileCopyrightText = "Copyright (c) 2024-2025 The Project Contributors" +SPDX-License-Identifier = "Apache-2.0" + +[[annotations]] +path = [ + "docs/security/dstack-audit.pdf", + "sdk/simulator/quote.hex", + "ra-tls/assets/tdx_quote", + "cc-eventlog/samples/ccel.bin", +] +SPDX-FileCopyrightText = "NONE" +SPDX-License-Identifier = "CC0-1.0" + +# Artworks + + +[[annotations]] +path = [ + "docs/assets/**", + "docs/security-guide/assets/**", + "dstack-logo.svg", +] +SPDX-FileCopyrightText = "Copyright (c) 2024-2025 The Project Contributors" +SPDX-License-Identifier = "Apache-2.0" + +# Vendor code + +[[annotations]] +path = "kms/auth-eth/lib/openzeppelin-contracts-upgradeable/**" +SPDX-FileCopyrightText = "Copyright (c) 2016-2025 Zeppelin Group Ltd" +SPDX-License-Identifier = "MIT" +precedence = "override" + +[[annotations]] +path = "kms/auth-eth/lib/openzeppelin-foundry-upgrades/**" +SPDX-FileCopyrightText = "NONE" +SPDX-License-Identifier = "MIT" + +[[annotations]] +path = "kms/auth-eth/lib/forge-std/**" +SPDX-FileCopyrightText = "NONE" +SPDX-License-Identifier = "Apache-2.0" + +[[annotations]] +path = "tdx-attest-sys/csrc/*" +SPDX-FileCopyrightText = "Copyright (C) 2011-2021 Intel Corporation. All rights reserved." +SPDX-License-Identifier = "BSD-3-Clause" + +[[annotations]] +path = "mod-tdx-guest/Kconfig" +SPDX-FileCopyrightText = "© 2022 Intel Corporation" +SPDX-License-Identifier = "GPL-2.0-only" + +# Generated files + +[[annotations]] +path = "kms/auth-eth/typechain-types/**" +SPDX-FileCopyrightText = "NONE" +SPDX-License-Identifier = "CC0-1.0" + +[[annotations]] +path = "**/*.lock" +SPDX-FileCopyrightText = "NONE" +SPDX-License-Identifier = "CC0-1.0" + +[[annotations]] +path = "**/*.lockb" +SPDX-FileCopyrightText = "NONE" +SPDX-License-Identifier = "CC0-1.0" + +[[annotations]] +path = "**/*.lockb" +SPDX-FileCopyrightText = "NONE" +SPDX-License-Identifier = "CC0-1.0" + +[[annotations]] +path = "**/*.snap" +SPDX-FileCopyrightText = "NONE" +SPDX-License-Identifier = "CC0-1.0" + +[[annotations]] +path = "**/src/generated.rs" +SPDX-FileCopyrightText = "NONE" +SPDX-License-Identifier = "CC0-1.0" + +[[annotations]] +path = "**/src/generated/*" +SPDX-FileCopyrightText = "NONE" +SPDX-License-Identifier = "CC0-1.0" + +[[annotations]] +path = "gateway/assets/*" +SPDX-FileCopyrightText = "NONE" +SPDX-License-Identifier = "CC0-1.0" + +[[annotations]] +path = "guest-api/src/generated/*" +SPDX-FileCopyrightText = "NONE" +SPDX-License-Identifier = "CC0-1.0" diff --git a/basefiles/app-compose.sh b/basefiles/app-compose.sh index e1780891f..c3768ea4c 100644 --- a/basefiles/app-compose.sh +++ b/basefiles/app-compose.sh @@ -1,5 +1,9 @@ #!/bin/bash +# SPDX-FileCopyrightText: © 2024-2025 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + HOST_SHARED_DIR="/dstack/.host-shared" SYS_CONFIG_FILE="$HOST_SHARED_DIR/.sys-config.json" CFG_PCCS_URL=$([ -f "$SYS_CONFIG_FILE" ] && jq -r '.pccs_url//""' "$SYS_CONFIG_FILE" || echo "") diff --git a/basefiles/dstack-prepare.sh b/basefiles/dstack-prepare.sh index 8aa4b8c9c..cd64f79ef 100755 --- a/basefiles/dstack-prepare.sh +++ b/basefiles/dstack-prepare.sh @@ -1,4 +1,9 @@ #!/bin/bash + +# SPDX-FileCopyrightText: © 2025 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + set -e WORK_DIR="/var/volatile/dstack" diff --git a/basefiles/wg-checker.sh b/basefiles/wg-checker.sh index ab72ec789..4b71fdf60 100644 --- a/basefiles/wg-checker.sh +++ b/basefiles/wg-checker.sh @@ -1,5 +1,9 @@ #!/bin/sh +# SPDX-FileCopyrightText: © 2024 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + get_conf_endpoint() { grep "Endpoint" /etc/wireguard/wg0.conf | awk "{print \$3}" } diff --git a/cargo-check-all.sh b/cargo-check-all.sh index caf0e2ec4..11adab7b3 100755 --- a/cargo-check-all.sh +++ b/cargo-check-all.sh @@ -1,4 +1,9 @@ #!/bin/sh + +# SPDX-FileCopyrightText: © 2024 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + find . -name Cargo.toml -exec dirname {} \; | while read dir; do echo "Checking $dir..." (cd "$dir" && cargo check) diff --git a/cc-eventlog/Cargo.toml b/cc-eventlog/Cargo.toml index 57611559e..f0516578f 100644 --- a/cc-eventlog/Cargo.toml +++ b/cc-eventlog/Cargo.toml @@ -1,3 +1,8 @@ +# SPDX-FileCopyrightText: © 2024 Phala Network +# SPDX-FileCopyrightText: © 2025 Daniel Sharifi +# +# SPDX-License-Identifier: Apache-2.0 + [package] name = "cc-eventlog" version.workspace = true diff --git a/cc-eventlog/src/codecs.rs b/cc-eventlog/src/codecs.rs index de5438ec5..c94edda3c 100644 --- a/cc-eventlog/src/codecs.rs +++ b/cc-eventlog/src/codecs.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use std::ops::Deref; use scale::{Decode, Input}; diff --git a/cc-eventlog/src/lib.rs b/cc-eventlog/src/lib.rs index 8fc189695..50f491cc1 100644 --- a/cc-eventlog/src/lib.rs +++ b/cc-eventlog/src/lib.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use crate::codecs::VecOf; use anyhow::{Context, Result}; use scale::Decode; diff --git a/cc-eventlog/src/tcg.rs b/cc-eventlog/src/tcg.rs index c18714a51..602ecd214 100644 --- a/cc-eventlog/src/tcg.rs +++ b/cc-eventlog/src/tcg.rs @@ -1,5 +1,9 @@ #![allow(dead_code)] +// SPDX-FileCopyrightText: © 2024 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use crate::codecs::VecOf; pub const TPM_ALG_ERROR: u16 = 0x0; diff --git a/cert-client/Cargo.toml b/cert-client/Cargo.toml index 69791810d..087d6f09d 100644 --- a/cert-client/Cargo.toml +++ b/cert-client/Cargo.toml @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: © 2025 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + [package] name = "cert-client" version.workspace = true diff --git a/cert-client/src/lib.rs b/cert-client/src/lib.rs index 958677347..ec6cb6702 100644 --- a/cert-client/src/lib.rs +++ b/cert-client/src/lib.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use anyhow::{Context, Result}; use dstack_kms_rpc::{kms_client::KmsClient, SignCertRequest}; use dstack_types::{AppKeys, KeyProvider}; diff --git a/certbot/Cargo.toml b/certbot/Cargo.toml index 207fb4281..52c49bea0 100644 --- a/certbot/Cargo.toml +++ b/certbot/Cargo.toml @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: © 2024 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + [package] name = "certbot" version.workspace = true diff --git a/certbot/cli/Cargo.toml b/certbot/cli/Cargo.toml index e37bb4c57..a3f21a10a 100644 --- a/certbot/cli/Cargo.toml +++ b/certbot/cli/Cargo.toml @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: © 2024 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + [package] name = "certbot-cli" version.workspace = true diff --git a/certbot/cli/src/main.rs b/certbot/cli/src/main.rs index de44ef0cc..19fed2e16 100644 --- a/certbot/cli/src/main.rs +++ b/certbot/cli/src/main.rs @@ -1,3 +1,8 @@ +// SPDX-FileCopyrightText: © 2024-2025 Phala Network +// SPDX-FileCopyrightText: © 2025 Test in Prod +// +// SPDX-License-Identifier: Apache-2.0 + use std::{path::PathBuf, time::Duration}; use anyhow::{Context, Result}; diff --git a/certbot/src/acme_client.rs b/certbot/src/acme_client.rs index e28b75664..b27a58523 100644 --- a/certbot/src/acme_client.rs +++ b/certbot/src/acme_client.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024-2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use anyhow::{bail, Context, Result}; use fs_err as fs; use hickory_resolver::error::ResolveErrorKind; diff --git a/certbot/src/acme_client/tests.rs b/certbot/src/acme_client/tests.rs index be6beffbd..54eefac0c 100644 --- a/certbot/src/acme_client/tests.rs +++ b/certbot/src/acme_client/tests.rs @@ -1,5 +1,9 @@ #![cfg(not(test))] +// SPDX-FileCopyrightText: © 2024 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use super::*; async fn new_acme_client() -> Result { diff --git a/certbot/src/bot.rs b/certbot/src/bot.rs index 952a7155c..7df254995 100644 --- a/certbot/src/bot.rs +++ b/certbot/src/bot.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024-2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use std::{ collections::BTreeSet, io::ErrorKind, diff --git a/certbot/src/bot/tests.rs b/certbot/src/bot/tests.rs index 6cd5ed07f..e7c65e6da 100644 --- a/certbot/src/bot/tests.rs +++ b/certbot/src/bot/tests.rs @@ -1,5 +1,9 @@ #![cfg(not(test))] +// SPDX-FileCopyrightText: © 2024 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use instant_acme::LetsEncrypt; use super::*; diff --git a/certbot/src/dns01_client.rs b/certbot/src/dns01_client.rs index ae447593d..27b1bb6d7 100644 --- a/certbot/src/dns01_client.rs +++ b/certbot/src/dns01_client.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use anyhow::Result; use cloudflare::CloudflareClient; use enum_dispatch::enum_dispatch; diff --git a/certbot/src/dns01_client/cloudflare.rs b/certbot/src/dns01_client/cloudflare.rs index fab189d9a..4dbc0df0e 100644 --- a/certbot/src/dns01_client/cloudflare.rs +++ b/certbot/src/dns01_client/cloudflare.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024-2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use anyhow::{Context, Result}; use reqwest::Client; use serde::{Deserialize, Serialize}; diff --git a/certbot/src/lib.rs b/certbot/src/lib.rs index 6abd31d59..20cf8ed17 100644 --- a/certbot/src/lib.rs +++ b/certbot/src/lib.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024-2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + //! A CertBot client for requesting certificates from Let's Encrypt. //! //! This library provides a simple interface for requesting and managing SSL/TLS certificates diff --git a/certbot/src/workdir.rs b/certbot/src/workdir.rs index 95dff2489..9265834d1 100644 --- a/certbot/src/workdir.rs +++ b/certbot/src/workdir.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024-2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use anyhow::Result; use fs_err as fs; use std::{ diff --git a/cliff.toml b/cliff.toml index fd53199ff..167ef9f5b 100644 --- a/cliff.toml +++ b/cliff.toml @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: © 2025 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + # git-cliff ~ configuration file # https://git-cliff.org/docs/configuration diff --git a/ct_monitor/Cargo.toml b/ct_monitor/Cargo.toml index 3dd6aea56..3828526e0 100644 --- a/ct_monitor/Cargo.toml +++ b/ct_monitor/Cargo.toml @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: © 2024-2025 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + [package] name = "ct_monitor" version.workspace = true diff --git a/ct_monitor/src/main.rs b/ct_monitor/src/main.rs index 7d02447cb..a060ede3b 100644 --- a/ct_monitor/src/main.rs +++ b/ct_monitor/src/main.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024-2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use anyhow::{bail, Context, Result}; use clap::Parser; use dstack_gateway_rpc::gateway_client::GatewayClient; diff --git a/dstack-mr/Cargo.toml b/dstack-mr/Cargo.toml index 6db6631d9..5bd6ef51d 100644 --- a/dstack-mr/Cargo.toml +++ b/dstack-mr/Cargo.toml @@ -1,3 +1,8 @@ +# SPDX-FileCopyrightText: © 2025 Daniel Sharifi +# SPDX-FileCopyrightText: © 2025 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + [package] name = "dstack-mr" version.workspace = true diff --git a/dstack-mr/cli/Cargo.toml b/dstack-mr/cli/Cargo.toml index 741ba82c1..c349cbcad 100644 --- a/dstack-mr/cli/Cargo.toml +++ b/dstack-mr/cli/Cargo.toml @@ -1,3 +1,8 @@ +# SPDX-FileCopyrightText: © 2025 Daniel Sharifi +# SPDX-FileCopyrightText: © 2025 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + [package] name = "dstack-mr-cli" version = "0.1.0" diff --git a/dstack-mr/cli/src/main.rs b/dstack-mr/cli/src/main.rs index e57ac278e..74acc07a9 100644 --- a/dstack-mr/cli/src/main.rs +++ b/dstack-mr/cli/src/main.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use anyhow::{Context, Result, anyhow}; use clap::{Parser, Subcommand}; use dstack_mr::Machine; diff --git a/dstack-mr/src/acpi.rs b/dstack-mr/src/acpi.rs index c74642e5d..b79a63019 100644 --- a/dstack-mr/src/acpi.rs +++ b/dstack-mr/src/acpi.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + //! This module provides functionality to generate ACPI tables for QEMU, //! translated from an original Go implementation. diff --git a/dstack-mr/src/kernel.rs b/dstack-mr/src/kernel.rs index cb085f7a4..1f714ee00 100644 --- a/dstack-mr/src/kernel.rs +++ b/dstack-mr/src/kernel.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use crate::{measure_log, measure_sha384, num::read_le, utf16_encode, util::debug_print_log}; use anyhow::{bail, Context, Result}; use object::pe; diff --git a/dstack-mr/src/lib.rs b/dstack-mr/src/lib.rs index fca333555..936e283fd 100644 --- a/dstack-mr/src/lib.rs +++ b/dstack-mr/src/lib.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use serde::{Deserialize, Serialize}; use serde_human_bytes as hex_bytes; diff --git a/dstack-mr/src/machine.rs b/dstack-mr/src/machine.rs index 04f01ed47..27a63a0f6 100644 --- a/dstack-mr/src/machine.rs +++ b/dstack-mr/src/machine.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use crate::tdvf::Tdvf; use crate::util::debug_print_log; use crate::{kernel, TdxMeasurements}; diff --git a/dstack-mr/src/num.rs b/dstack-mr/src/num.rs index 43a4de7b2..56a7bd797 100644 --- a/dstack-mr/src/num.rs +++ b/dstack-mr/src/num.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use anyhow::{Context, Result}; pub(crate) trait Num { diff --git a/dstack-mr/src/tdvf.rs b/dstack-mr/src/tdvf.rs index 3297464da..e04edcb37 100644 --- a/dstack-mr/src/tdvf.rs +++ b/dstack-mr/src/tdvf.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use anyhow::{anyhow, bail, Context, Result}; use hex_literal::hex; use sha2::{Digest, Sha384}; diff --git a/dstack-mr/src/util.rs b/dstack-mr/src/util.rs index 026114b3b..9b394944f 100644 --- a/dstack-mr/src/util.rs +++ b/dstack-mr/src/util.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use log::debug; use sha2::{Digest, Sha384}; diff --git a/dstack-types/Cargo.toml b/dstack-types/Cargo.toml index 4f3ee8302..ca3f22cdf 100644 --- a/dstack-types/Cargo.toml +++ b/dstack-types/Cargo.toml @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: © 2025 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + [package] name = "dstack-types" version.workspace = true diff --git a/dstack-types/src/lib.rs b/dstack-types/src/lib.rs index 4398097a1..151832488 100644 --- a/dstack-types/src/lib.rs +++ b/dstack-types/src/lib.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use serde::{Deserialize, Serialize}; use serde_human_bytes as hex_bytes; diff --git a/dstack-types/src/mr_config.rs b/dstack-types/src/mr_config.rs index e35948fdb..6546a5526 100644 --- a/dstack-types/src/mr_config.rs +++ b/dstack-types/src/mr_config.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use sha3::{Digest, Keccak256}; use crate::KeyProviderKind; diff --git a/dstack-types/src/shared_filenames.rs b/dstack-types/src/shared_filenames.rs index a96ad0b2e..2588ae78f 100644 --- a/dstack-types/src/shared_filenames.rs +++ b/dstack-types/src/shared_filenames.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + pub const APP_COMPOSE: &str = "app-compose.json"; pub const APP_KEYS: &str = ".appkeys.json"; pub const SYS_CONFIG: &str = ".sys-config.json"; diff --git a/dstack-util/Cargo.toml b/dstack-util/Cargo.toml index 95e7912a9..d9809c852 100644 --- a/dstack-util/Cargo.toml +++ b/dstack-util/Cargo.toml @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: © 2024-2025 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + [package] name = "dstack-util" version.workspace = true diff --git a/dstack-util/src/crypto.rs b/dstack-util/src/crypto.rs index 4724ed5de..ee1dc555f 100644 --- a/dstack-util/src/crypto.rs +++ b/dstack-util/src/crypto.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use aes_gcm::{ aead::{Aead, Nonce}, Aes256Gcm, KeyInit, diff --git a/dstack-util/src/host_api.rs b/dstack-util/src/host_api.rs index fcaa1fe56..cc40581a8 100644 --- a/dstack-util/src/host_api.rs +++ b/dstack-util/src/host_api.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024-2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use crate::utils::{deserialize_json_file, sha256, SysConfig}; use anyhow::{anyhow, bail, Context, Result}; use dstack_types::shared_filenames::{HOST_SHARED_DIR, SYS_CONFIG}; diff --git a/dstack-util/src/main.rs b/dstack-util/src/main.rs index 2db1474ed..5d24ad01f 100644 --- a/dstack-util/src/main.rs +++ b/dstack-util/src/main.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024-2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use anyhow::{Context, Result}; use bollard::container::{ListContainersOptions, RemoveContainerOptions}; use bollard::Docker; diff --git a/dstack-util/src/parse_env_file.rs b/dstack-util/src/parse_env_file.rs index 5acc05c63..1c93dee62 100644 --- a/dstack-util/src/parse_env_file.rs +++ b/dstack-util/src/parse_env_file.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024-2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use anyhow::{bail, Context, Result}; use serde::Deserialize; use std::collections::{BTreeMap, BTreeSet}; diff --git a/dstack-util/src/system_setup.rs b/dstack-util/src/system_setup.rs index 1716310ca..e0706e86b 100644 --- a/dstack-util/src/system_setup.rs +++ b/dstack-util/src/system_setup.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use std::{ collections::{BTreeMap, BTreeSet}, ops::Deref, diff --git a/dstack-util/src/system_setup/config_id_verifier.rs b/dstack-util/src/system_setup/config_id_verifier.rs index cf3814e9c..4e69a465e 100644 --- a/dstack-util/src/system_setup/config_id_verifier.rs +++ b/dstack-util/src/system_setup/config_id_verifier.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use anyhow::{bail, Context, Result}; use dstack_types::{mr_config::MrConfig, KeyProviderKind}; use tracing::info; diff --git a/dstack-util/src/utils.rs b/dstack-util/src/utils.rs index 341e9a6be..510f93b25 100644 --- a/dstack-util/src/utils.rs +++ b/dstack-util/src/utils.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024-2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use std::path::Path; use anyhow::{Context, Result}; diff --git a/gateway/Cargo.toml b/gateway/Cargo.toml index 8da68cf01..d150126c4 100644 --- a/gateway/Cargo.toml +++ b/gateway/Cargo.toml @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: © 2024-2025 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + [package] name = "dstack-gateway" version.workspace = true diff --git a/gateway/dstack-app/Dockerfile b/gateway/dstack-app/Dockerfile index f717b1b65..90aa8406a 100644 --- a/gateway/dstack-app/Dockerfile +++ b/gateway/dstack-app/Dockerfile @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: © 2025 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + FROM rust:1.86.0@sha256:300ec56abce8cc9448ddea2172747d048ed902a3090e6b57babb2bf19f754081 AS gateway-builder ARG DSTACK_REV WORKDIR /src diff --git a/gateway/dstack-app/builder/Dockerfile b/gateway/dstack-app/builder/Dockerfile index f481a058f..3e5b9c061 100644 --- a/gateway/dstack-app/builder/Dockerfile +++ b/gateway/dstack-app/builder/Dockerfile @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: © 2025 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + FROM rust:1.86.0@sha256:300ec56abce8cc9448ddea2172747d048ed902a3090e6b57babb2bf19f754081 AS gateway-builder COPY ./shared /build ARG DSTACK_REV diff --git a/gateway/dstack-app/builder/build-image.sh b/gateway/dstack-app/builder/build-image.sh index dfd84fdf1..9c7a56c65 100755 --- a/gateway/dstack-app/builder/build-image.sh +++ b/gateway/dstack-app/builder/build-image.sh @@ -1,4 +1,9 @@ #!/bin/bash + +# SPDX-FileCopyrightText: © 2025 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + set -e #NO_CACHE=--no-cache diff --git a/gateway/dstack-app/builder/entrypoint.sh b/gateway/dstack-app/builder/entrypoint.sh index 55964975d..7696b95d3 100755 --- a/gateway/dstack-app/builder/entrypoint.sh +++ b/gateway/dstack-app/builder/entrypoint.sh @@ -1,4 +1,9 @@ #!/bin/bash + +# SPDX-FileCopyrightText: © 2025 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + set -e DATA_DIR="/data" diff --git a/gateway/dstack-app/builder/shared/pin-packages.sh b/gateway/dstack-app/builder/shared/pin-packages.sh index e134d852c..3c750b1bb 100755 --- a/gateway/dstack-app/builder/shared/pin-packages.sh +++ b/gateway/dstack-app/builder/shared/pin-packages.sh @@ -1,4 +1,9 @@ #!/bin/bash + +# SPDX-FileCopyrightText: © 2025 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + set -e PKG_LIST=$1 diff --git a/gateway/dstack-app/deploy-to-vmm.sh b/gateway/dstack-app/deploy-to-vmm.sh index 409f86df5..b40696c91 100755 --- a/gateway/dstack-app/deploy-to-vmm.sh +++ b/gateway/dstack-app/deploy-to-vmm.sh @@ -1,5 +1,9 @@ #!/bin/bash +# SPDX-FileCopyrightText: © 2025 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + APP_COMPOSE_FILE="" usage() { diff --git a/gateway/dstack-app/docker-compose.yaml b/gateway/dstack-app/docker-compose.yaml index 9c165d97e..40ec0d560 100644 --- a/gateway/dstack-app/docker-compose.yaml +++ b/gateway/dstack-app/docker-compose.yaml @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: © 2025 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + services: gateway: image: kvin/gateway@sha256:27fc6872836712c640d22397e4cf86c3e771ebed0116e075dca0eb170d9a9081 diff --git a/gateway/gateway.toml b/gateway/gateway.toml index 9dc99e35d..a89ff3484 100644 --- a/gateway/gateway.toml +++ b/gateway/gateway.toml @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: © 2024-2025 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + workers = 8 max_blocking = 64 ident = "dstack Gateway" diff --git a/gateway/rpc/Cargo.toml b/gateway/rpc/Cargo.toml index fffe42f14..3a38ad25b 100644 --- a/gateway/rpc/Cargo.toml +++ b/gateway/rpc/Cargo.toml @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: © 2024-2025 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + [package] name = "dstack-gateway-rpc" version.workspace = true diff --git a/gateway/rpc/build.rs b/gateway/rpc/build.rs index 3d7ff6d09..5754dff41 100644 --- a/gateway/rpc/build.rs +++ b/gateway/rpc/build.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024-2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + fn main() { prpc_build::configure() .out_dir("./src/generated") diff --git a/gateway/rpc/proto/gateway_rpc.proto b/gateway/rpc/proto/gateway_rpc.proto index a18c44bba..890e87f7f 100644 --- a/gateway/rpc/proto/gateway_rpc.proto +++ b/gateway/rpc/proto/gateway_rpc.proto @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024-2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + syntax = "proto3"; import "google/protobuf/empty.proto"; diff --git a/gateway/rpc/src/lib.rs b/gateway/rpc/src/lib.rs index 29aad437c..089da7c60 100644 --- a/gateway/rpc/src/lib.rs +++ b/gateway/rpc/src/lib.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + extern crate alloc; pub use generated::*; diff --git a/gateway/src/admin_service.rs b/gateway/src/admin_service.rs index ea50469fc..541dee0d0 100644 --- a/gateway/src/admin_service.rs +++ b/gateway/src/admin_service.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use std::sync::atomic::Ordering; use std::time::{SystemTime, UNIX_EPOCH}; diff --git a/gateway/src/config.rs b/gateway/src/config.rs index 0374b09cc..3a3d88db2 100644 --- a/gateway/src/config.rs +++ b/gateway/src/config.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024-2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use anyhow::{bail, Context, Result}; use cmd_lib::run_cmd as cmd; use ipnet::Ipv4Net; diff --git a/gateway/src/main.rs b/gateway/src/main.rs index 500d3ca80..61d25632c 100644 --- a/gateway/src/main.rs +++ b/gateway/src/main.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024-2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use anyhow::{anyhow, Context, Result}; use clap::Parser; use config::{Config, TlsConfig}; diff --git a/gateway/src/main_service.rs b/gateway/src/main_service.rs index 1e8aaa43e..9162ff400 100644 --- a/gateway/src/main_service.rs +++ b/gateway/src/main_service.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024-2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use std::{ collections::{BTreeMap, BTreeSet}, net::Ipv4Addr, diff --git a/gateway/src/main_service/auth_client.rs b/gateway/src/main_service/auth_client.rs index bd8e85441..f729cf7fb 100644 --- a/gateway/src/main_service/auth_client.rs +++ b/gateway/src/main_service/auth_client.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use crate::config::AuthConfig; use anyhow::{Context, Result}; use ra_tls::attestation::AppInfo; diff --git a/gateway/src/main_service/sync_client.rs b/gateway/src/main_service/sync_client.rs index d3e9be689..7feba2a02 100644 --- a/gateway/src/main_service/sync_client.rs +++ b/gateway/src/main_service/sync_client.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use std::time::{Duration, Instant}; use anyhow::{Context, Result}; diff --git a/gateway/src/main_service/tests.rs b/gateway/src/main_service/tests.rs index 66ffea7e5..d98c0131b 100644 --- a/gateway/src/main_service/tests.rs +++ b/gateway/src/main_service/tests.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024-2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use super::*; use crate::config::{load_config_figment, Config}; diff --git a/gateway/src/models.rs b/gateway/src/models.rs index e92defef7..ec476cff0 100644 --- a/gateway/src/models.rs +++ b/gateway/src/models.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024-2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use dstack_gateway_rpc::{AcmeInfoResponse, StatusResponse}; use rinja::Template; use serde::{Deserialize, Serialize}; diff --git a/gateway/src/proxy.rs b/gateway/src/proxy.rs index 7eb1f35c0..75cc286ef 100644 --- a/gateway/src/proxy.rs +++ b/gateway/src/proxy.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024-2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use std::{ net::Ipv4Addr, sync::{ diff --git a/gateway/src/proxy/io_bridge.rs b/gateway/src/proxy/io_bridge.rs index 682296880..8c5dd7662 100644 --- a/gateway/src/proxy/io_bridge.rs +++ b/gateway/src/proxy/io_bridge.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024-2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use crate::config::ProxyConfig; use anyhow::{Context, Result}; use bytes::BytesMut; diff --git a/gateway/src/proxy/sni.rs b/gateway/src/proxy/sni.rs index a0768e79f..5235765b3 100644 --- a/gateway/src/proxy/sni.rs +++ b/gateway/src/proxy/sni.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use parcelona::parser_combinators::{Msg, PErr}; use parcelona::u8::*; use tracing::trace; diff --git a/gateway/src/proxy/tls_passthough.rs b/gateway/src/proxy/tls_passthough.rs index e62758759..1131eb017 100644 --- a/gateway/src/proxy/tls_passthough.rs +++ b/gateway/src/proxy/tls_passthough.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024-2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use anyhow::{Context, Result}; use std::fmt::Debug; use tokio::{io::AsyncWriteExt, net::TcpStream, task::JoinSet, time::timeout}; diff --git a/gateway/src/proxy/tls_terminate.rs b/gateway/src/proxy/tls_terminate.rs index 30d14fbcd..9c1594927 100644 --- a/gateway/src/proxy/tls_terminate.rs +++ b/gateway/src/proxy/tls_terminate.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024-2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use std::io; use std::pin::Pin; use std::sync::Arc; diff --git a/gateway/src/web_routes.rs b/gateway/src/web_routes.rs index 026f3b64a..1bd57f2b6 100644 --- a/gateway/src/web_routes.rs +++ b/gateway/src/web_routes.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use crate::main_service::Proxy; use anyhow::Result; use rocket::{get, response::content::RawHtml, routes, Route, State}; diff --git a/gateway/src/web_routes/route_index.rs b/gateway/src/web_routes/route_index.rs index 255a162a2..db414391f 100644 --- a/gateway/src/web_routes/route_index.rs +++ b/gateway/src/web_routes/route_index.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024-2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use crate::{ admin_service::AdminRpcHandler, main_service::{Proxy, RpcHandler}, diff --git a/gateway/templates/dashboard.html b/gateway/templates/dashboard.html index af0d02581..56750204d 100644 --- a/gateway/templates/dashboard.html +++ b/gateway/templates/dashboard.html @@ -1,3 +1,9 @@ + + diff --git a/gateway/templates/rproxy.yaml b/gateway/templates/rproxy.yaml index 2cd5adc96..69d03792b 100644 --- a/gateway/templates/rproxy.yaml +++ b/gateway/templates/rproxy.yaml @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: © 2024 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + servers: {%- for p in portmap %} - type: socket diff --git a/guest-agent/Cargo.toml b/guest-agent/Cargo.toml index b987bce45..d17ec3b5a 100644 --- a/guest-agent/Cargo.toml +++ b/guest-agent/Cargo.toml @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: © 2024-2025 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + [package] name = "dstack-guest-agent" version.workspace = true diff --git a/guest-agent/dstack.toml b/guest-agent/dstack.toml index c4836e83f..28722bf08 100644 --- a/guest-agent/dstack.toml +++ b/guest-agent/dstack.toml @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: © 2024-2025 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + [default] workers = 8 max_blocking = 64 diff --git a/guest-agent/rpc/Cargo.toml b/guest-agent/rpc/Cargo.toml index cb5cb23db..a7e573c64 100644 --- a/guest-agent/rpc/Cargo.toml +++ b/guest-agent/rpc/Cargo.toml @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: © 2024-2025 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + [package] name = "dstack-guest-agent-rpc" version.workspace = true diff --git a/guest-agent/rpc/build.rs b/guest-agent/rpc/build.rs index 3d7ff6d09..5754dff41 100644 --- a/guest-agent/rpc/build.rs +++ b/guest-agent/rpc/build.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024-2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + fn main() { prpc_build::configure() .out_dir("./src/generated") diff --git a/guest-agent/rpc/proto/agent_rpc.proto b/guest-agent/rpc/proto/agent_rpc.proto index 883353408..15606dbca 100644 --- a/guest-agent/rpc/proto/agent_rpc.proto +++ b/guest-agent/rpc/proto/agent_rpc.proto @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024-2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + syntax = "proto3"; import "google/protobuf/empty.proto"; diff --git a/guest-agent/rpc/src/lib.rs b/guest-agent/rpc/src/lib.rs index 29aad437c..089da7c60 100644 --- a/guest-agent/rpc/src/lib.rs +++ b/guest-agent/rpc/src/lib.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + extern crate alloc; pub use generated::*; diff --git a/guest-agent/src/config.rs b/guest-agent/src/config.rs index 9ceeab138..c8b75ed09 100644 --- a/guest-agent/src/config.rs +++ b/guest-agent/src/config.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024-2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use std::{collections::HashSet, ops::Deref, path::PathBuf}; use dstack_types::AppCompose; diff --git a/guest-agent/src/guest_api_service.rs b/guest-agent/src/guest_api_service.rs index 1cbfeca32..cd5272c54 100644 --- a/guest-agent/src/guest_api_service.rs +++ b/guest-agent/src/guest_api_service.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024-2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use std::fmt::Debug; use anyhow::{Context, Result}; diff --git a/guest-agent/src/http_routes.rs b/guest-agent/src/http_routes.rs index f5d482ff2..4e0c2facf 100644 --- a/guest-agent/src/http_routes.rs +++ b/guest-agent/src/http_routes.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024-2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use std::time::Duration; use crate::config::Config; diff --git a/guest-agent/src/main.rs b/guest-agent/src/main.rs index 3287ac98a..3183e61f9 100644 --- a/guest-agent/src/main.rs +++ b/guest-agent/src/main.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024-2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use std::{fs::Permissions, future::pending, os::unix::fs::PermissionsExt}; use anyhow::{anyhow, Context, Result}; diff --git a/guest-agent/src/models.rs b/guest-agent/src/models.rs index 780449aa4..12a0f887e 100644 --- a/guest-agent/src/models.rs +++ b/guest-agent/src/models.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024-2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use guest_api::{Container, SystemInfo}; use rinja::Template; diff --git a/guest-agent/src/rpc_service.rs b/guest-agent/src/rpc_service.rs index a78086c34..b31229027 100644 --- a/guest-agent/src/rpc_service.rs +++ b/guest-agent/src/rpc_service.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024-2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use std::sync::Arc; use anyhow::{Context, Result}; diff --git a/guest-agent/templates/dashboard.html b/guest-agent/templates/dashboard.html index 9f7d877d2..a81e3a45f 100644 --- a/guest-agent/templates/dashboard.html +++ b/guest-agent/templates/dashboard.html @@ -1,3 +1,9 @@ + + diff --git a/guest-api/Cargo.toml b/guest-api/Cargo.toml index 84f6a1ceb..01b6c8909 100644 --- a/guest-api/Cargo.toml +++ b/guest-api/Cargo.toml @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: © 2024 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + [package] name = "guest-api" version.workspace = true diff --git a/guest-api/build.rs b/guest-api/build.rs index 43bca3d81..cc70f72b7 100644 --- a/guest-api/build.rs +++ b/guest-api/build.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + fn main() { prpc_build::configure() .out_dir("./src/generated") diff --git a/guest-api/proto/guest_api.proto b/guest-api/proto/guest_api.proto index 0e1d78988..8c3c53372 100644 --- a/guest-api/proto/guest_api.proto +++ b/guest-api/proto/guest_api.proto @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: © 2024-2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 syntax = "proto3"; diff --git a/guest-api/src/client.rs b/guest-api/src/client.rs index e75e43a72..68fa36e44 100644 --- a/guest-api/src/client.rs +++ b/guest-api/src/client.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use crate::guest_api_client::GuestApiClient; use http_client::prpc::PrpcClient; diff --git a/guest-api/src/lib.rs b/guest-api/src/lib.rs index f0c09bc94..eb5524134 100644 --- a/guest-api/src/lib.rs +++ b/guest-api/src/lib.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + extern crate alloc; pub use generated::*; diff --git a/host-api/Cargo.toml b/host-api/Cargo.toml index b261ae708..8c43a217f 100644 --- a/host-api/Cargo.toml +++ b/host-api/Cargo.toml @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: © 2024 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + [package] name = "host-api" version.workspace = true diff --git a/host-api/build.rs b/host-api/build.rs index 43bca3d81..cc70f72b7 100644 --- a/host-api/build.rs +++ b/host-api/build.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + fn main() { prpc_build::configure() .out_dir("./src/generated") diff --git a/host-api/proto/host_api.proto b/host-api/proto/host_api.proto index eb11e92ac..f8864f516 100644 --- a/host-api/proto/host_api.proto +++ b/host-api/proto/host_api.proto @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: © 2024 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 syntax = "proto3"; diff --git a/host-api/src/client.rs b/host-api/src/client.rs index e8474a7d9..5a0606009 100644 --- a/host-api/src/client.rs +++ b/host-api/src/client.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use crate::host_api_client::HostApiClient; use http_client::prpc::PrpcClient; diff --git a/host-api/src/lib.rs b/host-api/src/lib.rs index f0c09bc94..eb5524134 100644 --- a/host-api/src/lib.rs +++ b/host-api/src/lib.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + extern crate alloc; pub use generated::*; diff --git a/http-client/Cargo.toml b/http-client/Cargo.toml index 4e57d164a..fffe277ab 100644 --- a/http-client/Cargo.toml +++ b/http-client/Cargo.toml @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: © 2024-2025 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + [package] name = "http-client" version.workspace = true diff --git a/http-client/src/hyper_vsock.rs b/http-client/src/hyper_vsock.rs index 740d12841..df280f80b 100644 --- a/http-client/src/hyper_vsock.rs +++ b/http-client/src/hyper_vsock.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use hyper::{body::Body, rt::ReadBufCursor, Uri}; use hyper_util::{ client::legacy::{ diff --git a/http-client/src/lib.rs b/http-client/src/lib.rs index 49aad39f2..cd121c96f 100644 --- a/http-client/src/lib.rs +++ b/http-client/src/lib.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024-2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use anyhow::Result; use http_body_util::{BodyExt, Full}; use hyper::body::Bytes; diff --git a/http-client/src/prpc.rs b/http-client/src/prpc.rs index 41bdb7e06..eacc03b1e 100644 --- a/http-client/src/prpc.rs +++ b/http-client/src/prpc.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024-2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use anyhow::Context; use prpc::{ client::{Error, RequestClient}, diff --git a/iohash/Cargo.toml b/iohash/Cargo.toml index 71accd9a7..2e7ac0e06 100644 --- a/iohash/Cargo.toml +++ b/iohash/Cargo.toml @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: © 2024 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + [package] name = "iohash" version.workspace = true diff --git a/iohash/src/main.rs b/iohash/src/main.rs index 28f51eb3c..2bb32ce2d 100644 --- a/iohash/src/main.rs +++ b/iohash/src/main.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + //! Stream compute hash digest of stdin and output the original data to stdout. The digest is output to stderr. use std::io::{Read, Write}; diff --git a/key-provider-build/Dockerfile.aesmd b/key-provider-build/Dockerfile.aesmd index 46e868b22..c5d032507 100644 --- a/key-provider-build/Dockerfile.aesmd +++ b/key-provider-build/Dockerfile.aesmd @@ -1,3 +1,6 @@ +# SPDX-FileCopyrightText: © 2024-2025 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 FROM ubuntu:20.04 # Prevent timezone prompt diff --git a/key-provider-build/Dockerfile.key-provider b/key-provider-build/Dockerfile.key-provider index 27ec8bf0f..5929d156f 100644 --- a/key-provider-build/Dockerfile.key-provider +++ b/key-provider-build/Dockerfile.key-provider @@ -1,3 +1,6 @@ +# SPDX-FileCopyrightText: © 2024-2025 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 FROM gramineproject/gramine:v1.5@sha256:615849089db84477f03cd13209c08eaf6b6a3a68b4df733e097db56781935589 RUN apt-get update && apt-get install -y \ diff --git a/key-provider-build/docker-compose.yaml b/key-provider-build/docker-compose.yaml index 9e4be79f6..25e7e4ef1 100644 --- a/key-provider-build/docker-compose.yaml +++ b/key-provider-build/docker-compose.yaml @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: © 2024-2025 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + x-common: &common-config restart: always logging: diff --git a/key-provider-build/entrypoint-aesmd.sh b/key-provider-build/entrypoint-aesmd.sh index f50cded81..020591aac 100755 --- a/key-provider-build/entrypoint-aesmd.sh +++ b/key-provider-build/entrypoint-aesmd.sh @@ -1,4 +1,9 @@ #!/bin/sh + +# SPDX-FileCopyrightText: © 2025 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + echo "Starting AESM service..." # Make sure the AESM directory exists with proper permissions mkdir -p /var/run/aesmd diff --git a/key-provider-build/entrypoint-key-provider.sh b/key-provider-build/entrypoint-key-provider.sh index 3d36c686e..893e4686b 100755 --- a/key-provider-build/entrypoint-key-provider.sh +++ b/key-provider-build/entrypoint-key-provider.sh @@ -1,4 +1,9 @@ #!/bin/sh + +# SPDX-FileCopyrightText: © 2025 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + echo "Waiting for AESM socket to be available..." AESM_SOCKET="/var/run/aesmd/aesm.socket" for i in $(seq 1 30); do diff --git a/key-provider-build/run.sh b/key-provider-build/run.sh index 365e19d08..42624b8e8 100755 --- a/key-provider-build/run.sh +++ b/key-provider-build/run.sh @@ -1,5 +1,9 @@ #!/bin/bash +# SPDX-FileCopyrightText: © 2025 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + echo "Starting all SGX services using docker-compose..." docker compose up --build -d diff --git a/key-provider-client/Cargo.toml b/key-provider-client/Cargo.toml index 7d674ce19..2743842ce 100644 --- a/key-provider-client/Cargo.toml +++ b/key-provider-client/Cargo.toml @@ -1,3 +1,8 @@ +# SPDX-FileCopyrightText: © 2024 Phala Network +# SPDX-FileCopyrightText: © 2025 Daniel Sharifi +# +# SPDX-License-Identifier: Apache-2.0 + [package] name = "key-provider-client" version.workspace = true diff --git a/key-provider-client/src/host.rs b/key-provider-client/src/host.rs index a4a2f3f1d..e6ade400d 100644 --- a/key-provider-client/src/host.rs +++ b/key-provider-client/src/host.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use anyhow::{bail, Context, Result}; use serde::{Deserialize, Serialize}; use std::net::IpAddr; diff --git a/key-provider-client/src/lib.rs b/key-provider-client/src/lib.rs index 5361e40d0..ada18a6e8 100644 --- a/key-provider-client/src/lib.rs +++ b/key-provider-client/src/lib.rs @@ -1 +1,5 @@ +// SPDX-FileCopyrightText: © 2024 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + pub mod host; diff --git a/kms/Cargo.toml b/kms/Cargo.toml index edd3c4756..3a08c7485 100644 --- a/kms/Cargo.toml +++ b/kms/Cargo.toml @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: © 2024-2025 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + [package] name = "dstack-kms" version.workspace = true diff --git a/kms/auth-eth-bun/index.test.ts b/kms/auth-eth-bun/index.test.ts index 4945f0995..4bc271b8b 100644 --- a/kms/auth-eth-bun/index.test.ts +++ b/kms/auth-eth-bun/index.test.ts @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + import { describe, it, expect, beforeAll, beforeEach, vi } from 'vitest'; import openApiSpec from './openapi.json'; diff --git a/kms/auth-eth-bun/index.ts b/kms/auth-eth-bun/index.ts index e2f33967c..2432d3d13 100644 --- a/kms/auth-eth-bun/index.ts +++ b/kms/auth-eth-bun/index.ts @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + import { Hono } from 'hono'; import { zValidator } from '@hono/zod-validator'; import { z } from 'zod'; diff --git a/kms/auth-eth-bun/vitest.config.ts b/kms/auth-eth-bun/vitest.config.ts index 096f6f7ad..990992495 100644 --- a/kms/auth-eth-bun/vitest.config.ts +++ b/kms/auth-eth-bun/vitest.config.ts @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + import { defineConfig } from 'vitest/config'; export default defineConfig({ diff --git a/kms/auth-eth/contracts/DstackApp.sol b/kms/auth-eth/contracts/DstackApp.sol index 3b349c4c6..a0093b0a9 100644 --- a/kms/auth-eth/contracts/DstackApp.sol +++ b/kms/auth-eth/contracts/DstackApp.sol @@ -1,4 +1,9 @@ -// SPDX-License-Identifier: MIT +/* + * SPDX-FileCopyrightText: © 2025 Phala Network + * + * SPDX-License-Identifier: Apache-2.0 + */ + pragma solidity ^0.8.22; import "./IAppAuth.sol"; diff --git a/kms/auth-eth/contracts/DstackKms.sol b/kms/auth-eth/contracts/DstackKms.sol index f7b0bc573..9a26ef4ff 100644 --- a/kms/auth-eth/contracts/DstackKms.sol +++ b/kms/auth-eth/contracts/DstackKms.sol @@ -1,4 +1,9 @@ -// SPDX-License-Identifier: MIT +/* + * SPDX-FileCopyrightText: © 2025 Phala Network + * + * SPDX-License-Identifier: Apache-2.0 + */ + pragma solidity ^0.8.22; import "./IAppAuth.sol"; diff --git a/kms/auth-eth/contracts/IAppAuth.sol b/kms/auth-eth/contracts/IAppAuth.sol index 2787b246c..29eb6737a 100644 --- a/kms/auth-eth/contracts/IAppAuth.sol +++ b/kms/auth-eth/contracts/IAppAuth.sol @@ -1,4 +1,9 @@ -// SPDX-License-Identifier: MIT +/* + * SPDX-FileCopyrightText: © 2025 Phala Network + * + * SPDX-License-Identifier: Apache-2.0 + */ + pragma solidity ^0.8.0; import "@openzeppelin/contracts/utils/introspection/IERC165.sol"; diff --git a/kms/auth-eth/contracts/IAppAuthBasicManagement.sol b/kms/auth-eth/contracts/IAppAuthBasicManagement.sol index b3ca86133..0396b1d47 100644 --- a/kms/auth-eth/contracts/IAppAuthBasicManagement.sol +++ b/kms/auth-eth/contracts/IAppAuthBasicManagement.sol @@ -1,4 +1,9 @@ -// SPDX-License-Identifier: MIT +/* + * SPDX-FileCopyrightText: © 2025 Phala Network + * + * SPDX-License-Identifier: Apache-2.0 + */ + pragma solidity ^0.8.0; import "@openzeppelin/contracts/utils/introspection/IERC165.sol"; diff --git a/kms/auth-eth/hardhat.config.ts b/kms/auth-eth/hardhat.config.ts index 6ce7ddc57..dd7c660c5 100644 --- a/kms/auth-eth/hardhat.config.ts +++ b/kms/auth-eth/hardhat.config.ts @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + import "@openzeppelin/hardhat-upgrades"; import { HardhatUserConfig, task, types } from "hardhat/config"; import "@nomicfoundation/hardhat-toolbox"; diff --git a/kms/auth-eth/jest.config.js b/kms/auth-eth/jest.config.js index 0071838dd..ae7a06b74 100644 --- a/kms/auth-eth/jest.config.js +++ b/kms/auth-eth/jest.config.js @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + module.exports = { preset: 'ts-jest', testEnvironment: 'node', diff --git a/kms/auth-eth/jest.integration.config.js b/kms/auth-eth/jest.integration.config.js index 430feb1f6..f6cc831be 100644 --- a/kms/auth-eth/jest.integration.config.js +++ b/kms/auth-eth/jest.integration.config.js @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + /** @type {import('ts-jest').JestConfigWithTsJest} */ module.exports = { preset: 'ts-jest', diff --git a/kms/auth-eth/lib/deployment-helpers.ts b/kms/auth-eth/lib/deployment-helpers.ts index d0a447c53..dbcb2b66f 100644 --- a/kms/auth-eth/lib/deployment-helpers.ts +++ b/kms/auth-eth/lib/deployment-helpers.ts @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + import { HardhatRuntimeEnvironment } from "hardhat/types"; import * as readline from 'readline'; diff --git a/kms/auth-eth/run-tests.sh b/kms/auth-eth/run-tests.sh index e37998f96..e8dd6ea0f 100644 --- a/kms/auth-eth/run-tests.sh +++ b/kms/auth-eth/run-tests.sh @@ -1 +1,5 @@ +# SPDX-FileCopyrightText: © 2025 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + npm run test diff --git a/kms/auth-eth/scripts/deploy.ts b/kms/auth-eth/scripts/deploy.ts index 7aedb3c1f..95b5587ac 100644 --- a/kms/auth-eth/scripts/deploy.ts +++ b/kms/auth-eth/scripts/deploy.ts @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + import { HardhatRuntimeEnvironment } from "hardhat/types"; import * as helpers from "../lib/deployment-helpers"; diff --git a/kms/auth-eth/scripts/upgrade.ts b/kms/auth-eth/scripts/upgrade.ts index 9f1647890..01f252314 100644 --- a/kms/auth-eth/scripts/upgrade.ts +++ b/kms/auth-eth/scripts/upgrade.ts @@ -1,3 +1,8 @@ +// SPDX-FileCopyrightText: © 2025 Phala Network +// © 2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + import { HardhatRuntimeEnvironment } from "hardhat/types"; import * as helpers from "../lib/deployment-helpers"; diff --git a/kms/auth-eth/scripts/verify.ts b/kms/auth-eth/scripts/verify.ts index c26b67f08..73904db4e 100644 --- a/kms/auth-eth/scripts/verify.ts +++ b/kms/auth-eth/scripts/verify.ts @@ -1,3 +1,8 @@ +// SPDX-FileCopyrightText: © 2025 Phala Network +// © 2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + import { run } from "hardhat"; async function main() { diff --git a/kms/auth-eth/src/ethereum.ts b/kms/auth-eth/src/ethereum.ts index f7095f1c0..5b1385d98 100644 --- a/kms/auth-eth/src/ethereum.ts +++ b/kms/auth-eth/src/ethereum.ts @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + import { ethers } from 'ethers'; import { BootInfo, BootResponse } from './types'; import { DstackKms__factory } from '../typechain-types/factories/contracts/DstackKms__factory'; diff --git a/kms/auth-eth/src/main.ts b/kms/auth-eth/src/main.ts index 78bfb9528..cdbf2e7c5 100644 --- a/kms/auth-eth/src/main.ts +++ b/kms/auth-eth/src/main.ts @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + import { config } from 'dotenv'; import { build } from './server'; diff --git a/kms/auth-eth/src/server.ts b/kms/auth-eth/src/server.ts index 219a1df1c..16f8cbc87 100644 --- a/kms/auth-eth/src/server.ts +++ b/kms/auth-eth/src/server.ts @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + import fastify, { FastifyInstance } from 'fastify'; import { EthereumBackend } from './ethereum'; import { BootInfo, BootResponse } from './types'; diff --git a/kms/auth-eth/src/types.ts b/kms/auth-eth/src/types.ts index 99f239132..fd1a89143 100644 --- a/kms/auth-eth/src/types.ts +++ b/kms/auth-eth/src/types.ts @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + export interface BootInfo { tcbStatus: string; advisoryIds: string[]; diff --git a/kms/auth-eth/test/DstackApp.test.ts b/kms/auth-eth/test/DstackApp.test.ts index bce673227..6421402e3 100644 --- a/kms/auth-eth/test/DstackApp.test.ts +++ b/kms/auth-eth/test/DstackApp.test.ts @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + import { expect } from "chai"; import { ethers } from "hardhat"; import { DstackApp } from "../typechain-types"; diff --git a/kms/auth-eth/test/ethereum.integration.test.ts b/kms/auth-eth/test/ethereum.integration.test.ts index 5c6bc11bf..51a0783b0 100644 --- a/kms/auth-eth/test/ethereum.integration.test.ts +++ b/kms/auth-eth/test/ethereum.integration.test.ts @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + import { SignerWithAddress } from "@nomicfoundation/hardhat-ethers/signers"; import { ethers } from "hardhat"; import { EthereumBackend } from '../src/ethereum'; diff --git a/kms/auth-eth/test/ethereum.test.ts b/kms/auth-eth/test/ethereum.test.ts index dcf6024f5..83c0561f3 100644 --- a/kms/auth-eth/test/ethereum.test.ts +++ b/kms/auth-eth/test/ethereum.test.ts @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + import { SignerWithAddress } from "@nomicfoundation/hardhat-ethers/signers"; import { ethers } from "hardhat"; import { EthereumBackend } from '../src/ethereum'; diff --git a/kms/auth-eth/test/main.test.ts b/kms/auth-eth/test/main.test.ts index d61e2de86..799b50302 100644 --- a/kms/auth-eth/test/main.test.ts +++ b/kms/auth-eth/test/main.test.ts @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + import { FastifyInstance } from 'fastify'; import { build } from '../src/server'; import { BootInfo } from '../src/types'; diff --git a/kms/auth-eth/test/setup.ts b/kms/auth-eth/test/setup.ts index 419443b88..9e5547b2a 100644 --- a/kms/auth-eth/test/setup.ts +++ b/kms/auth-eth/test/setup.ts @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + import { SignerWithAddress } from "@nomicfoundation/hardhat-ethers/signers"; import hre from "hardhat"; import { ethers } from "hardhat"; diff --git a/kms/auth-mock/index.test.ts b/kms/auth-mock/index.test.ts index 22730ab04..177fa1b44 100644 --- a/kms/auth-mock/index.test.ts +++ b/kms/auth-mock/index.test.ts @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + import { describe, it, expect, beforeAll, beforeEach, vi } from 'vitest'; import openApiSpec from './openapi.json'; diff --git a/kms/auth-mock/index.ts b/kms/auth-mock/index.ts index 7aaa8368f..cef8becb5 100644 --- a/kms/auth-mock/index.ts +++ b/kms/auth-mock/index.ts @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + import { Hono } from 'hono'; import { zValidator } from '@hono/zod-validator'; import { z } from 'zod'; diff --git a/kms/auth-mock/vitest.config.ts b/kms/auth-mock/vitest.config.ts index 096f6f7ad..990992495 100644 --- a/kms/auth-mock/vitest.config.ts +++ b/kms/auth-mock/vitest.config.ts @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + import { defineConfig } from 'vitest/config'; export default defineConfig({ diff --git a/kms/dstack-app/builder/Dockerfile b/kms/dstack-app/builder/Dockerfile index d91afd3f0..5e954755f 100644 --- a/kms/dstack-app/builder/Dockerfile +++ b/kms/dstack-app/builder/Dockerfile @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: © 2025 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + FROM rust:1.86.0@sha256:300ec56abce8cc9448ddea2172747d048ed902a3090e6b57babb2bf19f754081 AS kms-builder COPY ./shared /build ARG DSTACK_REV diff --git a/kms/dstack-app/builder/build-image.sh b/kms/dstack-app/builder/build-image.sh index 772f7795b..7290cd204 100755 --- a/kms/dstack-app/builder/build-image.sh +++ b/kms/dstack-app/builder/build-image.sh @@ -1,4 +1,9 @@ #!/bin/bash + +# SPDX-FileCopyrightText: © 2025 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + set -e NO_CACHE=--no-cache diff --git a/kms/dstack-app/builder/shared/config-qemu.sh b/kms/dstack-app/builder/shared/config-qemu.sh index e5a7990d3..94174a585 100755 --- a/kms/dstack-app/builder/shared/config-qemu.sh +++ b/kms/dstack-app/builder/shared/config-qemu.sh @@ -1,5 +1,9 @@ #!/bin/bash +# SPDX-FileCopyrightText: © 2025 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + BUILD_DIR="$1" PREFIX="$2" if [ -z "$BUILD_DIR" ]; then diff --git a/kms/dstack-app/builder/shared/pin-packages.sh b/kms/dstack-app/builder/shared/pin-packages.sh index e134d852c..3c750b1bb 100755 --- a/kms/dstack-app/builder/shared/pin-packages.sh +++ b/kms/dstack-app/builder/shared/pin-packages.sh @@ -1,4 +1,9 @@ #!/bin/bash + +# SPDX-FileCopyrightText: © 2025 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + set -e PKG_LIST=$1 diff --git a/kms/dstack-app/compose-dev.yaml b/kms/dstack-app/compose-dev.yaml index 6137ac121..9193c3383 100644 --- a/kms/dstack-app/compose-dev.yaml +++ b/kms/dstack-app/compose-dev.yaml @@ -1,3 +1,8 @@ +# SPDX-FileCopyrightText: © 2025 Phala Network +# SPDX-FileCopyrightText: © 2025 Test in Prod +# +# SPDX-License-Identifier: Apache-2.0 + services: auth-api: build: diff --git a/kms/dstack-app/deploy-to-vmm.sh b/kms/dstack-app/deploy-to-vmm.sh index 148fa3b76..d2d6ce5ba 100755 --- a/kms/dstack-app/deploy-to-vmm.sh +++ b/kms/dstack-app/deploy-to-vmm.sh @@ -1,5 +1,10 @@ #!/bin/bash +# SPDX-FileCopyrightText: © 2025 Phala Network +# SPDX-FileCopyrightText: © 2025 Test in Prod +# +# SPDX-License-Identifier: Apache-2.0 + # Check if .env exists if [ -f ".env" ]; then # Load variables from .env diff --git a/kms/dstack-app/docker-compose.yaml b/kms/dstack-app/docker-compose.yaml index e17391a43..43fe43ede 100644 --- a/kms/dstack-app/docker-compose.yaml +++ b/kms/dstack-app/docker-compose.yaml @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: © 2025 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + services: # Helios is a Ethereum light client helios: diff --git a/kms/dstack-app/entrypoint.sh b/kms/dstack-app/entrypoint.sh index a66a5d52e..781c31fa5 100755 --- a/kms/dstack-app/entrypoint.sh +++ b/kms/dstack-app/entrypoint.sh @@ -1,4 +1,10 @@ #!/bin/sh + +# SPDX-FileCopyrightText: © 2025 Phala Network +# SPDX-FileCopyrightText: © 2025 Test in Prod +# +# SPDX-License-Identifier: Apache-2.0 + set -e cat < ./kms.toml diff --git a/kms/kms.toml b/kms/kms.toml index 07170a080..1f354066e 100644 --- a/kms/kms.toml +++ b/kms/kms.toml @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: © 2024-2025 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + [default] workers = 8 max_blocking = 64 diff --git a/kms/rpc/Cargo.toml b/kms/rpc/Cargo.toml index 353c64115..79a9b3478 100644 --- a/kms/rpc/Cargo.toml +++ b/kms/rpc/Cargo.toml @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: © 2024-2025 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + [package] name = "dstack-kms-rpc" version.workspace = true diff --git a/kms/rpc/build.rs b/kms/rpc/build.rs index 3d7ff6d09..5754dff41 100644 --- a/kms/rpc/build.rs +++ b/kms/rpc/build.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024-2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + fn main() { prpc_build::configure() .out_dir("./src/generated") diff --git a/kms/rpc/proto/kms_rpc.proto b/kms/rpc/proto/kms_rpc.proto index 80fdc21db..baac19111 100644 --- a/kms/rpc/proto/kms_rpc.proto +++ b/kms/rpc/proto/kms_rpc.proto @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024-2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + syntax = "proto3"; import "google/protobuf/empty.proto"; diff --git a/kms/rpc/src/lib.rs b/kms/rpc/src/lib.rs index 29aad437c..089da7c60 100644 --- a/kms/rpc/src/lib.rs +++ b/kms/rpc/src/lib.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + extern crate alloc; pub use generated::*; diff --git a/kms/src/config.rs b/kms/src/config.rs index af7f0efb2..36874e1b9 100644 --- a/kms/src/config.rs +++ b/kms/src/config.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024-2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use load_config::load_config; use rocket::figment::Figment; use serde::Deserialize; diff --git a/kms/src/crypto.rs b/kms/src/crypto.rs index 82d4206fa..6400d7001 100644 --- a/kms/src/crypto.rs +++ b/kms/src/crypto.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024-2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use anyhow::{Context, Result}; use k256::ecdsa::SigningKey; use sha3::{Digest, Keccak256}; diff --git a/kms/src/ct_log.rs b/kms/src/ct_log.rs index 7f8136509..de5c4b6bd 100644 --- a/kms/src/ct_log.rs +++ b/kms/src/ct_log.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use std::path::{Path, PathBuf}; use anyhow::{Context, Result}; diff --git a/kms/src/main.rs b/kms/src/main.rs index bc5c81276..8584eec99 100644 --- a/kms/src/main.rs +++ b/kms/src/main.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024-2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use anyhow::{anyhow, bail, Context, Result}; use clap::Parser; use config::KmsConfig; diff --git a/kms/src/main_service.rs b/kms/src/main_service.rs index 3db5a9eb4..f7e50b1d5 100644 --- a/kms/src/main_service.rs +++ b/kms/src/main_service.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024-2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use std::{ ffi::OsStr, path::{Path, PathBuf}, diff --git a/kms/src/main_service/upgrade_authority.rs b/kms/src/main_service/upgrade_authority.rs index d9c18a312..5db8a47de 100644 --- a/kms/src/main_service/upgrade_authority.rs +++ b/kms/src/main_service/upgrade_authority.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024-2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use crate::config::AuthApi; use anyhow::{bail, Result}; use serde::{Deserialize, Serialize}; diff --git a/kms/src/onboard_service.rs b/kms/src/onboard_service.rs index 4f442e1a0..a92c4cee1 100644 --- a/kms/src/onboard_service.rs +++ b/kms/src/onboard_service.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use anyhow::{Context, Result}; use dstack_guest_agent_rpc::{ dstack_guest_client::DstackGuestClient, GetQuoteResponse, RawQuoteArgs, diff --git a/kms/src/www/onboard.html b/kms/src/www/onboard.html index 5460169c8..a8b674a77 100644 --- a/kms/src/www/onboard.html +++ b/kms/src/www/onboard.html @@ -1,3 +1,9 @@ + + diff --git a/load_config/Cargo.toml b/load_config/Cargo.toml index c50aa1793..4ff4b140b 100644 --- a/load_config/Cargo.toml +++ b/load_config/Cargo.toml @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: © 2024 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + [package] name = "load_config" version.workspace = true diff --git a/load_config/src/lib.rs b/load_config/src/lib.rs index 6b8dbd42f..cd99b6cf7 100644 --- a/load_config/src/lib.rs +++ b/load_config/src/lib.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use figment::{ providers::{Data, Format, Json, Toml}, Figment, diff --git a/lspci/Cargo.toml b/lspci/Cargo.toml index 16b7dac08..bbb6f35cd 100644 --- a/lspci/Cargo.toml +++ b/lspci/Cargo.toml @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: © 2025 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + [package] name = "lspci" version.workspace = true diff --git a/lspci/src/lib.rs b/lspci/src/lib.rs index 4288fd346..ef3565ede 100644 --- a/lspci/src/lib.rs +++ b/lspci/src/lib.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use std::process::Command; use anyhow::{Context, Result}; diff --git a/mod-tdx-guest/Makefile b/mod-tdx-guest/Makefile index a71b1897a..a9a17e211 100644 --- a/mod-tdx-guest/Makefile +++ b/mod-tdx-guest/Makefile @@ -1,4 +1,6 @@ -# SPDX-License-Identifier: GPL-2.0 +# SPDX-License-Identifier: GPL-2.0-only +# SPDX-FileCopyrightText: © 2022 Intel Corporation +# SPDX-FileCopyrightText: © 2024 Phala Network SRC := $(shell pwd) KERNEL_SRC ?= /lib/modules/$(shell uname -r)/build diff --git a/mod-tdx-guest/mod.c b/mod-tdx-guest/mod.c index f9481b471..98b865d1c 100644 --- a/mod-tdx-guest/mod.c +++ b/mod-tdx-guest/mod.c @@ -1,4 +1,6 @@ -// SPDX-License-Identifier: GPL-2.0 +// SPDX-FileCopyrightText: © 2022 Intel Corporation +// SPDX-FileCopyrightText: © 2024 Phala Network +// SPDX-License-Identifier: GPL-2.0-only /* * TDX guest user interface driver * diff --git a/mod-tdx-guest/tdcall.S b/mod-tdx-guest/tdcall.S index abee44fde..a98528695 100644 --- a/mod-tdx-guest/tdcall.S +++ b/mod-tdx-guest/tdcall.S @@ -1,4 +1,7 @@ -/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (c) 2023, Intel Inc + * SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note + */ #include #include diff --git a/mod-tdx-guest/tdx-guest.h b/mod-tdx-guest/tdx-guest.h index 2afc8cbda..05b2cb07a 100644 --- a/mod-tdx-guest/tdx-guest.h +++ b/mod-tdx-guest/tdx-guest.h @@ -1,4 +1,6 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +// SPDX-FileCopyrightText: © 2022 Intel Corporation +// SPDX-FileCopyrightText: © 2024 Phala Network +// SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note /* * Userspace interface for TDX guest driver * diff --git a/mod-tdx-guest/tdx.h b/mod-tdx-guest/tdx.h index 8ad0419b2..05e8b97ea 100644 --- a/mod-tdx-guest/tdx.h +++ b/mod-tdx-guest/tdx.h @@ -1,4 +1,6 @@ -/* SPDX-License-Identifier: GPL-2.0 */ +// SPDX-FileCopyrightText: © 2022 Intel Corporation +// SPDX-FileCopyrightText: © 2024 Phala Network +// SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note #ifndef _ASM_X86_SHARED_TDX_H #define _ASM_X86_SHARED_TDX_H diff --git a/no_std_check/Cargo.toml b/no_std_check/Cargo.toml index 2aa2fe811..4a78beb80 100644 --- a/no_std_check/Cargo.toml +++ b/no_std_check/Cargo.toml @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: © 2025 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + [package] name = "no_std_check" version = "0.1.0" diff --git a/no_std_check/src/lib.rs b/no_std_check/src/lib.rs index ea1554903..0f2f3803f 100644 --- a/no_std_check/src/lib.rs +++ b/no_std_check/src/lib.rs @@ -1,4 +1,8 @@ #![no_std] +// SPDX-FileCopyrightText: © 2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + // Import the types we want to test use dstack_sdk_types as _; diff --git a/python/ct_monitor/ct_monitor.py b/python/ct_monitor/ct_monitor.py index e056357dc..756636354 100644 --- a/python/ct_monitor/ct_monitor.py +++ b/python/ct_monitor/ct_monitor.py @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: © 2024 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + import sys import time import requests diff --git a/python/ct_monitor/pyproject.toml b/python/ct_monitor/pyproject.toml index e993c36ff..0c201bec9 100644 --- a/python/ct_monitor/pyproject.toml +++ b/python/ct_monitor/pyproject.toml @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: © 2024 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + [project] name = "ct_monitor" version = "0.1.0" diff --git a/ra-rpc/Cargo.toml b/ra-rpc/Cargo.toml index 563f90b40..b7171edad 100644 --- a/ra-rpc/Cargo.toml +++ b/ra-rpc/Cargo.toml @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: © 2024-2025 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + [package] name = "ra-rpc" version.workspace = true diff --git a/ra-rpc/src/client.rs b/ra-rpc/src/client.rs index 34a075482..7e4563176 100644 --- a/ra-rpc/src/client.rs +++ b/ra-rpc/src/client.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024-2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use std::time::Duration; use anyhow::{bail, Context, Result}; diff --git a/ra-rpc/src/lib.rs b/ra-rpc/src/lib.rs index 8fffd0d7f..e6f088aee 100644 --- a/ra-rpc/src/lib.rs +++ b/ra-rpc/src/lib.rs @@ -1,5 +1,9 @@ #![allow(async_fn_in_trait)] +// SPDX-FileCopyrightText: © 2024-2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use std::{net::SocketAddr, path::PathBuf}; use anyhow::Result; diff --git a/ra-rpc/src/rocket_helper.rs b/ra-rpc/src/rocket_helper.rs index 5e6b9bc2e..e2c398cee 100644 --- a/ra-rpc/src/rocket_helper.rs +++ b/ra-rpc/src/rocket_helper.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024-2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use std::convert::Infallible; use anyhow::{Context, Result}; diff --git a/ra-tls/Cargo.toml b/ra-tls/Cargo.toml index c264c6a05..9d7be749f 100644 --- a/ra-tls/Cargo.toml +++ b/ra-tls/Cargo.toml @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: © 2024-2025 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + [package] name = "ra-tls" version.workspace = true diff --git a/ra-tls/src/attestation.rs b/ra-tls/src/attestation.rs index 7eea23e9f..ee452cf24 100644 --- a/ra-tls/src/attestation.rs +++ b/ra-tls/src/attestation.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024-2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + //! Attestation functions use std::borrow::Cow; diff --git a/ra-tls/src/cert.rs b/ra-tls/src/cert.rs index 66ae15745..30939ec02 100644 --- a/ra-tls/src/cert.rs +++ b/ra-tls/src/cert.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024-2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + //! Certificate creation functions. use std::time::SystemTime; diff --git a/ra-tls/src/kdf.rs b/ra-tls/src/kdf.rs index 7e333b861..fbe16535b 100644 --- a/ra-tls/src/kdf.rs +++ b/ra-tls/src/kdf.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + //! Key derivation functions. use anyhow::{anyhow, Context, Result}; use p256::pkcs8::{DecodePrivateKey, EncodePrivateKey}; diff --git a/ra-tls/src/lib.rs b/ra-tls/src/lib.rs index f2629f9d0..410e8ad1b 100644 --- a/ra-tls/src/lib.rs +++ b/ra-tls/src/lib.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + //! RATLS library for Phala #![deny(missing_docs)] diff --git a/ra-tls/src/oids.rs b/ra-tls/src/oids.rs index e1558a811..9af9c4965 100644 --- a/ra-tls/src/oids.rs +++ b/ra-tls/src/oids.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024-2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + //! OIDs used by the RATLS protocol. /// OID for the SGX/TDX quote extension. diff --git a/ra-tls/src/traits.rs b/ra-tls/src/traits.rs index d0e7c9e6c..aaac91158 100644 --- a/ra-tls/src/traits.rs +++ b/ra-tls/src/traits.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024-2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + //! Traits for the crate use anyhow::{Context, Result}; diff --git a/rocket-vsock-listener/Cargo.toml b/rocket-vsock-listener/Cargo.toml index 3f5a16cfd..a0fe89de0 100644 --- a/rocket-vsock-listener/Cargo.toml +++ b/rocket-vsock-listener/Cargo.toml @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: © 2024 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + [package] name = "rocket-vsock-listener" version.workspace = true diff --git a/rocket-vsock-listener/src/lib.rs b/rocket-vsock-listener/src/lib.rs index 32910f631..fb7014985 100644 --- a/rocket-vsock-listener/src/lib.rs +++ b/rocket-vsock-listener/src/lib.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use derive_more::Display; use rocket::listener::{Connection, Endpoint, Listener}; use rocket::tokio::io::{AsyncRead, AsyncWrite, ReadBuf}; diff --git a/run-tests.sh b/run-tests.sh index 0083ad0f7..e348d1bed 100755 --- a/run-tests.sh +++ b/run-tests.sh @@ -1,4 +1,9 @@ #!/bin/bash + +# SPDX-FileCopyrightText: © 2025 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + set -e (cd sdk/simulator && ./build.sh) diff --git a/run.sh b/run.sh index 7e82acb3f..bf8a2af98 100755 --- a/run.sh +++ b/run.sh @@ -1,5 +1,9 @@ #!/bin/bash +# SPDX-FileCopyrightText: © 2024 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + VMDIR=$1 IMAGE_PATH=./images/$(jq -r '.image' ${VMDIR}/vm-manifest.json) IMG_METADATA=${IMAGE_PATH}/metadata.json diff --git a/scripts/add-spdx-attribution.py b/scripts/add-spdx-attribution.py new file mode 100755 index 000000000..67de938ba --- /dev/null +++ b/scripts/add-spdx-attribution.py @@ -0,0 +1,479 @@ +#!/usr/bin/env python3 +# SPDX-FileCopyrightText: © 2025 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 +""" +SPDX Header Attribution Script + +This script automatically analyzes git blame data to determine contributors +and adds appropriate SPDX-FileCopyrightText headers using the REUSE tool. + +Features: +- Excludes third-party code based on .spdx-exclude patterns +- Maps company email domains to company names +- Uses .mailmap for canonical contributor information +- Integrates with REUSE tool for consistent header formatting +- Supports dry-run mode for safe testing +""" + +import argparse +import fnmatch +import os +import re +import subprocess +import sys +from collections import defaultdict +from datetime import datetime +from pathlib import Path +from typing import Dict, List, Set, Tuple, Optional + + +class SPDXAttributor: + def __init__(self, repo_root: str, dry_run: bool = False): + self.repo_root = Path(repo_root).resolve() + self.dry_run = dry_run + self.exclude_patterns = self._load_exclude_patterns() + self.mailmap = self._parse_mailmap() + self.company_domains = self._build_company_domain_map() + + def _load_exclude_patterns(self) -> List[str]: + """Load exclusion patterns from .spdx-exclude file.""" + exclude_file = self.repo_root / '.spdx-exclude' + patterns = [] + + if exclude_file.exists(): + with open(exclude_file, 'r') as f: + for line in f: + line = line.strip() + if line and not line.startswith('#'): + patterns.append(line) + + return patterns + + def _parse_mailmap(self) -> Dict[str, Tuple[str, str]]: + """Parse .mailmap file to get canonical name/email mappings.""" + mailmap_file = self.repo_root / '.mailmap' + mailmap = {} + + if not mailmap_file.exists(): + print("Warning: .mailmap file not found") + return mailmap + + with open(mailmap_file, 'r') as f: + for line in f: + line = line.strip() + if not line or line.startswith('#'): + continue + + # Parse mailmap format: "Proper Name " + # or "Proper Name Commit Name " + if '>' in line: + parts = line.split('>') + if len(parts) >= 2: + proper_part = parts[0].strip() + commit_part = parts[1].strip() + + # Extract proper name and email + if '<' in proper_part: + proper_name = proper_part.split('<')[0].strip() + proper_email = proper_part.split('<')[1].strip() + else: + continue + + # Extract commit email (and possibly name) + if '<' in commit_part: + commit_email = commit_part.split('<')[1].split('>')[0].strip() + else: + commit_email = commit_part.strip() + + mailmap[commit_email] = (proper_name, proper_email) + + return mailmap + + def _build_company_domain_map(self) -> Dict[str, str]: + """Build mapping from email domains to company names.""" + return { + 'phala.network': 'Phala Network', + 'near.ai': 'Near Foundation', + 'nethermind.io': 'Nethermind', + 'rizelabs.io': 'Rize Labs', + 'testinprod.io': 'Test in Prod', + } + + def _is_excluded(self, file_path: Path) -> bool: + """Check if a file should be excluded based on patterns.""" + rel_path = file_path.relative_to(self.repo_root) + rel_path_str = str(rel_path) + + for pattern in self.exclude_patterns: + # Handle directory patterns + if pattern.endswith('/'): + if rel_path_str.startswith(pattern) or f"/{pattern}" in f"/{rel_path_str}/": + return True + # Handle glob patterns + elif fnmatch.fnmatch(rel_path_str, pattern): + return True + # Handle wildcard patterns + elif '*' in pattern and fnmatch.fnmatch(rel_path_str, pattern): + return True + + return False + + def _get_canonical_contributor(self, email: str, name: str) -> Tuple[str, str]: + """Get canonical name and email for a contributor using mailmap.""" + if email in self.mailmap: + return self.mailmap[email] + return name.strip(), email.strip() + + def _get_company_name(self, email: str) -> Optional[str]: + """Get company name for an email domain, or None for individual contributors.""" + domain = email.split('@')[-1].lower() + return self.company_domains.get(domain) + + def _get_company_contact_email(self, company: str) -> str: + """Get the standardized contact email for a company.""" + # Company-specific contact emails + company_contacts = { + 'Phala Network': 'dstack@phala.network', + 'Near Foundation': 'contact@near.ai', + 'Nethermind': 'contact@nethermind.io', + 'Rize Labs': 'contact@rizelabs.io', + 'Test in Prod': 'contact@testinprod.io', + } + + return company_contacts.get(company, f'contact@{company.lower().replace(" ", "")}.com') + + def _analyze_git_blame(self, file_path: Path) -> Dict[str, Set[int]]: + """Analyze git blame to get contributors and their contribution years.""" + try: + # Run git blame to get author info and dates + result = subprocess.run([ + 'git', 'blame', '--porcelain', str(file_path) + ], capture_output=True, text=True, cwd=self.repo_root) + + if result.returncode != 0: + print(f"Warning: Could not run git blame on {file_path}") + return {} + + contributors = defaultdict(set) + current_commit = None + + for line in result.stdout.split('\n'): + line = line.strip() + if not line: + continue + + # Parse commit hash line + if re.match(r'^[0-9a-f]{40}', line): + current_commit = line.split()[0] + # Parse author email + elif line.startswith('author-mail '): + email = line[12:].strip('<>') + + # Skip SPDX-only commits to avoid counting license header changes as contributions + if self._is_spdx_only_commit(current_commit): + continue + + # Get the year for this commit + year = self._get_commit_year(current_commit) + if year and email: + contributors[email].add(year) + + return contributors + + except subprocess.SubprocessError as e: + print(f"Error running git blame on {file_path}: {e}") + return {} + + def _is_spdx_only_commit(self, commit_hash: str) -> bool: + """Check if a commit only contains SPDX header changes.""" + try: + # Get commit message + result = subprocess.run([ + 'git', 'show', '-s', '--format=%s%n%b', commit_hash + ], capture_output=True, text=True, cwd=self.repo_root) + + if result.returncode != 0: + return False + + commit_message = result.stdout.lower() + + # Check for SPDX-related keywords in commit message + spdx_keywords = [ + 'spdx', 'license header', 'copyright header', 'add license', + 'update license', 'license annotation', 'reuse annotate', + 'add spdx', 'update spdx', 'copyright attribution' + ] + + if any(keyword in commit_message for keyword in spdx_keywords): + # Get the diff to see if it's only header changes + diff_result = subprocess.run([ + 'git', 'show', '--format=', commit_hash + ], capture_output=True, text=True, cwd=self.repo_root) + + if diff_result.returncode == 0: + diff_content = diff_result.stdout + + # Check if the diff only contains SPDX/copyright/license changes + # Look for lines that are only adding/removing headers + diff_lines = diff_content.split('\n') + substantial_changes = 0 + + for line in diff_lines: + if line.startswith(('+', '-')) and not line.startswith(('+++', '---')): + # Skip lines that are just SPDX/copyright/license related + line_content = line[1:].strip() + if line_content and not any(marker in line_content.lower() for marker in [ + 'spdx-', 'copyright', 'license-identifier', + 'filepyrighttext', '©', '(c)', 'all rights reserved' + ]): + substantial_changes += 1 + + # If we have very few substantial changes, likely an SPDX-only commit + return substantial_changes <= 2 + + return False + + except subprocess.SubprocessError: + return False + + def _get_commit_year(self, commit_hash: str) -> Optional[int]: + """Get the year of a commit.""" + try: + result = subprocess.run([ + 'git', 'show', '-s', '--format=%ad', '--date=format:%Y', commit_hash + ], capture_output=True, text=True, cwd=self.repo_root) + + if result.returncode == 0: + return int(result.stdout.strip()) + except (subprocess.SubprocessError, ValueError): + pass + + return None + + def _generate_spdx_headers(self, contributors: Dict[str, Set[int]]) -> List[str]: + """Generate SPDX-FileCopyrightText headers for contributors.""" + headers = [] + company_years = defaultdict(set) # Track years by company + individual_contributors = {} # Track individual contributors + + # First pass: group contributors by company vs individual + for email, years in contributors.items(): + # Get canonical name and email + name, canonical_email = self._get_canonical_contributor(email, "Unknown") + + # Check if this is a company contributor + company = self._get_company_name(canonical_email) + + if company: + # Accumulate years for this company + company_years[company].update(years) + else: + # Individual contributor + individual_contributors[canonical_email] = (name, years) + + # Generate company headers (one per company) + for company, years in company_years.items(): + year_list = sorted(years) + if len(year_list) == 1: + year_str = str(year_list[0]) + else: + year_str = f"{year_list[0]}-{year_list[-1]}" + + contact_email = self._get_company_contact_email(company) + header = f"SPDX-FileCopyrightText: © {year_str} {company} <{contact_email}>" + headers.append(header) + + # Generate individual headers + for canonical_email, (name, years) in individual_contributors.items(): + year_list = sorted(years) + if len(year_list) == 1: + year_str = str(year_list[0]) + else: + year_str = f"{year_list[0]}-{year_list[-1]}" + + header = f"SPDX-FileCopyrightText: © {year_str} {name} <{canonical_email}>" + headers.append(header) + + return sorted(headers) + + def _remove_existing_spdx_headers(self, file_path: Path) -> bool: + """Remove existing SPDX headers from a file.""" + if not file_path.exists(): + return False + + try: + with open(file_path, 'r', encoding='utf-8') as f: + lines = f.readlines() + + # Find and remove existing SPDX lines + new_lines = [] + for line in lines: + if not (line.strip().startswith('// SPDX-') or + line.strip().startswith('# SPDX-') or + line.strip().startswith('/* SPDX-') or + line.strip().startswith(' * SPDX-')): + new_lines.append(line) + + # Write back if changes were made + if len(new_lines) != len(lines): + if not self.dry_run: + with open(file_path, 'w', encoding='utf-8') as f: + f.writelines(new_lines) + return True + + except (IOError, UnicodeDecodeError) as e: + print(f"Warning: Could not process {file_path}: {e}") + + return False + + def _get_existing_license(self, file_path: Path) -> str: + """Get the existing SPDX license identifier from a file.""" + try: + with open(file_path, 'r', encoding='utf-8') as f: + content = f.read() + + # Look for existing SPDX-License-Identifier + lines = content.split('\n')[:20] # Check first 20 lines + for line in lines: + if 'SPDX-License-Identifier:' in line: + # Extract the license identifier + parts = line.split('SPDX-License-Identifier:') + if len(parts) > 1: + return parts[1].strip().rstrip('*/') + + # Default to Apache-2.0 if no existing license found + return 'Apache-2.0' + + except Exception: + return 'Apache-2.0' + + def _apply_reuse_annotation(self, file_path: Path, headers: List[str]) -> bool: + """Apply SPDX headers using the REUSE tool.""" + if not headers: + return False + + try: + # Prepare REUSE command - pass full SPDX-FileCopyrightText headers directly + cmd = ['reuse', 'annotate'] + + # Add all copyright lines with full SPDX-FileCopyrightText format + for header in headers: + cmd.extend(['--copyright', header]) # Keep the full SPDX-FileCopyrightText: format + + # Preserve existing license or use Apache-2.0 as default + existing_license = self._get_existing_license(file_path) + cmd.extend(['--license', existing_license]) + + # Handle Solidity files which need explicit style specification + if file_path.suffix == '.sol': + cmd.extend(['--style', 'c']) + + # Add the file + cmd.append(str(file_path)) + + if self.dry_run: + print(f"Would run: {' '.join(cmd)}") + return True + else: + result = subprocess.run(cmd, capture_output=True, text=True, cwd=self.repo_root) + if result.returncode != 0: + print(f"REUSE command failed for {file_path}: {result.stderr}") + return False + return True + + except subprocess.SubprocessError as e: + print(f"Error running REUSE on {file_path}: {e}") + return False + + def process_file(self, file_path: Path) -> bool: + """Process a single file to add SPDX attribution.""" + # Convert to absolute path if it's relative + if not file_path.is_absolute(): + file_path = self.repo_root / file_path + + if self._is_excluded(file_path): + if self.dry_run: + print(f"Excluded: {file_path}") + return False + + # Analyze git blame + contributors = self._analyze_git_blame(file_path) + if not contributors: + print(f"No contributors found for {file_path}") + return False + + # Generate SPDX headers + headers = self._generate_spdx_headers(contributors) + + if self.dry_run: + print(f"\nFile: {file_path}") + print(f"Contributors: {len(contributors)}") + for header in headers: + print(f" {header}") + return True + + # Remove existing SPDX headers + self._remove_existing_spdx_headers(file_path) + + # Apply new headers with REUSE + success = self._apply_reuse_annotation(file_path, headers) + + if success: + print(f"✓ Updated: {file_path}") + else: + print(f"✗ Failed: {file_path}") + + return success + + def find_source_files(self) -> List[Path]: + """Find all source files that should be processed.""" + extensions = {'.rs', '.py', '.go', '.ts', '.js', '.c', '.h', '.cpp', '.hpp', '.sol'} + source_files = [] + + for ext in extensions: + for file_path in self.repo_root.rglob(f'*{ext}'): + if file_path.is_file() and not self._is_excluded(file_path): + source_files.append(file_path) + + return sorted(source_files) + + +def main(): + parser = argparse.ArgumentParser(description='Add SPDX attribution headers to source files') + parser.add_argument('--dry-run', action='store_true', help='Show what would be done without making changes') + parser.add_argument('--file', type=str, help='Process a specific file instead of all source files') + parser.add_argument('--repo-root', type=str, default='.', help='Repository root directory') + + args = parser.parse_args() + + # Initialize the attributor + attributor = SPDXAttributor(args.repo_root, dry_run=args.dry_run) + + if args.file: + # Process single file + file_path = Path(args.file) + if not file_path.exists(): + print(f"Error: File {file_path} does not exist") + sys.exit(1) + + attributor.process_file(file_path) + else: + # Process all source files + source_files = attributor.find_source_files() + + if args.dry_run: + print(f"Found {len(source_files)} source files to process") + print("\nDry run - showing what would be done:\n") + + success_count = 0 + for file_path in source_files: + if attributor.process_file(file_path): + success_count += 1 + + if not args.dry_run: + print(f"\nProcessed {success_count}/{len(source_files)} files successfully") + + +if __name__ == '__main__': + main() \ No newline at end of file diff --git a/scripts/config-fw.sh b/scripts/config-fw.sh index f4e964193..c3442d791 100755 --- a/scripts/config-fw.sh +++ b/scripts/config-fw.sh @@ -1,4 +1,8 @@ #!/bin/bash + +# SPDX-FileCopyrightText: © 2025 Phala Network +# SPDX-License-Identifier: Apache-2.0 + set -e # dstack runs Confidential VMs (CVMs) with QEMU user networking. To prevent VMs from accessing 127.0.0.1, diff --git a/sdk/go/dstack/client.go b/sdk/go/dstack/client.go index 81b053665..ce60b45c5 100644 --- a/sdk/go/dstack/client.go +++ b/sdk/go/dstack/client.go @@ -1,6 +1,9 @@ -// Provides a dstack SDK client and related utilities +// SPDX-FileCopyrightText: © 2025 Phala Network +// SPDX-FileCopyrightText: © 2024 Nethermind // -// Author: Franco Barpp Gomes +// SPDX-License-Identifier: Apache-2.0 + +// Provides a dstack SDK client and related utilities package dstack import ( diff --git a/sdk/go/dstack/client_test.go b/sdk/go/dstack/client_test.go index 5d9791048..73c5c360d 100644 --- a/sdk/go/dstack/client_test.go +++ b/sdk/go/dstack/client_test.go @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + package dstack_test import ( diff --git a/sdk/go/go.mod b/sdk/go/go.mod index 43e43fc68..95e643ca0 100644 --- a/sdk/go/go.mod +++ b/sdk/go/go.mod @@ -1,3 +1,8 @@ +// SPDX-FileCopyrightText: © 2024 Nethermind +// SPDX-FileCopyrightText: © 2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + module github.com/Dstack-TEE/dstack/sdk/go go 1.23.0 diff --git a/sdk/go/tappd/client.go b/sdk/go/tappd/client.go index 411d8080b..208168976 100644 --- a/sdk/go/tappd/client.go +++ b/sdk/go/tappd/client.go @@ -1,3 +1,8 @@ +// SPDX-FileCopyrightText: © 2024 Nethermind +// SPDX-FileCopyrightText: © 2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + // Provides a dstack SDK Tappd client and related utilities // // Author: Franco Barpp Gomes diff --git a/sdk/go/tappd/client_test.go b/sdk/go/tappd/client_test.go index 8d43aa2cd..e2407b8cf 100644 --- a/sdk/go/tappd/client_test.go +++ b/sdk/go/tappd/client_test.go @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + package tappd_test import ( diff --git a/sdk/js/src/__tests__/browser-compatibility.test.ts b/sdk/js/src/__tests__/browser-compatibility.test.ts index 50c95b540..8c1f247c2 100644 --- a/sdk/js/src/__tests__/browser-compatibility.test.ts +++ b/sdk/js/src/__tests__/browser-compatibility.test.ts @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + /** * Browser Compatibility Tests * diff --git a/sdk/js/src/__tests__/get-compose-hash.test.ts b/sdk/js/src/__tests__/get-compose-hash.test.ts index 3247c46f8..76673ce4a 100644 --- a/sdk/js/src/__tests__/get-compose-hash.test.ts +++ b/sdk/js/src/__tests__/get-compose-hash.test.ts @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + import { expect, describe, it } from 'vitest' import { getComposeHash, AppCompose } from '../get-compose-hash' diff --git a/sdk/js/src/__tests__/index.test.ts b/sdk/js/src/__tests__/index.test.ts index 66471ec21..2236c1388 100644 --- a/sdk/js/src/__tests__/index.test.ts +++ b/sdk/js/src/__tests__/index.test.ts @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024-2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + import { expect, describe, it, vi } from 'vitest' import { DstackClient, TappdClient } from '../index' diff --git a/sdk/js/src/__tests__/send-rpc-request.test.ts b/sdk/js/src/__tests__/send-rpc-request.test.ts index f65587e7f..f4936ca0b 100644 --- a/sdk/js/src/__tests__/send-rpc-request.test.ts +++ b/sdk/js/src/__tests__/send-rpc-request.test.ts @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + import { expect, describe, it, vi, beforeEach, afterEach } from 'vitest' import { send_rpc_request, __version__ } from '../send-rpc-request' import http from 'http' diff --git a/sdk/js/src/__tests__/solana.test.ts b/sdk/js/src/__tests__/solana.test.ts index 4e6f5a388..dee1a04eb 100644 --- a/sdk/js/src/__tests__/solana.test.ts +++ b/sdk/js/src/__tests__/solana.test.ts @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + import crypto from 'crypto' import { expect, describe, it, vi } from 'vitest' import { Keypair } from '@solana/web3.js' diff --git a/sdk/js/src/__tests__/verify-env-encrypt-public-key.test.ts b/sdk/js/src/__tests__/verify-env-encrypt-public-key.test.ts index f954f2e67..bf7c5d840 100644 --- a/sdk/js/src/__tests__/verify-env-encrypt-public-key.test.ts +++ b/sdk/js/src/__tests__/verify-env-encrypt-public-key.test.ts @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + import { verifyEnvEncryptPublicKey } from '../verify-env-encrypt-public-key' import { describe, it, expect } from 'vitest' diff --git a/sdk/js/src/__tests__/viem.test.ts b/sdk/js/src/__tests__/viem.test.ts index a36e9c934..e46a34df0 100644 --- a/sdk/js/src/__tests__/viem.test.ts +++ b/sdk/js/src/__tests__/viem.test.ts @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024-2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + import crypto from 'crypto' import { expect, describe, it, vi } from 'vitest' import { DstackClient, TappdClient } from '../index' diff --git a/sdk/js/src/encrypt-env-vars.browser.ts b/sdk/js/src/encrypt-env-vars.browser.ts index fcedb0a26..0484b1b6b 100644 --- a/sdk/js/src/encrypt-env-vars.browser.ts +++ b/sdk/js/src/encrypt-env-vars.browser.ts @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + import { x25519 } from "@noble/curves/ed25519" // Convert hex string to Uint8Array diff --git a/sdk/js/src/encrypt-env-vars.ts b/sdk/js/src/encrypt-env-vars.ts index 9166c61e9..6fc453782 100644 --- a/sdk/js/src/encrypt-env-vars.ts +++ b/sdk/js/src/encrypt-env-vars.ts @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + import { x25519 } from "@noble/curves/ed25519" import crypto from 'crypto' diff --git a/sdk/js/src/get-compose-hash.browser.ts b/sdk/js/src/get-compose-hash.browser.ts index dd043d02c..b99bdfff6 100644 --- a/sdk/js/src/get-compose-hash.browser.ts +++ b/sdk/js/src/get-compose-hash.browser.ts @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + import crypto from 'crypto'; type SortableValue = string | number | boolean | null | undefined | SortableObject | SortableArray; diff --git a/sdk/js/src/get-compose-hash.ts b/sdk/js/src/get-compose-hash.ts index f1eecb488..0442b132d 100644 --- a/sdk/js/src/get-compose-hash.ts +++ b/sdk/js/src/get-compose-hash.ts @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + import crypto from "crypto"; type SortableValue = string | number | boolean | null | undefined | SortableObject | SortableArray; diff --git a/sdk/js/src/index.ts b/sdk/js/src/index.ts index 4adc14740..4448c0669 100644 --- a/sdk/js/src/index.ts +++ b/sdk/js/src/index.ts @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024-2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + import fs from 'fs' import crypto from 'crypto' import { send_rpc_request } from './send-rpc-request' diff --git a/sdk/js/src/send-rpc-request.ts b/sdk/js/src/send-rpc-request.ts index 622e1dae9..6c17c3446 100644 --- a/sdk/js/src/send-rpc-request.ts +++ b/sdk/js/src/send-rpc-request.ts @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + import http from 'http' import https from 'https' import net from 'net' diff --git a/sdk/js/src/solana.ts b/sdk/js/src/solana.ts index e075123a0..dffc86b54 100644 --- a/sdk/js/src/solana.ts +++ b/sdk/js/src/solana.ts @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + import crypto from 'crypto' import { type GetKeyResponse, type GetTlsKeyResponse } from './index' import { Keypair } from '@solana/web3.js' diff --git a/sdk/js/src/verify-env-encrypt-public-key.browser.ts b/sdk/js/src/verify-env-encrypt-public-key.browser.ts index 1db00c7b5..bd616aa08 100644 --- a/sdk/js/src/verify-env-encrypt-public-key.browser.ts +++ b/sdk/js/src/verify-env-encrypt-public-key.browser.ts @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + import { keccak_256 } from "@noble/hashes/sha3"; import { secp256k1 } from "@noble/curves/secp256k1"; diff --git a/sdk/js/src/verify-env-encrypt-public-key.ts b/sdk/js/src/verify-env-encrypt-public-key.ts index 88e793af9..821b28453 100644 --- a/sdk/js/src/verify-env-encrypt-public-key.ts +++ b/sdk/js/src/verify-env-encrypt-public-key.ts @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + import { keccak_256 } from "@noble/hashes/sha3"; import { secp256k1 } from "@noble/curves/secp256k1"; diff --git a/sdk/js/src/viem.ts b/sdk/js/src/viem.ts index 982dd2573..b0b4652f5 100644 --- a/sdk/js/src/viem.ts +++ b/sdk/js/src/viem.ts @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024-2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + import crypto from 'crypto' import { type GetKeyResponse, type GetTlsKeyResponse } from './index' import { privateKeyToAccount } from 'viem/accounts' diff --git a/sdk/python/pyproject.toml b/sdk/python/pyproject.toml index 78370e61b..bb8c1e0fd 100644 --- a/sdk/python/pyproject.toml +++ b/sdk/python/pyproject.toml @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: © 2024-2025 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + [project] name = "dstack-sdk" version = "0.2.0" diff --git a/sdk/python/src/dstack_sdk/__init__.py b/sdk/python/src/dstack_sdk/__init__.py index b4399c94b..aeeb0228e 100644 --- a/sdk/python/src/dstack_sdk/__init__.py +++ b/sdk/python/src/dstack_sdk/__init__.py @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: © 2024-2025 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + from .dstack_client import DstackClient, AsyncDstackClient, GetKeyResponse, GetTlsKeyResponse, GetQuoteResponse __all__ = ['DstackClient', 'AsyncDstackClient', 'GetKeyResponse', 'GetTlsKeyResponse', 'GetQuoteResponse'] diff --git a/sdk/python/src/dstack_sdk/dstack_client.py b/sdk/python/src/dstack_sdk/dstack_client.py index 8a8ab0047..2825e6c8c 100644 --- a/sdk/python/src/dstack_sdk/dstack_client.py +++ b/sdk/python/src/dstack_sdk/dstack_client.py @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: © 2025 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + from typing import Literal, Optional, List, Dict, Any import binascii import json diff --git a/sdk/python/src/dstack_sdk/ethereum.py b/sdk/python/src/dstack_sdk/ethereum.py index 9523735d4..c4680aa09 100644 --- a/sdk/python/src/dstack_sdk/ethereum.py +++ b/sdk/python/src/dstack_sdk/ethereum.py @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: © 2025 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + from eth_account import Account from .dstack_client import GetKeyResponse diff --git a/sdk/python/src/dstack_sdk/solana.py b/sdk/python/src/dstack_sdk/solana.py index f3c788336..ee536cd19 100644 --- a/sdk/python/src/dstack_sdk/solana.py +++ b/sdk/python/src/dstack_sdk/solana.py @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: © 2025 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + from solders.keypair import Keypair from .dstack_client import GetKeyResponse diff --git a/sdk/python/tests/test_client.py b/sdk/python/tests/test_client.py index fb0409497..3efd9ba28 100644 --- a/sdk/python/tests/test_client.py +++ b/sdk/python/tests/test_client.py @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: © 2024-2025 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + from dstack_sdk.dstack_client import TcbInfo from dstack_sdk.dstack_client import InfoResponse import hashlib diff --git a/sdk/python/tests/test_ethereum.py b/sdk/python/tests/test_ethereum.py index 7446e330a..14ac1d3a3 100644 --- a/sdk/python/tests/test_ethereum.py +++ b/sdk/python/tests/test_ethereum.py @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: © 2025 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + import pytest from eth_account.signers.local import LocalAccount diff --git a/sdk/python/tests/test_solana.py b/sdk/python/tests/test_solana.py index fd3127b2d..b8a7c3e8e 100644 --- a/sdk/python/tests/test_solana.py +++ b/sdk/python/tests/test_solana.py @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: © 2025 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + import pytest from solders.keypair import Keypair diff --git a/sdk/run-tests.sh b/sdk/run-tests.sh index f921ecaf8..8e1593c76 100755 --- a/sdk/run-tests.sh +++ b/sdk/run-tests.sh @@ -1,5 +1,10 @@ #!/bin/bash +# SPDX-FileCopyrightText: © 2025 Daniel Sharifi +# SPDX-FileCopyrightText: © 2025 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + set -e export DSTACK_SIMULATOR_ENDPOINT=$(realpath simulator/dstack.sock) diff --git a/sdk/rust/Cargo.toml b/sdk/rust/Cargo.toml index bef52e4f7..544784ddf 100644 --- a/sdk/rust/Cargo.toml +++ b/sdk/rust/Cargo.toml @@ -1,3 +1,10 @@ +# SPDX-FileCopyrightText: © 2025 Created-for-a-purpose +# SPDX-FileCopyrightText: © 2025 Daniel Sharifi +# SPDX-FileCopyrightText: © 2025 Phala Network +# SPDX-FileCopyrightText: © 2025 tuddman +# +# SPDX-License-Identifier: Apache-2.0 + [package] name = "dstack-sdk" version = "0.1.0" diff --git a/sdk/rust/examples/dstack_client_usage.rs b/sdk/rust/examples/dstack_client_usage.rs index 60d5e8624..4f82f5895 100644 --- a/sdk/rust/examples/dstack_client_usage.rs +++ b/sdk/rust/examples/dstack_client_usage.rs @@ -1,3 +1,8 @@ +// SPDX-FileCopyrightText: © 2025 Daniel Sharifi +// SPDX-FileCopyrightText: © 2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use dstack_sdk::dstack_client::DstackClient; use dstack_sdk_types::dstack::TlsKeyConfig; diff --git a/sdk/rust/examples/tappd_client_usage.rs b/sdk/rust/examples/tappd_client_usage.rs index 7a603c40a..e9a426035 100644 --- a/sdk/rust/examples/tappd_client_usage.rs +++ b/sdk/rust/examples/tappd_client_usage.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use dstack_sdk::tappd_client::TappdClient; #[tokio::main] diff --git a/sdk/rust/src/dstack_client.rs b/sdk/rust/src/dstack_client.rs index cc2dd0b4c..3e694bf47 100644 --- a/sdk/rust/src/dstack_client.rs +++ b/sdk/rust/src/dstack_client.rs @@ -1,3 +1,9 @@ +// SPDX-FileCopyrightText: © 2025 Created-for-a-purpose +// SPDX-FileCopyrightText: © 2025 Daniel Sharifi +// SPDX-FileCopyrightText: © 2025 tuddman +// +// SPDX-License-Identifier: Apache-2.0 + use anyhow::Result; use hex::encode as hex_encode; use http_client_unix_domain_socket::{ClientUnix, Method}; diff --git a/sdk/rust/src/ethereum.rs b/sdk/rust/src/ethereum.rs index a6d965666..4fc5b05b0 100644 --- a/sdk/rust/src/ethereum.rs +++ b/sdk/rust/src/ethereum.rs @@ -1,3 +1,8 @@ +// SPDX-FileCopyrightText: © 2025 Created-for-a-purpose +// SPDX-FileCopyrightText: © 2025 Daniel Sharifi +// +// SPDX-License-Identifier: Apache-2.0 + use alloy::signers::local::PrivateKeySigner; use dstack_sdk_types::dstack::GetKeyResponse; diff --git a/sdk/rust/src/lib.rs b/sdk/rust/src/lib.rs index ee0b59013..0c09e5bae 100644 --- a/sdk/rust/src/lib.rs +++ b/sdk/rust/src/lib.rs @@ -1,3 +1,8 @@ +// SPDX-FileCopyrightText: © 2025 Created-for-a-purpose +// SPDX-FileCopyrightText: © 2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + pub mod dstack_client; pub mod ethereum; pub mod tappd_client; diff --git a/sdk/rust/src/tappd_client.rs b/sdk/rust/src/tappd_client.rs index 0ac8398c8..9478d3298 100644 --- a/sdk/rust/src/tappd_client.rs +++ b/sdk/rust/src/tappd_client.rs @@ -1,3 +1,8 @@ +// SPDX-FileCopyrightText: © 2025 Daniel Sharifi +// SPDX-FileCopyrightText: © 2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use crate::dstack_client::BaseClient; use anyhow::{bail, Result}; use hex::encode as hex_encode; diff --git a/sdk/rust/tests/test_client.rs b/sdk/rust/tests/test_client.rs index dc670252c..92f7f4138 100644 --- a/sdk/rust/tests/test_client.rs +++ b/sdk/rust/tests/test_client.rs @@ -1,3 +1,10 @@ +// SPDX-FileCopyrightText: © 2025 Created-for-a-purpose +// SPDX-FileCopyrightText: © 2025 Daniel Sharifi +// SPDX-FileCopyrightText: © 2025 Phala Network +// SPDX-FileCopyrightText: © 2025 tuddman +// +// SPDX-License-Identifier: Apache-2.0 + use dcap_qvl::quote::Quote; use dstack_sdk::dstack_client::DstackClient as AsyncDstackClient; diff --git a/sdk/rust/tests/test_eth.rs b/sdk/rust/tests/test_eth.rs index 455c6a22d..234f1e822 100644 --- a/sdk/rust/tests/test_eth.rs +++ b/sdk/rust/tests/test_eth.rs @@ -1,3 +1,9 @@ +// SPDX-FileCopyrightText: © 2025 Created-for-a-purpose +// SPDX-FileCopyrightText: © 2025 Daniel Sharifi +// SPDX-FileCopyrightText: © 2025 tuddman +// +// SPDX-License-Identifier: Apache-2.0 + use dstack_sdk::dstack_client::DstackClient; use dstack_sdk::ethereum::to_account; use dstack_sdk_types::dstack::GetKeyResponse; diff --git a/sdk/rust/tests/test_tappd_client.rs b/sdk/rust/tests/test_tappd_client.rs index 3920e7ebe..cb1c66d12 100644 --- a/sdk/rust/tests/test_tappd_client.rs +++ b/sdk/rust/tests/test_tappd_client.rs @@ -1,3 +1,8 @@ +// SPDX-FileCopyrightText: © 2025 Daniel Sharifi +// SPDX-FileCopyrightText: © 2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use dstack_sdk::tappd_client::TappdClient; use dstack_sdk_types::tappd::DeriveKeyResponse; use std::env; diff --git a/sdk/rust/types/Cargo.toml b/sdk/rust/types/Cargo.toml index 8fbaf2b48..6293dca9f 100644 --- a/sdk/rust/types/Cargo.toml +++ b/sdk/rust/types/Cargo.toml @@ -1,3 +1,8 @@ +# SPDX-FileCopyrightText: © 2025 Daniel Sharifi +# SPDX-FileCopyrightText: © 2025 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + [package] name = "dstack-sdk-types" version = "0.1.0" diff --git a/sdk/rust/types/src/dstack.rs b/sdk/rust/types/src/dstack.rs index 78594f75e..c12494e81 100644 --- a/sdk/rust/types/src/dstack.rs +++ b/sdk/rust/types/src/dstack.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2025 Daniel Sharifi +// +// SPDX-License-Identifier: Apache-2.0 + use alloc::{ collections::BTreeMap, string::{String, ToString}, diff --git a/sdk/rust/types/src/lib.rs b/sdk/rust/types/src/lib.rs index a28b0ac73..bced888dc 100644 --- a/sdk/rust/types/src/lib.rs +++ b/sdk/rust/types/src/lib.rs @@ -1,5 +1,9 @@ #![no_std] +// SPDX-FileCopyrightText: © 2025 Daniel Sharifi +// +// SPDX-License-Identifier: Apache-2.0 + extern crate alloc; pub mod dstack; diff --git a/sdk/rust/types/src/tappd.rs b/sdk/rust/types/src/tappd.rs index 7b2227e52..fba0a51f9 100644 --- a/sdk/rust/types/src/tappd.rs +++ b/sdk/rust/types/src/tappd.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2025 Daniel Sharifi +// +// SPDX-License-Identifier: Apache-2.0 + use alloc::{ collections::BTreeMap, string::{String, ToString}, diff --git a/sdk/rust/types/tests/no_std_test.rs b/sdk/rust/types/tests/no_std_test.rs index 7bdcc54fd..d492fdf02 100644 --- a/sdk/rust/types/tests/no_std_test.rs +++ b/sdk/rust/types/tests/no_std_test.rs @@ -1,5 +1,9 @@ #![no_std] +// SPDX-FileCopyrightText: © 2025 Daniel Sharifi +// +// SPDX-License-Identifier: Apache-2.0 + extern crate alloc; use alloc::string::String; diff --git a/sdk/simulator/build.sh b/sdk/simulator/build.sh index a8b0c4e53..2567eeac1 100755 --- a/sdk/simulator/build.sh +++ b/sdk/simulator/build.sh @@ -1,4 +1,9 @@ #!/bin/bash + +# SPDX-FileCopyrightText: © 2025 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + cd $(dirname $0) cargo build --release -p dstack-guest-agent cp ../../target/release/dstack-guest-agent . diff --git a/sdk/simulator/dstack.toml b/sdk/simulator/dstack.toml index 4e4566d19..ab5bcebdb 100644 --- a/sdk/simulator/dstack.toml +++ b/sdk/simulator/dstack.toml @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: © 2025 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + [default] workers = 8 max_blocking = 64 diff --git a/serde-duration/Cargo.toml b/serde-duration/Cargo.toml index dfc6cddac..b92ebf43f 100644 --- a/serde-duration/Cargo.toml +++ b/serde-duration/Cargo.toml @@ -1,3 +1,8 @@ +# SPDX-FileCopyrightText: © 2025 Daniel Sharifi +# SPDX-FileCopyrightText: © 2025 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + [package] name = "serde-duration" version.workspace = true diff --git a/serde-duration/src/lib.rs b/serde-duration/src/lib.rs index fd2777820..41a223b3d 100644 --- a/serde-duration/src/lib.rs +++ b/serde-duration/src/lib.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use serde::{Deserialize, Deserializer, Serializer}; use std::time::Duration; diff --git a/sodiumbox/Cargo.toml b/sodiumbox/Cargo.toml index 983a783e8..ffd559623 100644 --- a/sodiumbox/Cargo.toml +++ b/sodiumbox/Cargo.toml @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: © 2025 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + [package] name = "sodiumbox" version = "0.1.0" diff --git a/sodiumbox/src/lib.rs b/sodiumbox/src/lib.rs index 1e8b27e88..f78ab3469 100644 --- a/sodiumbox/src/lib.rs +++ b/sodiumbox/src/lib.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + //! Pure Rust implementation of libsodium's sealed box encryption/decryption. //! //! This crate provides a standalone implementation of the sealed box functionality diff --git a/supervisor/Cargo.toml b/supervisor/Cargo.toml index cba407a49..ae62a9700 100644 --- a/supervisor/Cargo.toml +++ b/supervisor/Cargo.toml @@ -1,3 +1,8 @@ +# SPDX-FileCopyrightText: © 2024 Phala Network +# SPDX-FileCopyrightText: © 2025 Daniel Sharifi +# +# SPDX-License-Identifier: Apache-2.0 + [package] name = "supervisor" version.workspace = true diff --git a/supervisor/client/Cargo.toml b/supervisor/client/Cargo.toml index 0a9003e5c..99db01f7e 100644 --- a/supervisor/client/Cargo.toml +++ b/supervisor/client/Cargo.toml @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: © 2024 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + [package] name = "supervisor-client" version.workspace = true diff --git a/supervisor/client/src/lib.rs b/supervisor/client/src/lib.rs index 17887f0e2..53257e5c9 100644 --- a/supervisor/client/src/lib.rs +++ b/supervisor/client/src/lib.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024-2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use std::{path::Path, sync::Arc, time::Duration}; use anyhow::{Context, Result}; diff --git a/supervisor/client/src/main.rs b/supervisor/client/src/main.rs index f07843a35..b993984c7 100644 --- a/supervisor/client/src/main.rs +++ b/supervisor/client/src/main.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use anyhow::Result; use clap::{Parser, Subcommand}; use supervisor::ProcessConfig; diff --git a/supervisor/src/lib.rs b/supervisor/src/lib.rs index 9f5296e13..131070819 100644 --- a/supervisor/src/lib.rs +++ b/supervisor/src/lib.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + mod process; mod supervisor; pub mod web_api; diff --git a/supervisor/src/main.rs b/supervisor/src/main.rs index edc94b35b..752b511ca 100644 --- a/supervisor/src/main.rs +++ b/supervisor/src/main.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024-2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use std::path::Path; use anyhow::{anyhow, bail, Context, Result}; diff --git a/supervisor/src/process.rs b/supervisor/src/process.rs index e11df0647..769d586ea 100644 --- a/supervisor/src/process.rs +++ b/supervisor/src/process.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024-2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use anyhow::{bail, Result}; use bon::Builder; use fs_err as fs; diff --git a/supervisor/src/supervisor.rs b/supervisor/src/supervisor.rs index f4ac6387d..378013c05 100644 --- a/supervisor/src/supervisor.rs +++ b/supervisor/src/supervisor.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024-2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use crate::process::{Process, ProcessConfig, ProcessInfo}; use anyhow::{bail, Context, Result}; use dashmap::DashMap; diff --git a/supervisor/src/web_api.rs b/supervisor/src/web_api.rs index 97be4fe31..f52ebe0b9 100644 --- a/supervisor/src/web_api.rs +++ b/supervisor/src/web_api.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use anyhow::{anyhow, Result}; use rocket::figment::Figment; use rocket::serde::json::Json; diff --git a/supervisor/supervisor.toml b/supervisor/supervisor.toml index cbc455707..b66db0ac6 100644 --- a/supervisor/supervisor.toml +++ b/supervisor/supervisor.toml @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: © 2024 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + [default] workers = 8 max_blocking = 64 diff --git a/supervisor/tests/test-cli.sh b/supervisor/tests/test-cli.sh index 0f4ea6e5b..2985396aa 100755 --- a/supervisor/tests/test-cli.sh +++ b/supervisor/tests/test-cli.sh @@ -1,5 +1,9 @@ #!/bin/bash +# SPDX-FileCopyrightText: © 2024 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + # Colors for output GREEN='\033[0;32m' NC='\033[0m' # No Color diff --git a/supervisor/tests/test.sh b/supervisor/tests/test.sh index 34f808f7a..b1ec27e47 100755 --- a/supervisor/tests/test.sh +++ b/supervisor/tests/test.sh @@ -1,5 +1,9 @@ #!/bin/bash +# SPDX-FileCopyrightText: © 2024 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + # Base URL BASE_URL="http://localhost" UDS="./test.sock" diff --git a/tdx-attest-sys/Cargo.toml b/tdx-attest-sys/Cargo.toml index 233005105..01cdd7a42 100644 --- a/tdx-attest-sys/Cargo.toml +++ b/tdx-attest-sys/Cargo.toml @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: © 2024 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + [package] name = "tdx-attest-sys" version.workspace = true diff --git a/tdx-attest-sys/bindings.h b/tdx-attest-sys/bindings.h index 0c889a454..afd97d06d 100644 --- a/tdx-attest-sys/bindings.h +++ b/tdx-attest-sys/bindings.h @@ -1 +1,7 @@ +/* + * SPDX-FileCopyrightText: © 2024 Phala Network + * + * SPDX-License-Identifier: Apache-2.0 + */ + #include "csrc/tdx_attest.h" diff --git a/tdx-attest-sys/build.rs b/tdx-attest-sys/build.rs index 59ce17f5e..b943878e2 100644 --- a/tdx-attest-sys/build.rs +++ b/tdx-attest-sys/build.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use std::env; use std::path::PathBuf; diff --git a/tdx-attest-sys/src/lib.rs b/tdx-attest-sys/src/lib.rs index 7ff7d0129..abe54931c 100644 --- a/tdx-attest-sys/src/lib.rs +++ b/tdx-attest-sys/src/lib.rs @@ -3,4 +3,8 @@ #![allow(non_upper_case_globals)] #![allow(clippy::missing_safety_doc)] +// SPDX-FileCopyrightText: © 2024 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + include!(concat!(env!("OUT_DIR"), "/bindings.rs")); diff --git a/tdx-attest/Cargo.toml b/tdx-attest/Cargo.toml index a04f7e205..8953f133b 100644 --- a/tdx-attest/Cargo.toml +++ b/tdx-attest/Cargo.toml @@ -1,3 +1,8 @@ +# SPDX-FileCopyrightText: © 2024-2025 Phala Network +# SPDX-FileCopyrightText: © 2025 Daniel Sharifi +# +# SPDX-License-Identifier: Apache-2.0 + [package] name = "tdx-attest" version.workspace = true diff --git a/tdx-attest/src/dummy.rs b/tdx-attest/src/dummy.rs index c81c9a5ac..12ee199b7 100644 --- a/tdx-attest/src/dummy.rs +++ b/tdx-attest/src/dummy.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use cc_eventlog::TdxEventLog; use num_enum::FromPrimitive; use thiserror::Error; diff --git a/tdx-attest/src/lib.rs b/tdx-attest/src/lib.rs index 4b465c63d..3cfa4fdc8 100644 --- a/tdx-attest/src/lib.rs +++ b/tdx-attest/src/lib.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024-2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + #[cfg(all(target_os = "linux", target_arch = "x86_64", target_env = "gnu"))] pub use linux::*; #[cfg(all(target_os = "linux", target_arch = "x86_64", target_env = "gnu"))] diff --git a/tdx-attest/src/linux.rs b/tdx-attest/src/linux.rs index aba78a452..4331e7729 100644 --- a/tdx-attest/src/linux.rs +++ b/tdx-attest/src/linux.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use anyhow::Context; use cc_eventlog::TdxEventLog; diff --git a/test-scripts/get-app-key.sh b/test-scripts/get-app-key.sh index 2e1ae9473..7285a4fbe 100755 --- a/test-scripts/get-app-key.sh +++ b/test-scripts/get-app-key.sh @@ -1,4 +1,8 @@ #!/bin/bash + +# SPDX-FileCopyrightText: © 2025 Phala Network +# SPDX-License-Identifier: Apache-2.0 + CERT_FILE=${1} KEY_FILE=${CERT_FILE%.*}.key CERT_DIR=../certs diff --git a/test-scripts/inspect-cert.sh b/test-scripts/inspect-cert.sh index 68c3945f2..141ef4e8d 100755 --- a/test-scripts/inspect-cert.sh +++ b/test-scripts/inspect-cert.sh @@ -1,2 +1,6 @@ #!/bin/sh + +# SPDX-FileCopyrightText: © 2025 Phala Network +# SPDX-License-Identifier: Apache-2.0 + openssl x509 -text -noout -in $1 \ No newline at end of file diff --git a/vmm/Cargo.toml b/vmm/Cargo.toml index 6283f494c..ccdeff850 100644 --- a/vmm/Cargo.toml +++ b/vmm/Cargo.toml @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: © 2024-2025 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + [package] name = "dstack-vmm" version.workspace = true diff --git a/vmm/rpc/Cargo.toml b/vmm/rpc/Cargo.toml index 9c514c5bd..75f067353 100644 --- a/vmm/rpc/Cargo.toml +++ b/vmm/rpc/Cargo.toml @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: © 2024-2025 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + [package] name = "dstack-vmm-rpc" version.workspace = true diff --git a/vmm/rpc/build.rs b/vmm/rpc/build.rs index 3d7ff6d09..5754dff41 100644 --- a/vmm/rpc/build.rs +++ b/vmm/rpc/build.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024-2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + fn main() { prpc_build::configure() .out_dir("./src/generated") diff --git a/vmm/rpc/proto/vmm_rpc.proto b/vmm/rpc/proto/vmm_rpc.proto index 9985c6440..64de42e8c 100644 --- a/vmm/rpc/proto/vmm_rpc.proto +++ b/vmm/rpc/proto/vmm_rpc.proto @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024-2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + syntax = "proto3"; import "google/protobuf/empty.proto"; diff --git a/vmm/rpc/src/lib.rs b/vmm/rpc/src/lib.rs index 29aad437c..089da7c60 100644 --- a/vmm/rpc/src/lib.rs +++ b/vmm/rpc/src/lib.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + extern crate alloc; pub use generated::*; diff --git a/vmm/src/app.rs b/vmm/src/app.rs index f8be6598e..133f823a1 100644 --- a/vmm/src/app.rs +++ b/vmm/src/app.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024-2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use crate::config::{Config, ProcessAnnotation, Protocol}; use anyhow::{bail, Context, Result}; diff --git a/vmm/src/app/id_pool.rs b/vmm/src/app/id_pool.rs index 2451e5325..a111a16f4 100644 --- a/vmm/src/app/id_pool.rs +++ b/vmm/src/app/id_pool.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use std::collections::BTreeSet; use anyhow::bail; diff --git a/vmm/src/app/image.rs b/vmm/src/app/image.rs index d8907c98f..ae5868e5e 100644 --- a/vmm/src/app/image.rs +++ b/vmm/src/app/image.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024-2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use fs_err as fs; use path_absolutize::Absolutize; use std::path::{Path, PathBuf}; diff --git a/vmm/src/app/qemu.rs b/vmm/src/app/qemu.rs index 251adc44a..b67bd8d07 100644 --- a/vmm/src/app/qemu.rs +++ b/vmm/src/app/qemu.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024-2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + //! QEMU related code use crate::{ app::Manifest, diff --git a/vmm/src/config.rs b/vmm/src/config.rs index 64094d404..40b06d81f 100644 --- a/vmm/src/config.rs +++ b/vmm/src/config.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024-2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use std::{net::IpAddr, path::PathBuf, str::FromStr}; use anyhow::{bail, Context, Result}; diff --git a/vmm/src/console.html b/vmm/src/console.html index 490942a1b..2c4599ac2 100644 --- a/vmm/src/console.html +++ b/vmm/src/console.html @@ -1,3 +1,9 @@ + + diff --git a/vmm/src/guest_api_service.rs b/vmm/src/guest_api_service.rs index 792a937d4..1fc089f8f 100644 --- a/vmm/src/guest_api_service.rs +++ b/vmm/src/guest_api_service.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024-2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use crate::App as AppState; use anyhow::Result; use guest_api::{ diff --git a/vmm/src/host_api_service.rs b/vmm/src/host_api_service.rs index 1e71a99c1..fc4dcc704 100644 --- a/vmm/src/host_api_service.rs +++ b/vmm/src/host_api_service.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024-2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use anyhow::{bail, Context, Result}; use host_api::{ host_api_server::{HostApiRpc, HostApiServer}, diff --git a/vmm/src/main.rs b/vmm/src/main.rs index 852968ffc..a92dd695a 100644 --- a/vmm/src/main.rs +++ b/vmm/src/main.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024-2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use std::{path::Path, time::Duration}; use anyhow::{anyhow, Context, Result}; diff --git a/vmm/src/main_routes.rs b/vmm/src/main_routes.rs index 40ed84fe2..2e246fa0a 100644 --- a/vmm/src/main_routes.rs +++ b/vmm/src/main_routes.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024-2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use crate::app::App; use anyhow::Result; use fs_err as fs; diff --git a/vmm/src/main_service.rs b/vmm/src/main_service.rs index 437c1f5d8..c89f74905 100644 --- a/vmm/src/main_service.rs +++ b/vmm/src/main_service.rs @@ -1,3 +1,7 @@ +// SPDX-FileCopyrightText: © 2024-2025 Phala Network +// +// SPDX-License-Identifier: Apache-2.0 + use std::ops::Deref; use std::time::{SystemTime, UNIX_EPOCH}; diff --git a/vmm/src/setup-user.sh b/vmm/src/setup-user.sh index 24f8dbc49..f8e33bbbf 100755 --- a/vmm/src/setup-user.sh +++ b/vmm/src/setup-user.sh @@ -1,5 +1,9 @@ #!/bin/bash +# SPDX-FileCopyrightText: © 2025 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + # dstack currently runs the CVMs with qemu user networking. To prevent the VM to access 127.0.0.1, we need to # run the VM as a different user and setup the iptables rules to DROP the traffic to 127.0.0.1. diff --git a/vmm/src/tests/test-compose.sh b/vmm/src/tests/test-compose.sh index 09cd11c0e..a68a8fbcd 100755 --- a/vmm/src/tests/test-compose.sh +++ b/vmm/src/tests/test-compose.sh @@ -1,5 +1,9 @@ #!/bin/bash +# SPDX-FileCopyrightText: © 2025 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + # Test script for vmm-cli.py compose subcommand # Tests the refactored create_app_compose method that accepts args directly diff --git a/vmm/src/tests/test-deployment.sh b/vmm/src/tests/test-deployment.sh index 092cfd10c..b7156d1f7 100755 --- a/vmm/src/tests/test-deployment.sh +++ b/vmm/src/tests/test-deployment.sh @@ -1,5 +1,9 @@ #!/bin/bash +# SPDX-FileCopyrightText: © 2025 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + # Test script for vmm-cli.py deployment functionality # Tests the complete compose + deploy workflow with local VMM instance diff --git a/vmm/src/vmm-cli.py b/vmm/src/vmm-cli.py index 0a04fae5b..e3cf66e77 100755 --- a/vmm/src/vmm-cli.py +++ b/vmm/src/vmm-cli.py @@ -1,5 +1,9 @@ #!/usr/bin/env python3 +# SPDX-FileCopyrightText: © 2025 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + import os import sys import json diff --git a/vmm/src/x25519.js b/vmm/src/x25519.js index 3346083b6..05e0a7eb4 100644 --- a/vmm/src/x25519.js +++ b/vmm/src/x25519.js @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: © 2016 Dmitry Chestnykh, © 2019 Harvey Connor +// SPDX-License-Identifier: MIT + (() => { let _0 = new Uint8Array(16); let _9 = new Uint8Array(32); diff --git a/vmm/venv.sh b/vmm/venv.sh index 76685094f..6a520f3bb 100644 --- a/vmm/venv.sh +++ b/vmm/venv.sh @@ -1,5 +1,9 @@ #!/bin/bash +# SPDX-FileCopyrightText: © 2025 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + if [ -f ".venv/bin/activate" ]; then source .venv/bin/activate else diff --git a/vmm/vmm.toml b/vmm/vmm.toml index c8e2fccac..4058ed74f 100644 --- a/vmm/vmm.toml +++ b/vmm/vmm.toml @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: © 2024-2025 Phala Network +# +# SPDX-License-Identifier: Apache-2.0 + workers = 8 max_blocking = 64 ident = "dstack VMM"