The Simplest Way to Make Fortigate and Junit Work Like They Should
Teams pair fortigate and junit to test firewall rules right from build pipelines. This setup checks network paths and port rules before code reaches live servers. Manual network checks take too much time during a busy release week. Automated tests catch blocked ports and bad routes early in the build cycle. Developers get fast feedback when a code change breaks a network rule. Security teams also gain clear proof that firewall rules work as planned. How fortigate and junit share keys and data
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.
Teams pair fortigate and junit to test firewall rules right from build pipelines. This setup checks network paths and port rules before code reaches live servers.
Manual network checks take too much time during a busy release week. Automated tests catch blocked ports and bad routes early in the build cycle. Developers get fast feedback when a code change breaks a network rule. Security teams also gain clear proof that firewall rules work as planned.
How fortigate and junit share keys and data
A test runner needs a safe way to talk to the firewall. Junit starts the test run and sends requests to the Fortigate API. The firewall checks the key and role of the test runner first. If the key is valid, the firewall returns rule data to the runner.
The test code then reads this state data and checks each value. It confirms that open ports match the list in the test plan. It also checks that the firewall blocks bad traffic from outside networks. Each test step writes a pass or fail note to the build log. Teams read these logs to see which rule broke the build.
Good test plans only read state data from the live firewall. If a test must write new rules, use a staging device instead. This habit keeps test scripts from breaking live traffic during a run.
Common risks with shared keys and wide network paths
Many teams put a single admin key into their build server settings. Every test run then uses that same wide key to check the firewall. If that key leaks, an attacker gets full control over the network. A broken test script could also wipe out live routing rules by mistake.
Unlogged queries create another big blind spot for security and ops teams. When ten build jobs share one account, the firewall log shows one user. You cannot tell which job or developer ran a specific check. Sensitive data like phone numbers or emails might also sit in test logs. Masking rewrites matched fields in results so raw card numbers do not leak.
End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
To fix this, give each test runner a read-only role on the firewall. Scope the role so it only reads the zones your app needs. Restrict the test runner IP so it can only reach test ports. Rotate the API keys often and tie each run to a build ID.
Best ways to structure network tests in your pipeline
Split your firewall checks into two clear stages inside your build pipeline. Run fast syntax checks on every code push to catch simple mistakes. Run deep state checks against the staging firewall before you merge code.
Keep your test data clean and separate from your main app code. Store expected port lists in simple files that both teams can read. When a network rule changes, update the test file in the same commit. This keeps the firewall state and the test suite in sync all year.
Add runtime guardrails and masking beside your databases and APIs
Login rules, role grants, and CI checks govern who connects to your stack. Yet any allowed script, engineer, or AI agent still runs commands with the full scope of its role. For workloads on Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes, SSH, or internal HTTP services, hoop.dev sits beside the service as an open-source proxy, a sidecar for your database or API.
Before a query runs, hoop.dev guardrails check the statement against your rules. An AI Analyzer you configure can score intent or hold risky calls for human review. Next, hoop.dev data masking rewrites sensitive fields in responses, and each verdict is logged per listener. Explore the MIT-licensed project on GitHub.
Frequently asked questions
Can Junit tests change live Fortigate rules during a build?
Yes, if the API key has write permissions on the firewall. Still, you should give Junit a read-only role for live network checks. Run write tests only against a separate lab or staging firewall.
How do we keep firewall API keys safe in build pipelines?
Store the keys in a secure secret store instead of plain text files. Scope each key to the exact IP address of your build runner. Set a short lifespan for every key and rotate them on a schedule.
Why do my Junit network tests fail on the build server?
The firewall might block the IP address of your build server. Check that your firewall rules allow API traffic from the test runner subnet. Also check that the API role has permission to read the target zone.
Related guides
In this post