Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .cora.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,34 @@ ignore:
- "Hardcoded password or secret"
- "Command injection via exec/system with dynamic input"
- "SQL injection via string concatenation"
# Deterministic rule ids (cora 0.19). Each was validated against a full
# `cora scan --no-llm` of the repo (457 findings) before being silenced:
# - bug-todo matches the WORD "todo" (the todo_write/TodoState feature,
# `mod todo`), never a TODO marker: 22 of 22 hits were false positives.
- "bug-todo"
# - qual-clone: 306 info-level hits, almost all Arc/String clones that
# are the intended ownership model; no signal.
- "qual-clone"
# - bug-expect: every hit states a local invariant in its message
# (`expect("stdout piped above")`, poisoned-lock and runtime-build
# expects); the project's style, not unchecked external input.
- "bug-expect"
# - bug-println: the CLI's stdout IS its interface and eprintln! is the
# diagnostics channel. The real constraint (tole-core never writes to
# stdout) is enforced precisely by the core-no-stdout rule below.
- "bug-println"

# Deterministic custom rules (no LLM; run by `cora review` and `cora scan`).
# `languages` takes file extensions, and `exclude` is required.
rules_engine:
custom:
- id: core-no-stdout
# println!/print! but not eprintln!/eprint! (stderr diagnostics are fine).
pattern: "(?:^|[^a-z_])(?:println|print)!\\("
severity: major
message: "tole-core must stay embedder-safe: no stdout (hosts own I/O through the traits)"
languages: ["rs"]
exclude: ["crates/tole-cli/**", "evals/**", "**/tests/**"]

# Hook settings
hook:
Expand Down
2 changes: 2 additions & 0 deletions crates/tole-cli/src/approver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ impl PromptFn for StdioPrompt {
println!("what: {}", req.description);
println!("input: {}", input_preview(req.input));
print!("allow? [y/N] ");
// A failed prompt flush is not actionable.
// cora-ignore: qual-error-ignore
let _ = io::stdout().flush();
let mut line = String::new();
match io::stdin().lock().read_line(&mut line) {
Expand Down
2 changes: 2 additions & 0 deletions crates/tole-core/src/openai.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ impl std::fmt::Debug for OpenAiConfig {
/// tools on the same host.
pub const ENV_BASE_URL: &str = "TOLE_BASE_URL";
pub const ENV_MODEL: &str = "TOLE_MODEL";
// The env var NAME, not a secret value.
// cora-ignore: sec-hardcoded-secret
pub const ENV_API_KEY: &str = "TOLE_API_KEY";

/// Prefixes tried by [`OpenAiConfig::from_env`], in order. The first
Expand Down
Loading