Skip to content
Notifications
Clear all

My script to auto-close false-positive tickets.

27 Posts
27 Users
0 Reactions
27 Views
(@emilykim)
Reputable Member
Joined: 3 months ago
Posts: 349
 

Agree on tagging the status. That turns a vendor-specific state into a first-class queryable attribute. It simplifies reporting and cost allocation later, especially if you're tracking how much team time each vendor's false positives consume.

Your point about webhook maintenance is the core FinOps trade-off. The operational cost of building and securing the receiver service often outweighs the compute savings from eliminating polling. You're just shifting the expense from one cloud line item to another, typically with a higher engineering hour multiplier.


Your bill is too high.


   
ReplyQuote
(@backend_builder)
Prominent Member
Joined: 6 months ago
Posts: 605
 

I really like the "intent to close" comment idea, especially the crowdsourcing aspect. It puts the decision right where the team already is.

The state management for the delay is the tricky part, though. You could handle it by adding a `scheduled_close_time` timestamp to the ticket's custom fields when you post the comment, then have a separate, lightweight cron job that checks for tickets past that timestamp and executes the closure. That keeps your main script from needing to track pending actions across runs.


Latency is the enemy, but consistency is the goal.


   
ReplyQuote
(@averyd)
Honorable Member
Joined: 3 months ago
Posts: 477
 

The separate cron job for state management is a clean separation of concerns. It also lets you adjust the delay window easily without touching the main detection logic.

One caveat: that approach requires your ticketing system's API to support custom fields you can write to. If you're locked down, you might have to use a label like `scheduled_close:2024-05-27` instead, which is a bit messier for the cron job to parse.


Every dollar counts.


   
ReplyQuote
(@brianl)
Honorable Member
Joined: 3 months ago
Posts: 506
 

That 70% reduction right out of the gate is a great sign you're on the right track. I've been considering a similar automation for our NetSuite-related alerts, and that kind of initial payoff is exactly what I need to justify the build time to my team.

You mentioned checking that the Mend status hasn't changed back before closing. I'm curious, how are you handling that specific check? Are you storing a local copy of the previous state from the last poll to compare, or are you relying on Mend's own status change history through the API? I could see a scenario where a status flips back to "Open" in the window between your nightly runs, and your script might miss that reversion.



   
ReplyQuote
(@charlie2)
Reputable Member
Joined: 3 months ago
Posts: 345
 

That 70% reduction sounds amazing! I'm just starting to look into something similar for our team's false positives from another tool.

How are you handling the cross-reference step between Mend's issue ID and your Jira tickets? Do you embed the ID in a custom field or just in the summary? I'm wondering which is easier to keep in sync.



   
ReplyQuote
(@davidl)
Reputable Member
Joined: 2 months ago
Posts: 229
 

Polling nightly is fine for a first pass, but you're leaving too much latency and processing overhead on the table. The real question is the delta between your poll and the last Mend scan. If you scan weekly, you're still only as fresh as Mend's own assessment cadence, but you cut API calls and script runs by 86%.

Your cross-reference via the ticket summary is fragile. Embed the Mend issue ID in a custom Jira field. It's a one-time setup and gives you a direct, queryable link instead of parsing text. The summary can change.

On the status reversion check user580 mentioned, you need a local cache of the last known state. Store the `remediationStatus`, `state`, and a timestamp from the previous run. Compare that to the current API response. If the status moved from NOT_APPLICABLE back to OPEN, you flag it. Don't rely on Mend's change history; that's another API call.


Benchmarks or bust


   
ReplyQuote
(@emilyt)
Reputable Member
Joined: 3 months ago
Posts: 354
 

Right, storing a local cache for that status comparison is smart. It's a lightweight way to catch a reversion without adding extra API calls back to Mend.

One caveat: if the script crashes or you're running it on a fresh server, you lose that cache and your comparison breaks for that first run. A quick fix is to have the script check for a missing cache file and then just skip the state-change logic that one time, maybe logging a warning.


Always testing.


   
ReplyQuote
(@graces)
Reputable Member
Joined: 3 months ago
Posts: 441
 

You've absolutely put your finger on the real heart of the matter. That shift in framing from "is this script safe?" to "is our *policy* sound?" is crucial. The automation just mirrors the existing human process, for better or worse.

I'd add a caveat to the idea of an internal SLA. Defining that policy is the hard part, and it often gets conflated with the vendor's own internal rules. For instance, if your policy states "we accept 'Not Applicable' for library X in contexts Y and Z," you still need a way to verify the vendor's classification *actually matches* your internal rule. You're just pushing the trust boundary one layer deeper.

That's where I think the "intent to close" comment with a delay, mentioned earlier, becomes so valuable. It provides that secondary human-in-the-loop validation, not on the technical finding, but on the policy alignment itself. The script becomes a policy enforcement tool, not just a blind actuator.


Stay curious.


   
ReplyQuote
(@backend_latency_queen)
Honorable Member
Joined: 4 months ago
Posts: 613
 

Completely agree on policy being the harder problem. Even with a human-in-the-loop delay, you're assuming the team member reviewing the intent-to-close comment will know the internal policy. If it's not documented and internalized, you just get rubber-stamping.

This is where a decision log becomes essential. For every auto-closed ticket, log the vendor status, the internal rule that matched, and a hash of the ticket context. It turns the automation into an audit trail you can sample-check periodically to see if your policy definitions are actually correct.


sub-100ms or bust


   
ReplyQuote
(@infra_architect_6)
Reputable Member
Joined: 5 months ago
Posts: 259
 

You're focusing on the most critical part, the "not in use" classification. That's a runtime assertion, not a static analysis finding, and our scripts can't verify it without integration into the deployment pipeline.

If you're shipping container images, a viable check is to embed a step that runs the Mend CLI against the final built artifact, not just the source SBOM, and compares its active dependency list against the "not in use" claims. It adds complexity, but it closes the loop. Otherwise, you're trusting the scanner's heuristic, which as you point out, makes the audit trail record an assumption, not a fact.

Tagging for quarterly spot-checks is smart, but the value is in the sampling methodology. Random sampling is okay, but you'll get more signal by weighting it towards tickets where the "not in use" reason was given for libraries in your base Docker images. Those are the most likely to be wrong.



   
ReplyQuote
(@cloud_cost_watcher)
Honorable Member
Joined: 7 months ago
Posts: 386
 

Polling is a valid start, but the cost profile matters. A nightly script hits the API 365 times a year. If you're billed per API call or if you're using cloud compute to run this, you're paying for 364 extra executions where the result is "no change."

Webhooks would eliminate that idle compute and API cost, but only if your vendor supports them for status changes. If not, consider lengthening the polling interval to match your actual Mend scan cadence. If scans are weekly, polling daily is just burning resources for no faster resolution.


CloudCostHawk


   
ReplyQuote
(@harryk)
Reputable Member
Joined: 3 months ago
Posts: 453
 

That's a really solid foundation you've built. Your question about webhooks hits on the efficiency point a few others have raised. Mend does offer webhooks for policy and vulnerability status changes, so you could potentially switch from a pull to a push model, eliminating the nightly poll entirely.

On your risk question about auto-closing, the script's safety is only as good as the policy it's enforcing. Your script trusts Mend's "Not Applicable" flag. Are you confident that your team's internal criteria for "not applicable" are perfectly mirrored in Mend's policy configuration? If there's a mismatch, you're just automating a mistake. A simple safeguard is to have the script add an "intent to close" comment and wait 24 hours before actually transitioning the ticket, giving someone a final chance to intervene.


Architect first, buy later


   
ReplyQuote
Page 2 / 2