I apply the rule on the header json file with command
drheader compare single headers.json -rf rule.yaml
and it outputs
Then I trace the source code for a while, I found that in core.py L111 gives config['delimiters'] value get from _DELIMITERS, which will be None if the header not the keys in resources/delimiters.json. Therefore, when passing **config.get('delimiters', {}) to utils.parse_policy in header_validator.py L112, the error occur.
To the point of implementation, the meaning of **config.get('delimiters', {}) make the default value of delimiters a empty dict, but this will be None instead, which is expected.
Request
Can you fix this little bug? Or I can pull request to fix this error. This enables drheader to filter header based on values even if the header is not policy header. For example, you want to report the issue when some headers is in obselete values.
Description
Custom header or header other than policy headers can't work with
Must-*
rule.What I Did
I found this issue when I was using drheader with custom header rule below
and the headers json file
I apply the rule on the header json file with command
and it outputs
Then I trace the source code for a while, I found that in core.py L111 gives
config['delimiters']
value get from_DELIMITERS
, which will beNone
if the header not the keys inresources/delimiters.json
. Therefore, when passing**config.get('delimiters', {})
toutils.parse_policy
in header_validator.py L112, the error occur. To the point of implementation, the meaning of**config.get('delimiters', {})
make the default value ofdelimiters
a empty dict, but this will beNone
instead, which is expected.Request
Can you fix this little bug? Or I can pull request to fix this error. This enables drheader to filter header based on values even if the header is not policy header. For example, you want to report the issue when some headers is in obselete values.