mirror of
https://github.com/moltbot/moltbot.git
synced 2026-03-08 06:54:24 +00:00
fix(security): OC-65 prevent compaction counter reset to enforce context exhaustion limit — Aether AI Agent
Remove the `overflowCompactionAttempts = 0` reset inside the inner loop's tool-result-truncation branch. The counter was being zeroed on each truncation cycle, allowing prompt-injection attacks to bypass the MAX_OVERFLOW_COMPACTION_ATTEMPTS guard and trigger unbounded auto-compaction, exhausting context window resources (DoS). CWE-400 / GHSA-x2g4-7mj7-2hhj
This commit is contained in:
committed by
Peter Steinberger
parent
2b76901f35
commit
084f621025
@@ -714,8 +714,8 @@ export async function runEmbeddedPiAgent(
|
||||
log.info(
|
||||
`[context-overflow-recovery] Truncated ${truncResult.truncatedCount} tool result(s); retrying prompt`,
|
||||
);
|
||||
// Session is now smaller; allow compaction retries again.
|
||||
overflowCompactionAttempts = 0;
|
||||
// Do NOT reset overflowCompactionAttempts here — the global cap must remain
|
||||
// enforced across all iterations to prevent unbounded compaction cycles (OC-65).
|
||||
continue;
|
||||
}
|
||||
log.warn(
|
||||
|
||||
Reference in New Issue
Block a user