Skip to content

feat: add Cloudsmith vulnerability policy components#5676

Open
felixgateru wants to merge 2 commits into
superplanehq:mainfrom
felixgateru:feat/cloudsmith-vulnerability-policy
Open

feat: add Cloudsmith vulnerability policy components#5676
felixgateru wants to merge 2 commits into
superplanehq:mainfrom
felixgateru:feat/cloudsmith-vulnerability-policy

Conversation

@felixgateru

@felixgateru felixgateru commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator

What changed

Extended the Cloudsmith integration with three new action components: Create Vulnerability Policy, Get Vulnerability Policy, and Delete Vulnerability Policy.

Why

To manage organization-scoped package vulnerability policies as part of a workflow instead of the Cloudsmith UI. This enables policy-as-code use cases: provisioning guardrails when bootstrapping an organization, auditing/drift-detection of a policy's current settings, and tearing down policies for short-lived environments.

How

Backend

Extended pkg/integrations/cloudsmith/ with:

  • client.go — added Organization and VulnerabilityPolicy structs, the VulnerabilityPolicyRequest body, and client methods CreateVulnerabilityPolicy, GetVulnerabilityPolicy, DeleteVulnerabilityPolicy, plus ListOrganizations /
  • create_vulnerability_policy.gocloudsmith.createVulnerabilityPolicy: organization, name (required), description, minimum severity (select, default Critical), package query, and quarantine-on-violation / allow-unknown-severity booleans. Severity is validated at Setup and Execute. Emits cloudsmith.vulnerabilityPolicy.created.
  • get_vulnerability_policy.gocloudsmith.getVulnerabilityPolicy: organization + policy. Emits cloudsmith.vulnerabilityPolicy.fetched.
  • delete_vulnerability_policy.gocloudsmith.deleteVulnerabilityPolicy: organization + policy.
  • cloudsmith.go — registered the three actions and noted org-scoped permissions in the integration instructions.
  • Added backend tests for each component

Frontend

Added web_src/src/pages/app/mappers/cloudsmith/:

  • create_vulnerability_policy.ts, get_vulnerability_policy.ts, delete_vulnerability_policy.ts — node mappers with execution details and canvas metadata (organization via the building-2 icon, policy via shield).
  • types.tsVulnerabilityPolicyData, DeleteVulnerabilityPolicyData, node metadata and configuration interfaces.
  • index.ts — registered mappers and event-state registries (created / fetched / deleted).
  • test_helpers.tsbuildVulnerabilityPolicyData.
  • Spec files for each mapper.

@superplanehq-integration

Copy link
Copy Markdown

👋 Commands for maintainers:

  • /sp start - Start an ephemeral machine (takes ~30s)
  • /sp stop - Stop a running machine (auto-executed on pr close)

@superplane-gh-integration-9000

Copy link
Copy Markdown

PR Risk Review

Risk: 25/100 (low)
Review approved: Yes
Check passed: Yes

Summary

Well-structured addition of three new Cloudsmith vulnerability policy CRUD components (create, get, delete) with comprehensive tests, documentation, and frontend mappers following established patterns in the codebase.

Concerns

  • The pagination logic in ListOrganizations and ListVulnerabilityPolicies has no upper bound on pages, which could lead to infinite loops if the API consistently returns exactly page_size items due to a bug or edge case.
  • The resolveOrganizationMetadata and resolvePolicyMetadata functions make API calls during Setup which could slow down UI interactions if the Cloudsmith API is slow or unreachable.
  • No rate limiting or timeout configuration is visible for the new API calls, relying entirely on the existing client infrastructure.

Add createVulnerabilityPolicy, getVulnerabilityPolicy, and
deleteVulnerabilityPolicy actions for managing organization-scoped
package vulnerability policies via the Cloudsmith v1 API.

- client: add Organization and VulnerabilityPolicy types, create/get/
  delete/list policy methods, list/get organization methods, and
  org/policy node metadata resolution
- list_resources: add organization and vulnerabilityPolicy resource types
- register actions and add example outputs
- frontend: add mappers, types, specs, and registry entries
- regenerate component docs

Signed-off-by: Felix Gateru <felix.gateru@gmail.com>
Signed-off-by: Felix Gateru <felix.gateru@gmail.com>
@felixgateru felixgateru force-pushed the feat/cloudsmith-vulnerability-policy branch from e2f7a58 to e68ff83 Compare June 26, 2026 07:43
@felixgateru felixgateru marked this pull request as ready for review June 26, 2026 07:45
@superplane-gh-integration-9000

Copy link
Copy Markdown

Risk: 25/100 (low)

Summary

Adds three new Cloudsmith integration action components (create, get, delete) for organization-scoped vulnerability policy management, with Go backend, TypeScript mappers, tests, and documentation.

Concerns

  • resolveOrganizationMetadata and resolvePolicyMetadata in client.go import core.SetupContext, mixing API client and setup-layer concerns.
  • Name (max 100) and Description (max 250) length limits are documented but not enforced in Setup() validation.
  • No multi-page pagination test cases for ListOrganizations or ListVulnerabilityPolicies.
  • Severity validation (isValidSeverity) is only applied in Create; not guarded at the client layer.

Recommended reviewers: forestileao

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant