Repository navigation
Proposal: Make "detectability" a CodeGuard generation requirement, enforce detection hooks / security events in generated code #99
Replies: 3 comments 1 reply
|
@rithikha has a better memory than I on telemetry. Also David Girard created https://github.com/girdav01/AgentDR. |
|
This comes out of issues that weren't being detect: authentication, certificate, etc |
|
To clarify the ask: I am not proposing that CodeGuard itself emit events or become a logging component. The ask is that CodeGuard ensure the application being built has its own detection hooks: audit logging, security event capture, and related instrumentation, as described in OWASP A09, Security Logging and Monitoring Failures. In other words, when the agent writes a security-relevant code path, the generated app should also record the event that a detector would later need. Some possible ways to address it:
On verification: SecurityEval runs bandit.py to detect insecure patterns that are present in the generated code. Missing audit logging is the opposite case: there is no pattern to match, so the harness scores it as clean. Confirming that a required event exists needs a different check, closer to a rule-driven review pass that fails when the expected event is absent, not a pattern scanner. |
Uh oh!
There was an error while loading. Please reload this page.
CodeGuard is good at preventing vulnerabilities but says little about detectability, meaning whether the code it generates emits the security events needed to catch anomalous behavior at runtime. Many incidents are caught or missed based on whether the code logged the right signal at the right moment (a failed authz check, a privilege change, anomalous data access). If AI-generated code ships without that instrumentation, downstream detection has nothing to work with, and the volume of AI-generated code widens the blind spot faster than humans can backfill it.
Current state
codeguard-0-logging already covers what to log and has a Detection and Alerting section, and the OWASP logging-vocabulary rule gives a parseable event taxonomy. But the rule is alwaysApply: false, so it may never fire on the path that needed it.
If it fires, nothing verifies the agent inserted the instrumentation.
Proposal
Treat detectability as a generation requirement. Add a rule (working name codeguard-0-detection-instrumentation) that says: when generating a security-relevant sink, emit a structured security event at that branch, keyed to the OWASP logging vocabulary, with correlation IDs, on both success and denial paths.
Prescribe concrete patterns, such as use the OWASP vocabulary so events are SIEM-consumable.
Make presence enforceable. Hook on file write that checks each security-relevant function for a matching event and re-prompts if missing
How it fits
It reuses what we have (codeguard-0-logging, logging-vocabulary, codeguard-reviewer) rather than opening a new domain.
Scope boundary
CodeGuard owns event generation in the code, not the detection backend.
All reactions