-
Notifications
You must be signed in to change notification settings - Fork 1
fix: restore vault sonar env and TS tailwind scan for QA screenshots #26
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
Changes from all commits
8197657
18af30c
f19b820
f5d72aa
05ba98e
cc493cb
216afe6
3f21fd1
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 |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| # This file is committed to git no secrets. | ||
|
|
||
| #!/usr/bin/env bash | ||
|
|
||
| # Vault environment loader wrapper | ||
| # Usage: source .env (never run directly) | ||
|
|
||
| set -o pipefail | ||
|
|
||
| if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then | ||
| echo "This script must be sourced: source .env" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
| HELPER_PATH="${VAULT_HELPER_PATH:-${SCRIPT_DIR}/scripts/vault-helper.sh}" | ||
|
|
||
| if [[ ! -r "$HELPER_PATH" ]]; then | ||
| echo "Vault helper not found at $HELPER_PATH" >&2 | ||
| return 1 | ||
| fi | ||
|
|
||
| # shellcheck source=./scripts/vault-helper.sh | ||
| source "$HELPER_PATH" | ||
|
|
||
| DEFAULT_VAULT_SECRET_DEFS=$'kv/Sonarqube/sonarqube|SONAR_TOKEN=SONAR_TOKEN SONAR_TOKEN=sonar_token SONAR_TOKEN=token\nkv/dependencytrack|DTRACK_API_KEY=DTRACK_API_KEY DTRACK_API_KEY=api_key DTRACK_API_KEY=token' | ||
| DEFAULT_VAULT_REQUIRED_VARS="SONAR_TOKEN DTRACK_API_KEY" | ||
|
|
||
| if [[ -z "${VAULT_TOKEN:-}" ]]; then | ||
| token_candidates=() | ||
| if [[ -n "${VAULT_TOKEN_FILE:-}" ]]; then | ||
| token_candidates+=("$VAULT_TOKEN_FILE") | ||
| fi | ||
| token_candidates+=("${HOME}/.vault-token" "/home/vscode/.vault-token" "/root/.vault-token") | ||
| for token_path in "${token_candidates[@]}"; do | ||
| if [[ -r "$token_path" ]]; then | ||
| VAULT_TOKEN_FILE="$token_path" | ||
| export VAULT_TOKEN_FILE | ||
| break | ||
| fi | ||
| done | ||
| fi | ||
|
|
||
| SECRET_DEFS="${VAULT_SECRET_PATHS:-$DEFAULT_VAULT_SECRET_DEFS}" | ||
| REQUIRED_VARS="${VAULT_REQUIRED_VARS:-$DEFAULT_VAULT_REQUIRED_VARS}" | ||
|
|
||
| vault_helper::load_from_definitions "$SECRET_DEFS" "$REQUIRED_VARS" "$VAULT_TOKEN_FILE" | ||
|
Comment on lines
+44
to
+47
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 4. Vault prompts can hang • .env unconditionally calls vault_helper::load_from_definitions, which may invoke interactive read prompts when a token is missing/invalid. • scripts/sonar-scan.js runs .env inside a spawned bash with stdin inherited; in non-interactive contexts this can block until timeout. • This makes npm run sonar fragile on machines that have vault+jq installed but no valid token file/env configured. Agent Prompt
|
||
|
|
||
| # Commented out for CI/automated testing | ||
| # SONAR_TOKEN="" | ||
| DTR_PROJECT_KEY= | ||
| # DTRACK_API_KEY="" | ||
| DTRACK_PROJECT=ai-code-fusion | ||
| DTRACK_PROJECT_VERSION=main | ||
|
|
||
| # Local SonarQube defaults (cross-platform, no secrets) | ||
| SONAR_PROJECT_KEY=ai-code-fusion | ||
| # SONAR_TOKEN= | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| version: 2 | ||
| updates: | ||
| - package-ecosystem: npm | ||
| directory: "/" | ||
| schedule: | ||
| interval: weekly | ||
| open-pull-requests-limit: 10 | ||
| labels: | ||
| - dependencies | ||
| - dependabot | ||
|
|
||
| - package-ecosystem: github-actions | ||
| directory: "/" | ||
| schedule: | ||
| interval: weekly | ||
| open-pull-requests-limit: 10 | ||
| labels: | ||
| - dependencies | ||
| - dependabot |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| name: Secrets Gate | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: ['main'] | ||
| push: | ||
| branches: ['main'] | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| gitleaks: | ||
| name: Gitleaks Secret Scan | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd | ||
| with: | ||
| fetch-depth: 0 | ||
| persist-credentials: false | ||
|
|
||
| - name: Install gitleaks | ||
| env: | ||
| GITLEAKS_VERSION: 8.24.3 | ||
| run: | | ||
| set -euo pipefail | ||
| curl -sSfL "https://github.com/gitleaks/gitleaks/releases/download/v${GITLEAKS_VERSION}/gitleaks_${GITLEAKS_VERSION}_linux_x64.tar.gz" -o gitleaks.tar.gz | ||
| tar -xzf gitleaks.tar.gz gitleaks | ||
| chmod +x gitleaks | ||
| echo "${PWD}" >> "${GITHUB_PATH}" | ||
|
Comment on lines
+25
to
+33
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🌐 Web query:
💡 Result: Yes—Gitleaks publishes SHA256 checksums on GitHub Releases:
To verify locally, GitHub recommends using the CLI command Sources: [1] [2] [3] 🌐 Web query:
💡 Result: The official GitHub repository for gitleaks-action is Verify the downloaded gitleaks binary's checksum to mitigate supply-chain risk. The gitleaks binary is fetched directly from GitHub Releases without verifying its SHA256 digest. If the release asset were ever tampered with, a malicious binary would be installed silently. Gitleaks publishes SHA256 checksums for each release in a dedicated checksum file, and GitHub also displays digests alongside each asset. 🔒 Proposed fix — add checksum verification - name: Install gitleaks
env:
GITLEAKS_VERSION: 8.24.3
+ GITLEAKS_SHA256: "<expected-sha256-for-linux-x64-tarball>"
run: |
set -euo pipefail
curl -sSfL "https://github.com/gitleaks/gitleaks/releases/download/v${GITLEAKS_VERSION}/gitleaks_${GITLEAKS_VERSION}_linux_x64.tar.gz" -o gitleaks.tar.gz
+ echo "${GITLEAKS_SHA256} gitleaks.tar.gz" | sha256sum -c -
tar -xzf gitleaks.tar.gz gitleaks
chmod +x gitleaks
echo "${PWD}" >> "${GITHUB_PATH}"Alternatively, use the official 🤖 Prompt for AI Agents |
||
|
|
||
| - name: Determine git scan range | ||
| id: scan-range | ||
| shell: bash | ||
| run: | | ||
| set -euo pipefail | ||
| if [[ "${{ github.event_name }}" == "pull_request" ]]; then | ||
| echo "log_opts=${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}" >> "${GITHUB_OUTPUT}" | ||
| elif [[ "${{ github.event.before }}" != "0000000000000000000000000000000000000000" ]]; then | ||
| echo "log_opts=${{ github.event.before }}..${{ github.sha }}" >> "${GITHUB_OUTPUT}" | ||
| else | ||
| echo "log_opts=${{ github.sha }}" >> "${GITHUB_OUTPUT}" | ||
| fi | ||
|
|
||
| - name: Scan commit range for secrets | ||
| run: | | ||
| set -euo pipefail | ||
| gitleaks git \ | ||
| --redact \ | ||
| --no-banner \ | ||
| --exit-code 1 \ | ||
| --log-opts="${{ steps.scan-range.outputs.log_opts }}" \ | ||
| --report-format json \ | ||
| --report-path gitleaks-report.json | ||
|
|
||
| - name: Upload gitleaks report | ||
| if: always() | ||
| uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f | ||
| with: | ||
| name: gitleaks-report | ||
| path: gitleaks-report.json | ||
| if-no-files-found: ignore | ||
| retention-days: 14 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,10 @@ | ||
| #!/usr/bin/env sh | ||
| . "$(dirname -- "$0")/_/husky.sh" | ||
|
|
||
| set -e | ||
|
|
||
| # Run lint-staged (works on both Windows with Git Bash and Linux) | ||
| npx lint-staged | ||
|
|
||
| # Block commits that introduce secrets. | ||
| npm run gitleaks |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| # AGENTS.md | ||
|
|
||
| Lightweight rules for automated agents and contributors in this repository. | ||
|
|
||
| ## Scope | ||
|
|
||
| - Keep changes focused and minimal. | ||
| - Do not make unrelated refactors. | ||
|
|
||
| ## Tests and Quality | ||
|
|
||
| - Before proposing merge-ready changes, run: | ||
| - `npm run lint` | ||
| - `npm test -- --runInBand` | ||
| - If UI behavior/layout is changed, also run: | ||
| - `npm run qa:screenshot` | ||
| - Do not mark work complete while required CI checks are failing. | ||
| - Use `tests/catalog.md` as the source of truth for test targets and use cases. | ||
|
|
||
| ## `.env` Policy (Local-Only) | ||
|
|
||
| - `.env` in this repo is for local development bootstrap only. | ||
| - Keep `.env` tracked; do not remove/rename it. | ||
| - Do not over-engineer or heavily refactor `.env` for non-local use. | ||
| - Never commit secrets/tokens in `.env`. | ||
| - Use Vault/environment-provided secrets for real credentials. | ||
|
|
||
| ## Review Focus for Agents | ||
|
|
||
| - Treat `.env` changes as sensitive even when local-only. | ||
| - Ensure `.env` updates are minimal, intentional, and documented in PR notes. | ||
| - Reject any hardcoded secret, token, or credential exposure in code, docs, or PR text. |
This file was deleted.
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.
2. Windows sonar env broken
🐞 Bug✓ CorrectnessAgent Prompt
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools