Skip to content

fix(auth): accept canonical TrustSignal API key in production#83

Open
chrismaz11 wants to merge 6 commits intomasterfrom
chrismaz11-patch-2
Open

fix(auth): accept canonical TrustSignal API key in production#83
chrismaz11 wants to merge 6 commits intomasterfrom
chrismaz11-patch-2

Conversation

@chrismaz11
Copy link
Copy Markdown
Collaborator

Summary

  • accept TRUSTSIGNAL_API_KEY as a canonical production auth source without duplicating it in API_KEYS
  • add optional TRUSTSIGNAL_API_KEY_SCOPES with safe verify|read defaults for the single-key path
  • document the production env contract and add regression coverage for security config resolution

Security Review

  • auth logic changed in apps/api/src/security.ts
  • the new path reduces secret drift between GitHub Actions and backend allowlists for the common single-key deployment
  • default canonical scopes are constrained to verify|read; broader scopes still require explicit configuration
  • no new runtime dependencies were added

Dependencies

  • none

Copilot AI review requested due to automatic review settings March 24, 2026 02:48
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 24, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
trustsignal Ready Ready Preview, Comment Mar 24, 2026 5:28am

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the API security configuration to support a canonical production API key env var (TRUSTSIGNAL_API_KEY) without requiring duplication in API_KEYS, with constrained default scopes and regression coverage to prevent misconfiguration.

Changes:

  • Extend buildSecurityConfig to accept TRUSTSIGNAL_API_KEY, with default canonical scopes of verify|read and optional override via TRUSTSIGNAL_API_KEY_SCOPES.
  • Add Vitest coverage for production auth env resolution (canonical key path, scope overrides, and fail-fast behavior).
  • Document the new production env contract in .env.example and README.md.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
apps/api/src/security.ts Adds canonical key env support and pipe-delimited scope parsing with safe defaults.
tests/api/security-config.test.ts Adds regression tests for production security config resolution with the canonical key.
apps/api/.env.example Documents canonical single-key env configuration and scope defaults.
README.md Documents recommended production configuration for the public verification surface.
.github/workflows/main.yml Adds a new workflow file (currently a push-triggered placeholder job).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +3 to +15
on:
workflow_dispatch:
push:
branches: ["master"]

jobs:
verify-artifact:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Echo placeholder
run: echo "Placeholder TrustSignal verify artifact task"
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This workflow appears unrelated to the PR’s stated auth/env changes and currently only runs an echo placeholder on every push to master. If it’s not meant to provide real CI/verification yet, consider removing it from this PR (or switching it to workflow_dispatch only) to avoid adding a permanently-noop job that still consumes Actions capacity and can confuse release/CI signals.

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,15 @@
name: .github/workflows/main.yml
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Workflow name is set to the file path (.github/workflows/main.yml), which is inconsistent with the descriptive names used in other workflows (e.g., "TrustSignal CI", "AI PR Review Gate"). Consider renaming it to a short human-readable label so it’s clear in the GitHub Actions UI what this workflow represents.

Suggested change
name: .github/workflows/main.yml
name: TrustSignal Artifact Verification

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1ad6d2d3cf

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

- name: Checkout
uses: actions/checkout@v4
- name: Echo placeholder
run: echo "Placeholder TrustSignal verify artifact task"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Run real artifact verification in verify-artifact job

The verify-artifact workflow step currently only echoes a placeholder string, so this job will pass even when artifact verification is broken or missing. On push to master, that creates a false-positive CI signal for a security-sensitive control and weakens the auditability this workflow name implies.

Useful? React with 👍 / 👎.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants