Skip to content
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

Trufflehog precommit hook #1583

Merged
merged 38 commits into from
Jul 22, 2024
Merged

Trufflehog precommit hook #1583

merged 38 commits into from
Jul 22, 2024

Conversation

scottqueen-bixal
Copy link
Collaborator

@scottqueen-bixal scottqueen-bixal commented Jul 22, 2024

PR Summary

Related Github Issue

Detailed Testing steps

  • pull changes locally
  • cd benefit-finder
  • npm install
  • attempt to make a change in a directory, README etc
  • confirm that the pre-commit hook, runs secret-scanning, linters, and formatters
  • confirm that the pre-push hook, runs unit tests
  • confirm that the commit-msg hook, prefix commits

@scottqueen-bixal scottqueen-bixal self-assigned this Jul 22, 2024
@scottqueen-bixal scottqueen-bixal marked this pull request as ready for review July 22, 2024 19:20
Copy link
Collaborator

@gchi25 gchi25 left a comment

Choose a reason for hiding this comment

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

Tested. Worked as expected.


% git commit -m"test 2"
Current directory px-benefit-finder
Found stagged file: benefit-finder/README.md
running processes on staged files
npm verb cli /Users/gene.chi/.nvm/versions/node/v20.12.0/bin/node /Users/gene.chi/.nvm/versions/node/v20.12.0/bin/npm
npm info using npm@10.5.0
npm info using node@v20.12.0
npm verb title npm run lint-staged
npm verb argv "run" "lint-staged" "--loglevel" "verbose"
npm verb logfile logs-max:10 dir:/Users/gene.chi/.npm/_logs/2024-07-22T20_15_51_159Z-
npm verb logfile /Users/gene.chi/.npm/_logs/2024-07-22T20_15_51_159Z-debug-0.log

> benefit-finder@0.5.0.beta.1 lint-staged
> lint-staged

→ No staged files match any configured task.
npm verb exit 0
npm info ok 
Process succeeded.
Virtual environment already exists.
Scanning branch: trufflehog-precommit-hook
04:15PM [W] skipping rule: generic.api-key
04:15PM [W] skipping rule: generic.secret
04:15PM [W] skipping rule: generic.password-in-url
04:15PM [I] loading config from /Users/gene.chi/USA/px-benefit-finder/.trufflehog3.yml
No secrets found. Commit is safe.
[trufflehog-precommit-hook c9c7dcae] PXBF-trufflehog-precommit-hook: test 2
 1 file changed, 2 insertions(+)

% git push origin trufflehog-precommit-hook
benefit-finder/README.md
Found committed file: benefit-finder/README.md
running processes on committed files

> benefit-finder@0.5.0.beta.1 test:coverage
> vitest run --coverage


 RUN  v1.6.0 /Users/gene.chi/USA/px-benefit-finder/benefit-finder/src
      Coverage enabled with v8

 ✓ shared/api/__tests__/apiCallsUtilsDateEligibility.spec.js  (7 tests) 4ms
 ✓ shared/utils/buildURIParameter/__tests__/index.spec.jsx  (1 test) 2ms
 ✓ shared/api/__tests__/apiCallsPutData.spec.js  (4 tests) 2ms
 ✓ shared/api/__tests__/apiCallsGetElegibilityByCriteria.spec.js  (3 tests) 4ms
 ✓ shared/utils/dateInputValidation/__tests__/index.spec.jsx  (3 tests) 18ms
 ✓ shared/hooks/useHandleClassName/__tests__/index.spec.jsx  (3 tests) 25ms
 ✓ shared/hooks/useHandleUnload/__tests__/index.spec.jsx  (3 tests) 62ms
 ✓ shared/hooks/useResetElement/__tests__/index.spec.jsx  (4 tests) 109ms
 ✓ shared/api/__tests__/apiCallsPutDataFromParams.spec.js  (1 test) 1ms
 ✓ shared/utils/parseDate/__tests__/index.spec.jsx  (1 test) 37ms
 ✓ shared/components/Alert/__tests__/index.spec.jsx  (6 tests) 33ms
 ✓ shared/components/VerifySelectionsView/__tests__/index.spec.jsx  (1 test) 27ms
 ✓ shared/components/Select/__tests__/index.spec.jsx  (1 test) 26ms
 ✓ shared/components/Accordion/__tests__/index.spec.jsx  (1 test) 30ms
 ✓ shared/components/Icon/__tests__/index.spec.jsx  (2 tests) 26ms
 ✓ shared/components/BenefitAccordionGroup/__tests__/index.spec.jsx  (3 tests) 60ms
 ✓ shared/components/LifeEventSection/__tests__/index.spec.jsx  (1 test) 81ms
 ✓ shared/components/RelativeBenefitList/__tests__/index.spec.jsx  (2 tests) 82ms
 ✓ shared/components/Intro/__tests__/index.spec.jsx  (1 test) 53ms
 ✓ shared/utils/createMarkup/__tests__/index.spec.jsx  (1 test) 4ms
 ✓ shared/components/ResultsView/__tests__/index.spec.jsx  (2 tests) 639ms
 ✓ shared/components/NoticesList/__tests__/index.spec.jsx  (1 test) 23ms
 ✓ shared/components/ResultsView/components/blocks/EligibleBenefitsHeading/__tests__/index.spec.jsx  (1 test) 18ms
 ✓ shared/components/Summary/__tests__/index.spec.jsx  (1 test) 20ms
 ✓ shared/components/KeyElegibilityCrieriaList/__tests__/index.spec.jsx  (1 test) 20ms
 ✓ shared/components/ResultsView/components/blocks/ZeroBenefitsHeading/__tests__/index.spec.jsx  (1 test) 17ms
 ✓ shared/components/ResultsView/components/blocks/NotEligibleBenefitsHeading/__tests__/index.spec.jsx  (1 test) 25ms
 ✓ shared/components/ResultsView/components/Results/__tests__/index.spec.jsx  (1 test) 46ms
 ✓ App/__tests__/index.spec.jsx  (3 tests) 1173ms
 ✓ shared/components/Hint/__tests__/index.spec.jsx  (1 test) 16ms
 ✓ shared/components/Date/__tests__/index.spec.jsx  (1 test) 41ms
 ✓ shared/components/Heading/__tests__/index.spec.jsx  (1 test) 16ms
 ✓ shared/components/TimeIndicator/__tests__/index.spec.jsx  (1 test) 14ms
 ✓ shared/components/Modal/__tests__/index.spec.jsx  (1 test) 26ms
 ✓ shared/components/ObfuscatedLink/__tests__/index.spec.jsx  (1 test) 23ms
 ✓ shared/components/StepBackLink/__tests__/index.spec.jsx  (1 test) 21ms
 ✓ shared/components/ButtonGroup/__tests__/index.spec.jsx  (1 test) 21ms
 ✓ shared/components/StepIndicator/__tests__/index.spec.jsx  (1 test) 22ms
 ✓ shared/components/PrintButton/__tests__/index.spec.jsx  (1 test) 21ms
 ✓ shared/components/ProcessList/__tests__/index.spec.jsx  (1 test) 19ms
 ✓ shared/components/Paragraph/__tests__/index.spec.jsx  (1 test) 17ms
 ✓ shared/components/EmailButton/__tests__/index.spec.jsx  (1 test) 21ms
 ✓ shared/components/Legend/__tests__/index.spec.jsx  (1 test) 15ms
 ✓ shared/components/TextInput/__tests__/index.spec.jsx  (1 test) 20ms
 ✓ shared/components/Label/__tests__/index.spec.jsx  (1 test) 17ms
 ✓ shared/components/Fieldset/__tests__/index.spec.jsx  (1 test) 18ms
 ✓ shared/components/ShareButton/__tests__/index.spec.jsx  (1 test) 22ms
 ✓ shared/components/Button/__tests__/index.spec.jsx  (1 test) 19ms
 ✓ shared/components/Chevron/__tests__/index.spec.jsx  (1 test) 16ms
 ✓ shared/components/Radio/__tests__/index.spec.jsx  (1 test) 17ms
 ✓ shared/components/Card/__tests__/index.spec.jsx  (1 test) 17ms
 ✓ shared/components/Form/__tests__/index.spec.jsx  (1 test) 12ms

 Test Files  52 passed (52)
      Tests  84 passed (84)
   Start at  16:16:16
   Duration  4.93s (transform 3.60s, setup 12.57s, collect 11.21s, tests 3.12s, environment 14.26s, prepare 3.85s)

 % Coverage report from v8
----------------------------------------------------------------------------|---------|----------|---------|---------|------------------------------
File                                                                        | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s            
----------------------------------------------------------------------------|---------|----------|---------|---------|------------------------------
All files                                                                   |   91.17 |    81.65 |   60.24 |   91.17 |                              
 App                                                                        |    68.6 |    63.63 |   14.28 |    68.6 |                              
  index.jsx                                                                 |    68.6 |    63.63 |   14.28 |    68.6 | ...,52,54-57,122-124,126-164 
 shared/api                                                                 |   88.29 |    93.05 |   92.85 |   88.29 |                              
  apiCalls.js                                                               |   88.29 |    93.05 |   92.85 |   88.29 | ...2,276-278,380-382,432-434 
 shared/api/mock-data                                                       |     100 |      100 |     100 |     100 |                              
  current.js                                                                |     100 |      100 |     100 |     100 |                              
 shared/components/Accordion                                                |   87.17 |    85.71 |      60 |   87.17 |                              
  index.jsx                                                                 |   87.17 |    85.71 |      60 |   87.17 | 46-58,74-75                  
 shared/components/Alert                                                    |   96.62 |    81.81 |     100 |   96.62 |                              
  index.jsx                                                                 |   96.62 |    81.81 |     100 |   96.62 | 59-61                        
 shared/components/BenefitAccordionGroup                                    |   92.59 |    92.59 |      50 |   92.59 |                              
  index.jsx                                                                 |   92.59 |    92.59 |      50 |   92.59 | 59-65,73-84,207              
 shared/components/Button                                                   |   99.06 |    73.33 |   33.33 |   99.06 |                              
  index.jsx                                                                 |   99.06 |    73.33 |   33.33 |   99.06 | 48                           
 shared/components/ButtonGroup                                              |     100 |    33.33 |     100 |     100 |                              
  index.jsx                                                                 |     100 |    33.33 |     100 |     100 | 18-24                        
 shared/components/Card                                                     |     100 |    83.33 |     100 |     100 |                              
  index.jsx                                                                 |     100 |    83.33 |     100 |     100 | 34                           
 shared/components/Chevron                                                  |     100 |      100 |     100 |     100 |                              
  index.jsx                                                                 |     100 |      100 |     100 |     100 |                              
 shared/components/Date                                                     |   94.48 |    91.66 |     100 |   94.48 |                              
  index.jsx                                                                 |   94.48 |    91.66 |     100 |   94.48 | 30-36                        
 shared/components/EmailButton                                              |   92.85 |      100 |      50 |   92.85 |                              
  index.jsx                                                                 |   92.85 |      100 |      50 |   92.85 | 26-28                        
 shared/components/Fieldset                                                 |     100 |       75 |     100 |     100 |                              
  index.jsx                                                                 |     100 |       75 |     100 |     100 | 26                           
 shared/components/Form                                                     |     100 |      100 |     100 |     100 |                              
  index.jsx                                                                 |     100 |      100 |     100 |     100 |                              
 shared/components/Heading                                                  |     100 |      100 |     100 |     100 |                              
  index.jsx                                                                 |     100 |      100 |     100 |     100 |                              
 shared/components/Hint                                                     |     100 |      100 |     100 |     100 |                              
  index.jsx                                                                 |     100 |      100 |     100 |     100 |                              
 shared/components/Icon                                                     |   90.87 |    85.71 |   84.61 |   90.87 |                              
  index.jsx                                                                 |    94.2 |    85.71 |     100 |    94.2 | 27-28,45-46                  
  index_icons.jsx                                                           |   89.91 |    85.71 |   83.33 |   89.91 | 55-68,160-169                
 shared/components/Intro                                                    |    96.8 |      100 |   33.33 |    96.8 |                              
  index.jsx                                                                 |    96.8 |      100 |   33.33 |    96.8 | 31-33                        
 shared/components/KeyElegibilityCrieriaList                                |     100 |      100 |     100 |     100 |                              
  index.jsx                                                                 |     100 |      100 |     100 |     100 |                              
 shared/components/Label                                                    |     100 |      100 |     100 |     100 |                              
  index.jsx                                                                 |     100 |      100 |     100 |     100 |                              
 shared/components/Legend                                                   |     100 |      100 |     100 |     100 |                              
  index.jsx                                                                 |     100 |      100 |     100 |     100 |                              
 shared/components/LifeEventSection                                         |   70.18 |     57.5 |      25 |   70.18 |                              
  index.jsx                                                                 |   70.18 |     57.5 |      25 |   70.18 | ...6-509,512-540,545,560-576 
 shared/components/Modal                                                    |   73.09 |    71.42 |   27.27 |   73.09 |                              
  index.jsx                                                                 |   73.09 |    71.42 |   27.27 |   73.09 | ...,78-85,96,108-114,151-196 
 shared/components/NoticesList                                              |     100 |      100 |     100 |     100 |                              
  index.jsx                                                                 |     100 |      100 |     100 |     100 |                              
 shared/components/ObfuscatedLink                                           |      90 |       75 |     100 |      90 |                              
  index.jsx                                                                 |      90 |       75 |     100 |      90 | 31-37                        
 shared/components/Paragraph                                                |     100 |       50 |     100 |     100 |                              
  index.jsx                                                                 |     100 |       50 |     100 |     100 | 15                           
 shared/components/PrintButton                                              |      92 |      100 |      50 |      92 |                              
  index.jsx                                                                 |      92 |      100 |      50 |      92 | 15-16                        
 shared/components/ProcessList                                              |     100 |      100 |     100 |     100 |                              
  index.jsx                                                                 |     100 |      100 |     100 |     100 |                              
 shared/components/Radio                                                    |     100 |    66.66 |     100 |     100 |                              
  index.jsx                                                                 |     100 |    66.66 |     100 |     100 | 28                           
 shared/components/RelativeBenefitList                                      |     100 |      100 |     100 |     100 |                              
  index.jsx                                                                 |     100 |      100 |     100 |     100 |                              
 shared/components/ResultsView                                              |   94.96 |       85 |   66.66 |   94.96 |                              
  index.jsx                                                                 |   94.96 |       85 |   66.66 |   94.96 | 70-74,102,108-109            
 shared/components/ResultsView/components/Results                           |   99.58 |    90.62 |      80 |   99.58 |                              
  index.jsx                                                                 |   99.58 |    90.62 |      80 |   99.58 | 67                           
 shared/components/ResultsView/components/blocks                            |     100 |      100 |     100 |     100 |                              
  index.js                                                                  |     100 |      100 |     100 |     100 |                              
 shared/components/ResultsView/components/blocks/EligibleBenefitsHeading    |     100 |      100 |     100 |     100 |                              
  index.jsx                                                                 |     100 |      100 |     100 |     100 |                              
 shared/components/ResultsView/components/blocks/NotEligibleBenefitsHeading |     100 |    16.66 |     100 |     100 |                              
  index.jsx                                                                 |     100 |    16.66 |     100 |     100 | 11-21                        
 shared/components/ResultsView/components/blocks/ZeroBenefitsHeading        |     100 |      100 |     100 |     100 |                              
  index.jsx                                                                 |     100 |      100 |     100 |     100 |                              
 shared/components/Select                                                   |     100 |      100 |     100 |     100 |                              
  index.jsx                                                                 |     100 |      100 |     100 |     100 |                              
 shared/components/ShareButton                                              |   86.66 |      100 |      50 |   86.66 |                              
  index.jsx                                                                 |   86.66 |      100 |      50 |   86.66 | 25-30                        
 shared/components/StepBackLink                                             |   91.42 |      100 |   33.33 |   91.42 |                              
  index.jsx                                                                 |   91.42 |      100 |   33.33 |   91.42 | 18-20                        
 shared/components/StepIndicator                                            |   96.99 |       80 |      75 |   96.99 |                              
  index.jsx                                                                 |   96.99 |       80 |      75 |   96.99 | 63,68-70                     
 shared/components/Summary                                                  |   94.23 |      100 |   33.33 |   94.23 |                              
  index.jsx                                                                 |   94.23 |      100 |   33.33 |   94.23 | 7-9                          
 shared/components/TextInput                                                |   98.38 |       60 |      75 |   98.38 |                              
  index.jsx                                                                 |   98.38 |       60 |      75 |   98.38 | 19                           
 shared/components/TimeIndicator                                            |     100 |      100 |     100 |     100 |                              
  index.jsx                                                                 |     100 |      100 |     100 |     100 |                              
 shared/components/VerifySelectionsView                                     |   59.09 |    42.85 |      25 |   59.09 |                              
  index.jsx                                                                 |   59.09 |    42.85 |      25 |   59.09 | 40-48,60-71,81-104,139-174   
 shared/hooks/useHandleClassName                                            |     100 |      100 |     100 |     100 |                              
  index.js                                                                  |     100 |      100 |     100 |     100 |                              
 shared/hooks/useHandleUnload                                               |     100 |      100 |     100 |     100 |                              
  index.js                                                                  |     100 |      100 |     100 |     100 |                              
 shared/hooks/useResetElement                                               |     100 |      100 |     100 |     100 |                              
  index.js                                                                  |     100 |      100 |     100 |     100 |                              
 shared/styles/colors                                                       |     100 |      100 |     100 |     100 |                              
  _index.js                                                                 |     100 |      100 |     100 |     100 |                              
 shared/utils/buildURIParameter                                             |   97.05 |       75 |     100 |   97.05 |                              
  index.js                                                                  |   97.05 |       75 |     100 |   97.05 | 25                           
 shared/utils/createMarkup                                                  |     100 |      100 |     100 |     100 |                              
  index.js                                                                  |     100 |      100 |     100 |     100 |                              
 shared/utils/dataLayerUtils                                                |   64.42 |       50 |   33.33 |   64.42 |                              
  dataLayerPush.js                                                          |   19.56 |       50 |   33.33 |   19.56 | 3-4,7-29,32-43               
  dataLayerStructure.js                                                     |     100 |      100 |     100 |     100 |                              
  index.js                                                                  |     100 |      100 |     100 |     100 |                              
 shared/utils/dateInputValidation                                           |    86.2 |    71.42 |     100 |    86.2 |                              
  index.js                                                                  |    86.2 |    71.42 |     100 |    86.2 | 8-9,20-21                    
 shared/utils/parseDate                                                     |     100 |      100 |     100 |     100 |                              
  index.js                                                                  |     100 |      100 |     100 |     100 |                              
 shared/utils/scrollLock                                                    |    57.5 |        0 |       0 |    57.5 |                              
  index.js                                                                  |    57.5 |        0 |       0 |    57.5 | 10-11,14-18,26-30,34-38      
----------------------------------------------------------------------------|---------|----------|---------|---------|------------------------------
Process succeeded.
Enumerating objects: 7, done.
Counting objects: 100% (7/7), done.
Delta compression using up to 12 threads
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 379 bytes | 379.00 KiB/s, done.
Total 4 (delta 3), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (3/3), completed with 3 local objects.
remote: 
remote: GitHub found 1 vulnerability on GSA/px-benefit-finder's default branch (1 high). To find out more, visit:
remote:      https://github.com/GSA/px-benefit-finder/security/dependabot/13
remote: 
To github.com:GSA/px-benefit-finder.git
   b3ab2eab..c9c7dcae  trufflehog-precommit-hook -> trufflehog-precommit-hook

@scottqueen-bixal scottqueen-bixal merged commit fd72d7f into dev Jul 22, 2024
13 of 14 checks passed
@scottqueen-bixal scottqueen-bixal deleted the trufflehog-precommit-hook branch July 22, 2024 23:25
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.

Migrate to native githooks
2 participants