Closed edthedev closed 5 months ago
We've reached the point where we need to scrub cassettes of credentials info. Next step is to implement a VCR cleaner.
Yesterday, two .yaml
files were checked in containing ClearPass credentials. We informed security@illinois.edu
, set the repo to private, and deleted the two .yaml
files in question.
Cleaner is partially implemented. We are having trouble cleaning the token from the response.
It appears that in our cassette
method in conftest.py
, our serializer (cleanyaml') is not being used, despite being registered as a cleaner. Instead, the serializer
yaml` is being used.
yaml_cleaner = CleanYAMLSerializer()
my_vcr.register_serializer("cleanyaml", yaml_cleaner)
# TODO: Register cleaner functions here:
yaml_cleaner.register_cleaner(clean_auth)
breakpoint()
with my_vcr.use_cassette(f'{request.function.__name__}.yaml',
seralizer='cleanyaml') as tape:
(Pdb) my_vcr.serializers
{'yaml': <module 'vcr.serializers.yamlserializer' from '/home/tzturner/projects/clearpass-api/venv/lib64/python3.9/site-packages/vcr/serializers/yamlserializer.py'>,
'json': <module 'vcr.serializers.jsonserializer' from '/home/tzturner/projects/clearpass-api/venv/lib64/python3.9/site-packages/vcr/serializers/jsonserializer.py'>,
'cleanyaml': <vcr_cleaner.CleanYAMLSerializer object at 0x7fa012124160>}
(Pdb) my_vcr.serializer
'yaml'
The problem above was due to a spelling error. serializer
is not spelled seralizer
.
Context
Our primary use case is our SOAR app, which expects a
test connectivity
feature. It makes the most sense to provide that here, in this library.Tasks