AWS Builder Center

Building FixTrace: Secure Developer Diagnostics with Cedar and AWS EC2

Learn how I built FixTrace, a Python CLI that combines deterministic failure diagnosis, Cedar-based fail-closed authorization, automated testing, and AWS EC2 deployment to make developer diagnostics safer and more reliable.

Building FixTrace: Secure Developer Diagnostics with Cedar Authorization on AWS EC2

Introduction

Diagnostic tools are useful precisely because they touch real systems: they open connections, probe ports, and inspect environments. That same power is a risk. A troubleshooting tool that can run any check on demand, for anyone or anything that asks, is a security problem waiting to happen.
I built FixTrace to explore this problem. FixTrace is a Python command-line tool that diagnoses application and build failures, and it enforces an authorization decision before any diagnostic action runs. It uses Cedar, AWS's open-source policy language, for those decisions, and I validated the full system on an Amazon EC2 instance running Amazon Linux 2023.
In this post I'll cover the design, how Cedar fits in, how I tested it, what went wrong along the way, and what I learned.

The Problem

When something breaks, developers reach for checks like:
  • Is the API reachable?
  • Is the database connection working?
  • Is a given port open?
Each check interacts with a real network or system resource. If a tool executes them on request with no gatekeeping, you get three problems:
  1. No control over what runs. Any caller can trigger any check.
  1. No clear audit boundary. Security logic ends up scattered through application code.
  1. Unsafe automation. If an AI agent or script drives the tool, nothing limits which actions it can take.
FixTrace addresses this by placing an authorization boundary in front of every diagnostic operation.

What is FixTrace?

FixTrace is a Python CLI with two commands:
  •  analyze  classifies an application or build failure using deterministic rules.
  •  diagnose-port  checks TCP port connectivity through an authorized diagnostic tool ( check_port ).
Three design decisions shape the whole project:
1. Diagnosis is deterministic. Failures are classified by explicit rules, so the same input always produces the same result. That makes the tool predictable and testable.
2. The LLM explains but never decides. FixTrace can use a local LLM to produce a human-friendly explanation of a diagnosis, but the explanation is non-authoritative. The rules make the diagnosis, and the model only describes it. The model has no say in what gets executed or allowed.
3. Authorization fails closed. If a request isn't explicitly permitted by policy, or if the authorization check itself can't be completed, the request is denied. A broken policy layer must never turn into open access.

Architecture

Every request passes through a series of boundaries before any diagnostic tool runs:
text
Diagnostic Request
|
v
+-------------------+
| Input Validation |
+-------------------+
|
v
+-------------------+
| Authorization |
| Layer |
+-------------------+
|
v
+-------------------+
| Cedar Policy |
| Evaluation |
+-------------------+
|
+----+----+
| |
ALLOW DENY
| |
v v
Diagnostic Reject
Tool Request
|
v
Diagnostic Result
This separates the concerns cleanly:
  • Request handling receives the command and its arguments.
  • Validation rejects malformed input early.
  • Authorization decides whether the action is permitted.
  • Diagnostic execution runs only after approval.
Because each layer has one job, the system is easier to reason about and easier to test in isolation.

Using Cedar for Authorization

 Cedar  is an open-source policy language and authorization engine created by AWS. Instead of hard-coding rules like  if user == "admin"  throughout application logic, you write policies in a dedicated language and ask the engine for a decision.
Every authorization question in FixTrace has the same shape:
text
Principal (who is asking)
+ Action (what they want to do)
+ Resource (what it applies to)
|
v
Cedar Policies
|
+----+----+
| |
Allow Deny
The application asks Cedar whether a given agent may perform a given action. Cedar evaluates its policies and returns a decision. Cedar's model is default-deny, which matches FixTrace's fail-closed principle: an action that isn't explicitly permitted doesn't run.
Keeping policy separate from code has practical benefits:
  • Clarity. Rules can be read and reviewed on their own.
  • Changeability. Permissions can change without rewriting application logic.
  • Testability. You can test allowed and denied scenarios directly against the policy.

Validation and Defense in Depth

Authorization alone isn't enough. A request can be authorized and still carry bad input, so FixTrace validates inputs before they reach the authorization or diagnostic layers.
The result is several independent boundaries:
text
Request --> Input Validation --> Authorization --> Cedar Policy --> Diagnostic Tool
If one layer has a flaw, the others still limit the damage. Invalid requests never reach authorization, and unauthorized requests never reach the tool.

Testing

I treated testing as part of the architecture. The automated suite covers:
  • Authorization behavior
  • Cedar policy validation
  • Diagnostic operations
  • CLI behavior
  • Invalid input handling
  • Tool authorization
  • Error handling
The project also has a GitHub Actions CI pipeline, so the suite runs automatically on every change. The full suite currently reports:
text
50 passed
The tests give me a repeatable way to confirm that a change to the authorization or diagnostic layers hasn't broken anything else. They cover both sides of the boundary: requests that should be allowed, and requests that must be denied.

Deploying and Validating on AWS EC2

Passing tests on my own machine isn't the same as working in a clean environment, so I validated FixTrace on Amazon EC2:
Component
Details
Compute
Amazon EC2 (t3.micro)
Operating system
Amazon Linux 2023 (x86_64)
Region
us-east-1
Runtime
Python 3.14.7
Authorization engine
Cedar CLI 4.13.0
On the instance, I installed the project, ran the complete automated suite, and got the same result:
text
Python 3.14.7
50 passed
Running in a fresh cloud environment confirmed that the project doesn't depend on anything specific to my development machine, and it confirmed that the Cedar integration works end to end on Amazon Linux.

The Debugging Story

The most instructive part of the project was a failure. At one point, a large group of tests failed at once. The failures spread across:
  • Authorization tests
  • Cedar policy tests
  • CLI tests
  • Diagnostic tests
The tempting approach is to open each failing test and patch it separately. Instead, I noticed that all of these failures had something in common: every one of them depended on the authorization boundary. The authorization layer was denying requests that should have been allowed, and every layer built on top of it inherited the problem.
Fixing that one underlying issue brought the whole suite back to  50 passed .
The lesson: when many tests fail in the same area, look for the shared dependency instead of fixing each symptom. It's also a good sign that the architecture is doing its job. A single fail-closed boundary that everything depends on means a fault there is loud and obvious, not silent.

What I Learned

1. Authorization should be a boundary, not an afterthought. Security checks belong before sensitive operations, not scattered around them.
2. Policy-based authorization separates decisions from logic. With Cedar, the rules live in one reviewable place instead of being buried in application code.
3. Fail closed by default. If the authorization layer breaks, denying access is the safe failure mode. Allowing access is not.
4. Tests are useful for architecture, not just correctness. The pattern of failures pointed me directly to the shared dependency behind them.
5. Don't let the model make the decision. Using an LLM for explanations while keeping diagnosis deterministic gave me useful output without giving up predictability or safety.
6. Cloud environments expose differences. Running on EC2 confirmed the project works outside my local setup.

AWS Technologies Used

  • Amazon EC2: deployment and validation environment
  • Amazon Linux 2023: operating system for the instance
  • Cedar: policy language and engine for authorization decisions

Demo and Source Code

The demo walks through the architecture, the authorization flow, the test suite, and the AWS deployment.

Conclusion

FixTrace started as a developer diagnostics tool and became an exercise in secure tool execution. Its central rule is simple:
Don't execute a diagnostic action until the request has passed validation and authorization.
By combining deterministic diagnosis, Cedar-based authorization, layered validation, automated testing, and EC2 validation, I got hands-on experience building a security-aware developer tool. The main takeaway is that reliable engineering is more than making a feature work. It means setting clear boundaries, testing the failure cases, understanding why failures happen, and verifying the result in a real environment.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article