-
Notifications
You must be signed in to change notification settings - Fork 581
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
DodgyBear #836
Comments
@sils1297 I'd be interested in writing a bear. Maybe this one? |
cool why not @sils1297 :) |
I think |
👍 see docs.coala.io docs about writing linter bears |
Ya. Unmaintained. |
Nice, let's do that. |
@sils1297 given that the repo is not maintained do we want to use it? |
As @jayvdb proposed: we can rather make an own native bear with that functionality which is usable for all languages. Essentially we just "grep" through the code for suh things right? |
I think I'll have to get an idea of dodgy . Got to read up some stuff. |
Can we have some words that the bear should be dodging other then the ones in dodgy, I'll add those anyway, and also I was thinking of configuring the DodgyBear with a list of words that could be maybe mentioned in the coafile of the project. Some specific words for the CI or something they use, etc. Thoughts? CC @sils1297 @underyx |
Allowing regex config support to |
Though I think sane defaults are key to this, having some binary options
like detect_aws_keys or so is much easier than making up a regex for it
|
Take a look at
https://docs.gitlab.com/ee/push_rules/push_rules.html#prevent-pushing-secrets-to-the-repository
and see what they do - that one is largely filename based.
|
That'd be helpful |
Please assign me this, I would like to give it a shot |
@sils Maybe we can use this? https://github.com/awslabs/git-secrets |
Can someone guide me a little on what all understanding do I need other than getting familiar with writing a linter bear that the coala documentation demonstrates to take up this issue? |
@sils @Makman2 |
Then you return an empty iterable ;)
Hm I actually think it makes kind of sense like it is now, |
This bear checks Python code for possible dodgy looking values such as secret keys or passwords. Closes coala#836
I'm facing problems while writing a test for it and couldn't come up with a solution. Here's a snippet of what I've done so far for the DodgyBearTest: import os
import unittest
from queue import Queue
from bears.python.DodgyBear import DodgyBear
from coalib.settings.Section import Section
from coalib.testing.BearTestHelper import generate_skip_decorator
from coalib.testing.LocalBearTestHelper import LocalBearTestHelper
def get_absolute_file_path(file):
return os.path.join(os.path.dirname(__file__),
'dodgy_test_files', file)
@generate_skip_decorator(DodgyBear)
class DodgyBearTest(unittest.TestCase):
def setUp(self):
self.file_dict = {}
self.queue = Queue()
self.section = Section('dodgy')
self.test_files = [get_absolute_file_path(f) for f in os.listdir(get_absolute_file_path(""))]
for filename in self.test_files:
with open(filename, 'r', encoding='utf-8') as content:
self.file_dict[filename] = tuple(content.readlines())
self.uut = DodgyBear(self.file_dict,
self.section,
self.queue)
def get_results(self):
return list(result.message for result in self.uut.run())
def test(self):
self.assertEqual(self.get_results()[0], 'Amazon Web Services secret key') The test passes or raises an AssertionError only if the files being tested are present in the To sum up, I guess this is an issue with dodgy. Thoughts? Other than this, I've added a commit for the implementation of DodgyBear and it seems to work fine for me. |
If However, to make it work anyway and integrate into the coala-ecosystem, we can now deploy some OS capabilities: We could use temporary files. You create a temporary directory and symbolic mappings to the files that shall be analyzed, all ending with But really let's first consider using dodgy, and rather make them improve their CLI, because that is just bad design. |
So, what you mean is:
|
Tests DodgyBear for passwords, secret keys, ssh keys and diff check-ins. Closes coala#836
This bear checks Python code for possible dodgy looking values such as secret keys or passwords. Closes coala#836
This won't apply just for tests, but how the bear operates in general. But I would really suggest you sync up with the |
@Makman2 I have already written an email to one of the |
Probably dodgy not installed in CI. |
This bear checks Python code for possible dodgy looking values such as secret keys or passwords. Closes coala#836
Anything I need to take care of? |
Yes, you have to install it ;) |
This bear checks Python code for possible dodgy looking values such as secret keys or passwords. Closes coala#836
This bear checks Python code for possible dodgy looking values such as secret keys or passwords. Closes coala#836
@Makman2 I know this will be closed in favour of a better alternative but any guesses on why the tests are failing? They are all passing locally. Is writing and deleting new files in the |
It definitely is. And I don't know the problem on CI. However this is something you should discuss on the PR itself because it's implementation detail ;) |
This bear checks Python code for possible dodgy looking values such as secret keys or passwords. Closes coala#836
This bear checks Python code for possible dodgy looking values such as secret keys or passwords. Closes coala#836
https://github.com/landscapeio/dodgy
difficulty/low type/bear proposal area/lintbears
The text was updated successfully, but these errors were encountered: