-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Add language-agnostic JSON interface and CLI for cross-language Shield usage #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
83dcf96
f787950
dad6585
d1811e9
cc9f28d
d7ceb00
140dc75
b77a3f8
8866dea
cac3139
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -4,55 +4,176 @@ on: | |||||||||||||||||||||||
| release: | ||||||||||||||||||||||||
| types: [published] | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| # SECURITY: Limit permissions at workflow level | ||||||||||||||||||||||||
| permissions: | ||||||||||||||||||||||||
| contents: read | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||
| # ========================================== | ||||||||||||||||||||||||
| # Job 1: Publish to NPM | ||||||||||||||||||||||||
| # ========================================== | ||||||||||||||||||||||||
| publish: | ||||||||||||||||||||||||
| name: Publish to NPM | ||||||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||||||
| environment: production | ||||||||||||||||||||||||
| permissions: | ||||||||||||||||||||||||
| contents: read | ||||||||||||||||||||||||
| id-token: write | ||||||||||||||||||||||||
| id-token: write | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||
| - name: Checkout code | ||||||||||||||||||||||||
| uses: actions/checkout@v4 | ||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||
| ref: main | ||||||||||||||||||||||||
| ref: main | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| - name: Setup Node.js | ||||||||||||||||||||||||
| uses: actions/setup-node@v4 | ||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||
| node-version: 20.17.0 | ||||||||||||||||||||||||
| registry-url: 'https://registry.npmjs.org' | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| - name: Install pnpm | ||||||||||||||||||||||||
| uses: pnpm/action-setup@v2 | ||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||
| version: 10.12.2 | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| - name: Get pnpm store directory | ||||||||||||||||||||||||
| shell: bash | ||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||
| echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| - name: Setup pnpm cache | ||||||||||||||||||||||||
| uses: actions/cache@v3 | ||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||
| path: ${{ env.STORE_PATH }} | ||||||||||||||||||||||||
| key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | ||||||||||||||||||||||||
| restore-keys: | | ||||||||||||||||||||||||
| ${{ runner.os }}-pnpm-store- | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| - name: Install dependencies | ||||||||||||||||||||||||
| run: pnpm install --frozen-lockfile | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| - name: Run tests | ||||||||||||||||||||||||
| run: pnpm test | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| - name: Build package | ||||||||||||||||||||||||
| run: pnpm run build | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| - name: Publish to NPM | ||||||||||||||||||||||||
| run: pnpm publish --access public --no-git-checks --provenance | ||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||||||||||||||||||||||||
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| # ========================================== | ||||||||||||||||||||||||
| # Job 2: Build binaries for all platforms | ||||||||||||||||||||||||
| # ========================================== | ||||||||||||||||||||||||
| build-binaries: | ||||||||||||||||||||||||
| name: Build Binary (${{ matrix.platform }}-${{ matrix.arch }}) | ||||||||||||||||||||||||
| runs-on: ${{ matrix.os }} | ||||||||||||||||||||||||
| # SECURITY: Only grant write permission where needed | ||||||||||||||||||||||||
| permissions: | ||||||||||||||||||||||||
| contents: write | ||||||||||||||||||||||||
| attestations: write # SECURITY: For artifact attestation | ||||||||||||||||||||||||
| id-token: write # SECURITY: For OIDC signing | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| strategy: | ||||||||||||||||||||||||
| matrix: | ||||||||||||||||||||||||
| include: | ||||||||||||||||||||||||
| - os: ubuntu-latest | ||||||||||||||||||||||||
| platform: linux | ||||||||||||||||||||||||
| arch: x64 | ||||||||||||||||||||||||
| - os: macos-latest | ||||||||||||||||||||||||
| platform: darwin | ||||||||||||||||||||||||
| arch: arm64 | ||||||||||||||||||||||||
| - os: macos-13 | ||||||||||||||||||||||||
| platform: darwin | ||||||||||||||||||||||||
| arch: x64 | ||||||||||||||||||||||||
| - os: windows-latest | ||||||||||||||||||||||||
| platform: win32 | ||||||||||||||||||||||||
| arch: x64 | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||
| - name: Checkout code | ||||||||||||||||||||||||
| uses: actions/checkout@v4 | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| - name: Setup Node.js | ||||||||||||||||||||||||
| uses: actions/setup-node@v4 | ||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||
| node-version: '22' | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| - name: Install pnpm | ||||||||||||||||||||||||
| uses: pnpm/action-setup@v2 | ||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||
| version: 10.12.2 | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| - name: Get pnpm store directory | ||||||||||||||||||||||||
| shell: bash | ||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||
| echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| - name: Setup pnpm cache | ||||||||||||||||||||||||
| uses: actions/cache@v3 | ||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||
| path: ${{ env.STORE_PATH }} | ||||||||||||||||||||||||
| key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | ||||||||||||||||||||||||
| restore-keys: | | ||||||||||||||||||||||||
| ${{ runner.os }}-pnpm-store- | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| - name: Install dependencies | ||||||||||||||||||||||||
| run: pnpm install --frozen-lockfile | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| # SECURITY: Run audit before building | ||||||||||||||||||||||||
| - name: Security audit | ||||||||||||||||||||||||
| run: pnpm audit --audit-level=high | ||||||||||||||||||||||||
| continue-on-error: true | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| - name: Build TypeScript | ||||||||||||||||||||||||
| run: pnpm build | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| - name: Bundle CLI for SEA | ||||||||||||||||||||||||
| run: pnpm build:cli:bundle | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| - name: Prepare SEA blob | ||||||||||||||||||||||||
| run: pnpm build:sea:prepare | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| - name: Build binary | ||||||||||||||||||||||||
| run: pnpm build:sea | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| - name: Rename binary (Unix) | ||||||||||||||||||||||||
| if: matrix.platform != 'win32' | ||||||||||||||||||||||||
| run: mv shield-${{ matrix.platform }}-* shield-${{ matrix.platform }}-${{ matrix.arch }} | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
| run: mv shield-${{ matrix.platform }}-* shield-${{ matrix.platform }}-${{ matrix.arch }} | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| shopt -s nullglob | |
| files=(shield-${{ matrix.platform }}-*) | |
| if [ "${#files[@]}" -ne 1 ]; then | |
| echo "Error: Expected exactly one built binary matching 'shield-${{ matrix.platform }}-*', found ${#files[@]}: ${files[*]-}" >&2 | |
| exit 1 | |
| fi | |
| mv "${files[0]}" "shield-${{ matrix.platform }}-${{ matrix.arch }}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The workflow uses
continue-on-error: truefor the security audit step, which means the build will proceed even if high-severity vulnerabilities are found. This undermines the security guarantees mentioned in the PR description. Consider either removingcontinue-on-erroror at least adding a follow-up step that reviews the audit results and blocks the release if critical vulnerabilities are found.