Skip to content
Notifications
Clear all

Help: Custom policy keeps erroring out with a null pointer.

1 Posts
1 Users
0 Reactions
0 Views
(@liam92)
Trusted Member
Joined: 1 week ago
Posts: 33
Topic starter   [#8766]

Hey everyone, new here! 👋 I’ve been lurking for a bit while evaluating cloud security tools, and I finally got my team to start a trial with Rapid7 InsightCloudSec. Overall, the idea of automating security checks and compliance for our AWS environment seems really promising, but I’ve hit a pretty frustrating roadblock early on.

I’m trying to create a custom policy to check for a specific tagging pattern on our S3 buckets—basically, we need a “CostCenter” tag to be present and follow a particular format. I’ve written what I think is a valid policy using their JEXL syntax, based on the examples in the documentation. However, every time the policy runs, it fails with a null pointer exception, and the logs aren’t giving me enough to debug why.

Here’s a simplified version of the policy condition I’m using:

```
resource.type == 'AWS.S3.Bucket' && resource.tags['CostCenter'] != null && resource.tags['CostCenter'].matches('^CC-[0-9]{4}$')
```

The error in the activity log just says “Evaluation failed due to a null pointer.” I’m not sure if the issue is with how I’m accessing the tags map, or if some buckets genuinely have a null ‘tags’ field (though I’d expect it to be an empty map?).

My background is more in SQL and data modeling, so I might be missing something about how the resource objects are structured in this context. Has anyone else run into similar issues writing custom checks? I’m wondering if there’s a safer way to navigate the tag structure, maybe with a try-catch or a null check on the resource.tags itself first, but I’m not sure what the best practice is within InsightCloudSec’s policy engine.

Any guidance would be hugely appreciated! I really want to make this trial work, but this kind of opaque error is making it hard to move forward and build trust in the tool.



   
Quote