From 05ac6b3e8c182c1cac0739578e1e923dc8689283 Mon Sep 17 00:00:00 2001 From: Josh Knapp Date: Tue, 17 Nov 2026 06:43:41 -0800 Subject: [PATCH 01/12] build: fetch a pinned, verified AWS session-manager-plugin scripts/fetch-ssm-plugin.sh (Linux/macOS, incl. universal via lipo) and scripts/fetch-ssm-plugin.ps1 (Windows) download plugin 1.2.896.0 from AWS's S3 path into app/src-tauri/binaries/session-manager-plugin-[.exe], checking a pinned SHA-256 of each artifact before extraction, AWS's GPG signature on the Linux .deb (key committed, fingerprint pinned) or AWS's Authenticode signature on Windows, and a pinned SHA-256 of the binary. THIRD_PARTY_NOTICES reproduces the plugin's LICENSE (Apache-2.0), NOTICE and AWS's THIRD-PARTY statement. The binaries directory is never committed. Co-Authored-By: Claude Opus 5.5 --- .gitignore | 4 + app/src-tauri/THIRD_PARTY_NOTICES | 343 ++++++++++++++++++++++++++++++ scripts/aws-ssm-plugin-signer.asc | 14 ++ scripts/fetch-ssm-plugin.ps1 | 103 +++++++++ scripts/fetch-ssm-plugin.sh | 189 ++++++++++++++++ 5 files changed, 653 insertions(+) create mode 100644 app/src-tauri/THIRD_PARTY_NOTICES create mode 100644 scripts/aws-ssm-plugin-signer.asc create mode 100644 scripts/fetch-ssm-plugin.ps1 create mode 100755 scripts/fetch-ssm-plugin.sh diff --git a/.gitignore b/.gitignore index 7a0af42..84caf6c 100644 --- a/.gitignore +++ b/.gitignore @@ -27,3 +27,7 @@ screenshot_for_fix/ *.tfstate *.tfstate.* .terraform.tfstate.lock.info + +# The bundled AWS session-manager-plugin sidecar (scripts/fetch-ssm-plugin.*) and the +# debug-build placeholder build.rs writes there. Never committed. +app/src-tauri/binaries/ diff --git a/app/src-tauri/THIRD_PARTY_NOTICES b/app/src-tauri/THIRD_PARTY_NOTICES new file mode 100644 index 0000000..98463f9 --- /dev/null +++ b/app/src-tauri/THIRD_PARTY_NOTICES @@ -0,0 +1,343 @@ +Triple-C third-party notices +============================ + +Triple-C itself is licensed under the terms in LICENSE at the root of its +source repository. The desktop app bundles the following third-party +software, which is distributed under its own terms, reproduced below. + +------------------------------------------------------------------------ +AWS Session Manager plugin (session-manager-plugin) +------------------------------------------------------------------------ + +Version: 1.2.896.0 +Source: https://github.com/aws/session-manager-plugin +Binaries: https://s3.amazonaws.com/session-manager-downloads/plugin/1.2.896.0/ + (unmodified; fetched and SHA-256 checked by scripts/fetch-ssm-plugin.*) + +Bundled beside the Triple-C executable as `session-manager-plugin` +(`session-manager-plugin.exe` on Windows). Triple-C runs it as a child +process to connect to workspaces hosted on AWS. + +---- NOTICE ---- + +Session Manager Plugin +Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + +---- THIRD-PARTY (as shipped by AWS with the plugin) ---- + +The Amazon Session Manager Plugin constitutes AWS Content as defined in the AWS Customer Agreement +or your relevant customer agreement with AWS, and is licensed to you under that agreement. + +The Amazon Session Manager Plugin includes the following third-party software/licensing: + +** cihub/seelog - https://github.com/cihub/seelog +Copyright (c) 2012, Cloud Instruments Co., Ltd. . All rights reserved. +** gorilla/websocket - https://github.com/gorilla/websocket +Copyright (c) 2013 The Gorilla WebSocket Authors. All rights reserved. +** fsnotigy/fsnotify - https://github.com/fsnotify/fsnotify +Copyright (c) 2012 The Go Authors. All rights reserved. +Copyright (c) 2012 fsnotify Authors. All rights reserved. +** pmezard/go-difflib - https://github.com/pmezard/go-difflib +Copyright (c) 2013, Patrick Mezard + +BSD License + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of the Cloud Instruments Co., Ltd. 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 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. + +---------------- + +** twinj/uuid - https://github.com/twinj/uuid +Copyright (C) 2011 by Krzysztof Kowalik +Copyright (C) 2016 by Daniel Kemp Derivative work +** stretchr/testify - https://github.com/stretchr/testify +Copyright (c) 2012 - 2013 Mat Ryer and Tyler Bunnell +** stretchr/objx - https://github.com/stretchr/objx +Copyright (c) 2014 Stretchr, Inc. +Copyright (c) 2017-2018 objx contributors +** eiannone/keyboard - https://github.com/eiannone/keyboard +Copyright (C) 2012 termbox-go authors +Copyright (c) 2015 Emanuele Iannone +** xtaci/smux - https://github.com/xtaci/smux +Copyright (c) 2016-2017 Daniel Fu + +MIT License + +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. + +---------------- + +** davecgh/go-spew - https://github.com/davecgh/go-spew +Copyright (c) 2012-2016 Dave Collins + +ISC License + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +---------------- + +** jmespath/go-jmespath - https://github.com/jmespath/go-jmespath +Copyright 2015 James Saryerwinnie +** go-yaml/yaml - https://github.com/go-yaml/yaml +Copyright (c) 2011-2019 Canonical Ltd + +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. + +---- LICENSE ---- + + 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. \ No newline at end of file diff --git a/scripts/aws-ssm-plugin-signer.asc b/scripts/aws-ssm-plugin-signer.asc new file mode 100644 index 0000000..8b4388e --- /dev/null +++ b/scripts/aws-ssm-plugin-signer.asc @@ -0,0 +1,14 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- + +mFIEZ5ERQxMIKoZIzj0DAQcCAwQjuZy+IjFoYg57sLTGhF3aZLBaGpzB+gY6j7Ix +P7NqbpXyjVj8a+dy79gSd64OEaMxUb7vw/jug+CfRXwVGRMNtIBBV1MgU1NNIFNl +c3Npb24gTWFuYWdlciA8c2Vzc2lvbi1tYW5hZ2VyLXBsdWdpbi1zaWduZXJAYW1h +em9uLmNvbT4gKEFXUyBTeXN0ZW1zIE1hbmFnZXIgU2Vzc2lvbiBNYW5hZ2VyIFBs +dWdpbiBMaW51eCBTaWduZXIgS2V5KYkBAAQQEwgAqAUCZ5ERQ4EcQVdTIFNTTSBT +ZXNzaW9uIE1hbmFnZXIgPHNlc3Npb24tbWFuYWdlci1wbHVnaW4tc2lnbmVyQGFt +YXpvbi5jb20+IChBV1MgU3lzdGVtcyBNYW5hZ2VyIFNlc3Npb24gTWFuYWdlciBQ +bHVnaW4gTGludXggU2lnbmVyIEtleSkWIQR5WWNxJM4JOtUB1HosTUr/b2dX7gIe +AwIbAwIVCAAKCRAsTUr/b2dX7rO1AQCa1kig3lQ78W/QHGU76uHx3XAyv0tfpE9U +oQBCIwFLSgEA3PDHt3lZ+s6m9JLGJsy+Cp5ZFzpiF6RgluR/2gA861M= +=2DQm +-----END PGP PUBLIC KEY BLOCK----- diff --git a/scripts/fetch-ssm-plugin.ps1 b/scripts/fetch-ssm-plugin.ps1 new file mode 100644 index 0000000..3473837 --- /dev/null +++ b/scripts/fetch-ssm-plugin.ps1 @@ -0,0 +1,103 @@ +# fetch-ssm-plugin.ps1 - put AWS's session-manager-plugin where Tauri's +# bundle.externalBin expects it on Windows: +# +# app\src-tauri\binaries\session-manager-plugin-x86_64-pc-windows-msvc.exe +# +# The Windows half of scripts/fetch-ssm-plugin.sh (read its header for the +# why). Same trust chain, and the build fails on any miss: +# 1. A PINNED version, downloaded only from AWS's own S3 path +# (windows/SessionManagerPlugin.zip - the portable package AWS's own +# install.bat unpacks; the .exe installer next to it is a bootstrapper). +# 2. A PINNED SHA-256 of that zip, checked BEFORE anything is extracted, then +# of the package.zip inside it, then of the binary itself. +# 3. AWS's Authenticode signature on the binary: valid, chained to a trusted +# root, timestamped, and issued to Amazon Web Services, Inc. AWS publishes +# no GPG .sig for the Windows zip (403). +# +# We deliberately do NOT re-sign the plugin with our certificate. It already +# carries AWS's timestamped signature, which is what Windows checks, and +# Tauri itself skips a sidecar that `signtool verify /pa` accepts - so our sign +# command never sees it (windows-sign.ps1 refuses it if it ever does, rather +# than ship it unsigned or under our name). windows-verify-signatures.ps1 +# checks the copy inside the MSI is still AWS-signed. +# +# Idempotent: a destination that already holds the pinned binary is left alone. + +$ErrorActionPreference = 'Stop' +[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 +Add-Type -AssemblyName System.IO.Compression.FileSystem + +$Version = '1.2.896.0' +$BaseUrl = "https://s3.amazonaws.com/session-manager-downloads/plugin/$Version" +$Artifact = 'windows/SessionManagerPlugin.zip' +$ArtifactSha = 'B09ADC18721B6E7A9888C98CB1A3AA55B681B8F12391FC1A983410CB1163F670' +$PackageSha = '54577F90838E297801F79A769B4DCB47708FF0595CEBA5BF853276BC3EA83923' +$BinarySha = '03E9F869CDCB41C02060A4E8F8A07FAABAAE05F9940EC221D4A010B481A9AE30' +# .NET quotes a DN value holding a comma (O="Amazon Web Services, Inc."), so +# accept it with or without the quotes. +$SignerOrg = '(^|,\s*)O="?Amazon Web Services, Inc\."?(,|$)' +$Triple = 'x86_64-pc-windows-msvc' + +$repoRoot = Split-Path -Parent $PSScriptRoot +$destDir = Join-Path $repoRoot 'app\src-tauri\binaries' +$dest = Join-Path $destDir "session-manager-plugin-$Triple.exe" +$notices = Join-Path $repoRoot 'app\src-tauri\THIRD_PARTY_NOTICES' + +function Get-Sha256([string]$Path) { (Get-FileHash -LiteralPath $Path -Algorithm SHA256).Hash.ToUpperInvariant() } + +function Assert-AwsSigned([string]$Path) { + $sig = Get-AuthenticodeSignature -LiteralPath $Path + if ($sig.Status -ne 'Valid') { throw "session-manager-plugin.exe: Authenticode status $($sig.Status), expected Valid" } + if (-not $sig.TimeStamperCertificate) { throw 'session-manager-plugin.exe: AWS signature carries no timestamp' } + $subject = $sig.SignerCertificate.Subject + if ($subject -notmatch $SignerOrg) { throw "session-manager-plugin.exe: signed by '$subject', not Amazon Web Services, Inc." } + Write-Host "Signed by $subject (timestamped)" +} + +if (-not (Select-String -LiteralPath $notices -SimpleMatch "Version: $Version" -Quiet)) { + throw "$notices does not name plugin $Version - update it with the version bump" +} + +if ((Test-Path -LiteralPath $dest) -and ((Get-Sha256 $dest) -eq $BinarySha)) { + Assert-AwsSigned $dest + Write-Host "session-manager-plugin-$Triple.exe: already the pinned $Version binary" + exit 0 +} + +$work = Join-Path ([IO.Path]::GetTempPath()) ('ssm-plugin-' + [guid]::NewGuid().ToString('N')) +New-Item -ItemType Directory -Path $work | Out-Null +try { + $zip = Join-Path $work 'SessionManagerPlugin.zip' + Write-Host "Downloading $BaseUrl/$Artifact" + $ProgressPreference = 'SilentlyContinue' + Invoke-WebRequest -Uri "$BaseUrl/$Artifact" -OutFile $zip -UseBasicParsing + $actual = Get-Sha256 $zip + if ($actual -ne $ArtifactSha) { throw "SHA-256 mismatch for ${Artifact}: got $actual, pinned $ArtifactSha" } + + # Extract one named entry, never the whole archive. + function Expand-Entry([string]$Archive, [string]$Entry, [string]$Out) { + $z = [IO.Compression.ZipFile]::OpenRead($Archive) + try { + $e = $z.GetEntry($Entry) + if (-not $e) { throw "$Entry is not where AWS's package used to put it" } + [IO.Compression.ZipFileExtensions]::ExtractToFile($e, $Out, $true) + } finally { $z.Dispose() } + } + + $package = Join-Path $work 'package.zip' + Expand-Entry $zip 'package.zip' $package + $actual = Get-Sha256 $package + if ($actual -ne $PackageSha) { throw "SHA-256 mismatch for package.zip: got $actual, pinned $PackageSha" } + + $exe = Join-Path $work 'session-manager-plugin.exe' + Expand-Entry $package 'bin/session-manager-plugin.exe' $exe + $actual = Get-Sha256 $exe + if ($actual -ne $BinarySha) { throw "SHA-256 mismatch for session-manager-plugin.exe: got $actual, pinned $BinarySha" } + Assert-AwsSigned $exe + + New-Item -ItemType Directory -Force -Path $destDir | Out-Null + Move-Item -LiteralPath $exe -Destination $dest -Force + Write-Host "session-manager-plugin-$Triple.exe: session-manager-plugin $Version" +} finally { + Remove-Item -Recurse -Force -LiteralPath $work -ErrorAction SilentlyContinue +} diff --git a/scripts/fetch-ssm-plugin.sh b/scripts/fetch-ssm-plugin.sh new file mode 100755 index 0000000..231f30e --- /dev/null +++ b/scripts/fetch-ssm-plugin.sh @@ -0,0 +1,189 @@ +#!/usr/bin/env bash +# +# fetch-ssm-plugin.sh [target-triple ...] - put AWS's session-manager-plugin +# where Tauri's `bundle.externalBin` expects it: +# +# app/src-tauri/binaries/session-manager-plugin- +# +# The app runs the plugin to connect to workspaces on AWS, and bundling it means +# users do not have to install it. With no argument the host's triple is used +# (`rustc -vV`). Windows is scripts/fetch-ssm-plugin.ps1. +# +# Supported triples: +# x86_64-unknown-linux-gnu ubuntu_64bit/session-manager-plugin.deb +# aarch64-unknown-linux-gnu ubuntu_arm64/session-manager-plugin.deb +# x86_64-apple-darwin mac/sessionmanager-bundle.zip +# aarch64-apple-darwin mac_arm64/sessionmanager-bundle.zip +# universal-apple-darwin both macOS slices, plus the two thin files, joined +# with lipo (`tauri build --target +# universal-apple-darwin` compiles each arch, and +# tauri-build wants each arch's sidecar, then the +# bundler wants the universal one) +# +# Trust, in order, and the build fails on any miss: +# 1. A PINNED version, downloaded only from AWS's own S3 path. +# 2. A PINNED SHA-256 of every downloaded artifact, checked BEFORE anything is +# extracted from it. +# 3. For the Linux .deb, AWS's detached GPG signature (.sig), checked with +# gpgv against the key committed as scripts/aws-ssm-plugin-signer.asc, whose +# fingerprint is pinned here too. AWS publishes no .sig for the macOS zips +# (403); those binaries carry AWS's Developer ID signature instead. +# 4. A PINNED SHA-256 of the extracted binary itself. +# +# To bump the version: download every artifact of the new version, check the +# .deb signatures with the committed key, and only then record the new hashes +# (and the version in app/src-tauri/THIRD_PARTY_NOTICES, which this script +# checks). Do the same in fetch-ssm-plugin.ps1. +# +# Idempotent: a destination that already holds the pinned binary is left alone, +# so running it before every build costs nothing. + +set -euo pipefail + +VERSION="1.2.896.0" +BASE_URL="https://s3.amazonaws.com/session-manager-downloads/plugin/${VERSION}" +# AWS SSM Session Manager , as +# published at https://docs.aws.amazon.com/systems-manager/latest/userguide/install-plugin-linux-verify-signature.html +SIGNER_FPR="7959637124CE093AD501D47A2C4D4AFF6F6757EE" + +# artifact path (under BASE_URL) | SHA-256 of the artifact | SHA-256 of the binary in it +pin_for() { + case "$1" in + x86_64-unknown-linux-gnu) + echo "ubuntu_64bit/session-manager-plugin.deb|53f51fcc67314a4bf85888a38a3967cd41f8d0f28a60a9469a63acf935ba713e|6f6971b0ea322215cb8b316cd290c09a13c916114149a6b4c65358c232be6130" ;; + aarch64-unknown-linux-gnu) + echo "ubuntu_arm64/session-manager-plugin.deb|914eeca87b18b55356c58be197080f73742b3ca60d3823f0a45670dc9056aa9c|3f0efc482ce165fcf60a1ec44b40a700d48e7ec4b88cf0c339dd40d1620e98bf" ;; + x86_64-apple-darwin) + echo "mac/sessionmanager-bundle.zip|66e826fd48a6a6d06ad06b0892805986f7c455295b61974f99cb2a43d29624d7|e6e94c116003889244c5455a6dcd96ea584d2c6b6d6d719c3956d305429feb8b" ;; + aarch64-apple-darwin) + echo "mac_arm64/sessionmanager-bundle.zip|05c5ef53fb262de2fa1b46cf457890ee4152ec1dd8b2fdd94d028fa9b885ff36|71258c3f7d5c15603a3b75bc8dfd62f595e8ec6ef3b8132ab59a005eebb7fa35" ;; + *) return 1 ;; + esac +} + +repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +dest_dir="$repo_root/app/src-tauri/binaries" +signer_key="$repo_root/scripts/aws-ssm-plugin-signer.asc" +notices="$repo_root/app/src-tauri/THIRD_PARTY_NOTICES" + +die() { echo "fetch-ssm-plugin: $*" >&2; exit 1; } + +sha256() { + if command -v sha256sum >/dev/null 2>&1; then + sha256sum "$1" | cut -d' ' -f1 + else + shasum -a 256 "$1" | cut -d' ' -f1 + fi +} + +# The notices name the version they reproduce; a bump must update both. +grep -qF "Version: ${VERSION}" "$notices" \ + || die "$notices does not name plugin ${VERSION} - update it with the version bump" + +work="$(mktemp -d)" +trap 'rm -rf "$work"' EXIT + +download() { # + curl -fsSL --proto '=https' --tlsv1.2 --retry 3 --retry-delay 5 \ + -o "$2" "${BASE_URL}/$1" || die "download failed: ${BASE_URL}/$1" +} + +verify_deb_signature() { # + command -v gpg >/dev/null 2>&1 || die "gpg is required to check AWS's signature on the .deb" + command -v gpgv >/dev/null 2>&1 || die "gpgv is required to check AWS's signature on the .deb" + local keyring="$work/aws-signer.gpg" status="$work/gpgv.status" + [ -f "$keyring" ] || gpg --batch --quiet --dearmor <"$signer_key" >"$keyring" + # VALIDSIG carries the primary key's fingerprint as its last field; a good + # signature from any other key in the keyring (there is none) would not match. + gpgv --status-fd 3 --keyring "$keyring" "$2" "$1" 3>"$status" >/dev/null 2>&1 \ + || die "AWS's GPG signature does not verify for $(basename "$1")" + grep -q "^\[GNUPG:\] VALIDSIG .* ${SIGNER_FPR}\$" "$status" \ + || die "the .deb is not signed by the pinned AWS key ${SIGNER_FPR}" +} + +# Extract the binary of one thin triple into , every check included. +fetch_thin() { # + local triple="$1" out="$2" pin artifact artifact_sha bin_sha file + pin="$(pin_for "$triple")" || die "unsupported target $triple" + IFS='|' read -r artifact artifact_sha bin_sha <<<"$pin" + + if [ -f "$out" ] && [ "$(sha256 "$out")" = "$bin_sha" ]; then + echo "$(basename "$out"): already the pinned ${VERSION} binary" + return 0 + fi + + file="$work/${triple}-$(basename "$artifact")" + echo "Downloading ${BASE_URL}/${artifact}" + download "$artifact" "$file" + [ "$(sha256 "$file")" = "$artifact_sha" ] \ + || die "SHA-256 mismatch for ${artifact}: got $(sha256 "$file"), pinned ${artifact_sha}" + + local x="$work/${triple}-x" + mkdir -p "$x" + case "$artifact" in + *.deb) + download "${artifact}.sig" "$file.sig" + verify_deb_signature "$file" "$file.sig" + # A .deb is an ar archive; take only data.tar.* and only the one binary. + ( cd "$x" && ar x "$file" ) + local data + data="$(cd "$x" && ls data.tar.* 2>/dev/null | head -n1)" + [ -n "$data" ] || die "no data.tar.* in ${artifact}" + tar -xf "$x/$data" -C "$x" usr/local/sessionmanagerplugin/bin/session-manager-plugin \ + || die "the binary is not where AWS's .deb used to put it" + mv "$x/usr/local/sessionmanagerplugin/bin/session-manager-plugin" "$x/plugin" + ;; + *.zip) + unzip -p "$file" sessionmanager-bundle/bin/session-manager-plugin >"$x/plugin" \ + || die "the binary is not where AWS's bundle zip used to put it" + ;; + esac + [ "$(sha256 "$x/plugin")" = "$bin_sha" ] \ + || die "SHA-256 mismatch for the binary in ${artifact}: got $(sha256 "$x/plugin"), pinned ${bin_sha}" + + mkdir -p "$(dirname "$out")" + chmod 0755 "$x/plugin" + mv -f "$x/plugin" "$out" + echo "$(basename "$out"): session-manager-plugin ${VERSION}" +} + +fetch_universal() { + local lipo + lipo="$(command -v lipo || command -v llvm-lipo || true)" + [ -n "$lipo" ] || die "universal-apple-darwin needs lipo (Xcode command line tools) or llvm-lipo" + local x86="$dest_dir/session-manager-plugin-x86_64-apple-darwin" + local arm="$dest_dir/session-manager-plugin-aarch64-apple-darwin" + local uni="$dest_dir/session-manager-plugin-universal-apple-darwin" + fetch_thin x86_64-apple-darwin "$x86" + fetch_thin aarch64-apple-darwin "$arm" + "$lipo" -create "$x86" "$arm" -output "$work/universal" + # Each slice must come back out byte-identical to its pinned thin binary, so + # the universal file holds exactly AWS's two binaries (and their signatures). + local arch thin + for arch in x86_64 arm64; do + "$lipo" "$work/universal" -thin "$arch" -output "$work/slice-$arch" + done + for arch in x86_64:x86_64-apple-darwin arm64:aarch64-apple-darwin; do + thin="$(pin_for "${arch#*:}" | cut -d'|' -f3)" + [ "$(sha256 "$work/slice-${arch%%:*}")" = "$thin" ] \ + || die "the ${arch%%:*} slice of the universal binary is not the pinned binary" + done + chmod 0755 "$work/universal" + mv -f "$work/universal" "$uni" + echo "$(basename "$uni"): session-manager-plugin ${VERSION} (x86_64 + arm64)" +} + +targets=("$@") +if [ ${#targets[@]} -eq 0 ]; then + host="$(rustc -vV 2>/dev/null | sed -n 's/^host: //p')" + [ -n "$host" ] || die "no target given and rustc is not available to name the host's" + targets=("$host") +fi + +for t in "${targets[@]}"; do + case "$t" in + universal-apple-darwin) fetch_universal ;; + *-windows-*) die "$t: use scripts/fetch-ssm-plugin.ps1 on Windows" ;; + *) fetch_thin "$t" "$dest_dir/session-manager-plugin-$t" ;; + esac +done -- 2.52.0 From 39f502dcdf7d6426fec2bc7211c3ecd35b9ebf16 Mon Sep 17 00:00:00 2001 From: Josh Knapp Date: Tue, 17 Nov 2026 06:43:41 -0800 Subject: [PATCH 02/12] feat(ssm): bundle session-manager-plugin as a sidecar and prefer it bundle.externalBin ships the plugin beside the app binary (usr/bin in the AppImage, Contents/MacOS, the Windows install dir) and THIRD_PARTY_NOTICES as a resource. find_plugin() now resolves TRIPLEC_SSM_PLUGIN, then the bundled sidecar next to current_exe(), then PATH and AWS's install locations, then the install hint; the order is unit-tested against temp dirs. tauri-build fails any build whose externalBin file is missing, so build.rs writes a marked placeholder in debug builds (cargo test/check, tauri dev) and refuses a missing file or a placeholder in release builds. find_plugin() skips the placeholder. Co-Authored-By: Claude Opus 5.5 --- app/src-tauri/build.rs | 50 +++++++++ app/src-tauri/src/host/ssm.rs | 108 ++++++++++++++----- app/src-tauri/src/host/ssm/tests.rs | 132 +++++++++++++++++++++++ app/src-tauri/src/lib.rs | 1 + app/src-tauri/src/sidecar_placeholder.rs | 31 ++++++ app/src-tauri/tauri.conf.json | 6 ++ 6 files changed, 302 insertions(+), 26 deletions(-) create mode 100644 app/src-tauri/src/sidecar_placeholder.rs diff --git a/app/src-tauri/build.rs b/app/src-tauri/build.rs index cf8ad8d..7d0c76c 100644 --- a/app/src-tauri/build.rs +++ b/app/src-tauri/build.rs @@ -14,6 +14,8 @@ #[path = "src/command_census.rs"] mod command_census; +#[path = "src/sidecar_placeholder.rs"] +mod sidecar_placeholder; use std::path::Path; @@ -79,6 +81,7 @@ fn main() { } prune_permissions(&commands); + ensure_ssm_sidecar(); // `AppManifest::commands` takes `&'static [&'static str]` and the struct is `Copy`, so // there is no owned form; leaking is fine in a process that exits right after. @@ -206,3 +209,50 @@ fn check_tauri_config() { fail("capabilities declared outside capabilities/", &problems, LAYOUT_HINT); } } + +/// `bundle.externalBin` names `binaries/session-manager-plugin`, and tauri-build stops on a +/// missing `binaries/session-manager-plugin-[.exe]` for every build, tests +/// included. The real one comes from `scripts/fetch-ssm-plugin.sh` (`.ps1` on Windows), which +/// CI runs before `tauri build`. +/// +/// - **Release profile:** the real plugin is required. A missing file or a placeholder stops +/// the build here, so a placeholder can never ship. +/// - **Debug profile** (`cargo test`, `cargo check`, `tauri dev`): a missing file is replaced +/// by a placeholder (`src/sidecar_placeholder.rs`) so no test run needs AWS's S3. The app's +/// `find_plugin` skips a placeholder and falls back to an installed plugin. +fn ensure_ssm_sidecar() { + let target = std::env::var("TARGET").expect("cargo sets TARGET"); + let ext = if target.contains("windows") { ".exe" } else { "" }; + let path = Path::new("binaries").join(format!("session-manager-plugin-{target}{ext}")); + println!("cargo:rerun-if-changed={}", path.display()); + let release = std::env::var("PROFILE").as_deref() == Ok("release"); + let head = std::fs::read(&path).ok().map(|b| sidecar_placeholder::is_placeholder(&b)); + let fetch = if target.contains("windows") { + "scripts\\fetch-ssm-plugin.ps1" + } else { + "scripts/fetch-ssm-plugin.sh" + }; + match (head, release) { + (Some(false), _) => {} + (state, true) => fail( + "the AWS Session Manager plugin sidecar is missing", + &[format!( + "{} is {} (release builds bundle the real plugin)", + path.display(), + if state.is_some() { "a debug-build placeholder" } else { "missing" } + )], + &format!("Run {fetch} {target} from the repository root first."), + ), + (None, false) => { + std::fs::create_dir_all("binaries").expect("create src-tauri/binaries"); + std::fs::write(&path, sidecar_placeholder::contents()) + .unwrap_or_else(|e| panic!("cannot write {}: {e}", path.display())); + println!( + "cargo:warning=no {} - wrote a placeholder (debug only; AWS workspaces use an \ + installed plugin). Run {fetch} to bundle the real one.", + path.display() + ); + } + (Some(true), false) => {} + } +} diff --git a/app/src-tauri/src/host/ssm.rs b/app/src-tauri/src/host/ssm.rs index a76e6d2..521e083 100644 --- a/app/src-tauri/src/host/ssm.rs +++ b/app/src-tauri/src/host/ssm.rs @@ -198,27 +198,48 @@ fn sdk_error(e: &(dyn std::error::Error + 'static)) -> String { // ── The plugin ─────────────────────────────────────────────────────────────── -/// Find `session-manager-plugin`: `TRIPLEC_SSM_PLUGIN` if set, then `PATH`, -/// then where AWS's installers put it (the GUI app on macOS does not get the -/// shell's `PATH`, so the install locations are not optional). +/// The plugin's file name on this platform: what the bundle holds (Tauri strips the +/// `-` suffix of `bundle.externalBin` when it copies the sidecar in) and what +/// AWS's installers put on `PATH`. +const PLUGIN_FILE: &str = + if cfg!(windows) { "session-manager-plugin.exe" } else { "session-manager-plugin" }; + +const PLUGIN_INSTALL_HINT: &str = "The AWS Session Manager plugin (session-manager-plugin) is \ + not installed. It is what connects to a workspace on AWS; install it from \ + https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-working-with-install-plugin.html"; + +/// Find `session-manager-plugin`, in this order: +/// +/// 1. `TRIPLEC_SSM_PLUGIN`, if set (an error if it names no file — an explicit choice is never +/// silently replaced by another plugin); +/// 2. **the copy bundled with the app** (`bundle.externalBin`), beside the app's own +/// executable: `usr/bin` in the AppImage, `Contents/MacOS` in the macOS bundle, the install +/// directory on Windows (and `target/` under `tauri dev`, where tauri-build copies +/// it). A debug build's placeholder (`sidecar_placeholder`) is skipped; +/// 3. `PATH`; +/// 4. where AWS's installers put it (the GUI app on macOS does not get the shell's `PATH`, so +/// the install locations are not optional). +/// +/// 3 and 4 remain for dev builds without a fetched sidecar. pub fn find_plugin() -> Result { - if let Some(p) = std::env::var_os("TRIPLEC_SSM_PLUGIN").filter(|p| !p.is_empty()) { - let p = PathBuf::from(p); - return if p.is_file() { - Ok(p) - } else { - Err(format!("TRIPLEC_SSM_PLUGIN names {}, which is not a file", p.display())) - }; - } - let name = if cfg!(windows) { "session-manager-plugin.exe" } else { "session-manager-plugin" }; - let on_path = std::env::var_os("PATH") - .map(|paths| std::env::split_paths(&paths).map(|d| d.join(name)).collect::>()) - .unwrap_or_default(); - let installed: Vec = if cfg!(windows) { + let exe_dir = std::env::current_exe() + .ok() + .and_then(|exe| exe.parent().map(Path::to_path_buf)); + resolve_plugin(&PluginSearch { + override_path: std::env::var_os("TRIPLEC_SSM_PLUGIN"), + exe_dir, + path_var: std::env::var_os("PATH"), + install_dirs: plugin_install_dirs(), + }) +} + +/// Where AWS's installers put the plugin, in the order they are tried. +fn plugin_install_dirs() -> Vec { + if cfg!(windows) { ["ProgramFiles", "ProgramFiles(x86)"] .iter() .filter_map(|v| std::env::var_os(v)) - .map(|d| PathBuf::from(d).join(r"Amazon\SessionManagerPlugin\bin").join(name)) + .map(|d| PathBuf::from(d).join(r"Amazon\SessionManagerPlugin\bin")) .collect() } else { [ @@ -228,19 +249,54 @@ pub fn find_plugin() -> Result { "/usr/bin", ] .iter() - .map(|d| Path::new(d).join(name)) + .map(PathBuf::from) .collect() - }; + } +} + +/// Everything [`find_plugin`] reads from the process, so the order is testable. +struct PluginSearch { + override_path: Option, + exe_dir: Option, + path_var: Option, + install_dirs: Vec, +} + +fn resolve_plugin(search: &PluginSearch) -> Result { + if let Some(p) = search.override_path.as_ref().filter(|p| !p.is_empty()) { + let p = PathBuf::from(p); + return if p.is_file() { + Ok(p) + } else { + Err(format!("TRIPLEC_SSM_PLUGIN names {}, which is not a file", p.display())) + }; + } + if let Some(bundled) = search.exe_dir.as_ref().map(|d| d.join(PLUGIN_FILE)) { + if bundled.is_file() && !is_sidecar_placeholder(&bundled) { + return Ok(bundled); + } + } + let on_path = search + .path_var + .as_ref() + .map(|paths| std::env::split_paths(paths).map(|d| d.join(PLUGIN_FILE)).collect::>()) + .unwrap_or_default(); on_path .into_iter() - .chain(installed) + .chain(search.install_dirs.iter().map(|d| d.join(PLUGIN_FILE))) .find(|p| p.is_file()) - .ok_or_else(|| { - "The AWS Session Manager plugin (session-manager-plugin) is not installed. It is \ - what connects to a workspace on AWS; install it from \ - https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-working-with-install-plugin.html" - .to_string() - }) + .ok_or_else(|| PLUGIN_INSTALL_HINT.to_string()) +} + +/// Whether `path` is the stand-in a debug build bundles when no real plugin was fetched. +/// Unreadable counts as "not a placeholder": the spawn then reports the real error. +fn is_sidecar_placeholder(path: &Path) -> bool { + use std::io::Read; + let mut head = [0u8; crate::sidecar_placeholder::MARKER.len()]; + std::fs::File::open(path) + .and_then(|mut f| f.read_exact(&mut head)) + .map(|()| crate::sidecar_placeholder::is_placeholder(&head)) + .unwrap_or(false) } /// A running plugin process with a listener on the local port. diff --git a/app/src-tauri/src/host/ssm/tests.rs b/app/src-tauri/src/host/ssm/tests.rs index ba1bf7d..b3265e8 100644 --- a/app/src-tauri/src/host/ssm/tests.rs +++ b/app/src-tauri/src/host/ssm/tests.rs @@ -400,3 +400,135 @@ async fn the_keepalive_asks_for_health_without_a_token() { assert!(req.starts_with("GET /v1/health HTTP/1.1\r\n"), "{req}"); assert!(!req.to_ascii_lowercase().contains("authorization"), "{req}"); } + +// ── Finding the plugin ─────────────────────────────────────────────────────── + +mod plugin_resolution { + use super::super::{resolve_plugin, PluginSearch, PLUGIN_FILE, PLUGIN_INSTALL_HINT}; + use std::path::{Path, PathBuf}; + + /// A directory holding a fake plugin (contents are never run). + fn dir_with_plugin(root: &Path, name: &str) -> PathBuf { + let d = root.join(name); + std::fs::create_dir_all(&d).unwrap(); + std::fs::write(d.join(PLUGIN_FILE), b"\x7fELF fake plugin").unwrap(); + d + } + + fn search( + override_path: Option<&Path>, + exe_dir: Option<&Path>, + path: &[&Path], + install: &[&Path], + ) -> PluginSearch { + PluginSearch { + override_path: override_path.map(|p| p.as_os_str().to_owned()), + exe_dir: exe_dir.map(Path::to_path_buf), + path_var: Some(std::env::join_paths(path).unwrap()), + install_dirs: install.iter().map(|p| p.to_path_buf()).collect(), + } + } + + #[test] + fn the_override_wins_over_everything() { + let t = tempfile::tempdir().unwrap(); + let chosen = t.path().join("my-plugin"); + std::fs::write(&chosen, b"x").unwrap(); + let bundled = dir_with_plugin(t.path(), "app"); + let on_path = dir_with_plugin(t.path(), "path"); + let s = search(Some(&chosen), Some(&bundled), &[&on_path], &[]); + assert_eq!(resolve_plugin(&s).unwrap(), chosen); + } + + #[test] + fn an_override_naming_no_file_is_an_error_not_a_fallback() { + let t = tempfile::tempdir().unwrap(); + let bundled = dir_with_plugin(t.path(), "app"); + let s = search(Some(&t.path().join("missing")), Some(&bundled), &[], &[]); + let e = resolve_plugin(&s).unwrap_err(); + assert!(e.contains("TRIPLEC_SSM_PLUGIN names"), "{e}"); + } + + #[test] + fn an_empty_override_is_ignored() { + let t = tempfile::tempdir().unwrap(); + let bundled = dir_with_plugin(t.path(), "app"); + let mut s = search(None, Some(&bundled), &[], &[]); + s.override_path = Some(std::ffi::OsString::new()); + assert_eq!(resolve_plugin(&s).unwrap(), bundled.join(PLUGIN_FILE)); + } + + #[test] + fn the_bundled_sidecar_wins_over_path_and_installs() { + let t = tempfile::tempdir().unwrap(); + let bundled = dir_with_plugin(t.path(), "app"); + let on_path = dir_with_plugin(t.path(), "path"); + let installed = dir_with_plugin(t.path(), "installed"); + let s = search(None, Some(&bundled), &[&on_path], &[&installed]); + assert_eq!(resolve_plugin(&s).unwrap(), bundled.join(PLUGIN_FILE)); + } + + #[test] + fn without_a_sidecar_path_comes_before_the_install_locations() { + let t = tempfile::tempdir().unwrap(); + let empty_app = t.path().join("app"); + std::fs::create_dir_all(&empty_app).unwrap(); + let first = t.path().join("path-first-empty"); + std::fs::create_dir_all(&first).unwrap(); + let on_path = dir_with_plugin(t.path(), "path"); + let installed = dir_with_plugin(t.path(), "installed"); + let s = search(None, Some(&empty_app), &[&first, &on_path], &[&installed]); + assert_eq!(resolve_plugin(&s).unwrap(), on_path.join(PLUGIN_FILE)); + + let s = search(None, Some(&empty_app), &[&first], &[&installed]); + assert_eq!(resolve_plugin(&s).unwrap(), installed.join(PLUGIN_FILE)); + } + + #[test] + fn a_debug_placeholder_beside_the_exe_is_skipped() { + let t = tempfile::tempdir().unwrap(); + let app = t.path().join("app"); + std::fs::create_dir_all(&app).unwrap(); + std::fs::write(app.join(PLUGIN_FILE), crate::sidecar_placeholder::contents()).unwrap(); + let on_path = dir_with_plugin(t.path(), "path"); + let s = search(None, Some(&app), &[&on_path], &[]); + assert_eq!(resolve_plugin(&s).unwrap(), on_path.join(PLUGIN_FILE)); + + // And with nothing else installed, the install hint, not the placeholder. + let s = search(None, Some(&app), &[], &[]); + assert_eq!(resolve_plugin(&s).unwrap_err(), PLUGIN_INSTALL_HINT); + } + + #[test] + fn a_directory_named_like_the_plugin_is_not_a_plugin() { + let t = tempfile::tempdir().unwrap(); + let app = t.path().join("app"); + std::fs::create_dir_all(app.join(PLUGIN_FILE)).unwrap(); + let installed = dir_with_plugin(t.path(), "installed"); + let s = search(None, Some(&app), &[], &[&installed]); + assert_eq!(resolve_plugin(&s).unwrap(), installed.join(PLUGIN_FILE)); + } + + #[test] + fn nothing_anywhere_is_the_install_hint() { + let t = tempfile::tempdir().unwrap(); + let s = search(None, None, &[t.path()], &[t.path()]); + let e = resolve_plugin(&s).unwrap_err(); + assert!(e.contains("is not installed") && e.contains("docs.aws.amazon.com"), "{e}"); + } + + #[test] + fn the_bundled_name_is_what_tauri_gives_the_sidecar() { + // tauri-build/-bundler strip "-" from bundle.externalBin's + // "binaries/session-manager-plugin"; the .exe stays on Windows. + let conf: serde_json::Value = + serde_json::from_str(include_str!("../../../tauri.conf.json")).unwrap(); + let bins = conf["bundle"]["externalBin"].as_array().expect("bundle.externalBin"); + let stems: Vec<&str> = bins + .iter() + .map(|b| b.as_str().unwrap().rsplit('/').next().unwrap()) + .collect(); + let expected = PLUGIN_FILE.trim_end_matches(".exe"); + assert!(stems.contains(&expected), "{stems:?} has no {expected}"); + } +} diff --git a/app/src-tauri/src/lib.rs b/app/src-tauri/src/lib.rs index e6e3e64..3869f28 100644 --- a/app/src-tauri/src/lib.rs +++ b/app/src-tauri/src/lib.rs @@ -15,6 +15,7 @@ mod logging; mod marketplace; mod models; mod project_lock; +mod sidecar_placeholder; mod storage; pub mod url_open; pub mod web_terminal; diff --git a/app/src-tauri/src/sidecar_placeholder.rs b/app/src-tauri/src/sidecar_placeholder.rs new file mode 100644 index 0000000..85908a4 --- /dev/null +++ b/app/src-tauri/src/sidecar_placeholder.rs @@ -0,0 +1,31 @@ +//! The stand-in `build.rs` writes for the bundled `session-manager-plugin` sidecar in a +//! **debug** build that has no real one, and how the app recognises it. +//! +//! `bundle.externalBin` makes tauri-build fail outright when the per-target file is missing, +//! for `cargo test`, `cargo check` and `tauri dev` as much as for a release. The real binary +//! comes from `scripts/fetch-ssm-plugin.sh` (`.ps1` on Windows), which downloads a pinned, +//! hash-checked AWS release; requiring that for every test run would put AWS's S3 on the path +//! of every `cargo test`. So debug builds get this placeholder instead, a release build refuses +//! it (`build.rs`), and `host::ssm::find_plugin` skips it and falls back to an installed plugin. +//! +//! Shared by `build.rs` (through `#[path]`) and the app, so the two cannot disagree. + +/// The first bytes of a placeholder. Not an executable format on any platform. +pub const MARKER: &[u8] = b"TRIPLE-C SSM PLUGIN PLACEHOLDER"; + +/// The whole placeholder file. +#[allow(dead_code)] // build.rs only +pub fn contents() -> Vec { + let mut v = MARKER.to_vec(); + v.extend_from_slice( + b"\nNot the AWS Session Manager plugin. Debug builds get this when \ + app/src-tauri/binaries has no real one; run scripts/fetch-ssm-plugin.sh \ + (scripts/fetch-ssm-plugin.ps1 on Windows) to bundle the real plugin.\n", + ); + v +} + +/// Whether `bytes` (the start of a file) is a placeholder. +pub fn is_placeholder(bytes: &[u8]) -> bool { + bytes.starts_with(MARKER) +} diff --git a/app/src-tauri/tauri.conf.json b/app/src-tauri/tauri.conf.json index 48fce27..cdb6d40 100644 --- a/app/src-tauri/tauri.conf.json +++ b/app/src-tauri/tauri.conf.json @@ -36,6 +36,12 @@ "icons/icon.icns", "icons/icon.png" ], + "externalBin": [ + "binaries/session-manager-plugin" + ], + "resources": { + "THIRD_PARTY_NOTICES": "THIRD_PARTY_NOTICES" + }, "linux": { "appimage": { "bundleMediaFramework": true -- 2.52.0 From cb28d1da39714a996b258e3c72baf36bdd4ecc10 Mon Sep 17 00:00:00 2001 From: Josh Knapp Date: Tue, 17 Nov 2026 06:44:30 -0800 Subject: [PATCH 03/12] ci: fetch the SSM plugin before every build; check it ships Both build workflows fetch the pinned plugin before tauri build on Linux, macOS (universal: both slices plus the lipo'd file) and Windows. The test job needs no fetch: debug builds get build.rs's placeholder. finalize-appimage.sh asserts usr/bin/session-manager-plugin is a running ELF and THIRD_PARTY_NOTICES is in the image. Windows: the plugin ships under AWS's Authenticode signature and is not re-signed (Tauri skips a sidecar signtool verify accepts). windows-sign.ps1 refuses it if it is ever presented rather than letting the allowlist skip it unsigned; windows-verify-signatures.ps1 requires it in the MSI, valid, timestamped and signed by Amazon Web Services, Inc. Co-Authored-By: Claude Opus 5.5 --- .gitea/workflows/build-app-preview.yml | 30 ++++++++++++++++++++- .gitea/workflows/build-app.yml | 26 +++++++++++++++++++ scripts/finalize-appimage.sh | 16 ++++++++++++ scripts/windows-sign.ps1 | 14 +++++++++- scripts/windows-verify-signatures.ps1 | 36 ++++++++++++++++++++++++++ 5 files changed, 120 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/build-app-preview.yml b/.gitea/workflows/build-app-preview.yml index 07d33ed..e2da55f 100644 --- a/.gitea/workflows/build-app-preview.yml +++ b/.gitea/workflows/build-app-preview.yml @@ -334,7 +334,9 @@ jobs: run: npx vitest run # `--locked`: test against the committed Cargo.lock, never a re-resolved - # one, for the same reason the frontend uses `npm ci`. + # one, for the same reason the frontend uses `npm ci`. No plugin fetch + # here: a debug build gets a placeholder for the session-manager-plugin + # sidecar from build.rs, so tests never depend on AWS's S3. - name: Backend tests (cargo test) working-directory: ./app/src-tauri run: | @@ -416,6 +418,9 @@ jobs: curl \ wget \ file \ + gnupg \ + gpgv \ + unzip \ xdg-utils - name: Install Rust stable @@ -468,6 +473,13 @@ jobs: export PATH="$HOME/.cargo/bin:$PATH" npx tauri --version || npm install @tauri-apps/cli + # The AWS Session Manager plugin, bundled as a sidecar (bundle.externalBin) + # so AWS workspaces work without the user installing it. Pinned version, + # SHA-256 and AWS's GPG signature checked; fails the job on any mismatch. + # A release build refuses to start without it (build.rs). + - name: Fetch the AWS Session Manager plugin + run: bash scripts/fetch-ssm-plugin.sh x86_64-unknown-linux-gnu + - name: Build Tauri app working-directory: ./app env: @@ -597,6 +609,15 @@ jobs: export PATH="$HOME/.cargo/bin:$PATH" npx tauri --version || npm install @tauri-apps/cli + # The AWS Session Manager plugin sidecar (bundle.externalBin): both thin + # slices (tauri-build checks each arch it compiles) and the lipo'd + # universal one the bundler copies into Contents/MacOS. Pinned version and + # SHA-256s; fails the job on any mismatch. Not re-signed here: the app is + # not code-signed on macOS, so the plugin keeps AWS's Developer ID + # signature (with APPLE_* signing configured, Tauri would sign it too). + - name: Fetch the AWS Session Manager plugin + run: bash scripts/fetch-ssm-plugin.sh universal-apple-darwin + - name: Build Tauri app (universal) working-directory: ./app env: @@ -729,6 +750,13 @@ jobs: set "PATH=%USERPROFILE%\.cargo\bin;C:\Program Files\nodejs;%PATH%" npm run build + # The AWS Session Manager plugin sidecar (bundle.externalBin). Pinned + # version and SHA-256s, and AWS's Authenticode signature required; fails + # the job on any mismatch. It ships under AWS's signature, not ours (see + # the script and windows-sign.ps1). + - name: Fetch the AWS Session Manager plugin + run: powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass -File scripts\fetch-ssm-plugin.ps1 + - name: Build Tauri app working-directory: ./app # Previews are not code-signed: signing is metered, previews are built diff --git a/.gitea/workflows/build-app.yml b/.gitea/workflows/build-app.yml index a73495a..61a194b 100644 --- a/.gitea/workflows/build-app.yml +++ b/.gitea/workflows/build-app.yml @@ -174,6 +174,9 @@ jobs: curl \ wget \ file \ + gnupg \ + gpgv \ + unzip \ xdg-utils - name: Install Rust stable @@ -227,6 +230,13 @@ jobs: export PATH="$HOME/.cargo/bin:$PATH" npx tauri --version || npm install @tauri-apps/cli + # The AWS Session Manager plugin, bundled as a sidecar (bundle.externalBin) + # so AWS workspaces work without the user installing it. Pinned version, + # SHA-256 and AWS's GPG signature checked; fails the job on any mismatch. + # A release build refuses to start without it (build.rs). + - name: Fetch the AWS Session Manager plugin + run: bash scripts/fetch-ssm-plugin.sh x86_64-unknown-linux-gnu + - name: Build Tauri app working-directory: ./app run: | @@ -417,6 +427,15 @@ jobs: export PATH="$HOME/.cargo/bin:$PATH" npx tauri --version || npm install @tauri-apps/cli + # The AWS Session Manager plugin sidecar (bundle.externalBin): both thin + # slices (tauri-build checks each arch it compiles) and the lipo'd + # universal one the bundler copies into Contents/MacOS. Pinned version and + # SHA-256s; fails the job on any mismatch. Not re-signed here: the app is + # not code-signed on macOS, so the plugin keeps AWS's Developer ID + # signature (with APPLE_* signing configured, Tauri would sign it too). + - name: Fetch the AWS Session Manager plugin + run: bash scripts/fetch-ssm-plugin.sh universal-apple-darwin + - name: Build Tauri app (universal) working-directory: ./app run: | @@ -656,6 +675,13 @@ jobs: set "PATH=%USERPROFILE%\.cargo\bin;C:\Program Files\nodejs;%PATH%" npm run build + # The AWS Session Manager plugin sidecar (bundle.externalBin). Pinned + # version and SHA-256s, and AWS's Authenticode signature required; fails + # the job on any mismatch. It ships under AWS's signature, not ours (see + # the script and windows-sign.ps1). + - name: Fetch the AWS Session Manager plugin + run: powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass -File scripts\fetch-ssm-plugin.ps1 + # Releases are signed with Azure Artifact Signing (scripts/windows-*.ps1). # The setup fetches the signing client and a job-local .NET runtime, and # writes the Tauri config holding the sign command, which "Build Tauri diff --git a/scripts/finalize-appimage.sh b/scripts/finalize-appimage.sh index 77589d1..8edd72e 100755 --- a/scripts/finalize-appimage.sh +++ b/scripts/finalize-appimage.sh @@ -317,6 +317,22 @@ if [ "$pw_removed" = true ]; then fi [ -x "$out/usr/bin/triple-c" ] || fail "no executable usr/bin/triple-c." +# The bundled AWS Session Manager plugin (bundle.externalBin, fetched by +# fetch-ssm-plugin.sh) is what AWS workspaces connect through. Tauri copies it +# beside the app binary with the target triple stripped, which is where +# `host::ssm::find_plugin` looks. It must be the real plugin: an ELF, not the +# placeholder a debug build writes (build.rs refuses that for release, and this +# is the check on what actually shipped). +plugin="$out/usr/bin/session-manager-plugin" +[ -x "$plugin" ] || fail "no executable usr/bin/session-manager-plugin (the bundled AWS plugin)." +[ "$(head -c 4 "$plugin" | od -An -c | tr -d ' ')" = "177ELF" ] \ + || fail "usr/bin/session-manager-plugin is not an ELF binary (a placeholder?)." +"$plugin" --version >/dev/null 2>&1 \ + || fail "usr/bin/session-manager-plugin does not run (--version)." +# Its license and notices travel with it (bundle.resources). +notices=("$out"/usr/lib/*/THIRD_PARTY_NOTICES) +[ -f "${notices[0]}" ] || fail "THIRD_PARTY_NOTICES is not in the image." + # Every file readable by all, every program executable by all — what the # `chmod -R a+rX` before the repack promised (AppRun.wrapped used to ship 0770). # Files only: the AppImage runtime's --appimage-extract creates every diff --git a/scripts/windows-sign.ps1 b/scripts/windows-sign.ps1 index 56d4da7..05b8844 100644 --- a/scripts/windows-sign.ps1 +++ b/scripts/windows-sign.ps1 @@ -11,7 +11,8 @@ # each signature is metered (about 1000 a month), so those are skipped. The # allowlist below is the whole of what reaches users: the app binary, the MSI, # the NSIS installer, and the uninstaller makensis writes to the job's temp -# directory. A file that already carries a valid signature is skipped too: +# directory. The bundled session-manager-plugin sidecar is AWS-signed and is +# refused rather than re-signed (see below). A file that already carries a valid signature is skipped too: # Tauri presents the app binary once per bundle type. # # This may run as 32-bit PowerShell: the NSIS uninstaller is signed from inside @@ -46,6 +47,17 @@ try { $full = (Resolve-Path -LiteralPath $Path).ProviderPath Write-Log "== $full" + # The bundled AWS session-manager-plugin (bundle.externalBin) ships AWS's own + # signature and is deliberately never re-signed: fetch-ssm-plugin.ps1 checks it + # is AWS-signed and timestamped, and Tauri skips a sidecar `signtool verify /pa` + # accepts. Being asked to sign it means that check failed on this machine, so + # stop rather than put our name on it - or, via the allowlist below, skip it + # and ship it unsigned. + if ($full -match '\\binaries\\session-manager-plugin-[^\\]+\.exe$') { + Write-Log 'refused: the session-manager-plugin sidecar must carry AWS''s signature, not ours (see fetch-ssm-plugin.ps1)' + exit 1 + } + $ships = ($full -match '\\target\\release\\[^\\]+\.exe$') -or ($full -match '\\target\\release\\bundle\\(msi|nsis)\\[^\\]+\.(msi|exe)$') -or $full.StartsWith($env:TRIPLE_C_SIGN_TMP.TrimEnd('\') + '\', [StringComparison]::OrdinalIgnoreCase) diff --git a/scripts/windows-verify-signatures.ps1 b/scripts/windows-verify-signatures.ps1 index 1ddc74f..4a793ee 100644 --- a/scripts/windows-verify-signatures.ps1 +++ b/scripts/windows-verify-signatures.ps1 @@ -14,6 +14,10 @@ # unpacked with an administrative install and its binaries checked directly; # the NSIS installer cannot be unpacked that way, so for it the signing log # must show the app binary and the uninstaller were signed. +# +# The bundled AWS session-manager-plugin is checked too - present in the MSI, +# and in both installers signed, timestamped and signed by AWS, because it is +# shipped under AWS's signature rather than re-signed by us. param([Parameter(Mandatory = $true, ValueFromRemainingArguments = $true)][string[]]$Patterns) @@ -47,6 +51,20 @@ function Test-Signature([IO.FileInfo]$File, [string]$Label) { return $false } +# The bundled AWS session-manager-plugin sidecar is deliberately left under +# AWS's own signature (see fetch-ssm-plugin.ps1), so beyond being valid and +# timestamped it must be AWS's, not ours. +$sidecarName = 'session-manager-plugin.exe' +$sidecarSource = Join-Path (Split-Path -Parent $PSScriptRoot) 'app\src-tauri\binaries\session-manager-plugin-x86_64-pc-windows-msvc.exe' +function Test-AwsSigner([IO.FileInfo]$File, [string]$Label) { + if (-not (Test-Signature $File $Label)) { return $false } + $subject = (Get-AuthenticodeSignature -FilePath $File.FullName).SignerCertificate.Subject + # .NET quotes a DN value holding a comma: O="Amazon Web Services, Inc.". + if ($subject -match '(^|,\s*)O="?Amazon Web Services, Inc\."?(,|$)') { return $true } + Write-Host "FAIL $Label - signed by '$subject', expected Amazon Web Services, Inc." + return $false +} + function Get-SignedLog { if ($env:TRIPLE_C_SIGN_LOG -and (Test-Path $env:TRIPLE_C_SIGN_LOG)) { return @(Get-Content $env:TRIPLE_C_SIGN_LOG) } return @() @@ -74,6 +92,16 @@ foreach ($file in $files) { foreach ($f in $inner) { if (-not (Test-Signature $f "$($file.Name) > $($f.Name)")) { $failed += "$($file.Name) > $($f.Name)" } } + # The bundled AWS plugin must be in there, and still under AWS's signature. + if ($proc.ExitCode -eq 0) { + $plugin = @($inner | Where-Object { $_.Name -eq $sidecarName }) + if ($plugin.Count -ne 1) { + Write-Host "FAIL $($file.Name) - carries $($plugin.Count) $sidecarName, expected 1" + $failed += "$($file.Name) > $sidecarName (missing)" + } elseif (-not (Test-AwsSigner $plugin[0] "$($file.Name) > $sidecarName")) { + $failed += "$($file.Name) > $sidecarName (signer)" + } + } Remove-Item -Recurse -Force $extract -ErrorAction SilentlyContinue } } @@ -92,6 +120,14 @@ if ($nsisBuilt) { } else { Write-Host "OK app binary - signed before packaging ($($appSigned.Count)x)" } + # makensis packs the sidecar straight from app\src-tauri\binaries, so the + # file it read is the one to check. + if (-not (Test-Path -LiteralPath $sidecarSource)) { + Write-Host "FAIL $sidecarName - $sidecarSource is missing" + $failed += "NSIS > $sidecarName (missing)" + } elseif (-not (Test-AwsSigner (Get-Item -LiteralPath $sidecarSource) "NSIS > $sidecarName (as packed)")) { + $failed += "NSIS > $sidecarName (signer)" + } $tmp = $env:TRIPLE_C_SIGN_TMP $uninstaller = @() if ($tmp) { $uninstaller = @($log | Where-Object { $_.StartsWith($tmp, [StringComparison]::OrdinalIgnoreCase) }) } -- 2.52.0 From 381158cca05b5fecdc2d487f3db74f67023b3de2 Mon Sep 17 00:00:00 2001 From: Josh Knapp Date: Tue, 17 Nov 2026 06:44:30 -0800 Subject: [PATCH 04/12] docs: the bundled AWS session-manager-plugin Co-Authored-By: Claude Opus 5.5 --- CLAUDE.md | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 50 insertions(+), 2 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index afe1084..afb9b9e 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -14,7 +14,8 @@ All frontend/tauri commands run from the `app/` directory: cd app npm ci # Install dependencies (required first time) npx tauri dev # Launch app in dev mode with hot reload (Vite on port 1420) -npx tauri build # Production build (outputs to src-tauri/target/release/bundle/) +npx tauri build # Production build (outputs to src-tauri/target/release/bundle/); + # run ../scripts/fetch-ssm-plugin.sh first (bundled AWS plugin, see Packaging) npm run build # Frontend-only build (tsc + vite) npm run test # Run Vitest once npm run test:watch # Run Vitest in watch mode @@ -1225,6 +1226,52 @@ verbatim copy yields a launcher entry that starts nothing. It keeps `StartupWMCl the bundle sets it, which is what lets the shell match the window to the entry. Extraction uses `--appimage-extract`, which needs no FUSE, so the script works before `fuse2` is installed. +### The bundled AWS Session Manager plugin + +AWS workspaces connect through AWS's `session-manager-plugin` (`host/ssm.rs`), and the app +**bundles it as a Tauri sidecar** (`bundle.externalBin: binaries/session-manager-plugin`) so users +need not install it. Tauri copies it beside the app binary with the `-` suffix +stripped — `usr/bin/session-manager-plugin` in the AppImage, `Contents/MacOS/` on macOS, the +install directory on Windows (`session-manager-plugin.exe`), and `target//` under +`tauri dev`. `find_plugin()` resolves `TRIPLEC_SSM_PLUGIN` → **that sidecar (beside +`current_exe()`)** → `PATH` → AWS's install locations → the install hint; the order is +unit-tested (`host/ssm/tests.rs`, `plugin_resolution`). + +- **The binaries are never committed** (`app/src-tauri/binaries/` is ignored). + `scripts/fetch-ssm-plugin.sh …` (Linux/macOS) and `scripts/fetch-ssm-plugin.ps1` + (Windows) download a **pinned** version from AWS's S3 path, check a **pinned SHA-256 of the + artifact before extracting anything**, then AWS's GPG signature on the Linux `.deb` (`gpgv` + against `scripts/aws-ssm-plugin-signer.asc`, fingerprint pinned in the script; AWS publishes no + `.sig` for the macOS/Windows zips) or AWS's Authenticode signature on Windows, then a pinned + SHA-256 of the extracted binary. Any miss fails the build. Every build job in both workflows + runs it before `tauri build`. macOS builds `universal-apple-darwin`, which needs **three** + files: each thin slice (tauri-build checks the arch it is compiling) and the `lipo`'d universal + one (the bundler), whose slices the script checks are byte-identical to the pinned thin ones. + Bumping the version means new hashes in both scripts and the version line in + `THIRD_PARTY_NOTICES` (the scripts refuse to run when they disagree). +- **Debug builds get a placeholder; release builds refuse one.** tauri-build fails *any* build + whose externalBin file is missing, `cargo test` included. `build.rs` (`ensure_ssm_sidecar`) + writes a marked placeholder (`src/sidecar_placeholder.rs`) for a missing file when + `PROFILE=debug`, so `cargo test`/`cargo check`/`tauri dev` and CI's `test` job never need + AWS's S3, and `find_plugin()` skips it (falling back to an installed plugin). With + `PROFILE=release` a missing file **or** a placeholder stops the build. So `cargo build + --release` locally needs the fetch script first. `finalize-appimage.sh` additionally asserts the + shipped `usr/bin/session-manager-plugin` is an ELF that runs `--version`. +- **Windows: the plugin ships under AWS's signature, deliberately not re-signed.** It is + Authenticode-signed and timestamped by Amazon Web Services, Inc.; Tauri skips a sidecar that + `signtool verify /pa` accepts, so the sign command never sees it, and re-signing would cost a + metered signature to put our name on AWS's binary. `windows-sign.ps1` **refuses** (exits 1) if + it is ever presented — that means AWS's signature failed to verify, and the allowlist would + otherwise skip it and ship it unsigned. `windows-verify-signatures.ps1` requires the copy inside + the MSI (and the file NSIS packed) to be valid, timestamped and signed by AWS. +- **macOS: not code-signed by us**, because the app is not (no `APPLE_*`/`signingIdentity` in + the workflows); the plugin keeps AWS's Developer ID signature on both slices. If macOS signing + is ever configured, Tauri signs externalBin with the app's identity, inside-out, as it should. +- **Licence:** the plugin's source is Apache-2.0; its LICENSE, NOTICE and AWS's `THIRD-PARTY` + statement are reproduced in `app/src-tauri/THIRD_PARTY_NOTICES`, bundled as a resource + (`usr/lib/Triple-C/` in the AppImage — asserted by `finalize-appimage.sh`). Note AWS's + `THIRD-PARTY` file calls the binary "AWS Content" under the AWS Customer Agreement. + ### Windows code signing Windows **releases** (`build-app.yml`) are signed with **Azure Artifact Signing**: the app binary, @@ -1251,7 +1298,8 @@ without releasing (see Releases above). and its uninstaller). Tauri also presents build-time tools, the WiX extension DLLs and NSIS plugins, and signing those would more than double the metered count for no user-visible benefit. If the app ever ships resource DLLs or sidecars, extend the - allowlist, or they will go out unsigned. Tauri reports a failed sign command only as + allowlist, or they will go out unsigned. (The one sidecar so far, `session-manager-plugin`, is + AWS-signed and refused rather than re-signed; see the section above.) Tauri reports a failed sign command only as "failed to run powershell", so the script keeps a transcript (`.code-signing/sign-output.log`, `signtool /debug` included), and the job prints it on failure. - `scripts/windows-verify-signatures.ps1` checks `signtool verify /pa` plus a timestamp on the -- 2.52.0 From 5b23dc1aec7e69e5a39faee6864f81984c1c4438 Mon Sep 17 00:00:00 2001 From: Josh Knapp Date: Tue, 17 Nov 2026 08:12:11 -0800 Subject: [PATCH 05/12] build: build session-manager-plugin from source, not AWS's binaries AWS ships its prebuilt plugin as "AWS Content" under the AWS Customer Agreement; the source is Apache-2.0. Replace the binary fetch with scripts/build-ssm-plugin.sh (any triple, cross-compiles; universal via lipo) and build-ssm-plugin.ps1 (Windows runner): - source: tag 1.2.896.0 at commit 6430675a, GitHub archive SHA-256 checked before extraction; - Go 1.26.11 from go.dev, published SHA-256 checked before use; - the repo's own build (GOPATH mode, vendored deps, -s -w, sessionmanagerplugin-main) with VERSION stamped to the tag, plus -trimpath, no VCS stamp, empty build id, CGO off; - output must equal a pinned SHA-256 per target (reproducible builds). Each platform job builds its own targets. Windows: the exe is now ours and unsigned, so windows-sign.ps1 allowlists it and windows-verify-signatures.ps1 requires it signed by the installer's own certificate in the MSI and NSIS. THIRD_PARTY_NOTICES now carries the source's LICENSE/NOTICE/THIRD-PARTY, the commit, every linked vendored module's licence and Go's. AWS's GPG key and the AWS-signature checks are gone. Co-Authored-By: Claude Opus 5.5 --- .gitea/workflows/build-app-preview.yml | 44 +- .gitea/workflows/build-app.yml | 42 +- .gitignore | 2 +- CLAUDE.md | 86 +- app/src-tauri/THIRD_PARTY_NOTICES | 1112 +++++++++++++++++++--- app/src-tauri/build.rs | 16 +- app/src-tauri/src/sidecar_placeholder.rs | 13 +- scripts/aws-ssm-plugin-signer.asc | 14 - scripts/build-ssm-plugin.ps1 | 124 +++ scripts/build-ssm-plugin.sh | 228 +++++ scripts/fetch-ssm-plugin.ps1 | 103 -- scripts/fetch-ssm-plugin.sh | 189 ---- scripts/finalize-appimage.sh | 4 +- scripts/windows-sign.ps1 | 26 +- scripts/windows-verify-signatures.ps1 | 39 +- 15 files changed, 1480 insertions(+), 562 deletions(-) delete mode 100644 scripts/aws-ssm-plugin-signer.asc create mode 100644 scripts/build-ssm-plugin.ps1 create mode 100755 scripts/build-ssm-plugin.sh delete mode 100644 scripts/fetch-ssm-plugin.ps1 delete mode 100755 scripts/fetch-ssm-plugin.sh diff --git a/.gitea/workflows/build-app-preview.yml b/.gitea/workflows/build-app-preview.yml index e2da55f..fbc70c5 100644 --- a/.gitea/workflows/build-app-preview.yml +++ b/.gitea/workflows/build-app-preview.yml @@ -336,7 +336,7 @@ jobs: # `--locked`: test against the committed Cargo.lock, never a re-resolved # one, for the same reason the frontend uses `npm ci`. No plugin fetch # here: a debug build gets a placeholder for the session-manager-plugin - # sidecar from build.rs, so tests never depend on AWS's S3. + # sidecar from build.rs, so tests never build Go or download anything. - name: Backend tests (cargo test) working-directory: ./app/src-tauri run: | @@ -418,9 +418,6 @@ jobs: curl \ wget \ file \ - gnupg \ - gpgv \ - unzip \ xdg-utils - name: Install Rust stable @@ -474,11 +471,12 @@ jobs: npx tauri --version || npm install @tauri-apps/cli # The AWS Session Manager plugin, bundled as a sidecar (bundle.externalBin) - # so AWS workspaces work without the user installing it. Pinned version, - # SHA-256 and AWS's GPG signature checked; fails the job on any mismatch. - # A release build refuses to start without it (build.rs). - - name: Fetch the AWS Session Manager plugin - run: bash scripts/fetch-ssm-plugin.sh x86_64-unknown-linux-gnu + # so AWS workspaces work without the user installing it. Built here from + # AWS's Apache-2.0 source (pinned commit + archive SHA-256) with a pinned, + # hash-checked Go; the output must match a pinned SHA-256 (reproducible + # build). A release build refuses to start without it (build.rs). + - name: Build the AWS Session Manager plugin + run: bash scripts/build-ssm-plugin.sh x86_64-unknown-linux-gnu - name: Build Tauri app working-directory: ./app @@ -609,14 +607,14 @@ jobs: export PATH="$HOME/.cargo/bin:$PATH" npx tauri --version || npm install @tauri-apps/cli - # The AWS Session Manager plugin sidecar (bundle.externalBin): both thin - # slices (tauri-build checks each arch it compiles) and the lipo'd - # universal one the bundler copies into Contents/MacOS. Pinned version and - # SHA-256s; fails the job on any mismatch. Not re-signed here: the app is - # not code-signed on macOS, so the plugin keeps AWS's Developer ID - # signature (with APPLE_* signing configured, Tauri would sign it too). - - name: Fetch the AWS Session Manager plugin - run: bash scripts/fetch-ssm-plugin.sh universal-apple-darwin + # The AWS Session Manager plugin sidecar (bundle.externalBin), built from + # source (see build-ssm-plugin.sh): both thin slices (tauri-build checks + # each arch it compiles) and the lipo'd universal one the bundler copies + # into Contents/MacOS. Each must match its pinned SHA-256. Signed exactly + # like the app: Go ad-hoc signs the arm64 slice, and with APPLE_* signing + # configured Tauri would sign the sidecar with the app's identity. + - name: Build the AWS Session Manager plugin + run: bash scripts/build-ssm-plugin.sh universal-apple-darwin - name: Build Tauri app (universal) working-directory: ./app @@ -750,12 +748,12 @@ jobs: set "PATH=%USERPROFILE%\.cargo\bin;C:\Program Files\nodejs;%PATH%" npm run build - # The AWS Session Manager plugin sidecar (bundle.externalBin). Pinned - # version and SHA-256s, and AWS's Authenticode signature required; fails - # the job on any mismatch. It ships under AWS's signature, not ours (see - # the script and windows-sign.ps1). - - name: Fetch the AWS Session Manager plugin - run: powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass -File scripts\fetch-ssm-plugin.ps1 + # The AWS Session Manager plugin sidecar (bundle.externalBin), built from + # source (see build-ssm-plugin.ps1); must match its pinned SHA-256. It + # comes out unsigned, so it ships unsigned in previews, like the + # app (releases sign it: see build-app.yml). + - name: Build the AWS Session Manager plugin + run: powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass -File scripts\build-ssm-plugin.ps1 - name: Build Tauri app working-directory: ./app diff --git a/.gitea/workflows/build-app.yml b/.gitea/workflows/build-app.yml index 61a194b..11b937f 100644 --- a/.gitea/workflows/build-app.yml +++ b/.gitea/workflows/build-app.yml @@ -174,9 +174,6 @@ jobs: curl \ wget \ file \ - gnupg \ - gpgv \ - unzip \ xdg-utils - name: Install Rust stable @@ -231,11 +228,12 @@ jobs: npx tauri --version || npm install @tauri-apps/cli # The AWS Session Manager plugin, bundled as a sidecar (bundle.externalBin) - # so AWS workspaces work without the user installing it. Pinned version, - # SHA-256 and AWS's GPG signature checked; fails the job on any mismatch. - # A release build refuses to start without it (build.rs). - - name: Fetch the AWS Session Manager plugin - run: bash scripts/fetch-ssm-plugin.sh x86_64-unknown-linux-gnu + # so AWS workspaces work without the user installing it. Built here from + # AWS's Apache-2.0 source (pinned commit + archive SHA-256) with a pinned, + # hash-checked Go; the output must match a pinned SHA-256 (reproducible + # build). A release build refuses to start without it (build.rs). + - name: Build the AWS Session Manager plugin + run: bash scripts/build-ssm-plugin.sh x86_64-unknown-linux-gnu - name: Build Tauri app working-directory: ./app @@ -427,14 +425,14 @@ jobs: export PATH="$HOME/.cargo/bin:$PATH" npx tauri --version || npm install @tauri-apps/cli - # The AWS Session Manager plugin sidecar (bundle.externalBin): both thin - # slices (tauri-build checks each arch it compiles) and the lipo'd - # universal one the bundler copies into Contents/MacOS. Pinned version and - # SHA-256s; fails the job on any mismatch. Not re-signed here: the app is - # not code-signed on macOS, so the plugin keeps AWS's Developer ID - # signature (with APPLE_* signing configured, Tauri would sign it too). - - name: Fetch the AWS Session Manager plugin - run: bash scripts/fetch-ssm-plugin.sh universal-apple-darwin + # The AWS Session Manager plugin sidecar (bundle.externalBin), built from + # source (see build-ssm-plugin.sh): both thin slices (tauri-build checks + # each arch it compiles) and the lipo'd universal one the bundler copies + # into Contents/MacOS. Each must match its pinned SHA-256. Signed exactly + # like the app: Go ad-hoc signs the arm64 slice, and with APPLE_* signing + # configured Tauri would sign the sidecar with the app's identity. + - name: Build the AWS Session Manager plugin + run: bash scripts/build-ssm-plugin.sh universal-apple-darwin - name: Build Tauri app (universal) working-directory: ./app @@ -675,12 +673,12 @@ jobs: set "PATH=%USERPROFILE%\.cargo\bin;C:\Program Files\nodejs;%PATH%" npm run build - # The AWS Session Manager plugin sidecar (bundle.externalBin). Pinned - # version and SHA-256s, and AWS's Authenticode signature required; fails - # the job on any mismatch. It ships under AWS's signature, not ours (see - # the script and windows-sign.ps1). - - name: Fetch the AWS Session Manager plugin - run: powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass -File scripts\fetch-ssm-plugin.ps1 + # The AWS Session Manager plugin sidecar (bundle.externalBin), built from + # source (see build-ssm-plugin.ps1); must match its pinned SHA-256. It + # comes out unsigned, so Tauri hands it to the sign command and + # "Verify signatures" requires our signature on it in both installers. + - name: Build the AWS Session Manager plugin + run: powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass -File scripts\build-ssm-plugin.ps1 # Releases are signed with Azure Artifact Signing (scripts/windows-*.ps1). # The setup fetches the signing client and a job-local .NET runtime, and diff --git a/.gitignore b/.gitignore index 84caf6c..59e925e 100644 --- a/.gitignore +++ b/.gitignore @@ -28,6 +28,6 @@ screenshot_for_fix/ *.tfstate.* .terraform.tfstate.lock.info -# The bundled AWS session-manager-plugin sidecar (scripts/fetch-ssm-plugin.*) and the +# The bundled AWS session-manager-plugin sidecar (scripts/build-ssm-plugin.*, built from source) and the # debug-build placeholder build.rs writes there. Never committed. app/src-tauri/binaries/ diff --git a/CLAUDE.md b/CLAUDE.md index afb9b9e..20cbaff 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -15,7 +15,7 @@ cd app npm ci # Install dependencies (required first time) npx tauri dev # Launch app in dev mode with hot reload (Vite on port 1420) npx tauri build # Production build (outputs to src-tauri/target/release/bundle/); - # run ../scripts/fetch-ssm-plugin.sh first (bundled AWS plugin, see Packaging) + # run ../scripts/build-ssm-plugin.sh first (bundled AWS plugin, see Packaging) npm run build # Frontend-only build (tsc + vite) npm run test # Run Vitest once npm run test:watch # Run Vitest in watch mode @@ -1237,45 +1237,57 @@ install directory on Windows (`session-manager-plugin.exe`), and `target/…` (Linux/macOS) and `scripts/fetch-ssm-plugin.ps1` - (Windows) download a **pinned** version from AWS's S3 path, check a **pinned SHA-256 of the - artifact before extracting anything**, then AWS's GPG signature on the Linux `.deb` (`gpgv` - against `scripts/aws-ssm-plugin-signer.asc`, fingerprint pinned in the script; AWS publishes no - `.sig` for the macOS/Windows zips) or AWS's Authenticode signature on Windows, then a pinned - SHA-256 of the extracted binary. Any miss fails the build. Every build job in both workflows - runs it before `tauri build`. macOS builds `universal-apple-darwin`, which needs **three** - files: each thin slice (tauri-build checks the arch it is compiling) and the `lipo`'d universal - one (the bundler), whose slices the script checks are byte-identical to the pinned thin ones. - Bumping the version means new hashes in both scripts and the version line in - `THIRD_PARTY_NOTICES` (the scripts refuse to run when they disagree). +- **We build it from source; we never ship AWS's binaries.** AWS distributes its prebuilt plugin + as "AWS Content" under the AWS Customer Agreement; the source (github.com/aws/session-manager-plugin) + is Apache-2.0. `scripts/build-ssm-plugin.sh …` (Linux/macOS; any triple, it + cross-compiles) and `scripts/build-ssm-plugin.ps1` (the Windows runner, which has no bash) take + the tag's **commit** as GitHub's archive (pinned SHA-256, checked before extraction) and a + **pinned Go** from go.dev (go.dev's published SHA-256), and run the repo's own build — GOPATH + mode over its vendored deps, `-ldflags "-s -w"`, `sessionmanagerplugin-main` — with `VERSION` + stamped to the tag (the repo's file says `1.3.0.0`; AWS's pipeline stamps the real one, so + `--version` would otherwise lie), plus `-trimpath`, no VCS stamp, empty build id, `CGO_ENABLED=0` + and a scrubbed Go environment. **The output must equal a pinned SHA-256 per target**: Go builds + are reproducible across hosts, so every runner must produce the exact bytes recorded in the + scripts (verified locally: Linux-hosted builds of every target, repeated in fresh directories, + and the `.ps1` flow, are identical). A mismatch fails the build and means the source, toolchain + or flags changed — never "update the hash" without knowing which. +- **Each platform job builds its own targets** before `tauri build` (Linux: `x86_64-unknown-linux-gnu`; + macOS: `universal-apple-darwin`, i.e. both thin slices — tauri-build checks the arch it compiles — + plus the `lipo`'d universal file the bundler wants, whose slices must thin back out byte-identical + to the pins; Windows: the `.ps1`). Not one Linux job feeding the others: workflow artifacts do + not work on this Gitea (see `build-app-preview.yml`'s header), and with reproducible output and + pinned hashes nothing is gained by building once. +- **Bumping** the plugin or Go: new pins in **both** scripts, rebuild every target, record the new + output hashes, and update `app/src-tauri/THIRD_PARTY_NOTICES` (the scripts refuse to run unless + its `Version:`/`Commit:` lines match) including its dependency licences. - **Debug builds get a placeholder; release builds refuse one.** tauri-build fails *any* build whose externalBin file is missing, `cargo test` included. `build.rs` (`ensure_ssm_sidecar`) writes a marked placeholder (`src/sidecar_placeholder.rs`) for a missing file when - `PROFILE=debug`, so `cargo test`/`cargo check`/`tauri dev` and CI's `test` job never need - AWS's S3, and `find_plugin()` skips it (falling back to an installed plugin). With - `PROFILE=release` a missing file **or** a placeholder stops the build. So `cargo build - --release` locally needs the fetch script first. `finalize-appimage.sh` additionally asserts the - shipped `usr/bin/session-manager-plugin` is an ELF that runs `--version`. -- **Windows: the plugin ships under AWS's signature, deliberately not re-signed.** It is - Authenticode-signed and timestamped by Amazon Web Services, Inc.; Tauri skips a sidecar that - `signtool verify /pa` accepts, so the sign command never sees it, and re-signing would cost a - metered signature to put our name on AWS's binary. `windows-sign.ps1` **refuses** (exits 1) if - it is ever presented — that means AWS's signature failed to verify, and the allowlist would - otherwise skip it and ship it unsigned. `windows-verify-signatures.ps1` requires the copy inside - the MSI (and the file NSIS packed) to be valid, timestamped and signed by AWS. -- **macOS: not code-signed by us**, because the app is not (no `APPLE_*`/`signingIdentity` in - the workflows); the plugin keeps AWS's Developer ID signature on both slices. If macOS signing - is ever configured, Tauri signs externalBin with the app's identity, inside-out, as it should. -- **Licence:** the plugin's source is Apache-2.0; its LICENSE, NOTICE and AWS's `THIRD-PARTY` - statement are reproduced in `app/src-tauri/THIRD_PARTY_NOTICES`, bundled as a resource - (`usr/lib/Triple-C/` in the AppImage — asserted by `finalize-appimage.sh`). Note AWS's - `THIRD-PARTY` file calls the binary "AWS Content" under the AWS Customer Agreement. + `PROFILE=debug`, so `cargo test`/`cargo check`/`tauri dev` and CI's `test` job need neither Go + nor the network, and `find_plugin()` skips it (falling back to an installed plugin). With + `PROFILE=release` a missing file **or** a placeholder stops the build, so a local `cargo build + --release` needs the build script first. `finalize-appimage.sh` asserts the shipped + `usr/bin/session-manager-plugin` is an ELF that runs `--version`. +- **Windows: our build is unsigned, so the release signs it with our certificate.** Tauri runs + `signtool verify /pa` on each sidecar and hands the unsigned one to the sign command, in place + under `app\src-tauri\binaries` before any bundle (both MSI and NSIS pack that file); + `windows-sign.ps1`'s allowlist includes it (one more metered signature per release: 6). + `windows-verify-signatures.ps1` requires exactly one `session-manager-plugin.exe` in the MSI and + the file NSIS packed to be validly signed, timestamped, **by the same certificate as the + installer**, and the signing log to show it. Previews ship it unsigned, like the app. +- **macOS: signed exactly like the app.** The app is not code-signed (no `APPLE_*`/`signingIdentity` + in the workflows); Go's linker ad-hoc signs the arm64 slice (needed to run on Apple Silicon). If + signing is ever configured, Tauri signs externalBin with the app's identity, inside-out. +- **Licence:** `app/src-tauri/THIRD_PARTY_NOTICES` (bundled as a resource; `usr/lib/Triple-C/` in + the AppImage, asserted by `finalize-appimage.sh`) carries the plugin's Apache-2.0 LICENSE and + NOTICE, the commit we build, the repo's own `THIRD-PARTY` file verbatim, the licence of every + vendored module linked in (`go list -deps` for linux/darwin/windows) and Go's own. Note that the + repo's `THIRD-PARTY` file opens with the same "AWS Content" sentence as the binary packages. ### Windows code signing Windows **releases** (`build-app.yml`) are signed with **Azure Artifact Signing**: the app binary, -the MSI, the NSIS installer and its uninstaller. Three scripts do it, and "Verify signatures" +the bundled `session-manager-plugin`, the MSI, the NSIS installer and its uninstaller. Three scripts do it, and "Verify signatures" fails the job if any of them is unsigned or untimestamped, so an unsigned installer cannot ship quietly. **PR previews are deliberately not signed**, and `build-app-preview.yml` must not reference the signing secrets. Two reasons: signing is metered (about 1000 signatures a month, @@ -1293,13 +1305,13 @@ without releasing (see Releases above). - `scripts/windows-sign.ps1` is the sign command: `signtool sign /dlib` with SHA-256 and the Microsoft timestamp server, retried. Credentials never reach a command line — the dlib reads `AZURE_TENANT_ID` / `AZURE_CLIENT_ID` / `AZURE_CLIENT_SECRET` from the environment. - **It signs only an allowlist of what ships**: 5 signatures per release (the app binary twice, + **It signs only an allowlist of what ships**: 6 signatures per release (the app binary twice, because Tauri re-patches it between the MSI and NSIS bundles; the MSI; the NSIS installer; - and its uninstaller). Tauri also presents build-time tools, the WiX extension DLLs and NSIS + its uninstaller; and the `session-manager-plugin` sidecar we build from source). Tauri also presents build-time tools, the WiX extension DLLs and NSIS plugins, and signing those would more than double the metered count for no user-visible benefit. If the app ever ships resource DLLs or sidecars, extend the - allowlist, or they will go out unsigned. (The one sidecar so far, `session-manager-plugin`, is - AWS-signed and refused rather than re-signed; see the section above.) Tauri reports a failed sign command only as + allowlist, or they will go out unsigned (as `session-manager-plugin`'s entry does; see the + section above). Tauri reports a failed sign command only as "failed to run powershell", so the script keeps a transcript (`.code-signing/sign-output.log`, `signtool /debug` included), and the job prints it on failure. - `scripts/windows-verify-signatures.ps1` checks `signtool verify /pa` plus a timestamp on the diff --git a/app/src-tauri/THIRD_PARTY_NOTICES b/app/src-tauri/THIRD_PARTY_NOTICES index 98463f9..81c37f9 100644 --- a/app/src-tauri/THIRD_PARTY_NOTICES +++ b/app/src-tauri/THIRD_PARTY_NOTICES @@ -5,139 +5,28 @@ Triple-C itself is licensed under the terms in LICENSE at the root of its source repository. The desktop app bundles the following third-party software, which is distributed under its own terms, reproduced below. ------------------------------------------------------------------------- +======================================================================== AWS Session Manager plugin (session-manager-plugin) ------------------------------------------------------------------------- +======================================================================== Version: 1.2.896.0 -Source: https://github.com/aws/session-manager-plugin -Binaries: https://s3.amazonaws.com/session-manager-downloads/plugin/1.2.896.0/ - (unmodified; fetched and SHA-256 checked by scripts/fetch-ssm-plugin.*) +Commit: 6430675a44032a551be1937fb27a2d3fdfeb27f7 +Source: https://github.com/aws/session-manager-plugin (tag 1.2.896.0) +License: Apache License 2.0 -Bundled beside the Triple-C executable as `session-manager-plugin` -(`session-manager-plugin.exe` on Windows). Triple-C runs it as a child -process to connect to workspaces hosted on AWS. +Triple-C builds this program itself from the source above +(scripts/build-ssm-plugin.sh / .ps1, Go 1.26.11, the repository's own build +with the version stamped to 1.2.896.0); it does not redistribute AWS's prebuilt +binaries. The source is unmodified. It is bundled beside the Triple-C +executable as `session-manager-plugin` (`session-manager-plugin.exe` on +Windows), and Triple-C runs it as a child process to connect to workspaces +hosted on AWS. ---- NOTICE ---- Session Manager Plugin Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. ----- THIRD-PARTY (as shipped by AWS with the plugin) ---- - -The Amazon Session Manager Plugin constitutes AWS Content as defined in the AWS Customer Agreement -or your relevant customer agreement with AWS, and is licensed to you under that agreement. - -The Amazon Session Manager Plugin includes the following third-party software/licensing: - -** cihub/seelog - https://github.com/cihub/seelog -Copyright (c) 2012, Cloud Instruments Co., Ltd. . All rights reserved. -** gorilla/websocket - https://github.com/gorilla/websocket -Copyright (c) 2013 The Gorilla WebSocket Authors. All rights reserved. -** fsnotigy/fsnotify - https://github.com/fsnotify/fsnotify -Copyright (c) 2012 The Go Authors. All rights reserved. -Copyright (c) 2012 fsnotify Authors. All rights reserved. -** pmezard/go-difflib - https://github.com/pmezard/go-difflib -Copyright (c) 2013, Patrick Mezard - -BSD License - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - * Neither the name of the Cloud Instruments Co., Ltd. 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 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. - ----------------- - -** twinj/uuid - https://github.com/twinj/uuid -Copyright (C) 2011 by Krzysztof Kowalik -Copyright (C) 2016 by Daniel Kemp Derivative work -** stretchr/testify - https://github.com/stretchr/testify -Copyright (c) 2012 - 2013 Mat Ryer and Tyler Bunnell -** stretchr/objx - https://github.com/stretchr/objx -Copyright (c) 2014 Stretchr, Inc. -Copyright (c) 2017-2018 objx contributors -** eiannone/keyboard - https://github.com/eiannone/keyboard -Copyright (C) 2012 termbox-go authors -Copyright (c) 2015 Emanuele Iannone -** xtaci/smux - https://github.com/xtaci/smux -Copyright (c) 2016-2017 Daniel Fu - -MIT License - -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. - ----------------- - -** davecgh/go-spew - https://github.com/davecgh/go-spew -Copyright (c) 2012-2016 Dave Collins - -ISC License - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - ----------------- - -** jmespath/go-jmespath - https://github.com/jmespath/go-jmespath -Copyright 2015 James Saryerwinnie -** go-yaml/yaml - https://github.com/go-yaml/yaml -Copyright (c) 2011-2019 Canonical Ltd - -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. - ---- LICENSE ---- Apache License @@ -340,4 +229,979 @@ limitations under the License. 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. \ No newline at end of file + limitations under the License. + +---- THIRD-PARTY (the source repository's own file, verbatim) ---- + +The Amazon Session Manager Plugin constitutes AWS Content as defined in the AWS Customer Agreement +or your relevant customer agreement with AWS, and is licensed to you under that agreement. + +The Amazon Session Manager Plugin includes the following third-party software/licensing: + +** cihub/seelog - https://github.com/cihub/seelog +Copyright (c) 2012, Cloud Instruments Co., Ltd. . All rights reserved. +** gorilla/websocket - https://github.com/gorilla/websocket +Copyright (c) 2013 The Gorilla WebSocket Authors. All rights reserved. +** fsnotigy/fsnotify - https://github.com/fsnotify/fsnotify +Copyright (c) 2012 The Go Authors. All rights reserved. +Copyright (c) 2012 fsnotify Authors. All rights reserved. +** pmezard/go-difflib - https://github.com/pmezard/go-difflib +Copyright (c) 2013, Patrick Mezard + +BSD License + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of the Cloud Instruments Co., Ltd. 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 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. + +---------------- + +** twinj/uuid - https://github.com/twinj/uuid +Copyright (C) 2011 by Krzysztof Kowalik +Copyright (C) 2016 by Daniel Kemp Derivative work +** stretchr/testify - https://github.com/stretchr/testify +Copyright (c) 2012 - 2013 Mat Ryer and Tyler Bunnell +** stretchr/objx - https://github.com/stretchr/objx +Copyright (c) 2014 Stretchr, Inc. +Copyright (c) 2017-2018 objx contributors +** eiannone/keyboard - https://github.com/eiannone/keyboard +Copyright (C) 2012 termbox-go authors +Copyright (c) 2015 Emanuele Iannone +** xtaci/smux - https://github.com/xtaci/smux +Copyright (c) 2016-2017 Daniel Fu + +MIT License + +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. + +---------------- + +** davecgh/go-spew - https://github.com/davecgh/go-spew +Copyright (c) 2012-2016 Dave Collins + +ISC License + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +---------------- + +** jmespath/go-jmespath - https://github.com/jmespath/go-jmespath +Copyright 2015 James Saryerwinnie +** go-yaml/yaml - https://github.com/go-yaml/yaml +Copyright (c) 2011-2019 Canonical Ltd + +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. + +======================================================================== +Go modules compiled into session-manager-plugin +======================================================================== + +The packages below are vendored in the plugin's source repository +(vendor/src) and linked into the binary (`go list -deps` for linux, darwin +and windows). Each module's licence file, verbatim. + +------------------------------------------------------------------------ +github.com/aws/aws-sdk-go-v2 +------------------------------------------------------------------------ + +---- LICENSE.txt ---- + + 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. + +---- NOTICE.txt ---- + +AWS SDK for Go +Copyright 2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. +Copyright 2014-2015 Stripe, Inc. + +------------------------------------------------------------------------ +github.com/aws/smithy-go +------------------------------------------------------------------------ + +---- LICENSE ---- + + 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. + +---- NOTICE ---- + +Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + +------------------------------------------------------------------------ +github.com/cihub/seelog +------------------------------------------------------------------------ + +Copyright (c) 2012, Cloud Instruments Co., Ltd. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of the Cloud Instruments Co., Ltd. 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 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. + +------------------------------------------------------------------------ +github.com/davecgh/go-spew +------------------------------------------------------------------------ + +ISC License + +Copyright (c) 2012-2016 Dave Collins + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +------------------------------------------------------------------------ +github.com/fsnotify/fsnotify +------------------------------------------------------------------------ + +Copyright (c) 2012 The Go Authors. All rights reserved. +Copyright (c) 2012 fsnotify Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +------------------------------------------------------------------------ +github.com/gorilla/websocket +------------------------------------------------------------------------ + +Copyright (c) 2013 The Gorilla WebSocket Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +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. + +------------------------------------------------------------------------ +github.com/pmezard/go-difflib +------------------------------------------------------------------------ + +Copyright (c) 2013, Patrick Mezard +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + The names of its contributors may not 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. + +------------------------------------------------------------------------ +github.com/stretchr/objx +------------------------------------------------------------------------ + +The MIT License + +Copyright (c) 2014 Stretchr, Inc. +Copyright (c) 2017-2018 objx contributors + +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. + +------------------------------------------------------------------------ +github.com/stretchr/testify +------------------------------------------------------------------------ + +MIT License + +Copyright (c) 2012-2020 Mat Ryer, Tyler Bunnell and contributors. + +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. + +------------------------------------------------------------------------ +github.com/twinj/uuid +------------------------------------------------------------------------ + +Copyright (C) 2011 by Krzysztof Kowalik +Copyright (C) 2014 by Daniel Kemp Derivative work + +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. + +------------------------------------------------------------------------ +github.com/xtaci/smux +------------------------------------------------------------------------ + +MIT License + +Copyright (c) 2016-2017 Daniel Fu + +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. + +------------------------------------------------------------------------ +golang.org/x/sync +------------------------------------------------------------------------ + +Copyright (c) 2009 The Go Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +------------------------------------------------------------------------ +golang.org/x/sys +------------------------------------------------------------------------ + +Copyright (c) 2009 The Go Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +------------------------------------------------------------------------ +golang.org/x/term +------------------------------------------------------------------------ + +Copyright (c) 2009 The Go Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +------------------------------------------------------------------------ +gopkg.in/yaml.v3 +------------------------------------------------------------------------ + +---- LICENSE ---- + +This project is covered by two different licenses: MIT and Apache. + +#### MIT License #### + +The following files were ported to Go from C files of libyaml, and thus +are still covered by their original MIT license, with the additional +copyright staring in 2011 when the project was ported over: + + apic.go emitterc.go parserc.go readerc.go scannerc.go + writerc.go yamlh.go yamlprivateh.go + +Copyright (c) 2006-2010 Kirill Simonov +Copyright (c) 2006-2011 Kirill Simonov + +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. + +### Apache License ### + +All the remaining project files are covered by the Apache license: + +Copyright (c) 2011-2019 Canonical Ltd + +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. + +---- NOTICE ---- + +Copyright 2011-2016 Canonical Ltd. + +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. + +------------------------------------------------------------------------ +golang.org/x/crypto +------------------------------------------------------------------------ + +Vendored without its licence file; golang.org/x/crypto is distributed under +the same BSD-3-Clause licence, Copyright (c) 2009 The Go Authors, as +golang.org/x/sys above. + +======================================================================== +The Go standard library and runtime (Go 1.26.11) +======================================================================== + +Copyright 2009 The Go Authors. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google LLC nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/app/src-tauri/build.rs b/app/src-tauri/build.rs index 7d0c76c..421a50f 100644 --- a/app/src-tauri/build.rs +++ b/app/src-tauri/build.rs @@ -212,13 +212,13 @@ fn check_tauri_config() { /// `bundle.externalBin` names `binaries/session-manager-plugin`, and tauri-build stops on a /// missing `binaries/session-manager-plugin-[.exe]` for every build, tests -/// included. The real one comes from `scripts/fetch-ssm-plugin.sh` (`.ps1` on Windows), which -/// CI runs before `tauri build`. +/// included. The real one is built from AWS's source by `scripts/build-ssm-plugin.sh` (`.ps1` on +/// Windows), which CI runs before `tauri build`. /// /// - **Release profile:** the real plugin is required. A missing file or a placeholder stops /// the build here, so a placeholder can never ship. /// - **Debug profile** (`cargo test`, `cargo check`, `tauri dev`): a missing file is replaced -/// by a placeholder (`src/sidecar_placeholder.rs`) so no test run needs AWS's S3. The app's +/// by a placeholder (`src/sidecar_placeholder.rs`) so no test run needs Go or the network. The app's /// `find_plugin` skips a placeholder and falls back to an installed plugin. fn ensure_ssm_sidecar() { let target = std::env::var("TARGET").expect("cargo sets TARGET"); @@ -227,10 +227,10 @@ fn ensure_ssm_sidecar() { println!("cargo:rerun-if-changed={}", path.display()); let release = std::env::var("PROFILE").as_deref() == Ok("release"); let head = std::fs::read(&path).ok().map(|b| sidecar_placeholder::is_placeholder(&b)); - let fetch = if target.contains("windows") { - "scripts\\fetch-ssm-plugin.ps1" + let build = if target.contains("windows") { + "scripts\\build-ssm-plugin.ps1" } else { - "scripts/fetch-ssm-plugin.sh" + "scripts/build-ssm-plugin.sh" }; match (head, release) { (Some(false), _) => {} @@ -241,7 +241,7 @@ fn ensure_ssm_sidecar() { path.display(), if state.is_some() { "a debug-build placeholder" } else { "missing" } )], - &format!("Run {fetch} {target} from the repository root first."), + &format!("Run {build} {target} from the repository root first."), ), (None, false) => { std::fs::create_dir_all("binaries").expect("create src-tauri/binaries"); @@ -249,7 +249,7 @@ fn ensure_ssm_sidecar() { .unwrap_or_else(|e| panic!("cannot write {}: {e}", path.display())); println!( "cargo:warning=no {} - wrote a placeholder (debug only; AWS workspaces use an \ - installed plugin). Run {fetch} to bundle the real one.", + installed plugin). Run {build} to build the real one.", path.display() ); } diff --git a/app/src-tauri/src/sidecar_placeholder.rs b/app/src-tauri/src/sidecar_placeholder.rs index 85908a4..295dea5 100644 --- a/app/src-tauri/src/sidecar_placeholder.rs +++ b/app/src-tauri/src/sidecar_placeholder.rs @@ -3,10 +3,11 @@ //! //! `bundle.externalBin` makes tauri-build fail outright when the per-target file is missing, //! for `cargo test`, `cargo check` and `tauri dev` as much as for a release. The real binary -//! comes from `scripts/fetch-ssm-plugin.sh` (`.ps1` on Windows), which downloads a pinned, -//! hash-checked AWS release; requiring that for every test run would put AWS's S3 on the path -//! of every `cargo test`. So debug builds get this placeholder instead, a release build refuses -//! it (`build.rs`), and `host::ssm::find_plugin` skips it and falls back to an installed plugin. +//! is built from AWS's pinned source by `scripts/build-ssm-plugin.sh` (`.ps1` on Windows), with +//! a downloaded Go toolchain; requiring that for every test run would put a Go build and the +//! network on the path of every `cargo test`. So debug builds get this placeholder instead, a +//! release build refuses it (`build.rs`), and `host::ssm::find_plugin` skips it and falls back to +//! an installed plugin. //! //! Shared by `build.rs` (through `#[path]`) and the app, so the two cannot disagree. @@ -19,8 +20,8 @@ pub fn contents() -> Vec { let mut v = MARKER.to_vec(); v.extend_from_slice( b"\nNot the AWS Session Manager plugin. Debug builds get this when \ - app/src-tauri/binaries has no real one; run scripts/fetch-ssm-plugin.sh \ - (scripts/fetch-ssm-plugin.ps1 on Windows) to bundle the real plugin.\n", + app/src-tauri/binaries has no real one; run scripts/build-ssm-plugin.sh \ + (scripts/build-ssm-plugin.ps1 on Windows) to build the real plugin.\n", ); v } diff --git a/scripts/aws-ssm-plugin-signer.asc b/scripts/aws-ssm-plugin-signer.asc deleted file mode 100644 index 8b4388e..0000000 --- a/scripts/aws-ssm-plugin-signer.asc +++ /dev/null @@ -1,14 +0,0 @@ ------BEGIN PGP PUBLIC KEY BLOCK----- - -mFIEZ5ERQxMIKoZIzj0DAQcCAwQjuZy+IjFoYg57sLTGhF3aZLBaGpzB+gY6j7Ix -P7NqbpXyjVj8a+dy79gSd64OEaMxUb7vw/jug+CfRXwVGRMNtIBBV1MgU1NNIFNl -c3Npb24gTWFuYWdlciA8c2Vzc2lvbi1tYW5hZ2VyLXBsdWdpbi1zaWduZXJAYW1h -em9uLmNvbT4gKEFXUyBTeXN0ZW1zIE1hbmFnZXIgU2Vzc2lvbiBNYW5hZ2VyIFBs -dWdpbiBMaW51eCBTaWduZXIgS2V5KYkBAAQQEwgAqAUCZ5ERQ4EcQVdTIFNTTSBT -ZXNzaW9uIE1hbmFnZXIgPHNlc3Npb24tbWFuYWdlci1wbHVnaW4tc2lnbmVyQGFt -YXpvbi5jb20+IChBV1MgU3lzdGVtcyBNYW5hZ2VyIFNlc3Npb24gTWFuYWdlciBQ -bHVnaW4gTGludXggU2lnbmVyIEtleSkWIQR5WWNxJM4JOtUB1HosTUr/b2dX7gIe -AwIbAwIVCAAKCRAsTUr/b2dX7rO1AQCa1kig3lQ78W/QHGU76uHx3XAyv0tfpE9U -oQBCIwFLSgEA3PDHt3lZ+s6m9JLGJsy+Cp5ZFzpiF6RgluR/2gA861M= -=2DQm ------END PGP PUBLIC KEY BLOCK----- diff --git a/scripts/build-ssm-plugin.ps1 b/scripts/build-ssm-plugin.ps1 new file mode 100644 index 0000000..c54f64d --- /dev/null +++ b/scripts/build-ssm-plugin.ps1 @@ -0,0 +1,124 @@ +# build-ssm-plugin.ps1 - build AWS's session-manager-plugin FROM SOURCE for +# Windows and put it where Tauri's bundle.externalBin expects it: +# +# app\src-tauri\binaries\session-manager-plugin-x86_64-pc-windows-msvc.exe +# +# The Windows runner's half of scripts/build-ssm-plugin.sh - read that header +# for the why. The same pins and the same build, so it must produce the same +# bytes (Go builds are reproducible across hosts); keep the two in step. +# +# 1. Source: AWS's tag 1.2.896.0 by COMMIT, as GitHub's archive of that +# commit, SHA-256 checked before extraction (and its top directory must +# name the commit). +# 2. Toolchain: Go, pinned, SHA-256 as published by go.dev, checked before use. +# 3. AWS's own build (GOPATH mode over the vendored deps, -ldflags "-s -w"), +# version stamped to the tag, made reproducible (-trimpath, no VCS stamp, +# empty build id, CGO off, GOAMD64=v1, nothing inherited). +# 4. The output must equal the pinned SHA-256. +# +# The result is UNSIGNED: in a release build Tauri presents it to the sign +# command (windows-sign.ps1 signs it with our certificate), and +# windows-verify-signatures.ps1 requires our signature on it in both installers. +# +# Needs tar.exe (bsdtar, in every Windows 10+). Idempotent. + +$ErrorActionPreference = 'Stop' +[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 +Add-Type -AssemblyName System.IO.Compression.FileSystem + +$PluginVersion = '1.2.896.0' +$PluginCommit = '6430675a44032a551be1937fb27a2d3fdfeb27f7' +$SourceUrl = "https://codeload.github.com/aws/session-manager-plugin/tar.gz/$PluginCommit" +$SourceSha = '7C95BE411AD5F43D14D01460500BFD5A5AA0E28BA94815F8B049AF33A2C381B0' +$GoVersion = '1.26.11' +$GoSha = '71AE086F0137E665F855A811CC119152B6A783E0BBC1B906E709F46D80141EB0' # go1.26.11.windows-amd64.zip, go.dev +$BinarySha = '6D428E5FD77E76D9713F0C42B8EC39F2DE1031E5F3C567FEB73C7FE11B14B226' +$Triple = 'x86_64-pc-windows-msvc' + +$repoRoot = Split-Path -Parent $PSScriptRoot +$destDir = Join-Path $repoRoot 'app\src-tauri\binaries' +$dest = Join-Path $destDir "session-manager-plugin-$Triple.exe" +$notices = Join-Path $repoRoot 'app\src-tauri\THIRD_PARTY_NOTICES' + +function Get-Sha256([string]$Path) { (Get-FileHash -LiteralPath $Path -Algorithm SHA256).Hash.ToUpperInvariant() } + +if (-not ((Select-String -LiteralPath $notices -SimpleMatch "Version: $PluginVersion" -Quiet) -and + (Select-String -LiteralPath $notices -SimpleMatch "Commit: $PluginCommit" -Quiet))) { + throw "$notices does not name plugin $PluginVersion at $PluginCommit - update it with the bump" +} + +if ((Test-Path -LiteralPath $dest) -and ((Get-Sha256 $dest) -eq $BinarySha)) { + Write-Host "session-manager-plugin-$Triple.exe: already the pinned $PluginVersion build" + exit 0 +} + +$work = Join-Path ([IO.Path]::GetTempPath()) ('ssm-plugin-' + [guid]::NewGuid().ToString('N')) +New-Item -ItemType Directory -Path $work | Out-Null +$ProgressPreference = 'SilentlyContinue' +try { + $goZip = Join-Path $work 'go.zip' + Write-Host "Downloading Go $GoVersion (windows-amd64)" + Invoke-WebRequest -Uri "https://go.dev/dl/go$GoVersion.windows-amd64.zip" -OutFile $goZip -UseBasicParsing + $actual = Get-Sha256 $goZip + if ($actual -ne $GoSha) { throw "SHA-256 mismatch for the Go toolchain: got $actual, pinned $GoSha" } + [IO.Compression.ZipFile]::ExtractToDirectory($goZip, (Join-Path $work 'toolchain')) + $go = Join-Path $work 'toolchain\go\bin\go.exe' + + $srcTgz = Join-Path $work 'source.tar.gz' + Write-Host "Downloading session-manager-plugin $PluginVersion source ($PluginCommit)" + Invoke-WebRequest -Uri $SourceUrl -OutFile $srcTgz -UseBasicParsing + $actual = Get-Sha256 $srcTgz + if ($actual -ne $SourceSha) { throw "SHA-256 mismatch for the plugin source: got $actual, pinned $SourceSha" } + $srcDir = Join-Path $work 'src' + New-Item -ItemType Directory -Path $srcDir | Out-Null + & tar.exe -xzf $srcTgz -C $srcDir + if ($LASTEXITCODE -ne 0) { throw "tar.exe could not extract the source ($LASTEXITCODE)" } + $goSpace = Join-Path $srcDir "session-manager-plugin-$PluginCommit" + if (-not (Test-Path -LiteralPath (Join-Path $goSpace 'src\sessionmanagerplugin-main'))) { + throw "the source archive is not the pinned commit's tree" + } + + # A clean, fully specified Go environment for everything below. + foreach ($v in 'GOFLAGS', 'GOROOT', 'GOBIN', 'GOEXPERIMENT', 'GOTMPDIR') { Remove-Item "env:$v" -ErrorAction SilentlyContinue } + $gopath = Join-Path $work 'gopath' + $env:GOENV = 'off'; $env:GOTOOLCHAIN = 'local'; $env:GO111MODULE = 'off'; $env:GOPROXY = 'off'; $env:GOWORK = 'off' + $env:GOPATH = "$gopath;$(Join-Path $goSpace 'vendor')" + $env:GOCACHE = Join-Path $work 'cache'; $env:GOMODCACHE = Join-Path $work 'modcache' + $env:CGO_ENABLED = '0'; $env:GOAMD64 = 'v1'; $env:GOARM64 = 'v8.0' + + # makefile pre-build: stamp the version with AWS's own generator. + [IO.File]::WriteAllText((Join-Path $goSpace 'VERSION'), $PluginVersion) + # version-gen runs on this host, so no GOOS/GOARCH yet. + Remove-Item env:GOOS, env:GOARCH -ErrorAction SilentlyContinue + Push-Location $goSpace + try { & $go run ./src/version/versiongenerator/version-gen.go | Out-Null } finally { Pop-Location } + if ($LASTEXITCODE -ne 0) { throw "version-gen failed ($LASTEXITCODE)" } + if (-not (Select-String -LiteralPath (Join-Path $goSpace 'src\version\version.go') -SimpleMatch "const Version = `"$PluginVersion`"" -Quiet)) { + throw 'the version stamp did not take' + } + + # makefile copy-src: GOPATH mode, from a copy at the import path. + $pkgRoot = Join-Path $gopath 'src\github.com\aws\session-manager-plugin' + New-Item -ItemType Directory -Force -Path $pkgRoot | Out-Null + Copy-Item -Recurse -LiteralPath (Join-Path $goSpace 'src') -Destination $pkgRoot + + $out = Join-Path $work 'session-manager-plugin.exe' + Write-Host "Building session-manager-plugin $PluginVersion for windows/amd64" + $env:GOOS = 'windows'; $env:GOARCH = 'amd64' + Push-Location $pkgRoot + try { + & $go build -trimpath -buildvcs=false -ldflags '-s -w -buildid=' -o $out ` + github.com/aws/session-manager-plugin/src/sessionmanagerplugin-main + } finally { Pop-Location } + if ($LASTEXITCODE -ne 0) { throw "go build failed ($LASTEXITCODE)" } + $actual = Get-Sha256 $out + if ($actual -ne $BinarySha) { + throw "the windows/amd64 build is not the pinned binary: got $actual, pinned $BinarySha (source, toolchain or build flags changed)" + } + + New-Item -ItemType Directory -Force -Path $destDir | Out-Null + Move-Item -LiteralPath $out -Destination $dest -Force + Write-Host "session-manager-plugin-$Triple.exe: session-manager-plugin $PluginVersion (unsigned; signed by the release build)" +} finally { + Remove-Item -Recurse -Force -LiteralPath $work -ErrorAction SilentlyContinue +} diff --git a/scripts/build-ssm-plugin.sh b/scripts/build-ssm-plugin.sh new file mode 100755 index 0000000..882c89e --- /dev/null +++ b/scripts/build-ssm-plugin.sh @@ -0,0 +1,228 @@ +#!/usr/bin/env bash +# +# build-ssm-plugin.sh [target-triple ...] - build AWS's session-manager-plugin +# FROM SOURCE and put it where Tauri's `bundle.externalBin` expects it: +# +# app/src-tauri/binaries/session-manager-plugin-[.exe] +# +# The app runs the plugin to connect to workspaces on AWS; bundling it means +# users do not have to install it. We build it ourselves from AWS's Apache-2.0 +# source (github.com/aws/session-manager-plugin) rather than redistributing +# AWS's prebuilt binaries, which AWS ships as "AWS Content" under the AWS +# Customer Agreement. +# +# With no argument the host's triple is used (`rustc -vV`). Every target is a +# pure-Go cross-compile (CGO_ENABLED=0), so any host can build any of them; CI +# builds each platform's own targets in its own job. scripts/build-ssm-plugin.ps1 +# is the same build for the Windows runner, which has no bash. +# +# Supported triples: +# x86_64-unknown-linux-gnu linux/amd64 +# aarch64-unknown-linux-gnu linux/arm64 +# x86_64-apple-darwin darwin/amd64 +# aarch64-apple-darwin darwin/arm64 +# universal-apple-darwin both darwin slices plus the two thin files, +# joined with lipo (`tauri build --target +# universal-apple-darwin` compiles each arch and +# tauri-build wants each arch's sidecar; the +# bundler then wants the universal one) +# x86_64-pc-windows-msvc windows/amd64 (for local cross-builds; CI uses +# the .ps1) +# +# Trust and reproducibility - the build fails on any miss: +# 1. The source is AWS's tag 1.2.896.0, pinned by COMMIT, downloaded as +# GitHub's archive of that commit and checked against a pinned SHA-256 +# and the commit id git embeds in the archive, BEFORE extraction. +# 2. The Go toolchain is a pinned release from go.dev, checked against the +# SHA-256 go.dev publishes (https://go.dev/dl/?mode=json), before use. +# 3. The build is AWS's own (its makefile: GOPATH mode over the vendored +# dependencies, `-ldflags "-s -w"`, package sessionmanagerplugin-main), +# with VERSION set to the tag so `--version` prints 1.2.896.0 (AWS's +# release pipeline stamps it; the repo's VERSION file says 1.3.0.0), plus +# what makes it reproducible: -trimpath, no VCS stamping, an empty build +# id, CGO off, explicit GOAMD64/GOARM64, no inherited GOFLAGS. +# 4. The output must equal a PINNED SHA-256 per target. Go builds are +# bit-for-bit reproducible across hosts, so every CI runner must produce +# exactly the binary recorded here; a mismatch means the source, the +# toolchain or the build changed. +# +# To bump the plugin or Go: change the pins in this script and in +# build-ssm-plugin.ps1, rebuild every target, record the new output hashes +# (both scripts), and update the version/commit lines in +# app/src-tauri/THIRD_PARTY_NOTICES (checked below) and its dependency licences. +# +# Idempotent: a destination that already holds the pinned binary is left alone. + +set -euo pipefail + +PLUGIN_VERSION="1.2.896.0" +PLUGIN_COMMIT="6430675a44032a551be1937fb27a2d3fdfeb27f7" +SOURCE_URL="https://codeload.github.com/aws/session-manager-plugin/tar.gz/${PLUGIN_COMMIT}" +SOURCE_SHA256="7c95be411ad5f43d14d01460500bfd5a5aa0e28ba94815f8b049af33a2c381b0" + +GO_VERSION="1.26.11" +go_pin() { # -> SHA-256 published by go.dev + case "$1" in + linux-amd64) echo 9849f4e04ee35303714e34fbc3ac8ab44ea3e448a95aa182f91e3b9b79c710ec ;; + linux-arm64) echo 6c2f29b458b5add0835f18b776f69c8881a6d88428f1484a6da55755e620757e ;; + darwin-amd64) echo 394baae971332f2bc783d6e2004ae57101479bd3b06ed8209a3fe3570d4ce498 ;; + darwin-arm64) echo e3a42e67a7a8acf450ebada2b074c7ca863000ca514907b7185b45e8f5cdff57 ;; + *) return 1 ;; + esac +} + +# target triple -> GOOS GOARCH SHA-256 of the binary we build +target_pin() { + case "$1" in + x86_64-unknown-linux-gnu) echo "linux amd64 414dafe49a90428cb4271a28ea964ad9242a26cb08a38d9679d808470c3b6b62" ;; + aarch64-unknown-linux-gnu) echo "linux arm64 79f00cd41536611e2906a9ea703175ab4f06f9b81107a0357b2304c8bfac61dd" ;; + x86_64-apple-darwin) echo "darwin amd64 fc61cd7e30bef3524a3681dc6b1a0f472506d9c98bccf62a67865067c9f2f059" ;; + aarch64-apple-darwin) echo "darwin arm64 9f3857f85cbcdc88e3ca686f84ac2a794e19e1778ad47ac3294c39e700de08f8" ;; + x86_64-pc-windows-msvc) echo "windows amd64 6d428e5fd77e76d9713f0c42b8ec39f2de1031e5f3c567feb73c7fe11b14b226" ;; + *) return 1 ;; + esac +} + +repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +dest_dir="$repo_root/app/src-tauri/binaries" +notices="$repo_root/app/src-tauri/THIRD_PARTY_NOTICES" + +die() { echo "build-ssm-plugin: $*" >&2; exit 1; } + +sha256() { + if command -v sha256sum >/dev/null 2>&1; then + sha256sum "$1" | cut -d' ' -f1 + else + shasum -a 256 "$1" | cut -d' ' -f1 + fi +} + +# The notices name the version and commit they describe; a bump updates both. +grep -qF "Version: ${PLUGIN_VERSION}" "$notices" && grep -qF "Commit: ${PLUGIN_COMMIT}" "$notices" \ + || die "$notices does not name plugin ${PLUGIN_VERSION} at ${PLUGIN_COMMIT} - update it with the bump" + +work="$(mktemp -d)" +trap 'rm -rf "$work"' EXIT +prepared=false + +download() { # + curl -fsSL --proto '=https' --tlsv1.2 --retry 3 --retry-delay 5 -o "$2" "$1" \ + || die "download failed: $1" +} + +# Toolchain and source, once per run, both verified before they are unpacked. +prepare() { + [ "$prepared" = true ] && return 0 + + local host_os host_arch go_sha go_tgz + case "$(uname -s)" in Linux) host_os=linux ;; Darwin) host_os=darwin ;; *) die "unsupported build host $(uname -s)" ;; esac + case "$(uname -m)" in x86_64|amd64) host_arch=amd64 ;; arm64|aarch64) host_arch=arm64 ;; *) die "unsupported build host arch $(uname -m)" ;; esac + go_sha="$(go_pin "$host_os-$host_arch")" || die "no pinned Go for $host_os-$host_arch" + go_tgz="$work/go.tar.gz" + echo "Downloading Go ${GO_VERSION} (${host_os}-${host_arch})" + download "https://go.dev/dl/go${GO_VERSION}.${host_os}-${host_arch}.tar.gz" "$go_tgz" + [ "$(sha256 "$go_tgz")" = "$go_sha" ] \ + || die "SHA-256 mismatch for the Go toolchain: got $(sha256 "$go_tgz"), pinned $go_sha" + mkdir -p "$work/toolchain" + tar -xzf "$go_tgz" -C "$work/toolchain" + GO="$work/toolchain/go/bin/go" + + local src_tgz="$work/source.tar.gz" + echo "Downloading session-manager-plugin ${PLUGIN_VERSION} source (${PLUGIN_COMMIT})" + download "$SOURCE_URL" "$src_tgz" + [ "$(sha256 "$src_tgz")" = "$SOURCE_SHA256" ] \ + || die "SHA-256 mismatch for the plugin source: got $(sha256 "$src_tgz"), pinned $SOURCE_SHA256" + mkdir -p "$work/src" + tar -xzf "$src_tgz" -C "$work/src" + GO_SPACE="$work/src/session-manager-plugin-${PLUGIN_COMMIT}" + [ -d "$GO_SPACE/src/sessionmanagerplugin-main" ] || die "the source archive is not the pinned commit's tree" + + # makefile `pre-build`: stamp the version with AWS's own generator. + printf '%s' "$PLUGIN_VERSION" >"$GO_SPACE/VERSION" + ( cd "$GO_SPACE" && go_env "$(go_host_os)" "$(go_host_arch)" "$GO" run ./src/version/versiongenerator/version-gen.go >/dev/null ) + grep -qF "const Version = \"${PLUGIN_VERSION}\"" "$GO_SPACE/src/version/version.go" \ + || die "the version stamp did not take" + + # makefile `copy-src`: the code builds in GOPATH mode, from a copy at its + # import path, with the vendored dependencies as a second GOPATH entry. + GOPATH_DIR="$work/gopath" + mkdir -p "$GOPATH_DIR/src/github.com/aws/session-manager-plugin" + cp -R "$GO_SPACE/src" "$GOPATH_DIR/src/github.com/aws/session-manager-plugin/" + prepared=true +} + +go_host_os() { "$GO" env GOHOSTOS; } +go_host_arch() { "$GO" env GOHOSTARCH; } + +# Run with a clean, fully specified Go environment (nothing inherited). +go_env() { # + local goos="$1" goarch="$2"; shift 2 + env -u GOFLAGS -u GOROOT -u GOBIN -u GOEXPERIMENT \ + GOENV=off GOTOOLCHAIN=local GO111MODULE=off GOPROXY=off GOWORK=off \ + GOPATH="${GOPATH_DIR:-$work/gopath}:${GO_SPACE}/vendor" \ + GOCACHE="$work/cache" GOMODCACHE="$work/modcache" GOTMPDIR= \ + CGO_ENABLED=0 GOOS="$goos" GOARCH="$goarch" GOAMD64=v1 GOARM64=v8.0 \ + "$@" +} + +build_thin() { # + local triple="$1" out="$2" pin goos goarch want + pin="$(target_pin "$triple")" || die "unsupported target $triple" + read -r goos goarch want <<<"$pin" + + if [ -f "$out" ] && [ "$(sha256 "$out")" = "$want" ]; then + echo "$(basename "$out"): already the pinned ${PLUGIN_VERSION} build" + return 0 + fi + prepare + echo "Building session-manager-plugin ${PLUGIN_VERSION} for ${goos}/${goarch}" + ( cd "$GOPATH_DIR/src/github.com/aws/session-manager-plugin" && \ + go_env "$goos" "$goarch" "$GO" build -trimpath -buildvcs=false \ + -ldflags "-s -w -buildid=" -o "$work/out-$triple" \ + github.com/aws/session-manager-plugin/src/sessionmanagerplugin-main ) + local got + got="$(sha256 "$work/out-$triple")" + [ "$got" = "$want" ] || die "the ${goos}/${goarch} build is not the pinned binary: got $got, pinned $want (source, toolchain or build flags changed)" + mkdir -p "$(dirname "$out")" + chmod 0755 "$work/out-$triple" + mv -f "$work/out-$triple" "$out" + echo "$(basename "$out"): session-manager-plugin ${PLUGIN_VERSION}" +} + +build_universal() { + local lipo + lipo="$(command -v lipo || command -v llvm-lipo || true)" + [ -n "$lipo" ] || die "universal-apple-darwin needs lipo (Xcode command line tools) or llvm-lipo" + local x86="$dest_dir/session-manager-plugin-x86_64-apple-darwin" + local arm="$dest_dir/session-manager-plugin-aarch64-apple-darwin" + local uni="$dest_dir/session-manager-plugin-universal-apple-darwin" + build_thin x86_64-apple-darwin "$x86" + build_thin aarch64-apple-darwin "$arm" + "$lipo" -create "$x86" "$arm" -output "$work/universal" + # Each slice must come back out byte-identical to its pinned thin binary. + local pair arch triple + for pair in x86_64:x86_64-apple-darwin arm64:aarch64-apple-darwin; do + arch="${pair%%:*}" triple="${pair#*:}" + "$lipo" "$work/universal" -thin "$arch" -output "$work/slice-$arch" + [ "$(sha256 "$work/slice-$arch")" = "$(target_pin "$triple" | cut -d' ' -f3)" ] \ + || die "the $arch slice of the universal binary is not the pinned binary" + done + chmod 0755 "$work/universal" + mv -f "$work/universal" "$uni" + echo "$(basename "$uni"): session-manager-plugin ${PLUGIN_VERSION} (x86_64 + arm64)" +} + +targets=("$@") +if [ ${#targets[@]} -eq 0 ]; then + host="$(rustc -vV 2>/dev/null | sed -n 's/^host: //p')" + [ -n "$host" ] || die "no target given and rustc is not available to name the host's" + targets=("$host") +fi + +for t in "${targets[@]}"; do + case "$t" in + universal-apple-darwin) build_universal ;; + *-windows-*) build_thin "$t" "$dest_dir/session-manager-plugin-$t.exe" ;; + *) build_thin "$t" "$dest_dir/session-manager-plugin-$t" ;; + esac +done diff --git a/scripts/fetch-ssm-plugin.ps1 b/scripts/fetch-ssm-plugin.ps1 deleted file mode 100644 index 3473837..0000000 --- a/scripts/fetch-ssm-plugin.ps1 +++ /dev/null @@ -1,103 +0,0 @@ -# fetch-ssm-plugin.ps1 - put AWS's session-manager-plugin where Tauri's -# bundle.externalBin expects it on Windows: -# -# app\src-tauri\binaries\session-manager-plugin-x86_64-pc-windows-msvc.exe -# -# The Windows half of scripts/fetch-ssm-plugin.sh (read its header for the -# why). Same trust chain, and the build fails on any miss: -# 1. A PINNED version, downloaded only from AWS's own S3 path -# (windows/SessionManagerPlugin.zip - the portable package AWS's own -# install.bat unpacks; the .exe installer next to it is a bootstrapper). -# 2. A PINNED SHA-256 of that zip, checked BEFORE anything is extracted, then -# of the package.zip inside it, then of the binary itself. -# 3. AWS's Authenticode signature on the binary: valid, chained to a trusted -# root, timestamped, and issued to Amazon Web Services, Inc. AWS publishes -# no GPG .sig for the Windows zip (403). -# -# We deliberately do NOT re-sign the plugin with our certificate. It already -# carries AWS's timestamped signature, which is what Windows checks, and -# Tauri itself skips a sidecar that `signtool verify /pa` accepts - so our sign -# command never sees it (windows-sign.ps1 refuses it if it ever does, rather -# than ship it unsigned or under our name). windows-verify-signatures.ps1 -# checks the copy inside the MSI is still AWS-signed. -# -# Idempotent: a destination that already holds the pinned binary is left alone. - -$ErrorActionPreference = 'Stop' -[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 -Add-Type -AssemblyName System.IO.Compression.FileSystem - -$Version = '1.2.896.0' -$BaseUrl = "https://s3.amazonaws.com/session-manager-downloads/plugin/$Version" -$Artifact = 'windows/SessionManagerPlugin.zip' -$ArtifactSha = 'B09ADC18721B6E7A9888C98CB1A3AA55B681B8F12391FC1A983410CB1163F670' -$PackageSha = '54577F90838E297801F79A769B4DCB47708FF0595CEBA5BF853276BC3EA83923' -$BinarySha = '03E9F869CDCB41C02060A4E8F8A07FAABAAE05F9940EC221D4A010B481A9AE30' -# .NET quotes a DN value holding a comma (O="Amazon Web Services, Inc."), so -# accept it with or without the quotes. -$SignerOrg = '(^|,\s*)O="?Amazon Web Services, Inc\."?(,|$)' -$Triple = 'x86_64-pc-windows-msvc' - -$repoRoot = Split-Path -Parent $PSScriptRoot -$destDir = Join-Path $repoRoot 'app\src-tauri\binaries' -$dest = Join-Path $destDir "session-manager-plugin-$Triple.exe" -$notices = Join-Path $repoRoot 'app\src-tauri\THIRD_PARTY_NOTICES' - -function Get-Sha256([string]$Path) { (Get-FileHash -LiteralPath $Path -Algorithm SHA256).Hash.ToUpperInvariant() } - -function Assert-AwsSigned([string]$Path) { - $sig = Get-AuthenticodeSignature -LiteralPath $Path - if ($sig.Status -ne 'Valid') { throw "session-manager-plugin.exe: Authenticode status $($sig.Status), expected Valid" } - if (-not $sig.TimeStamperCertificate) { throw 'session-manager-plugin.exe: AWS signature carries no timestamp' } - $subject = $sig.SignerCertificate.Subject - if ($subject -notmatch $SignerOrg) { throw "session-manager-plugin.exe: signed by '$subject', not Amazon Web Services, Inc." } - Write-Host "Signed by $subject (timestamped)" -} - -if (-not (Select-String -LiteralPath $notices -SimpleMatch "Version: $Version" -Quiet)) { - throw "$notices does not name plugin $Version - update it with the version bump" -} - -if ((Test-Path -LiteralPath $dest) -and ((Get-Sha256 $dest) -eq $BinarySha)) { - Assert-AwsSigned $dest - Write-Host "session-manager-plugin-$Triple.exe: already the pinned $Version binary" - exit 0 -} - -$work = Join-Path ([IO.Path]::GetTempPath()) ('ssm-plugin-' + [guid]::NewGuid().ToString('N')) -New-Item -ItemType Directory -Path $work | Out-Null -try { - $zip = Join-Path $work 'SessionManagerPlugin.zip' - Write-Host "Downloading $BaseUrl/$Artifact" - $ProgressPreference = 'SilentlyContinue' - Invoke-WebRequest -Uri "$BaseUrl/$Artifact" -OutFile $zip -UseBasicParsing - $actual = Get-Sha256 $zip - if ($actual -ne $ArtifactSha) { throw "SHA-256 mismatch for ${Artifact}: got $actual, pinned $ArtifactSha" } - - # Extract one named entry, never the whole archive. - function Expand-Entry([string]$Archive, [string]$Entry, [string]$Out) { - $z = [IO.Compression.ZipFile]::OpenRead($Archive) - try { - $e = $z.GetEntry($Entry) - if (-not $e) { throw "$Entry is not where AWS's package used to put it" } - [IO.Compression.ZipFileExtensions]::ExtractToFile($e, $Out, $true) - } finally { $z.Dispose() } - } - - $package = Join-Path $work 'package.zip' - Expand-Entry $zip 'package.zip' $package - $actual = Get-Sha256 $package - if ($actual -ne $PackageSha) { throw "SHA-256 mismatch for package.zip: got $actual, pinned $PackageSha" } - - $exe = Join-Path $work 'session-manager-plugin.exe' - Expand-Entry $package 'bin/session-manager-plugin.exe' $exe - $actual = Get-Sha256 $exe - if ($actual -ne $BinarySha) { throw "SHA-256 mismatch for session-manager-plugin.exe: got $actual, pinned $BinarySha" } - Assert-AwsSigned $exe - - New-Item -ItemType Directory -Force -Path $destDir | Out-Null - Move-Item -LiteralPath $exe -Destination $dest -Force - Write-Host "session-manager-plugin-$Triple.exe: session-manager-plugin $Version" -} finally { - Remove-Item -Recurse -Force -LiteralPath $work -ErrorAction SilentlyContinue -} diff --git a/scripts/fetch-ssm-plugin.sh b/scripts/fetch-ssm-plugin.sh deleted file mode 100755 index 231f30e..0000000 --- a/scripts/fetch-ssm-plugin.sh +++ /dev/null @@ -1,189 +0,0 @@ -#!/usr/bin/env bash -# -# fetch-ssm-plugin.sh [target-triple ...] - put AWS's session-manager-plugin -# where Tauri's `bundle.externalBin` expects it: -# -# app/src-tauri/binaries/session-manager-plugin- -# -# The app runs the plugin to connect to workspaces on AWS, and bundling it means -# users do not have to install it. With no argument the host's triple is used -# (`rustc -vV`). Windows is scripts/fetch-ssm-plugin.ps1. -# -# Supported triples: -# x86_64-unknown-linux-gnu ubuntu_64bit/session-manager-plugin.deb -# aarch64-unknown-linux-gnu ubuntu_arm64/session-manager-plugin.deb -# x86_64-apple-darwin mac/sessionmanager-bundle.zip -# aarch64-apple-darwin mac_arm64/sessionmanager-bundle.zip -# universal-apple-darwin both macOS slices, plus the two thin files, joined -# with lipo (`tauri build --target -# universal-apple-darwin` compiles each arch, and -# tauri-build wants each arch's sidecar, then the -# bundler wants the universal one) -# -# Trust, in order, and the build fails on any miss: -# 1. A PINNED version, downloaded only from AWS's own S3 path. -# 2. A PINNED SHA-256 of every downloaded artifact, checked BEFORE anything is -# extracted from it. -# 3. For the Linux .deb, AWS's detached GPG signature (.sig), checked with -# gpgv against the key committed as scripts/aws-ssm-plugin-signer.asc, whose -# fingerprint is pinned here too. AWS publishes no .sig for the macOS zips -# (403); those binaries carry AWS's Developer ID signature instead. -# 4. A PINNED SHA-256 of the extracted binary itself. -# -# To bump the version: download every artifact of the new version, check the -# .deb signatures with the committed key, and only then record the new hashes -# (and the version in app/src-tauri/THIRD_PARTY_NOTICES, which this script -# checks). Do the same in fetch-ssm-plugin.ps1. -# -# Idempotent: a destination that already holds the pinned binary is left alone, -# so running it before every build costs nothing. - -set -euo pipefail - -VERSION="1.2.896.0" -BASE_URL="https://s3.amazonaws.com/session-manager-downloads/plugin/${VERSION}" -# AWS SSM Session Manager , as -# published at https://docs.aws.amazon.com/systems-manager/latest/userguide/install-plugin-linux-verify-signature.html -SIGNER_FPR="7959637124CE093AD501D47A2C4D4AFF6F6757EE" - -# artifact path (under BASE_URL) | SHA-256 of the artifact | SHA-256 of the binary in it -pin_for() { - case "$1" in - x86_64-unknown-linux-gnu) - echo "ubuntu_64bit/session-manager-plugin.deb|53f51fcc67314a4bf85888a38a3967cd41f8d0f28a60a9469a63acf935ba713e|6f6971b0ea322215cb8b316cd290c09a13c916114149a6b4c65358c232be6130" ;; - aarch64-unknown-linux-gnu) - echo "ubuntu_arm64/session-manager-plugin.deb|914eeca87b18b55356c58be197080f73742b3ca60d3823f0a45670dc9056aa9c|3f0efc482ce165fcf60a1ec44b40a700d48e7ec4b88cf0c339dd40d1620e98bf" ;; - x86_64-apple-darwin) - echo "mac/sessionmanager-bundle.zip|66e826fd48a6a6d06ad06b0892805986f7c455295b61974f99cb2a43d29624d7|e6e94c116003889244c5455a6dcd96ea584d2c6b6d6d719c3956d305429feb8b" ;; - aarch64-apple-darwin) - echo "mac_arm64/sessionmanager-bundle.zip|05c5ef53fb262de2fa1b46cf457890ee4152ec1dd8b2fdd94d028fa9b885ff36|71258c3f7d5c15603a3b75bc8dfd62f595e8ec6ef3b8132ab59a005eebb7fa35" ;; - *) return 1 ;; - esac -} - -repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" -dest_dir="$repo_root/app/src-tauri/binaries" -signer_key="$repo_root/scripts/aws-ssm-plugin-signer.asc" -notices="$repo_root/app/src-tauri/THIRD_PARTY_NOTICES" - -die() { echo "fetch-ssm-plugin: $*" >&2; exit 1; } - -sha256() { - if command -v sha256sum >/dev/null 2>&1; then - sha256sum "$1" | cut -d' ' -f1 - else - shasum -a 256 "$1" | cut -d' ' -f1 - fi -} - -# The notices name the version they reproduce; a bump must update both. -grep -qF "Version: ${VERSION}" "$notices" \ - || die "$notices does not name plugin ${VERSION} - update it with the version bump" - -work="$(mktemp -d)" -trap 'rm -rf "$work"' EXIT - -download() { # - curl -fsSL --proto '=https' --tlsv1.2 --retry 3 --retry-delay 5 \ - -o "$2" "${BASE_URL}/$1" || die "download failed: ${BASE_URL}/$1" -} - -verify_deb_signature() { # - command -v gpg >/dev/null 2>&1 || die "gpg is required to check AWS's signature on the .deb" - command -v gpgv >/dev/null 2>&1 || die "gpgv is required to check AWS's signature on the .deb" - local keyring="$work/aws-signer.gpg" status="$work/gpgv.status" - [ -f "$keyring" ] || gpg --batch --quiet --dearmor <"$signer_key" >"$keyring" - # VALIDSIG carries the primary key's fingerprint as its last field; a good - # signature from any other key in the keyring (there is none) would not match. - gpgv --status-fd 3 --keyring "$keyring" "$2" "$1" 3>"$status" >/dev/null 2>&1 \ - || die "AWS's GPG signature does not verify for $(basename "$1")" - grep -q "^\[GNUPG:\] VALIDSIG .* ${SIGNER_FPR}\$" "$status" \ - || die "the .deb is not signed by the pinned AWS key ${SIGNER_FPR}" -} - -# Extract the binary of one thin triple into , every check included. -fetch_thin() { # - local triple="$1" out="$2" pin artifact artifact_sha bin_sha file - pin="$(pin_for "$triple")" || die "unsupported target $triple" - IFS='|' read -r artifact artifact_sha bin_sha <<<"$pin" - - if [ -f "$out" ] && [ "$(sha256 "$out")" = "$bin_sha" ]; then - echo "$(basename "$out"): already the pinned ${VERSION} binary" - return 0 - fi - - file="$work/${triple}-$(basename "$artifact")" - echo "Downloading ${BASE_URL}/${artifact}" - download "$artifact" "$file" - [ "$(sha256 "$file")" = "$artifact_sha" ] \ - || die "SHA-256 mismatch for ${artifact}: got $(sha256 "$file"), pinned ${artifact_sha}" - - local x="$work/${triple}-x" - mkdir -p "$x" - case "$artifact" in - *.deb) - download "${artifact}.sig" "$file.sig" - verify_deb_signature "$file" "$file.sig" - # A .deb is an ar archive; take only data.tar.* and only the one binary. - ( cd "$x" && ar x "$file" ) - local data - data="$(cd "$x" && ls data.tar.* 2>/dev/null | head -n1)" - [ -n "$data" ] || die "no data.tar.* in ${artifact}" - tar -xf "$x/$data" -C "$x" usr/local/sessionmanagerplugin/bin/session-manager-plugin \ - || die "the binary is not where AWS's .deb used to put it" - mv "$x/usr/local/sessionmanagerplugin/bin/session-manager-plugin" "$x/plugin" - ;; - *.zip) - unzip -p "$file" sessionmanager-bundle/bin/session-manager-plugin >"$x/plugin" \ - || die "the binary is not where AWS's bundle zip used to put it" - ;; - esac - [ "$(sha256 "$x/plugin")" = "$bin_sha" ] \ - || die "SHA-256 mismatch for the binary in ${artifact}: got $(sha256 "$x/plugin"), pinned ${bin_sha}" - - mkdir -p "$(dirname "$out")" - chmod 0755 "$x/plugin" - mv -f "$x/plugin" "$out" - echo "$(basename "$out"): session-manager-plugin ${VERSION}" -} - -fetch_universal() { - local lipo - lipo="$(command -v lipo || command -v llvm-lipo || true)" - [ -n "$lipo" ] || die "universal-apple-darwin needs lipo (Xcode command line tools) or llvm-lipo" - local x86="$dest_dir/session-manager-plugin-x86_64-apple-darwin" - local arm="$dest_dir/session-manager-plugin-aarch64-apple-darwin" - local uni="$dest_dir/session-manager-plugin-universal-apple-darwin" - fetch_thin x86_64-apple-darwin "$x86" - fetch_thin aarch64-apple-darwin "$arm" - "$lipo" -create "$x86" "$arm" -output "$work/universal" - # Each slice must come back out byte-identical to its pinned thin binary, so - # the universal file holds exactly AWS's two binaries (and their signatures). - local arch thin - for arch in x86_64 arm64; do - "$lipo" "$work/universal" -thin "$arch" -output "$work/slice-$arch" - done - for arch in x86_64:x86_64-apple-darwin arm64:aarch64-apple-darwin; do - thin="$(pin_for "${arch#*:}" | cut -d'|' -f3)" - [ "$(sha256 "$work/slice-${arch%%:*}")" = "$thin" ] \ - || die "the ${arch%%:*} slice of the universal binary is not the pinned binary" - done - chmod 0755 "$work/universal" - mv -f "$work/universal" "$uni" - echo "$(basename "$uni"): session-manager-plugin ${VERSION} (x86_64 + arm64)" -} - -targets=("$@") -if [ ${#targets[@]} -eq 0 ]; then - host="$(rustc -vV 2>/dev/null | sed -n 's/^host: //p')" - [ -n "$host" ] || die "no target given and rustc is not available to name the host's" - targets=("$host") -fi - -for t in "${targets[@]}"; do - case "$t" in - universal-apple-darwin) fetch_universal ;; - *-windows-*) die "$t: use scripts/fetch-ssm-plugin.ps1 on Windows" ;; - *) fetch_thin "$t" "$dest_dir/session-manager-plugin-$t" ;; - esac -done diff --git a/scripts/finalize-appimage.sh b/scripts/finalize-appimage.sh index 8edd72e..7254a22 100755 --- a/scripts/finalize-appimage.sh +++ b/scripts/finalize-appimage.sh @@ -317,8 +317,8 @@ if [ "$pw_removed" = true ]; then fi [ -x "$out/usr/bin/triple-c" ] || fail "no executable usr/bin/triple-c." -# The bundled AWS Session Manager plugin (bundle.externalBin, fetched by -# fetch-ssm-plugin.sh) is what AWS workspaces connect through. Tauri copies it +# The bundled AWS Session Manager plugin (bundle.externalBin, built from +# source by build-ssm-plugin.sh) is what AWS workspaces connect through. Tauri copies it # beside the app binary with the target triple stripped, which is where # `host::ssm::find_plugin` looks. It must be the real plugin: an ELF, not the # placeholder a debug build writes (build.rs refuses that for release, and this diff --git a/scripts/windows-sign.ps1 b/scripts/windows-sign.ps1 index 05b8844..ce16c1a 100644 --- a/scripts/windows-sign.ps1 +++ b/scripts/windows-sign.ps1 @@ -10,10 +10,10 @@ # extension DLLs candle/light load, the NSIS plugins makensis embeds - and # each signature is metered (about 1000 a month), so those are skipped. The # allowlist below is the whole of what reaches users: the app binary, the MSI, -# the NSIS installer, and the uninstaller makensis writes to the job's temp -# directory. The bundled session-manager-plugin sidecar is AWS-signed and is -# refused rather than re-signed (see below). A file that already carries a valid signature is skipped too: -# Tauri presents the app binary once per bundle type. +# the NSIS installer, the uninstaller makensis writes to the job's temp +# directory, and the session-manager-plugin sidecar we build from source. A +# file that already carries a valid signature is skipped too: Tauri presents +# the app binary once per bundle type. # # This may run as 32-bit PowerShell: the NSIS uninstaller is signed from inside # makensis, which is 32-bit and resolves `powershell` to the SysWOW64 copy. So @@ -47,18 +47,12 @@ try { $full = (Resolve-Path -LiteralPath $Path).ProviderPath Write-Log "== $full" - # The bundled AWS session-manager-plugin (bundle.externalBin) ships AWS's own - # signature and is deliberately never re-signed: fetch-ssm-plugin.ps1 checks it - # is AWS-signed and timestamped, and Tauri skips a sidecar `signtool verify /pa` - # accepts. Being asked to sign it means that check failed on this machine, so - # stop rather than put our name on it - or, via the allowlist below, skip it - # and ship it unsigned. - if ($full -match '\\binaries\\session-manager-plugin-[^\\]+\.exe$') { - Write-Log 'refused: the session-manager-plugin sidecar must carry AWS''s signature, not ours (see fetch-ssm-plugin.ps1)' - exit 1 - } - - $ships = ($full -match '\\target\\release\\[^\\]+\.exe$') -or + # The bundled session-manager-plugin sidecar (bundle.externalBin), which we + # build from AWS's source (scripts/build-ssm-plugin.ps1) and so ship unsigned + # unless signed here. Tauri presents a sidecar to the sign command, in place + # under app\src-tauri\binaries, only when `signtool verify /pa` rejects it. + $ships = ($full -match '\\binaries\\session-manager-plugin-[^\\]+\.exe$') -or + ($full -match '\\target\\release\\[^\\]+\.exe$') -or ($full -match '\\target\\release\\bundle\\(msi|nsis)\\[^\\]+\.(msi|exe)$') -or $full.StartsWith($env:TRIPLE_C_SIGN_TMP.TrimEnd('\') + '\', [StringComparison]::OrdinalIgnoreCase) if (-not $ships) { diff --git a/scripts/windows-verify-signatures.ps1 b/scripts/windows-verify-signatures.ps1 index 4a793ee..1f47623 100644 --- a/scripts/windows-verify-signatures.ps1 +++ b/scripts/windows-verify-signatures.ps1 @@ -15,9 +15,9 @@ # the NSIS installer cannot be unpacked that way, so for it the signing log # must show the app binary and the uninstaller were signed. # -# The bundled AWS session-manager-plugin is checked too - present in the MSI, -# and in both installers signed, timestamped and signed by AWS, because it is -# shipped under AWS's signature rather than re-signed by us. +# The bundled session-manager-plugin (built from source, signed by us) is +# checked too: present in the MSI, and in both installers validly signed, +# timestamped, and by the same certificate as the installer itself. param([Parameter(Mandatory = $true, ValueFromRemainingArguments = $true)][string[]]$Patterns) @@ -51,17 +51,18 @@ function Test-Signature([IO.FileInfo]$File, [string]$Label) { return $false } -# The bundled AWS session-manager-plugin sidecar is deliberately left under -# AWS's own signature (see fetch-ssm-plugin.ps1), so beyond being valid and -# timestamped it must be AWS's, not ours. +# The session-manager-plugin sidecar is built from AWS's source +# (build-ssm-plugin.ps1), so it is unsigned until windows-sign.ps1 signs it. It +# must carry OUR signature: valid, timestamped, and from the same certificate +# as the installer that ships it. $sidecarName = 'session-manager-plugin.exe' $sidecarSource = Join-Path (Split-Path -Parent $PSScriptRoot) 'app\src-tauri\binaries\session-manager-plugin-x86_64-pc-windows-msvc.exe' -function Test-AwsSigner([IO.FileInfo]$File, [string]$Label) { +function Test-OurSigner([IO.FileInfo]$File, [string]$Label, [IO.FileInfo]$Installer) { if (-not (Test-Signature $File $Label)) { return $false } - $subject = (Get-AuthenticodeSignature -FilePath $File.FullName).SignerCertificate.Subject - # .NET quotes a DN value holding a comma: O="Amazon Web Services, Inc.". - if ($subject -match '(^|,\s*)O="?Amazon Web Services, Inc\."?(,|$)') { return $true } - Write-Host "FAIL $Label - signed by '$subject', expected Amazon Web Services, Inc." + $ours = (Get-AuthenticodeSignature -FilePath $Installer.FullName).SignerCertificate + $theirs = (Get-AuthenticodeSignature -FilePath $File.FullName).SignerCertificate + if ($ours -and $theirs -and $ours.Thumbprint -eq $theirs.Thumbprint) { return $true } + Write-Host "FAIL $Label - signed by '$($theirs.Subject)', not the certificate that signed $($Installer.Name)" return $false } @@ -74,7 +75,7 @@ $failed = @() $nsisBuilt = $false foreach ($file in $files) { if (-not (Test-Signature $file $file.Name)) { $failed += $file.Name } - if ($file.FullName -match '\\bundle\\nsis\\') { $nsisBuilt = $true } + if ($file.FullName -match '\\bundle\\nsis\\') { $nsisBuilt = $true; $nsisInstaller = $file } if ($file.Extension -eq '.msi') { $extract = Join-Path ([IO.Path]::GetTempPath()) ('msi-verify-' + [guid]::NewGuid().ToString('N')) @@ -92,13 +93,13 @@ foreach ($file in $files) { foreach ($f in $inner) { if (-not (Test-Signature $f "$($file.Name) > $($f.Name)")) { $failed += "$($file.Name) > $($f.Name)" } } - # The bundled AWS plugin must be in there, and still under AWS's signature. + # The bundled plugin must be in there, under our signature. if ($proc.ExitCode -eq 0) { $plugin = @($inner | Where-Object { $_.Name -eq $sidecarName }) if ($plugin.Count -ne 1) { Write-Host "FAIL $($file.Name) - carries $($plugin.Count) $sidecarName, expected 1" $failed += "$($file.Name) > $sidecarName (missing)" - } elseif (-not (Test-AwsSigner $plugin[0] "$($file.Name) > $sidecarName")) { + } elseif (-not (Test-OurSigner $plugin[0] "$($file.Name) > $sidecarName" $file)) { $failed += "$($file.Name) > $sidecarName (signer)" } } @@ -120,13 +121,17 @@ if ($nsisBuilt) { } else { Write-Host "OK app binary - signed before packaging ($($appSigned.Count)x)" } - # makensis packs the sidecar straight from app\src-tauri\binaries, so the - # file it read is the one to check. + # makensis packs the sidecar straight from app\src-tauri\binaries, where + # Tauri had it signed in place before any bundle: so that file, and a + # logged signature for it, are what NSIS shipped. if (-not (Test-Path -LiteralPath $sidecarSource)) { Write-Host "FAIL $sidecarName - $sidecarSource is missing" $failed += "NSIS > $sidecarName (missing)" - } elseif (-not (Test-AwsSigner (Get-Item -LiteralPath $sidecarSource) "NSIS > $sidecarName (as packed)")) { + } elseif (-not (Test-OurSigner (Get-Item -LiteralPath $sidecarSource) "NSIS > $sidecarName (as packed)" $nsisInstaller)) { $failed += "NSIS > $sidecarName (signer)" + } elseif (-not @($log | Where-Object { $_ -match '\\binaries\\session-manager-plugin-[^\\]+\.exe$' }).Count) { + Write-Host "FAIL $sidecarName - no signature was logged for it" + $failed += "NSIS > $sidecarName (not logged)" } $tmp = $env:TRIPLE_C_SIGN_TMP $uninstaller = @() -- 2.52.0 From b62f472d79f035ff508be654ee524a8815838e0b Mon Sep 17 00:00:00 2001 From: Josh Knapp Date: Tue, 17 Nov 2026 08:20:09 -0800 Subject: [PATCH 06/12] fix(ssm-plugin): review fixes for the source build and signing checks - build-ssm-plugin.{sh,ps1}: skip the vendored SDK's Java codegen/ and test snapshot/ trees when extracting (codegen paths reach 258 chars, past MAX_PATH on Windows); the .ps1 works under a short %SystemDrive%\ssm-<8hex> root and falls back to rd /s /q on cleanup. Pinned output hashes unchanged (rebuilt every target). - build-ssm-plugin.sh: the header no longer claims a git commit-id check. - windows-verify-signatures.ps1: compare signer Subject + Issuer, not the thumbprint (Artifact Signing certificates rotate); require THIRD_PARTY_NOTICES in the MSI. - windows-sign.ps1: allowlist exactly src-tauri\binaries\session-manager-plugin-x86_64-pc-windows-msvc.exe. - macOS jobs: check the .app carries the two-slice plugin and Contents/Resources/THIRD_PARTY_NOTICES. - CLAUDE.md: a local release build must re-run the build script. Co-Authored-By: Claude Opus 5.5 --- .gitea/workflows/build-app-preview.yml | 15 +++++++++++++++ .gitea/workflows/build-app.yml | 15 +++++++++++++++ CLAUDE.md | 17 +++++++++++++---- scripts/build-ssm-plugin.ps1 | 16 +++++++++++++--- scripts/build-ssm-plugin.sh | 9 +++++++-- scripts/windows-sign.ps1 | 2 +- scripts/windows-verify-signatures.ps1 | 20 ++++++++++++++------ 7 files changed, 78 insertions(+), 16 deletions(-) diff --git a/.gitea/workflows/build-app-preview.yml b/.gitea/workflows/build-app-preview.yml index fbc70c5..9d936b0 100644 --- a/.gitea/workflows/build-app-preview.yml +++ b/.gitea/workflows/build-app-preview.yml @@ -625,6 +625,21 @@ jobs: export PATH="$HOME/.cargo/bin:$PATH" npx tauri build --target universal-apple-darwin + # The sidecar and its notices must be in the bundle Tauri made: the + # plugin in Contents/MacOS with both slices, THIRD_PARTY_NOTICES in + # Contents/Resources (bundle.resources). + - name: Check the bundled Session Manager plugin + run: | + app_dir="$(ls -d app/src-tauri/target/universal-apple-darwin/release/bundle/macos/*.app | head -n1)" + [ -n "$app_dir" ] || { echo "no .app bundle"; exit 1; } + plugin="$app_dir/Contents/MacOS/session-manager-plugin" + [ -x "$plugin" ] || { echo "missing $plugin"; exit 1; } + archs="$(lipo -archs "$plugin")" + case " $archs " in *" x86_64 "*) ;; *) echo "plugin lacks x86_64 ($archs)"; exit 1 ;; esac + case " $archs " in *" arm64 "*) ;; *) echo "plugin lacks arm64 ($archs)"; exit 1 ;; esac + "$plugin" --version + [ -f "$app_dir/Contents/Resources/THIRD_PARTY_NOTICES" ] || { echo "missing Contents/Resources/THIRD_PARTY_NOTICES"; exit 1; } + - name: Collect artifacts run: | mkdir -p artifacts diff --git a/.gitea/workflows/build-app.yml b/.gitea/workflows/build-app.yml index 11b937f..cf27f18 100644 --- a/.gitea/workflows/build-app.yml +++ b/.gitea/workflows/build-app.yml @@ -440,6 +440,21 @@ jobs: export PATH="$HOME/.cargo/bin:$PATH" npx tauri build --target universal-apple-darwin + # The sidecar and its notices must be in the bundle Tauri made: the + # plugin in Contents/MacOS with both slices, THIRD_PARTY_NOTICES in + # Contents/Resources (bundle.resources). + - name: Check the bundled Session Manager plugin + run: | + app_dir="$(ls -d app/src-tauri/target/universal-apple-darwin/release/bundle/macos/*.app | head -n1)" + [ -n "$app_dir" ] || { echo "no .app bundle"; exit 1; } + plugin="$app_dir/Contents/MacOS/session-manager-plugin" + [ -x "$plugin" ] || { echo "missing $plugin"; exit 1; } + archs="$(lipo -archs "$plugin")" + case " $archs " in *" x86_64 "*) ;; *) echo "plugin lacks x86_64 ($archs)"; exit 1 ;; esac + case " $archs " in *" arm64 "*) ;; *) echo "plugin lacks arm64 ($archs)"; exit 1 ;; esac + "$plugin" --version + [ -f "$app_dir/Contents/Resources/THIRD_PARTY_NOTICES" ] || { echo "missing Contents/Resources/THIRD_PARTY_NOTICES"; exit 1; } + - name: Collect artifacts run: | mkdir -p artifacts diff --git a/CLAUDE.md b/CLAUDE.md index 20cbaff..e55863d 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1241,7 +1241,10 @@ unit-tested (`host/ssm/tests.rs`, `plugin_resolution`). as "AWS Content" under the AWS Customer Agreement; the source (github.com/aws/session-manager-plugin) is Apache-2.0. `scripts/build-ssm-plugin.sh …` (Linux/macOS; any triple, it cross-compiles) and `scripts/build-ssm-plugin.ps1` (the Windows runner, which has no bash) take - the tag's **commit** as GitHub's archive (pinned SHA-256, checked before extraction) and a + the tag's **commit** as GitHub's archive (pinned SHA-256, checked before extraction; the + vendored SDK's Java `codegen/` and test `snapshot/` trees are not extracted — they reach 258 + characters, past Windows' MAX_PATH, so the `.ps1` also works under a short `C:\ssm-<8hex>` root) + and a **pinned Go** from go.dev (go.dev's published SHA-256), and run the repo's own build — GOPATH mode over its vendored deps, `-ldflags "-s -w"`, `sessionmanagerplugin-main` — with `VERSION` stamped to the tag (the repo's file says `1.3.0.0`; AWS's pipeline stamps the real one, so @@ -1266,15 +1269,21 @@ unit-tested (`host/ssm/tests.rs`, `plugin_resolution`). `PROFILE=debug`, so `cargo test`/`cargo check`/`tauri dev` and CI's `test` job need neither Go nor the network, and `find_plugin()` skips it (falling back to an installed plugin). With `PROFILE=release` a missing file **or** a placeholder stops the build, so a local `cargo build - --release` needs the build script first. `finalize-appimage.sh` asserts the shipped + --release` needs the build script first. **build.rs rejects only a missing file or the + placeholder, not a stale or wrong binary**: re-run `scripts/build-ssm-plugin.sh` before every + local release build (it is a no-op when the file already matches the pin, and rebuilds it + otherwise — e.g. after a pin bump, or after a Windows release build signed it in place). `finalize-appimage.sh` asserts the shipped `usr/bin/session-manager-plugin` is an ELF that runs `--version`. - **Windows: our build is unsigned, so the release signs it with our certificate.** Tauri runs `signtool verify /pa` on each sidecar and hands the unsigned one to the sign command, in place under `app\src-tauri\binaries` before any bundle (both MSI and NSIS pack that file); `windows-sign.ps1`'s allowlist includes it (one more metered signature per release: 6). `windows-verify-signatures.ps1` requires exactly one `session-manager-plugin.exe` in the MSI and - the file NSIS packed to be validly signed, timestamped, **by the same certificate as the - installer**, and the signing log to show it. Previews ship it unsigned, like the app. + the file NSIS packed to be validly signed, timestamped, **by the same signing identity + (subject + issuer) as the installer** — not the thumbprint: Artifact Signing certificates are + short-lived and rotate — and the signing log to show it. The MSI must also carry + `THIRD_PARTY_NOTICES`; on macOS a workflow step checks the `.app` holds the two-slice plugin in + `Contents/MacOS` and the notices in `Contents/Resources`. Previews ship it unsigned, like the app. - **macOS: signed exactly like the app.** The app is not code-signed (no `APPLE_*`/`signingIdentity` in the workflows); Go's linker ad-hoc signs the arm64 slice (needed to run on Apple Silicon). If signing is ever configured, Tauri signs externalBin with the app's identity, inside-out. diff --git a/scripts/build-ssm-plugin.ps1 b/scripts/build-ssm-plugin.ps1 index c54f64d..976c556 100644 --- a/scripts/build-ssm-plugin.ps1 +++ b/scripts/build-ssm-plugin.ps1 @@ -52,7 +52,10 @@ if ((Test-Path -LiteralPath $dest) -and ((Get-Sha256 $dest) -eq $BinarySha)) { exit 0 } -$work = Join-Path ([IO.Path]::GetTempPath()) ('ssm-plugin-' + [guid]::NewGuid().ToString('N')) +# A short work root, not %TEMP% (on the runner that is deep under +# systemprofile): the longest extracted path is ~200 characters, and MAX_PATH +# is 260 for Windows PowerShell 5.1, tar.exe and the Go build alike. +$work = Join-Path "$env:SystemDrive\" ('ssm-' + [guid]::NewGuid().ToString('N').Substring(0, 8)) New-Item -ItemType Directory -Path $work | Out-Null $ProgressPreference = 'SilentlyContinue' try { @@ -71,7 +74,10 @@ try { if ($actual -ne $SourceSha) { throw "SHA-256 mismatch for the plugin source: got $actual, pinned $SourceSha" } $srcDir = Join-Path $work 'src' New-Item -ItemType Directory -Path $srcDir | Out-Null - & tar.exe -xzf $srcTgz -C $srcDir + # Only what the build reads, as build-ssm-plugin.sh does: the vendored SDK's + # Java codegen/ tree reaches 258 characters inside the archive, past + # MAX_PATH, and its snapshot/ files are test data. + & tar.exe --exclude='*/codegen/*' --exclude='*/snapshot/*' -xzf $srcTgz -C $srcDir if ($LASTEXITCODE -ne 0) { throw "tar.exe could not extract the source ($LASTEXITCODE)" } $goSpace = Join-Path $srcDir "session-manager-plugin-$PluginCommit" if (-not (Test-Path -LiteralPath (Join-Path $goSpace 'src\sessionmanagerplugin-main'))) { @@ -120,5 +126,9 @@ try { Move-Item -LiteralPath $out -Destination $dest -Force Write-Host "session-manager-plugin-$Triple.exe: session-manager-plugin $PluginVersion (unsigned; signed by the release build)" } finally { - Remove-Item -Recurse -Force -LiteralPath $work -ErrorAction SilentlyContinue + Remove-Item -LiteralPath $work -Recurse -Force -ErrorAction SilentlyContinue + # PS 5.1's Remove-Item can give up on read-only files and deep trees; + # rd /s /q is the fallback. + if (Test-Path -LiteralPath $work) { cmd /c rd /s /q "`"$work`"" | Out-Null } + if (Test-Path -LiteralPath $work) { Write-Warning "could not remove $work" } } diff --git a/scripts/build-ssm-plugin.sh b/scripts/build-ssm-plugin.sh index 882c89e..a72d346 100755 --- a/scripts/build-ssm-plugin.sh +++ b/scripts/build-ssm-plugin.sh @@ -32,7 +32,12 @@ # Trust and reproducibility - the build fails on any miss: # 1. The source is AWS's tag 1.2.896.0, pinned by COMMIT, downloaded as # GitHub's archive of that commit and checked against a pinned SHA-256 -# and the commit id git embeds in the archive, BEFORE extraction. +# BEFORE extraction (the SHA-256 is the check; the archive's top +# directory, which names the commit, must also be there). Only what the +# build reads is extracted: the vendored SDK's Java `codegen/` tree and its +# test `snapshot/` files are skipped, which also keeps every path under +# Windows' MAX_PATH (the .ps1 extracts the same way, so both build the +# same tree). # 2. The Go toolchain is a pinned release from go.dev, checked against the # SHA-256 go.dev publishes (https://go.dev/dl/?mode=json), before use. # 3. The build is AWS's own (its makefile: GOPATH mode over the vendored @@ -133,7 +138,7 @@ prepare() { [ "$(sha256 "$src_tgz")" = "$SOURCE_SHA256" ] \ || die "SHA-256 mismatch for the plugin source: got $(sha256 "$src_tgz"), pinned $SOURCE_SHA256" mkdir -p "$work/src" - tar -xzf "$src_tgz" -C "$work/src" + tar --exclude='*/codegen/*' --exclude='*/snapshot/*' -xzf "$src_tgz" -C "$work/src" GO_SPACE="$work/src/session-manager-plugin-${PLUGIN_COMMIT}" [ -d "$GO_SPACE/src/sessionmanagerplugin-main" ] || die "the source archive is not the pinned commit's tree" diff --git a/scripts/windows-sign.ps1 b/scripts/windows-sign.ps1 index ce16c1a..3ea8adc 100644 --- a/scripts/windows-sign.ps1 +++ b/scripts/windows-sign.ps1 @@ -51,7 +51,7 @@ try { # build from AWS's source (scripts/build-ssm-plugin.ps1) and so ship unsigned # unless signed here. Tauri presents a sidecar to the sign command, in place # under app\src-tauri\binaries, only when `signtool verify /pa` rejects it. - $ships = ($full -match '\\binaries\\session-manager-plugin-[^\\]+\.exe$') -or + $ships = ($full -match '\\src-tauri\\binaries\\session-manager-plugin-x86_64-pc-windows-msvc\.exe$') -or ($full -match '\\target\\release\\[^\\]+\.exe$') -or ($full -match '\\target\\release\\bundle\\(msi|nsis)\\[^\\]+\.(msi|exe)$') -or $full.StartsWith($env:TRIPLE_C_SIGN_TMP.TrimEnd('\') + '\', [StringComparison]::OrdinalIgnoreCase) diff --git a/scripts/windows-verify-signatures.ps1 b/scripts/windows-verify-signatures.ps1 index 1f47623..51ea292 100644 --- a/scripts/windows-verify-signatures.ps1 +++ b/scripts/windows-verify-signatures.ps1 @@ -17,7 +17,7 @@ # # The bundled session-manager-plugin (built from source, signed by us) is # checked too: present in the MSI, and in both installers validly signed, -# timestamped, and by the same certificate as the installer itself. +# timestamped, and by the same signing identity as the installer itself. param([Parameter(Mandatory = $true, ValueFromRemainingArguments = $true)][string[]]$Patterns) @@ -53,16 +53,19 @@ function Test-Signature([IO.FileInfo]$File, [string]$Label) { # The session-manager-plugin sidecar is built from AWS's source # (build-ssm-plugin.ps1), so it is unsigned until windows-sign.ps1 signs it. It -# must carry OUR signature: valid, timestamped, and from the same certificate -# as the installer that ships it. +# must carry OUR signature: valid, timestamped, and from the same signing +# identity (subject and issuer) as the installer that ships it. $sidecarName = 'session-manager-plugin.exe' $sidecarSource = Join-Path (Split-Path -Parent $PSScriptRoot) 'app\src-tauri\binaries\session-manager-plugin-x86_64-pc-windows-msvc.exe' function Test-OurSigner([IO.FileInfo]$File, [string]$Label, [IO.FileInfo]$Installer) { if (-not (Test-Signature $File $Label)) { return $false } $ours = (Get-AuthenticodeSignature -FilePath $Installer.FullName).SignerCertificate $theirs = (Get-AuthenticodeSignature -FilePath $File.FullName).SignerCertificate - if ($ours -and $theirs -and $ours.Thumbprint -eq $theirs.Thumbprint) { return $true } - Write-Host "FAIL $Label - signed by '$($theirs.Subject)', not the certificate that signed $($Installer.Name)" + # Subject + Issuer, not the thumbprint: Azure Artifact Signing issues a + # fresh short-lived certificate (daily), so the plugin and the installer + # can legitimately carry different thumbprints within one build. + if ($ours -and $theirs -and $ours.Subject -eq $theirs.Subject -and $ours.Issuer -eq $theirs.Issuer) { return $true } + Write-Host "FAIL $Label - signed by '$($theirs.Subject)' (issuer '$($theirs.Issuer)'), not the identity that signed $($Installer.Name)" return $false } @@ -93,6 +96,11 @@ foreach ($file in $files) { foreach ($f in $inner) { if (-not (Test-Signature $f "$($file.Name) > $($f.Name)")) { $failed += "$($file.Name) > $($f.Name)" } } + # Its licence notices travel with it (bundle.resources). + if ($proc.ExitCode -eq 0 -and -not @(Get-ChildItem -Path $extract -Recurse -File -Filter 'THIRD_PARTY_NOTICES').Count) { + Write-Host "FAIL $($file.Name) - carries no THIRD_PARTY_NOTICES" + $failed += "$($file.Name) > THIRD_PARTY_NOTICES (missing)" + } # The bundled plugin must be in there, under our signature. if ($proc.ExitCode -eq 0) { $plugin = @($inner | Where-Object { $_.Name -eq $sidecarName }) @@ -129,7 +137,7 @@ if ($nsisBuilt) { $failed += "NSIS > $sidecarName (missing)" } elseif (-not (Test-OurSigner (Get-Item -LiteralPath $sidecarSource) "NSIS > $sidecarName (as packed)" $nsisInstaller)) { $failed += "NSIS > $sidecarName (signer)" - } elseif (-not @($log | Where-Object { $_ -match '\\binaries\\session-manager-plugin-[^\\]+\.exe$' }).Count) { + } elseif (-not @($log | Where-Object { $_ -match '\\src-tauri\\binaries\\session-manager-plugin-x86_64-pc-windows-msvc\.exe$' }).Count) { Write-Host "FAIL $sidecarName - no signature was logged for it" $failed += "NSIS > $sidecarName (not logged)" } -- 2.52.0 From 614e89bef47c45ffdc7226a1bdb11bff54dc719d Mon Sep 17 00:00:00 2001 From: Josh Knapp Date: Tue, 17 Nov 2026 08:21:55 -0800 Subject: [PATCH 07/12] fix(ssm-plugin): lock down the Windows work root; re-hash the output in place The short %SystemDrive%\ssm-<8hex> root inherited the drive root's ACL, where Authenticated Users can write, so another local user could swap the source, toolchain or output between verification and use. Right after creating it, icacls removes inheritance and grants full control only to SYSTEM, Administrators and the current user's SID; failure aborts. It is mandatory on Windows and skipped only off Windows (the pwsh test path). The binary is hashed again at its final location. Co-Authored-By: Claude Opus 5.5 --- scripts/build-ssm-plugin.ps1 | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/scripts/build-ssm-plugin.ps1 b/scripts/build-ssm-plugin.ps1 index 976c556..faeb035 100644 --- a/scripts/build-ssm-plugin.ps1 +++ b/scripts/build-ssm-plugin.ps1 @@ -57,6 +57,20 @@ if ((Test-Path -LiteralPath $dest) -and ((Get-Sha256 $dest) -eq $BinarySha)) { # is 260 for Windows PowerShell 5.1, tar.exe and the Go build alike. $work = Join-Path "$env:SystemDrive\" ('ssm-' + [guid]::NewGuid().ToString('N').Substring(0, 8)) New-Item -ItemType Directory -Path $work | Out-Null +# A directory at the drive root inherits C:\'s ACL, where Authenticated Users +# may create and modify files - another local user could swap the source, the +# toolchain or the output between our checks and their use. So before anything +# lands in it: no inheritance, full control for SYSTEM, Administrators and this +# process's own user only. Mandatory on Windows; skipped only where there is no +# Windows ACL (the Linux pwsh test path). +if ($env:OS -eq 'Windows_NT') { + $me = [Security.Principal.WindowsIdentity]::GetCurrent().User.Value + & icacls.exe $work /inheritance:r /grant:r '*S-1-5-18:(OI)(CI)F' '*S-1-5-32-544:(OI)(CI)F' "*${me}:(OI)(CI)F" | Out-Null + if ($LASTEXITCODE -ne 0) { + Remove-Item -LiteralPath $work -Recurse -Force -ErrorAction SilentlyContinue + throw "icacls could not restrict $work ($LASTEXITCODE)" + } +} $ProgressPreference = 'SilentlyContinue' try { $goZip = Join-Path $work 'go.zip' @@ -124,6 +138,12 @@ try { New-Item -ItemType Directory -Force -Path $destDir | Out-Null Move-Item -LiteralPath $out -Destination $dest -Force + # And what landed is still what was checked. + $actual = Get-Sha256 $dest + if ($actual -ne $BinarySha) { + Remove-Item -LiteralPath $dest -Force -ErrorAction SilentlyContinue + throw "$dest changed after it was verified: got $actual, pinned $BinarySha" + } Write-Host "session-manager-plugin-$Triple.exe: session-manager-plugin $PluginVersion (unsigned; signed by the release build)" } finally { Remove-Item -LiteralPath $work -Recurse -Force -ErrorAction SilentlyContinue -- 2.52.0 From a93a8135be1657a41059f77d0879dfc11efd8129 Mon Sep 17 00:00:00 2001 From: Josh Knapp Date: Tue, 17 Nov 2026 12:16:55 -0800 Subject: [PATCH 08/12] fix(aws): settings layout and deploy for anyone who can Hosts settings live in a 224-320px sidebar; nowrap buttons and long ARNs, policy names and run summaries overflowed it. Button and StatusIndicator get an opt-in wrap prop; host, environment, progress and policy rows wrap with min-w-0 children; policy copy buttons sit in an auto-fill grid; pre blocks scroll; the Modal footer wraps. Deploy a new environment and self-join are offered to anyone after a scan. When the permission check didn't confirm environment-admin rights a note says AWS has the last word, and the policies and environment request sit under a 'Not an admin?' disclosure. The boundary note shows whenever the boundary is missing. AWS refusals show AWS's message (awsErrorMessage now names the denied action) and offer the admin bundle: in the deploy and join modals, and under a failed deploy/join run whose output reads as denied. The backend already had no tier check on onboard_aws_user; its comment is corrected. Co-Authored-By: Claude Opus 5.5 --- .../src/commands/environment_commands.rs | 7 +- app/src/components/settings/HostsSettings.tsx | 26 +-- .../settings/hosts/AdminBundleModal.tsx | 2 +- .../settings/hosts/DeployEnvironmentModal.tsx | 19 +- .../settings/hosts/DeployProgress.test.tsx | 28 ++- .../settings/hosts/DeployProgress.tsx | 23 +- .../settings/hosts/Ec2CapacityFields.tsx | 1 + .../settings/hosts/EnvironmentsPanel.test.tsx | 176 ++++++++++++++- .../settings/hosts/EnvironmentsPanel.tsx | 202 ++++++++++++------ .../settings/hosts/JoinEnvironmentModal.tsx | 30 ++- .../settings/hosts/NetworkFields.tsx | 1 + .../components/settings/hosts/PolicyFiles.tsx | 48 +++-- .../settings/hosts/environmentFormat.ts | 4 + app/src/components/ui/Button.test.tsx | 19 ++ app/src/components/ui/Button.tsx | 14 +- app/src/components/ui/Modal.tsx | 2 +- app/src/components/ui/StatusIndicator.tsx | 5 +- app/src/lib/aws-error.test.ts | 19 +- app/src/lib/aws-error.ts | 13 ++ 19 files changed, 498 insertions(+), 141 deletions(-) diff --git a/app/src-tauri/src/commands/environment_commands.rs b/app/src-tauri/src/commands/environment_commands.rs index 736a346..71d6e9a 100644 --- a/app/src-tauri/src/commands/environment_commands.rs +++ b/app/src-tauri/src/commands/environment_commands.rs @@ -374,9 +374,10 @@ pub(crate) fn ec2_collision_refusal( /// Everything a self-onboarding apply needs settled before it starts: the /// caller's record, the capacity ([`resolve_ec2`]), the module variables /// and, with EC2 capacity, the name check ([`ec2_collision_refusal`]). -/// Check-then-apply leaves a narrow race (another admin creating the same -/// names in between); only admins apply, and the module would then fail on -/// create rather than adopt. +/// Check-then-apply leaves a narrow race (someone else creating the same +/// names in between); the module would then fail on create rather than +/// adopt. Anyone may start this: there is no tier check in the app, and AWS +/// refuses (mapped to `AccessDenied`) what the caller isn't permitted. pub(crate) async fn prepare_onboarding( api: &A, env: &str, diff --git a/app/src/components/settings/HostsSettings.tsx b/app/src/components/settings/HostsSettings.tsx index b1653d9..9a70a49 100644 --- a/app/src/components/settings/HostsSettings.tsx +++ b/app/src/components/settings/HostsSettings.tsx @@ -64,7 +64,7 @@ function ErrorLine({ }) { return (
- {awsErrorMessage(failure.error)} + {awsErrorMessage(failure.error)} {failure.error.kind === "sso_expired" && !onSignIn && ( Sign in with aws sso login --profile {failure.error.profile} and try again. @@ -124,7 +124,7 @@ function PermissionReportView({ report }: { report: PermissionReport }) { > {badge} - + {report.identity.arn} · {report.region}
@@ -154,8 +154,8 @@ function PermissionReportView({ report }: { report: PermissionReport }) {
    {t.results.map((r) => ( -
  • - {r.action} — {r.verdict} +
  • + {r.action} — {r.verdict} {r.note && ( <> {" "} @@ -263,7 +263,7 @@ function ConnectionRow({ host }: { host: HostConnection }) {
  • {editing ? (
    @@ -273,7 +273,7 @@ function ConnectionRow({ host }: { host: HostConnection }) { setRegion(e.target.value)} /> )} -
    +
    @@ -283,16 +283,16 @@ function ConnectionRow({ host }: { host: HostConnection }) {
    ) : ( -
    +
    -
    {host.name}
    -
    +
    {host.name}
    +
    {auth.method === "profile" ? `Profile: ${auth.name}` : "Access keys"} {" · "} {host.kind.default_region}
    -
    +
    @@ -309,7 +309,7 @@ function ConnectionRow({ host }: { host: HostConnection }) { )} {confirmRemove && (
    - Remove {host.name}? Its stored credentials are deleted. + Remove {host.name}? Its stored credentials are deleted. @@ -501,7 +501,7 @@ function AddConnectionForm() { {busy ? "Adding…" : "Add connection"} {signedInAs && ( -

    +

    Signed in as {signedInAs}

    )} @@ -516,7 +516,7 @@ export default function HostsSettings() { const { appSettings } = useSettings(); const hosts = appSettings?.hosts ?? []; return ( -
    +

    Where project environments run. AWS connections check what your credentials can do, and find, deploy and join environments.

    diff --git a/app/src/components/settings/hosts/AdminBundleModal.tsx b/app/src/components/settings/hosts/AdminBundleModal.tsx index 59719e4..6a852e2 100644 --- a/app/src/components/settings/hosts/AdminBundleModal.tsx +++ b/app/src/components/settings/hosts/AdminBundleModal.tsx @@ -177,7 +177,7 @@ export default function AdminBundleModal({ Saved to {saved}

    From that folder, run:

    -
    +            
                   {COMMANDS}
                 
    -
    {boundaryError && ( -

    +

    {awsErrorMessage(boundaryError)}

    )} @@ -149,6 +153,7 @@ export default function DeployEnvironmentModal({

    +
    + )}
    )} diff --git a/app/src/components/settings/hosts/DeployProgress.test.tsx b/app/src/components/settings/hosts/DeployProgress.test.tsx index 0e4e17c..99c4065 100644 --- a/app/src/components/settings/hosts/DeployProgress.test.tsx +++ b/app/src/components/settings/hosts/DeployProgress.test.tsx @@ -1,6 +1,6 @@ import { describe, it, expect, vi, beforeEach } from "vitest"; -import { act, renderHook } from "@testing-library/react"; -import { runKey, useDeployRuns } from "./DeployProgress"; +import { act, render, renderHook, screen } from "@testing-library/react"; +import DeployProgressView, { runKey, useDeployRuns } from "./DeployProgress"; import type { DeployProgress } from "../../../lib/types"; import { progress, tofuEvent } from "./testkit"; @@ -75,3 +75,27 @@ describe("useDeployRuns", () => { expect(result.current.runs).toEqual({}); }); }); + +describe("DeployProgress layout", () => { + it("wraps its header and a long failure summary", () => { + render( + , + ); + const header = screen.getByTestId("deploy-progress-header"); + expect(header.className).toContain("flex-wrap"); + expect(header.firstElementChild?.className).toContain("min-w-0"); + expect(screen.getByRole("status").firstElementChild?.className).toContain("whitespace-normal"); + }); +}); diff --git a/app/src/components/settings/hosts/DeployProgress.tsx b/app/src/components/settings/hosts/DeployProgress.tsx index bd51d1b..f2008e4 100644 --- a/app/src/components/settings/hosts/DeployProgress.tsx +++ b/app/src/components/settings/hosts/DeployProgress.tsx @@ -146,7 +146,7 @@ function EventLine({ e }: { e: TofuEvent }) { return (
  • {(e.resource || e.action) && ( - + {e.resource && {e.resource}} {e.action && {e.action}} @@ -154,10 +154,10 @@ function EventLine({ e }: { e: TofuEvent }) { {isError ? ( <> Error: -
    {e.message}
    +
    {e.message}
    ) : ( - {e.message} + {e.message} )}
  • ); @@ -205,14 +205,14 @@ export default function DeployProgress({ return (
    -
    -
    - {run.label} +
    +
    + {run.label} {status && }
    -
    +
    {!run.done && ( +
    + )} +
    + ); + }; const envRow = (found: EnvironmentScan, e: DetectedEnvironment) => { const at = found.region; @@ -349,10 +386,10 @@ export default function EnvironmentsPanel({ data-testid={`env-${e.name}`} className="border border-[var(--border-color)] rounded-[var(--radius-control)] p-2 space-y-1.5" > -
    -
    -
    - {e.name} +
    +
    +
    + {e.name} {onboarding === "joined" && } {onboarding === "in_progress" && } @@ -407,11 +444,11 @@ export default function EnvironmentsPanel({ })()}
    )} - {!isAdmin && isWaiting && onboarding !== "joined" && ( + {isWaiting && onboarding !== "joined" && (
    Waiting for an admin to onboard you
    )}
    -
    +
    {has("join") && onboarding !== "joined" && onboarding !== "in_progress" && ( )} {has("join") && onboarding === "joined" && ( )} {mine("follow") && ( @@ -548,7 +586,7 @@ export default function EnvironmentsPanel({
    {rowError && ( -

    +

    {awsErrorMessage(rowError)}

    )} @@ -560,14 +598,14 @@ export default function EnvironmentsPanel({ const nothingFound = !!current && current.environments.length === 0; return ( -
    +
    {open && ( -
    -
    +
    +
    {(id) => ( edit(i, field, e.target.value)} + onBlur={() => commit(rowsRef.current)} + placeholder={field === "host" ? "Host port" : "Container port"} + aria-label={`${field === "host" ? "Host" : "Container"} port ${i + 1}`} + aria-invalid={missing || undefined} + aria-describedby={rowProblem(row) ? `pm-problem-${row.key}` : undefined} + data-row={row.key} + data-field={field} + disabled={disabled} + className={`w-[28%] ${monoInputClass} ${placeholderClass}`} + /> + ); }; return ( -
    +
    { + if (!e.currentTarget.contains(e.relatedTarget as Node | null)) setFocusLeft((n) => n + 1); + }} + > {disabled && disabledReason && (

    {disabledReason}

    )} - {mappings.length === 0 && ( + {rows.length === 0 && (

    No port mappings configured.

    )} - {mappings.length > 0 && ( + {rows.length > 0 && (
    Host port Container port @@ -57,71 +172,58 @@ export default function PortMappingsEditor({
    )} - {mappings.map((pm, i) => ( -
    - updatePort(i, "host_port", e.target.value)} - onBlur={() => onSave(mappings)} - placeholder="8080" - aria-label={`Host port ${i + 1}`} - disabled={disabled} - className={`w-[28%] ${monoInputClass}`} - /> - updatePort(i, "container_port", e.target.value)} - onBlur={() => onSave(mappings)} - placeholder="8080" - aria-label={`Container port ${i + 1}`} - disabled={disabled} - className={`w-[28%] ${monoInputClass}`} - /> - - -
    - ))} + {rows.map((row, i) => { + const problem = rowProblem(row); + return ( +
    +
    + {portInput(row, i, "host")} + {portInput(row, i, "container")} + + +
    + {problem && ( +

    + ⚠ {problem} — this mapping isn't saved or active. +

    + )} +
    + ); + })}