Skip to content

Make cyhy-ip aware of default CyHy owner#129

Merged
dav3r merged 9 commits intodevelopfrom
improvement/make-cyhy-ip-aware-of-default-owner-ips
Nov 19, 2025
Merged

Make cyhy-ip aware of default CyHy owner#129
dav3r merged 9 commits intodevelopfrom
improvement/make-cyhy-ip-aware-of-default-owner-ips

Conversation

@dav3r
Copy link
Member

@dav3r dav3r commented Nov 18, 2025

🗣 Description

This PR makes changes to various cyhy-ip functions in order to make them work as intended (or not work, in certain cases - see below) when interacting with the default CyHy owner (CYHY). Specifically:

  • cyhy-ip add:
    • Displays an error message that addresses cannot be manually added to the default owner
    • When adding an IP to another entity that is currently owned by the default owner, modifies the owner of the existing HostDoc without changing any other info from the HostDoc (aside from the last_change timestamp) and displays a warning message that this is happening
  • cyhy-ip check: Checks for addresses owned by the default owner
  • cyhy-ip list: Lists addresses owned by the default owner
  • cyhy-ip list-all: Lists addresses owned by the default owner
  • cyhy-ip remove: Prints an error message if attempting to remove addresses owned by the default owner
  • cyhy-ip compare: Supports comparison with addresses owned by the default owner
  • cyhy-ip move: Prints an error message if attempting to move addresses to or from the default owner
  • cyhy-ip setstage: Supports setting the scan stage for addresses owned by the default owner

💭 Motivation and context

Some of these changes were specifically requested by the CyHy Ops team. The other changes were made so that cyhy-ip operates in a sane and consistent way with respect to the default CyHy owner.

Resolves #127.

🧪 Testing

The following items were validated:

  • cyhy-ip add <OWNER> <ADDRESSES> for a CYHY-owned IP displays a warning message that the IP is owned by CYHY
  • cyhy-ip add <OWNER> <ADDRESSES> for a CYHY-owned IP modifies the owner of the existing HostDoc without changing any other info from the HostDoc (aside from the last_change timestamp)
  • cyhy-ip add <OWNER> <ADDRESSES> for a non-CYHY-owned IP operates the same as it does now
  • cyhy-ip add CYHY <ADDRESSES> displays an error message that addresses cannot be manually added to the CYHY owner
  • cyhy-ip check <ADDRESSES> for CYHY-owned addresses correctly displays ownership or lack thereof by CYHY
  • cyhy-ip compare CYHY <ADDRESSES> correctly compares the addresses to those owned by CYHY
  • cyhy-ip list CYHY displays IPs owned by CYHY
  • cyhy-ip list-all displays IPs owned by CYHY (as well as all other entities)
  • cyhy-ip move displays an error message when attempting to move IPs to or from the default CYHY owner
  • cyhy-ip remove CYHY <ADDRESSES> displays an error message that IPs owned by CYHY cannot be manually removed
  • cyhy-ip setstage <STAGE> <ADDRESSES> correctly sets the scan stage for IPs owned by CYHY

✅ Pre-approval checklist

  • This PR has an informative and human-readable title.
  • Changes are limited to a single goal - eschew scope creep!
  • All relevant type-of-change labels have been added.
  • I have read the CONTRIBUTING document.
  • These code changes follow cisagov code standards.
  • All relevant repo and/or project documentation has been updated to reflect the changes in this PR.
  • All new and existing tests pass.
  • Bump major, minor, patch, pre-release, and/or build versions as appropriate via the bump_version script if this repository is versioned and the changes in this PR warrant a version bump.

✅ Pre-merge checklist

  • Finalize version.

✅ Post-merge checklist

  • Create a release (necessary if and only if the version was bumped).

@dav3r dav3r self-assigned this Nov 18, 2025
@dav3r dav3r added the improvement This issue or pull request will add or improve functionality, maintainability, or ease of use label Nov 18, 2025
@dav3r dav3r requested review from jsf9k and mcdonnnj as code owners November 18, 2025 20:16
@dav3r dav3r added version bump This issue or pull request increments the version number python Pull requests that update Python code labels Nov 18, 2025
@dav3r dav3r requested a review from Copilot November 18, 2025 20:16
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@dav3r dav3r moved this to In Progress in CyHy System Nov 18, 2025
Copy link
Member

@jsf9k jsf9k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This all looks fine, except that I don't understand exactly what kind of dictionary is being returned by get_default_owner_intersections().

Copy link
Member

@jsf9k jsf9k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ad astra

@dav3r dav3r merged commit e4ecab3 into develop Nov 19, 2025
8 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in CyHy System Nov 19, 2025
@dav3r dav3r deleted the improvement/make-cyhy-ip-aware-of-default-owner-ips branch November 19, 2025 18:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement This issue or pull request will add or improve functionality, maintainability, or ease of use python Pull requests that update Python code version bump This issue or pull request increments the version number

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Make cyhy-ip aware of IPs "owned" by default CYHY entity and handle them accordingly

3 participants