cerndb / zkpolicy

Zookeeper Policy Audit Tool (aka zkPolicy) for checking and enforcing ACLs on ZNodes.
MIT License
7 stars 1 forks source link

Check with no negate definition lead to NullPointerException #2

Closed nbarrientos closed 11 months ago

nbarrientos commented 1 year ago

audit_example.yml lists checks with no value set for the property negate, however it seems that if I define a check like the following:

sections:
  generalInformation: true
  fourLetterWordCommands: false
  queryResults: false
  checkResults: true
  aclOverview: false
...
checks:
  - title: "Kafka"
    rootPath: "/"
    pathPattern: "/kafka/.*"
    # negate: false
    acls:
      - "sasl:kafka:cdwra"
      - "world:anyone:r"

zkpolicy crashes:

[/root/zkpolicy]@ndev9al.cern.ch
λ zkpolicy --config config.yml a -i gptn-audit.yaml
WARNING: sun.reflect.Reflection.getCallerClass is not supported. This will impact performance.
java.lang.NullPointerException
ZKPolicy v1.0.1-22 Audit report
DateTime: 10/10/2023 11:34:32 +0200
Report results for file: /root/zkpolicy/gptn-audit.yaml
Connected to ZooKeeper server: 1.1.1.1:2181

===============================================

when I bring back in the negate: false directive, the tool seems to do the job as expected.

I'd suggest to either fix the tests and the code so it does not crash or to fix the example.

Thanks for looking!