Skip to content

Conversation

@fmenezes
Copy link
Collaborator

@fmenezes fmenezes commented Nov 12, 2025

Proposed changes

Add pre-commit hook to run husky, which runs git-secrets.

Checklist

@fmenezes fmenezes requested a review from a team as a code owner November 12, 2025 14:46
Copilot AI review requested due to automatic review settings November 12, 2025 14:46
Copy link
Contributor

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 adds pre-commit hooks to the project using Husky, integrating git-secrets scanning and automated code quality checks into the development workflow.

Key Changes:

  • Integrated Husky for Git hook management with a pre-commit hook that runs git-secrets, code formatting, linting, and unit tests
  • Updated the npm prepare script to initialize Husky instead of running the build
  • Added a clarifying comment about test certificates being self-signed

Reviewed Changes

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

File Description
package.json Added Husky dependency and updated prepare script to initialize Husky
.husky/pre-commit Created pre-commit hook script with git-secrets validation and automated checks
tests/integration/fixtures/httpsServerProxyTest.ts Added security warning comment for self-signed certificates

fi

git-secrets --register-aws > /dev/null
git-secrets --pre_commit_hook -- "$@"
Copy link

Copilot AI Nov 12, 2025

Choose a reason for hiding this comment

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

The flag should be '--pre-commit-hook' (with hyphens) not '--pre_commit_hook' (with underscores). This is the correct flag name according to git-secrets documentation.

Suggested change
git-secrets --pre_commit_hook -- "$@"
git-secrets --pre-commit-hook -- "$@"

Copilot uses AI. Check for mistakes.
Comment on lines 12 to 13
npm run check
npm test -- --run tests/unit
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we not do this - there's no reason to have this run as part of pre-commit.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this is not the entire suite only the fast unit tests, I can remove but commits will still be red, I also moved it to pre-push, instead

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

as discussed offline I've removed tests and left only git-secrets we can revisit it later

@coveralls
Copy link
Collaborator

coveralls commented Nov 12, 2025

Pull Request Test Coverage Report for Build 19307245256

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.006%) to 80.179%

Totals Coverage Status
Change from base Build 19300465075: 0.006%
Covered Lines: 6488
Relevant Lines: 7980

💛 - Coveralls

run: |
sudo apt-get install -y git-secrets
npm ci
- name: Run pre-commit and pre-push hooks
Copy link
Collaborator

Choose a reason for hiding this comment

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

I understand the idea behind having those aligned but beyond git-secret, isn't the rest redundant and handled by other runs? We can turn this into a git-secrets check instead

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

sure

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done!


requests: IncomingMessage[];

// note: these are self-signed certs for testing purposes, DO NOT use in production
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@blva is this enough?

- name: Install dependencies
run: |
sudo apt-get install -y git-secrets
npm ci
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we need to install npm packages? I don't expect we want to scan for secrets in node_modules anyway?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

will remove

@fmenezes fmenezes enabled auto-merge (squash) November 12, 2025 18:07
@fmenezes fmenezes merged commit 0e8534c into main Nov 12, 2025
20 checks passed
@fmenezes fmenezes deleted the MCP-284 branch November 12, 2025 18:14
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.

6 participants