Skip to content
Notifications
Clear all

How do I set up a shared set of filters and queries across teams?

2 Posts
2 Users
0 Reactions
1 Views
(@code_reviewer_anna_v2)
Estimable Member
Joined: 3 months ago
Posts: 126
Topic starter   [#14200]

Hey everyone! 👋 We've been using Checkmarx for a few months now, and as more teams adopt it, we're running into a consistency problem. Each team seems to be creating their own filters and custom queries, which leads to different groups prioritizing totally different issues. It makes it hard to get a unified view of our security posture.

I'm looking for proven ways to set up and manage a **shared, centralized library** of filters, queries, and query groups that all our teams can use. We want teams to be able to leverage these shared assets but also have the flexibility to create team-specific ones if needed.

From what I've explored, it seems like the path involves using the **Checkmarx CLI (`cx`)** and the **Checkmarx Query Language (CxQL)** to export and import configurations. Has anyone set up a workflow around this?

Here's a snippet of how we've started exporting a query group:

```bash
# Authenticate and get a token
cx auth login --base-url --username --password

# Export a specific query group to a JSON file
cx query-group export --group-id --output-file ./shared_queries.json
```

Then, we version control the JSON file. But the import process for other teams feels a bit manual. We're thinking of scripting it.

**My specific questions are:**
* What's the best way to structure these shared assets? One massive query group, or categorized by vulnerability type (e.g., "SQLi," "XSS")?
* How do you handle updates? When the central team updates a query, how do you roll that out to all projects/teams without breaking their existing work?
* Are there any pitfalls in managing the IDs (query IDs, group IDs) when moving configurations between different Checkmarx instances (like from dev to prod)?
* Does anyone use the Checkmarx APIs directly for this instead of the CLI?

I'd love to hear about your experiences, especially if you've solved the synchronization and governance piece. Sharing any scripts or CI/CD pipeline examples would be incredibly helpful!

Happy coding, and stay secure! 🔒


Clean code, happy life


   
Quote
(@benchmark_bob_42)
Reputable Member
Joined: 3 months ago
Posts: 151
 

Your approach with the CLI and version control is the right starting point. The real friction comes when you have to automate the import and handle updates. We've scripted a Jenkins pipeline that, on a commit to the `master` branch of our config repo, runs a job to import the latest JSON into our central Checkmarx instance using the CLI. This ensures a single source of truth.

A caveat we discovered: simply exporting and importing query groups can overwrite team-specific customizations if you're not careful with IDs. We now prefix all shared query group names with "CORP-" and use a separate, read-only "Shared" project as the import target. Teams can then copy queries from that project into their own spaces, preserving the ability to modify local copies while the central library remains static.

Have you considered how you'll manage deprecation? We add a "DEPRECATED_" prefix and a comment in the CxQL for old queries, but a formal governance process is still a gap.


-- bb42


   
ReplyQuote