How to Configure Network Policy Control

Published
Length
3 min read

Luis Felipe Dias

All posts

Network policy control sets rules for which apps and users can send traffic to your servers. You set it up by blocking all traffic first and then opening only needed ports. Many teams rely on flat networks where any server can talk to any other server. This setup makes it easy for an attacker to move around after a breach. Good traffic rules stop this movement by locking down both incoming and outgoing paths. You must define who can talk, where they can go, and which ports they use. How netwo

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

Network policy control sets rules for which apps and users can send traffic to your servers. You set it up by blocking all traffic first and then opening only needed ports.

Many teams rely on flat networks where any server can talk to any other server. This setup makes it easy for an attacker to move around after a breach. Good traffic rules stop this movement by locking down both incoming and outgoing paths. You must define who can talk, where they can go, and which ports they use.

How network policy control works

At its core, network policy control checks packet headers against a list of rules. Every packet has a source address, a target address, a port, and a protocol. The system reads these details before it lets the packet move forward. If the packet matches an allow rule, the system sends it to the target. If it does not match, the system drops the packet right away.

These rules apply to many kinds of workloads and users. You can scope rules by IP range, subnet, server tag, or workload group. Modern cloud and container tools let you attach labels to each app. Then you write rules that let specific labels talk to other labels. This label approach beats raw IP lists because app addresses change all the time.

Safe defaults start with a strict deny rule for both incoming and outgoing traffic. When you block everything by default, no hidden paths keeps the session active by mistake. Next, you add narrow rules for core needs like DNS lookups and health checks. After that, you open exact ports between your web tier and your data tier. You should never open wide port ranges or allow all subnets to reach a database.

How to check rules and spot session gaps

After you put rules in place, you must check that they work as planned. Start by reviewing flow logs from your cloud network or container runtime. Flow logs show which packets got through and which ones the firewall dropped. You should test both allowed paths and blocked paths from a test workload. If a blocked port still answers, check the rule order for a broad allow rule.

End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Auditing these rules takes steady work as your apps grow and change. Teams often add temporary rules during an outage and forget to remove them later. You should review all active rules every month and delete unused entries. Keep all rule files in version control so you can see who changed what. A clear change history helps your team fix broken paths fast.

Still, packet rules only check where traffic comes from and where it goes. Once a user or app opens a valid session, network rules stop helping. A firewall cannot tell a safe read query from a command that drops a table. It also cannot mask card numbers, phone numbers, or emails in query results. Static rules leave the inside of an active session wide open to mistakes or abuse.

Shared database accounts make this blind spot much worse for security teams. Many developers may reach a database host over the same allowed port and IP range. Network logs will show the packet flow, but not which person ran a bad command. To close this gap, you need controls that inspect commands and data inside the session.

Govern statements and responses across databases and APIs

Good config and scoped roles are needed setup. They do not check single queries in flight or mask sensitive fields in returned rows. Across Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, and internal HTTP endpoints, hoop.dev sits inline in the protocol beside each supported service as an open-source proxy, a sidecar for your database or API. For every query or command an AI agent or engineer runs against production, hoop.dev decides to pass, mask, block, or hold it for human approval.

First, hoop.dev guardrails block banned queries before they run or hold risky ones for review, and hoop.dev data masking rewrites matched sensitive values in responses in memory. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.

Frequently asked questions

What is the difference between ingress and egress rules?

Ingress rules filter traffic that comes into a server or workload from outside. Egress rules filter traffic that leaves a workload to reach other systems or the internet.

Why should teams block outgoing traffic by default?

Blocking outgoing traffic stops compromised servers from sending stolen data to outside hosts. It also prevents malware from downloading extra tools from an attacker server.

Can network rules replace database user roles?

No, network rules only control which hosts can reach the database port. You still need database roles and command checks to control what users do inside.

The query runs. The emails stay hidden.