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

Content Checker Plugin #118

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

TharunMohandoss
Copy link

No description provided.

@victoria-miltcheva
Copy link
Member

Hi @TharunMohandoss, thank you for your pull request! I will review it this week.

@victoria-miltcheva victoria-miltcheva self-assigned this Mar 24, 2023
@victoria-miltcheva
Copy link
Member

@TharunMohandoss sorry for the wait on the PR review, unfortunately I've been very busy lately. I will make some time this week to review your PR!

@victoria-miltcheva
Copy link
Member

Hi @TharunMohandoss, you will want to make sure that your commits are signed. See this check for instructions on how to fix the unsigned commit: https://github.com/IBM/detect-secrets/runs/11811883373.

._add_output_verified_false_flag()\
._add_fail_on_unaudited_flag()
._add_fail_on_non_audited_flag()
Copy link
Member

Choose a reason for hiding this comment

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

Comment on lines +149 to +151
def _add_fail_on_non_audited_flag(self):
self.parser.add_argument(
'--fail-on-unaudited',
'--fail-on-non-audited',
Copy link
Member

Choose a reason for hiding this comment

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

Can this change please be undone? This renames the --fail-on-unaudited flag and will break detect-secrets for users who are using this flag in their builds and pre-commit config files.

Copy link
Member

Choose a reason for hiding this comment

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

I think I understand what happened, you're probably working off an outdated version of master (see #118 (comment)).

Comment on lines +206 to +232



























Copy link
Member

@victoria-miltcheva victoria-miltcheva Apr 24, 2023

Choose a reason for hiding this comment

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

Suggested change

"content": 'String jwtSecret = "dasdasdasdasdasdasdasdasdasddaasdasdasdasdsdhashdsahdhsadhhasdhahdhashdhahdhah";',
"want": secretExpected,
},
# {
Copy link
Member

Choose a reason for hiding this comment

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

It looks like some of the values in java_source_file_tests are commented out. Was this intentional?

Comment on lines +123 to +134












Copy link
Member

Choose a reason for hiding this comment

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

Suggested change

Comment on lines +114 to +125












Copy link
Member

Choose a reason for hiding this comment

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

Suggested change


self.secret_type = 'Content Checker'

#print('initialization')
Copy link
Member

Choose a reason for hiding this comment

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

This line can probably be removed.

Comment on lines +185 to +202
# print('pattern : ',pattern.name)
# print("pattern : ",pattern.pattern)
# print('string : ',string.strip())
if pattern.extensions and (file_extension not in pattern.extensions):
# print('skipping no in extensions list')
# print()
# print()
continue
elif file_extension in pattern.excluded_extensions:
# print('in excluded extensions list')
# print()
# print()
continue

match = pattern.regex.search(string)
# print('match : ',match)
# print()
# print()
Copy link
Member

Choose a reason for hiding this comment

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

These print statements can probably be removed as well.

Adaptation from : https://github.ibm.com/cognitive-data-platform/cognitive-data-platform/blob/master/tools/cedp_ci/check/passwords.go

Searches for the following named patterns.
2. SecretFoundInString
Copy link
Member

Choose a reason for hiding this comment

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

Why does this list start with 2?

def __init__(self, subparser):
# Override the default audit parser usage message since the arguments within
Copy link
Member

Choose a reason for hiding this comment

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

Question: why was the report parser code removed? I wonder if you were working off an outdated version of master. I'd recommend merging upstream master into your branch to ensure that you're working with the latest code.

@victoria-miltcheva
Copy link
Member

It looks like the tests are failing in the build:

================ 33 failed, 1275 passed, 117 warnings in 30.92s ================

py37: exit 1 (31.40 seconds) /home/travis/build/IBM/detect-secrets> coverage run -m pytest tests pid=5073

.pkg: _exit> python /home/travis/virtualenv/python3.7.13/lib/python3.7/site-packages/pyproject_api/_backend.py True setuptools.build_meta __legacy__

  py37: FAIL code 1 (69.40=setup[37.88]+cmd[0.11,31.40] seconds)

  evaluation failed :( (69.54 seconds)

Makefile:16: recipe for target 'test' failed

make: *** [test] Error 1

The command "make setup-trivy && make trivy-scan-python-vulnerabilities && make test" exited with 2.
cache.2

store build cache

Can you please fix them after merging upstream master into your branch?

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.

3 participants