Files
rengine/shared/models/__init__.py
T
Yogesh OjhaandClaude Opus 5 0fd89332e2 feat(notes): recon notes anchored to an asset
2.x had `recon_note.TodoNote` — a title, a body and an optional scan. 3.0
dropped it and replaced it with nothing, so the operator's own reasoning had
nowhere to live: the lead to come back to, the dead end not worth retesting,
the reason behind a conclusion.

A note anchors to a durable asset identity rather than to a scan row. A note
written on api.example.com during scan 2 is still on that host in scan 9,
because the anchor is the host name, not the `subdomains.id` scan 2 created.
Identity per dimension: host name, endpoint signature, `ip:port`, address, and
vulnerability fingerprint.

That gives the rollup for free. An asset sheet shows its own notes across every
scan; a scan shows notes for assets it observed, plus what was written on it; a
target shows everything under it; /notes holds the project. The scan reach is a
per-dimension EXISTS over the `TABLES` map `surface_scope` already holds.

Every note carries at least one tag, enforced by `min_length=1` on the create
model and a disabled Save in the composer. Tags are the project vocabulary from
`shared/models/tag.py`, so a tag means the same thing on a note as on a target.

`dimension` is a `SurfaceDimension` value, so notes inherit the labels, nouns
and ordering the rest of the product uses. No second asset-kind enum.

Surfaces: a Notes section in the web asset, endpoint, service and vulnerability
sheets; a Notes tab on a scan and on a target; and /notes with tag, dimension,
status and free-text filters. The IP sheet is left out — an address group folds
across targets, so it has no single rollup anchor.

Also gives the two ScrollAreas added with the focused-scan work a definite
height; `max-h` alone does not clip, and a short list now renders without a
scroller rather than showing an empty track.

Row markers on the result tables are not built.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01799buekQvDvH41ns8EdhdH
2026-09-11 22:21:13 +05:30

422 lines
9.1 KiB
Python

import shared.models._tztypes # patch datetime->timestamptz first
from shared.models.activity_log import ActivityLog, ActivityLogRead
from shared.models.ai import AiNarrative
from shared.models.api_key import (
APIKey,
APIKeyCreate,
APIKeyRead,
APIKeyUpdate,
ProviderInfo,
)
from shared.models.connector import (
ActionRead,
ActionRequest,
AddTargetRequest,
CandidatePage,
CandidateRead,
Connector,
ConnectorAction,
ConnectorCandidate,
ConnectorCoverage,
ConnectorCreate,
ConnectorCreated,
ConnectorHost,
ConnectorRead,
ConnectorScope,
ConnectorSession,
ConnectorUpdate,
DiscoveredDomain,
FindingRecorded,
FindingReport,
HostFacts,
IngestItem,
IngestRequest,
IngestResult,
NoticeRead,
SessionRead,
TargetAdded,
TargetOption,
)
from shared.models.dns import (
DnsLookup,
DnsLookupRead,
DnsLookupSummary,
DnsRecord,
DnsRecordRead,
)
from shared.models.endpoint import (
Endpoint,
EndpointCoverage,
EndpointDetail,
EndpointFacets,
EndpointFilter,
EndpointPage,
EndpointRead,
EndpointSummary,
EndpointTree,
TreeNode,
)
from shared.models.http_asset import (
HttpAsset,
HttpAssetRead,
HttpAssetSummary,
)
from shared.models.instance_settings import (
InstanceSettings,
InstanceSettingsRead,
InstanceSettingsUpdate,
)
from shared.models.interest import (
InterestCatalog,
InterestDismissal,
InterestFilter,
InterestPage,
InterestRow,
InterestRule,
InterestRuleCreate,
InterestRuleRead,
InterestRuleUpdate,
InterestSignal,
InterestSummary,
RulePreview,
RuleSuggestion,
)
from shared.models.ip_address import (
IpAddress,
IpAddressRead,
IpAddressSummary,
TargetIpAddressRead,
)
from shared.models.ip_asn_range import IpAsnRange, IpCountryRange
from shared.models.note import (
Note,
NoteCount,
NoteCreate,
NoteRead,
NoteTag,
NoteUpdate,
)
from shared.models.notification import (
Notification,
NotificationCreate,
NotificationRead,
)
from shared.models.notification_channel import (
NotificationChannel,
NotificationChannelCreate,
NotificationChannelRead,
NotificationChannelTestResult,
NotificationChannelUpdate,
NotificationPreference,
)
from shared.models.organization import (
Organization,
OrganizationCreate,
OrganizationRead,
OrganizationSummary,
OrganizationUpdate,
)
from shared.models.port import Port, PortRead, PortSummary
from shared.models.project import Project, ProjectBase, ProjectCreate, ProjectRead
from shared.models.proxy import (
Proxy,
ProxyCreate,
ProxyEndpoint,
ProxyEndpointRead,
ProxyRead,
ProxyTestResult,
ProxyUpdate,
)
from shared.models.report import Report, ReportFont, ReportTemplate, ReportTheme
from shared.models.ripestat import (
RIPEStatAbuseContact,
RIPEStatAnnouncedPrefix,
RIPEStatASNNeighbour,
RIPEStatASOverview,
RIPEStatNetworkInfo,
RIPEStatPrefixOverview,
RIPEStatRelatedPrefix,
)
from shared.models.scan import (
Scan,
ScanCreate,
ScanRead,
)
from shared.models.scan_activity import ScanActivity, ScanActivityRead
from shared.models.scan_command import (
ScanCommand,
ScanCommandDetail,
ScanCommandRead,
)
from shared.models.scan_context import (
AuthConfig,
AuthHeader,
ScanContext,
ScanContextCreate,
ScanContextRead,
ScanContextUpdate,
)
from shared.models.scan_engine import (
EngineCatalog,
ScanEngine,
ScanEngineCreate,
ScanEngineRead,
ScanEngineUpdate,
)
from shared.models.scan_schedule import (
ScanSchedule,
ScanScheduleCreate,
ScanScheduleRead,
ScanScheduleUpdate,
ScheduleTargetRef,
)
from shared.models.subdomain import (
Subdomain,
SubdomainRead,
SubdomainSummary,
TargetSubdomainRead,
)
from shared.models.tag import Tag, TagBase, TagCreate, TagRead, TagSummary, TagUpdate
from shared.models.target import (
Target,
TargetBulkCreate,
TargetBulkCreateResponse,
TargetCreate,
TargetImportItem,
TargetImportRequest,
TargetImportResult,
TargetRead,
TargetType,
TargetUpdate,
TargetValidationRequest,
TargetValidationResponse,
)
from shared.models.user import User, UserBase, UserCreate, UserRead
from shared.models.viewdns import ViewDNSCache
from shared.models.vuln_template import (
TemplateFilter,
TemplateLibraryStats,
TemplatePage,
TemplateSelection,
VulnTemplate,
VulnTemplateRead,
VulnTemplateUpdate,
VulnTemplateUploadRequest,
)
from shared.models.vulnerability import (
ScanVulnerabilities,
Vulnerability,
VulnerabilityCoverage,
VulnerabilityFacets,
VulnerabilityFilter,
VulnerabilityPage,
VulnerabilityRead,
VulnerabilityTriage,
)
from shared.models.wordlist import (
Wordlist,
WordlistFile,
WordlistRead,
WordlistUpdate,
WordlistUploadRequest,
WordlistUploadResult,
)
TargetRead.model_rebuild()
__all__ = [
"APIKey",
"APIKeyCreate",
"APIKeyRead",
"APIKeyUpdate",
"ActionRead",
"ActionRequest",
"ActivityLog",
"ActivityLogRead",
"AddTargetRequest",
"AiNarrative",
"AuthConfig",
"AuthHeader",
"CandidatePage",
"CandidateRead",
"Connector",
"ConnectorAction",
"ConnectorCandidate",
"ConnectorCoverage",
"ConnectorCreate",
"ConnectorCreated",
"ConnectorHost",
"ConnectorRead",
"ConnectorScope",
"ConnectorSession",
"ConnectorUpdate",
"DiscoveredDomain",
"DnsLookup",
"DnsLookupRead",
"DnsLookupSummary",
"DnsRecord",
"DnsRecordRead",
"Endpoint",
"EndpointCoverage",
"EndpointDetail",
"EndpointFacets",
"EndpointFilter",
"EndpointPage",
"EndpointRead",
"EndpointSummary",
"EndpointTree",
"EngineCatalog",
"FindingRecorded",
"FindingReport",
"HostFacts",
"HttpAsset",
"HttpAssetRead",
"HttpAssetSummary",
"IngestItem",
"IngestRequest",
"IngestResult",
"InstanceSettings",
"InstanceSettingsRead",
"InstanceSettingsUpdate",
"InterestCatalog",
"InterestDismissal",
"InterestFilter",
"InterestPage",
"InterestRow",
"InterestRule",
"InterestRuleCreate",
"InterestRuleRead",
"InterestRuleUpdate",
"InterestSignal",
"InterestSummary",
"IpAddress",
"IpAddressRead",
"IpAddressSummary",
"IpAsnRange",
"IpCountryRange",
"Note",
"NoteCount",
"NoteCreate",
"NoteRead",
"NoteTag",
"NoteUpdate",
"NoticeRead",
"Notification",
"NotificationChannel",
"NotificationChannelCreate",
"NotificationChannelRead",
"NotificationChannelTestResult",
"NotificationChannelUpdate",
"NotificationCreate",
"NotificationPreference",
"NotificationRead",
"Organization",
"OrganizationCreate",
"OrganizationRead",
"OrganizationSummary",
"OrganizationUpdate",
"Port",
"PortRead",
"PortSummary",
"Project",
"ProjectBase",
"ProjectCreate",
"ProjectRead",
"ProviderInfo",
"Proxy",
"ProxyCreate",
"ProxyEndpoint",
"ProxyEndpointRead",
"ProxyRead",
"ProxyTestResult",
"ProxyUpdate",
"RIPEStatASNNeighbour",
"RIPEStatASOverview",
"RIPEStatAbuseContact",
"RIPEStatAnnouncedPrefix",
"RIPEStatNetworkInfo",
"RIPEStatPrefixOverview",
"RIPEStatRelatedPrefix",
"Report",
"ReportFont",
"ReportTemplate",
"ReportTheme",
"RulePreview",
"RuleSuggestion",
"Scan",
"ScanActivity",
"ScanActivityRead",
"ScanCommand",
"ScanCommandDetail",
"ScanCommandRead",
"ScanContext",
"ScanContextCreate",
"ScanContextRead",
"ScanContextUpdate",
"ScanCreate",
"ScanEngine",
"ScanEngineCreate",
"ScanEngineRead",
"ScanEngineUpdate",
"ScanRead",
"ScanSchedule",
"ScanScheduleCreate",
"ScanScheduleRead",
"ScanScheduleUpdate",
"ScanVulnerabilities",
"ScheduleTargetRef",
"SessionRead",
"Subdomain",
"SubdomainRead",
"SubdomainSummary",
"Tag",
"TagBase",
"TagCreate",
"TagRead",
"TagSummary",
"TagUpdate",
"Target",
"TargetAdded",
"TargetBulkCreate",
"TargetBulkCreateResponse",
"TargetCreate",
"TargetImportItem",
"TargetImportRequest",
"TargetImportResult",
"TargetIpAddressRead",
"TargetOption",
"TargetRead",
"TargetSubdomainRead",
"TargetType",
"TargetUpdate",
"TargetValidationRequest",
"TargetValidationResponse",
"TemplateFilter",
"TemplateLibraryStats",
"TemplatePage",
"TemplateSelection",
"TreeNode",
"User",
"UserBase",
"UserCreate",
"UserRead",
"ViewDNSCache",
"VulnTemplate",
"VulnTemplateRead",
"VulnTemplateUpdate",
"VulnTemplateUploadRequest",
"Vulnerability",
"VulnerabilityCoverage",
"VulnerabilityFacets",
"VulnerabilityFilter",
"VulnerabilityPage",
"VulnerabilityRead",
"VulnerabilityTriage",
"Wordlist",
"WordlistFile",
"WordlistRead",
"WordlistUpdate",
"WordlistUploadRequest",
"WordlistUploadResult",
]