Port Table

Published ports with their bind address. `0.0.0.0:5432` and `127.0.0.1:5432` are the difference between a database on the internet and a database on the machine — printing only the number hides that.

src/components/ui/port-table.tsx

About

From the component's own source, where it was written.

Published ports, with what is actually listening.

The bind address is shown, not just the port. 0.0.0.0:5432 and 127.0.0.1:5432 are the difference between a database on the internet and a database on the machine, and a table that prints only the number hides the one that matters.

Ports bound to all interfaces without TLS are flagged. That combination is the actual finding; either alone is often fine.

Well-known ports get their conventional service name, because 5432 means nothing to someone who does not already know it is Postgres.

One grid owns the columns and every row inherits them through subgrid. Giving each row its own grid looks identical in a mock-up and drifts in practice: 1fr and auto resolve against whatever that row happens to contain, so a row carrying an "exposed" badge squeezes its neighbours while an empty one does not, and no two rows line up.

Install

npx astralyx-ui add port-table

Usage

import { PortTable } from '@/components/ui/port-table'

<PortTable ports={ports} />

Composer

Change the props and the source below follows.

PortBindProcess
  • 443→80800.0.0.0nginxhttps
  • 80800.0.0.0node apihttp-altexposed
  • 5432127.0.0.1postgrespostgres
  • 63790.0.0.0redis-serverredisexposed
  • 9090127.0.0.1prometheusprometheus
  • 53/udp127.0.0.53systemd-resolveddns

Bound to every interface without TLS — reachable from outside the host in the clear.

Props
tsx
<PortTable ports={ports} />

Examples

What is listening

API

Generated from the source, so it cannot fall behind the code. One table per exported component, then hooks, functions and types.

PortTable

Published ports, with what is actually listening.

Extends ComponentProps<'div'>.

PropTypeDefaultDescription
portsPortBinding[]required{ id, port, targetPort?, protocol?, address?, process?, tls?, service? }.
emptyLabelReactNode'No published ports'—
portHeaderReactNode'Port'—
addressHeaderReactNode'Bind'—
processHeaderReactNode'Process'—
exposedLabelReactNode'exposed'—
tlsLabelstring'TLS'Accessible name for the TLS marker.
exposedNoteReactNode'Bound to every interface without TLS — reachable from outside the host in the clear.'—

Functions

FunctionSignatureDescription
wellKnownPortsRecord<number, string>—

Types

PortBinding

FieldTypeDescription
idstring—
portnumberPort on the host.
targetPort?numberPort inside the container or process.
protocol?'tcp' | 'udp'—
address?stringBound to every interface is highlighted; loopback is not.
process?ReactNode—
tls?boolean—
service?string5432 means nothing to someone who does not already know it is Postgres.

Behaviour

TopicDetailDescription
exposurepublic + no TLSThat combination is the actual finding. Either alone is often fine.