278 Commits

Author SHA1 Message Date
Jonathan Flatt
ea2de29d37 Fix Trivy scanner multi-line image tag error
Extract only the first tag from Docker metadata output to fix
"could not parse reference" error when multiple tags are present.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-24 18:53:14 +00:00
Jonathan Flatt
012e96a75f Fix Docker push permissions for pull requests
Only push Docker images when not in a pull request context. PRs don't have
permission to push to ghcr.io, so we should only build without pushing.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-24 18:44:07 +00:00
Jonathan Flatt
355241e8f7 Fix invalid Docker tag format in CI/CD
Remove branch prefix from sha-based tags to avoid invalid tag format
when branch name is empty. Tags cannot start with a hyphen.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-24 18:36:55 +00:00
Jonathan Flatt
74f194a7db Merge branch 'main' into fix/trufflehog-scheduled-runs 2025-05-24 18:34:45 +00:00
Jonathan Flatt
50f55ddf28 Remove non-existent typecheck step from CI/CD
The project is written in JavaScript, not TypeScript, so there's no
typecheck script in package.json. Removing this step prevents CI failures.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-24 18:24:39 +00:00
Jonathan Flatt
f36600aeca Fix linting errors across the codebase
- Remove unused variables and imports
- Add underscore prefix to intentionally unused caught errors
- Fix ESLint config to recognize underscore pattern for caught errors
- Update test mocks to use underscore prefix for unused parameters

All 12 linting errors resolved, only warnings remain.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-24 18:22:00 +00:00
Jonathan Flatt
fde4d593f1 Fix TruffleHog failing on scheduled runs
- Only set base/head parameters for pull requests
- For scheduled runs and pushes, let TruffleHog scan entire repo
- Fixes "BASE and HEAD commits are the same" error

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-24 18:14:29 +00:00
Jonathan Flatt
c51eba4f0f Add deployment workflow and scripts for self-hosted runner
- Add GitHub Actions deployment workflow for staging and production
- Add deployment scripts for automated deployments
- Add GitHub runner management scripts
- Add staging docker-compose configuration
- Enable automatic deployments on push to main (staging) and version tags (production)
2025-05-23 23:39:33 +00:00
Cheffromspace
398027ae27 Merge pull request #28 from intelligence-assist/fix-docker-command-injection
Fix command injection vulnerability in Docker execution
2025-05-23 18:06:44 -05:00
ClaudeBot
03d18f5aa9 Resolve merge conflicts with main branch
- Keep structured logging with dockerImageName parameter from fix-docker-command-injection branch
- Merge latest changes from main including CI/CD improvements, Docker Hub setup, and documentation updates

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-23 23:00:30 +00:00
Cheffromspace
8ab0ea1471 Merge pull request #42 from intelligence-assist/docs/docker-hub-auth-setup
docs: Add Docker Hub authentication guide
2025-05-22 21:14:27 -05:00
Cheffromspace
92874f727a Merge pull request #41 from intelligence-assist/fix/readme-badges
fix: Update CI and Security badge URLs to correct repository
2025-05-22 21:13:11 -05:00
Jonathan Flatt
e250706a1a fix: Address PR review feedback for Docker Hub authentication docs
- Clarify that DOCKER_HUB_USERNAME is an environment variable, not a secret
- Add cross-reference to existing docker-ci-cd.md documentation
- Document both build jobs that use Docker Hub authentication
- Update troubleshooting section to reflect actual workflow configuration

This addresses the concerns raised in the automated PR review about
incorrect secret references and documentation overlap.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-23 02:10:32 +00:00
Jonathan Flatt
c2f77b58d4 docs: Add Docker Hub authentication guide for GitHub Actions
- Document how to create Docker Hub access tokens
- Explain both repository and organization secret setup options
- Include troubleshooting steps for common authentication issues
- Add security best practices for token management

This guide helps contributors set up Docker Hub authentication
correctly to avoid the "Password required" error in CI/CD workflows.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-23 02:04:03 +00:00
Jonathan Flatt
f9b2869620 fix: Update CI and Security badge URLs to correct repository
- Replace placeholder 'your-org/claude-github-webhook' with actual repository 'intelligence-assist/claude-hub'
- Fix broken CI Pipeline and Security Scans badges in README

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-23 01:39:11 +00:00
Cheffromspace
8786e3048f Merge pull request #39 from intelligence-assist/feat/prompt_improvements
feat: Update PR review prompt with comprehensive GitHub API instructions
2025-05-22 20:35:02 -05:00
Jonathan Flatt
265738ab46 Merge remote-tracking branch 'origin/main' into feat/prompt_improvements 2025-05-23 01:34:02 +00:00
Jonathan Flatt
4c5fb59251 feat: Optimize Docker PR builds for speed
- Only trigger PR builds when Docker-related files change
- Skip Docker Hub login/push for PR builds (build-only validation)
- Use single platform (amd64) for PR builds vs multi-platform for releases
- Skip claudecode build entirely for PRs
- Keep aggressive GitHub Actions caching for faster rebuilds
- Add path filtering to prevent unnecessary Docker builds
2025-05-22 20:32:00 -05:00
Jonathan Flatt
a96d4969ed fix: Fix Docker tag format for PR builds
- Only add SHA prefix for branch builds, not PRs
- Add proper PR tag format (pr-NUMBER)
- Prevents invalid tag format error in GitHub Actions
2025-05-22 20:32:00 -05:00
Jonathan Flatt
c7863283bb feat: Add Docker Hub automated builds and publishing
- Add GitHub Actions workflow for automated Docker builds
- Configure staging builds on main/master branch pushes
- Configure release builds on version tags (v*.*.*)
- Support multi-platform builds (amd64, arm64)
- Auto-update Docker Hub README on main branch pushes
- Add comprehensive Docker Hub documentation
- Create publish script for manual releases
- Update docker-compose for public use

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-22 20:32:00 -05:00
Jonathan Flatt
1e3b88d718 Merge branch 'main' into feat/prompt_improvements
Resolved conflicts:
- Updated PR review prompt to include commit SHA tracking
- Integrated new features from main (PR labels, deduplication)
- Maintained comprehensive GitHub API instructions format
2025-05-23 01:03:28 +00:00
Jonathan Flatt
1811bd2e50 feat: Update PR review prompt with comprehensive GitHub API instructions
- Replace basic PR review workflow with detailed GitHub API instructions
- Add inline comment creation using gh api commands with proper parameters
- Include commit ID retrieval for line-specific comments
- Add comprehensive review submission with batch comments
- Provide clear guidance on review event types (APPROVE, REQUEST_CHANGES, COMMENT)
- Add file-type specific review focus areas
- Include multi-file output strategies for different PR sizes
- Update tests to match new prompt format and add GitHub service mocks

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-23 00:56:39 +00:00
Jonathan Flatt
dd31081b09 test: Add Octokit mock to fix Jest module resolution
- Mock @octokit/rest module to prevent ES module import errors in Jest
- Provide mock implementations for all Octokit methods used in tests
- Tests now pass with the new Octokit-based implementation

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-22 19:45:11 -05:00
Jonathan Flatt
6c219bc178 fix: Replace axios with Octokit to fix CodeQL SSRF vulnerabilities
- Install @octokit/rest package for secure GitHub API access
- Replace manual URL construction with Octokit client methods
- Fix all 6 CodeQL security alerts (3 critical SSRF, 3 medium)
- Update all GitHub API calls to use type-safe Octokit methods
- Maintain backward compatibility with existing tests

This addresses the server-side request forgery vulnerabilities identified
by CodeQL by using GitHub's official client library instead of manually
constructing API URLs.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-22 19:45:11 -05:00
Jonathan Flatt
7f1fe0c771 feat: Add PR review deduplication and status labels
- Add hasReviewedPRAtCommit() to check for existing reviews at specific commit SHA
- Add managePRLabels() to manage review status labels (in-progress, complete)
- Remove Combined Status API check that was incompatible with GitHub Actions
- Update PR reviews to include commit SHA for tracking
- Add comprehensive test coverage for deduplication logic

This prevents duplicate PR reviews when multiple check_suite events occur
and provides clear visual indicators of review status through labels.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-22 19:45:11 -05:00
Jonathan Flatt
582fa19bf6 fix: Improve PR review workflow reliability and performance
- Fix SHA extraction to use PR's actual commit SHA, not check suite SHA
- Add parallel processing for multiple PRs using Promise.allSettled
- Implement detailed status tracking for each PR review attempt
- Fix error handling to properly report failures and skipped reviews
- Add comprehensive unit tests for all edge cases
- Ensure mutually exclusive counting of success/failure/skipped states

This ensures the automated PR review process correctly verifies the right
commit status and provides clear feedback on what happened with each PR.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-22 19:45:11 -05:00
Jonathan Flatt
78815925da fix: Fix syntax errors and code formatting issues
- Fixed missing catch clause in handleWebhook function
- Removed extra closing braces causing syntax errors
- Fixed indentation issues throughout githubController.js
- Updated lint scripts for ESLint 9 flat config
- Applied automatic formatting fixes
- Fixed test data for check-suite tests

All tests now pass and code meets linting standards.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-22 19:45:11 -05:00
Jonathan Flatt
7182855dbe docs: Add comprehensive PR review workflow documentation
- Added detailed workflow diagrams using Mermaid
- Documented the complete automated PR review process
- Included troubleshooting guides and common issues
- Added code examples for key components
- Documented configuration requirements and security considerations

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-22 19:45:11 -05:00
Jonathan Flatt
906ec7403a fix: Fix automated PR review trigger on check_suite completion
- Fixed issue where PR reviews weren't being triggered when all checks passed
- Corrected logic to process all PRs in a check_suite event
- Fixed test data to include required SHA values for multiple PR handling
- Removed early return that prevented processing multiple PRs
- Cleaned up debugging code

The webhook now correctly:
1. Detects when check_suite completes with success
2. Verifies all status checks have passed using Combined Status API
3. Triggers Claude review for each associated PR
4. Handles multiple PRs in a single check_suite event

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-22 19:45:11 -05:00
Jonathan Flatt
fd5a30346b debug: Add logging to identify check_suite action types
Added detailed logging to understand why PR reviews aren't being triggered.
This will help identify if the issue is with the action type or pull_requests array.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-22 19:45:11 -05:00
Jonathan Flatt
a281db126c chore: Add comment to clarify integration tests are disabled
This will trigger a new CI run to test the PR review functionality.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-22 19:45:11 -05:00
Jonathan Flatt
791231ca67 fix: Use secure credentials consistently in GitHub service
- Fixed getCombinedStatus to use githubToken from secure credentials
- Fixed postComment to use consistent token retrieval
- Added missing credential retrieval in addLabelsToIssue and createRepositoryLabels
- Prevents authentication failures that were causing PR reviews to be skipped

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-22 19:45:11 -05:00
Jonathan Flatt
dfe27f299b docs: Update CI/CD documentation for separated workflows
- Update workflow descriptions to reflect new CI and deployment structure
- Add note about automated PR reviews when CI jobs complete successfully
- Renumber workflow sections for clarity

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-22 19:45:11 -05:00
Jonathan Flatt
4f634117f1 fix: Separate CI and deployment workflows to enable PR reviews
- Move build-and-push and deploy jobs to dedicated deploy.yml workflow
- CI workflow now only contains essential PR checks (test, security, docker)
- Prevents skipped deployment jobs from blocking PR review automation
- Fixes issue where PR #36 couldn't trigger automated reviews

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-22 19:45:11 -05:00
Jonathan Flatt
5256e912f1 docs: Add comprehensive automated PR review documentation
- Document the automated PR review system triggered by check_suite events
- Explain Combined Status API validation to prevent duplicate reviews
- Detail the comprehensive review process and focus areas
- Add supported webhook events section
- Clarify configuration requirements

Addresses documentation suggestions from PR #31 review.
2025-05-22 16:32:57 -05:00
Jonathan Flatt
c8b9fce737 fix: Use process.env.GITHUB_TOKEN consistently for CodeQL security 2025-05-22 14:37:36 -05:00
Jonathan Flatt
90c9fdf872 fix: Prevent duplicate PR reviews by validating all status checks complete
The PR review trigger was firing on every individual check_suite completion,
causing 30+ duplicate reviews when multiple CI checks were running. This fix:

- Adds getCombinedStatus() function to query GitHub's Combined Status API
- Validates ALL required status checks pass before triggering review
- Only reviews when combinedStatus.state === 'success'
- Prevents oversensitive triggering while maintaining immediate response

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-22 14:37:36 -05:00
ClaudeBot
aede80c150 fix: Fix AWS credential provider caching and associated tests
This commit improves the AWS credential provider by:
1. Adding proper caching mechanism for credentials
2. Checking for cached credentials before reading from filesystem
3. Fixing the test to properly verify object identity (not just equality)
4. Adding comprehensive documentation for the caching behavior

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-22 14:28:48 -05:00
Jonathan Flatt
2ab13ac736 feat: Update ESLint to v9 and fix linting issues
- Convert .eslintrc.js to eslint.config.js (ESLint v9 format)
- Add global definitions for fetch and URL
- Fix unused variables automatically via ESLint auto-fix
- Configure proper unused variable detection patterns
- All tests passing with good coverage (28 passed, 1 skipped)

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-22 14:13:22 -05:00
Jonathan Flatt
a2450d8da4 docs: Fix CLI command examples to reference correct claude-webhook path
Update CLI command examples in CLAUDE.md to use ./cli/claude-webhook instead of ./claude-webhook now that the script has been moved to the cli/ directory.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-22 14:13:22 -05:00
Jonathan Flatt
2662ed41da refactor: Clean up project root directory structure
- Remove backup Dockerfile and temporary benchmark results
- Organize scripts and documentation into proper directories
- Update CLAUDE.md to reference actual script locations instead of wrappers
- Enhance .gitignore to prevent future root directory clutter
- Move utilities to appropriate locations (cli/, test/, docs/)

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-22 14:13:22 -05:00
ClaudeBot
8015d8c26d fix: Prevent command injection vulnerability in Docker execution
- Replace string-based command construction with array-based execFileAsync
- Add comprehensive pattern-based credential redaction
- Implement least-privilege container security with configurable capabilities
- Add resource limits for Docker containers
- Add tests for Docker command execution security
- Use file-based handling for long commands

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-22 17:43:51 +00:00
Jonathan Flatt
cf92900bad ci: Remove gitleaks and trivy from security audit workflow
- Removed gitleaks-action step from security-audit.yml
- Removed trivy-action scanner step and SARIF upload
- Kept credential audit, high-risk file check, and npm audit
- Streamlined CI pipeline while maintaining essential security checks

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-21 23:03:07 -05:00
Jonathan Flatt
80a69973ac security: Fix command injection vulnerability in claudeService.js
- Replace execSync with execFileSync to prevent command injection attacks
- Sanitize container names to only allow safe characters (alphanumeric, dash, underscore)
- Update all Docker command executions to use safe argument arrays
- Remove unused execSync import
- All tests continue to pass

This addresses the CodeQL security alert for uncontrolled command line execution.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-21 23:03:07 -05:00
Jonathan Flatt
de2c25977c test: Fix failing unit tests by improving mock configuration
- Fixed githubController.test.js by adding proper secureCredentials mock
- Fixed githubService.test.js by adding logger and secureCredentials mocks
- Applied code formatting with Prettier across all files
- All tests now pass successfully

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-21 23:03:07 -05:00
Jonathan Flatt
3072f6e425 security: Replace example AWS credentials with generic placeholders
Replaces AWS access key examples (AKIAIOSFODNN7EXAMPLE) and secret keys
with generic EXAMPLE_KEY_ID and EXAMPLE_SECRET_KEY placeholders to prevent
security scanners from flagging them as potential real credentials.

Fixes workflow failure while maintaining test functionality.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-21 23:03:07 -05:00
Jonathan Flatt
7e545475d0 security: Implement comprehensive credential protection system
Replace environment variable credentials with secure file-based mounting
to prevent runtime credential exposure that was causing security leaks.

Key security improvements:
- Docker secrets integration for credential mounting
- Secure credential loader utility (secureCredentials.js)
- Enhanced logging redaction for all credential types
- Pre-commit security scanning with multiple tools
- Automated security audit workflow and scripts
- File-based credentials with proper 600 permissions

Services updated:
- githubController.js: Use secure credentials for webhook verification
- claudeService.js: Use secure credentials for GitHub/Anthropic APIs
- githubService.js: Use secure credentials for GitHub API calls
- logger.js: Enhanced redaction patterns for all credential types

New security infrastructure:
- ./scripts/setup/setup-secure-credentials.sh: Setup script for secure credentials
- ./scripts/security/credential-audit.sh: Comprehensive security audit
- .github/workflows/security-audit.yml: Automated security scanning
- docker-compose.yml: Updated to use Docker secrets by default
- k8s/secrets.yaml: Kubernetes secrets configuration
- systemd/claude-webhook.service: Systemd service configuration

This eliminates credential exposure in:
- Environment variables and process lists
- Container logs and debug output
- Git commits and PR comments
- Runtime error messages

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-21 23:03:07 -05:00
Jonathan Flatt
57a3a211f7 feat: Make auto-tagging more subtle and satisfying
- Remove verbose auto-tagging comments that cluttered issues
- Streamline Claude prompt to be more direct and action-oriented
- Auto-tagging now silently applies perfect labels without explanation
- Clean professional experience with satisfying "Claude just knows" feel

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-21 23:03:07 -05:00
dependabot[bot]
e4b64f0a7b chore(deps): Bump body-parser from 1.20.3 to 2.2.0 (#20)
Bumps [body-parser](https://github.com/expressjs/body-parser) from 1.20.3 to 2.2.0.
- [Release notes](https://github.com/expressjs/body-parser/releases)
- [Changelog](https://github.com/expressjs/body-parser/blob/master/HISTORY.md)
- [Commits](https://github.com/expressjs/body-parser/compare/1.20.3...v2.2.0)

---
updated-dependencies:
- dependency-name: body-parser
  dependency-version: 2.2.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-05-21 22:35:27 -05:00
dependabot[bot]
2dd57f8f32 chore(deps): Bump express from 4.21.2 to 5.1.0 (#19)
Bumps [express](https://github.com/expressjs/express) from 4.21.2 to 5.1.0.
- [Release notes](https://github.com/expressjs/express/releases)
- [Changelog](https://github.com/expressjs/express/blob/master/History.md)
- [Commits](https://github.com/expressjs/express/compare/4.21.2...v5.1.0)

---
updated-dependencies:
- dependency-name: express
  dependency-version: 5.1.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-05-21 22:30:50 -05:00