Skip to content

Conversation

@dorien-koelemeijer
Copy link
Collaborator

@dorien-koelemeijer dorien-koelemeijer commented Jan 5, 2026

Summary

Logging uplift for model training purposes (command injection model). These logs will end up in Snowflake where we'll be able to join on tool_request_id to use the data included in the flagged security finding log and user decision log to generate training data for our command injection model (initial model is created, aim is to use production data for training and fine tuning).

In addition, prefixed prompt injection detection logs for easier manual searching if necessary.

Type of Change

  • Feature
  • Bug fix
  • Refactor / Code quality
  • Performance improvement
  • Documentation
  • Tests
  • Security fix
  • Build / Release
  • Other (specify below)
    Feature uplift

AI Assistance

  • This PR was created or reviewed with AI assistance

Testing

TBD - testing currently

Copilot AI review requested due to automatic review settings January 5, 2026 05:38
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances logging for security findings to support command injection model training. The changes add structured fields and consistent prefixes to logs that will be sent to Snowflake for analysis.

Key Changes

  • Added threat_type and tool_call_json fields to security finding logs
  • Added tool_request_id to user decision logs for join capability
  • Standardized log messages with "Prompt injection detection:" prefix

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
crates/goose/src/security/mod.rs Enhanced security finding logs with threat_type field and full tool_call JSON serialization; updated log message prefixes for consistency
crates/goose/src/agents/tool_execution.rs Added tool_request_id to user decision logs to enable joining with security findings in Snowflake

Comment on lines +88 to +126
let tool_call_json =
serde_json::to_string(&tool_call).unwrap_or_else(|_| "{}".to_string());

tracing::warn!(
counter.goose.prompt_injection_finding = 1,
threat_type = "command_injection",
above_threshold = above_threshold,
tool_name = %tool_call.name,
tool_request_id = %tool_request.id,
tool_call_json = %tool_call_json,
Copy link

Copilot AI Jan 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logging the complete tool_call JSON may expose sensitive data. Tool arguments can contain credentials, API keys, file paths, or other sensitive information that could be logged to Snowflake. Consider sanitizing or redacting sensitive fields from tool_call.arguments before serialization, or implement a privacy filter for the logged data.

Suggested change
let tool_call_json =
serde_json::to_string(&tool_call).unwrap_or_else(|_| "{}".to_string());
tracing::warn!(
counter.goose.prompt_injection_finding = 1,
threat_type = "command_injection",
above_threshold = above_threshold,
tool_name = %tool_call.name,
tool_request_id = %tool_request.id,
tool_call_json = %tool_call_json,
tracing::warn!(
counter.goose.prompt_injection_finding = 1,
threat_type = "command_injection",
above_threshold = above_threshold,
tool_name = %tool_call.name,
tool_request_id = %tool_request.id,

Copilot uses AI. Check for mistakes.
Copy link
Collaborator Author

@dorien-koelemeijer dorien-koelemeijer Jan 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check if any sanitisation happens (i.e. in vector fx), otherwise think of another way + check if these logs go over the public internet

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah I think the robot makes a good point. can we log something here that allows us to get the actual LLM request back from databricks? that would make sure only people who have access to that can see these potentially PII data

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah this is problematic, could possibly do name only I would think.

I wonder if this isn't the right level to log things at.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have set up a sensitive data filter in the OTLP logs here: https://github.com/squareup/ccd-goose-otlp-proxy/pull/12

@dorien-koelemeijer dorien-koelemeijer marked this pull request as draft January 5, 2026 06:33
Copy link
Collaborator

@DOsinga DOsinga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the robot makes a good point though

Comment on lines +88 to +126
let tool_call_json =
serde_json::to_string(&tool_call).unwrap_or_else(|_| "{}".to_string());

tracing::warn!(
counter.goose.prompt_injection_finding = 1,
threat_type = "command_injection",
above_threshold = above_threshold,
tool_name = %tool_call.name,
tool_request_id = %tool_request.id,
tool_call_json = %tool_call_json,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah I think the robot makes a good point. can we log something here that allows us to get the actual LLM request back from databricks? that would make sure only people who have access to that can see these potentially PII data

@dorien-koelemeijer dorien-koelemeijer marked this pull request as ready for review January 8, 2026 21:33
@dorien-koelemeijer dorien-koelemeijer force-pushed the feat/uplift-application-logs-for-model-training branch from 51c2927 to f5e17be Compare January 8, 2026 22:06
@zanesq
Copy link
Collaborator

zanesq commented Jan 26, 2026

@dorien-koelemeijer checking if still in progress?

@dorien-koelemeijer
Copy link
Collaborator Author

@dorien-koelemeijer checking if still in progress?

Hi, yes, just about to merge this! Just needed to get some other stuff out, but this can move forward now as well. Thanks for checking!

Copilot AI review requested due to automatic review settings January 27, 2026 04:06
@dorien-koelemeijer dorien-koelemeijer force-pushed the feat/uplift-application-logs-for-model-training branch from f5e17be to 0fa544d Compare January 27, 2026 04:06
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@dorien-koelemeijer dorien-koelemeijer merged commit e9024b7 into main Jan 27, 2026
23 checks passed
@dorien-koelemeijer dorien-koelemeijer deleted the feat/uplift-application-logs-for-model-training branch January 27, 2026 05:25
zanesq added a commit that referenced this pull request Jan 27, 2026
…upport

* origin/main: (79 commits)
  fix[format/openai]: return error on empty msg. (#6511)
  Fix: ElevenLabs API Key Not Persisting (#6557)
  Logging uplift for model training purposes (command injection model) [Small change] (#6330)
  fix(goose): only send agent-session-id when a session exists (#6657)
  BERT-based command injection detection in tool calls (#6599)
  chore: [CONTRIBUTING.md] add Hermit to instructions (#6518)
  fix: update Gemini context limits (#6536)
  Document r slash command (#6724)
  Upgrade GitHub Actions to latest versions (#6700)
  fix: Manual compaction does not update context window. (#6682)
  Removed the Acceptable Usage Policy (#6204)
  Document spellcheck toggle (#6721)
  fix: docs workflow cleanup and prevent cancellations (#6713)
  Docs: file bug directly (#6718)
  fix: dispatch ADD_ACTIVE_SESSION event before navigating from "View All" (#6679)
  Speed up Databricks provider init by removing fetch of supported models (#6616)
  fix: correct typos in documentation and Justfile (#6686)
  docs: frameDomains and baseUriDomains for mcp apps (#6684)
  docs: add Remotion video creation tutorial (#6675)
  docs: export recipe and copy yaml (#6680)
  ...

# Conflicts:
#	ui/desktop/src/hooks/useChatStream.ts
katzdave added a commit that referenced this pull request Jan 27, 2026
…ovider

* 'main' of github.com:block/goose:
  fix slash and @ keyboard navigation popover background color (#6550)
  fix[format/openai]: return error on empty msg. (#6511)
  Fix: ElevenLabs API Key Not Persisting (#6557)
  Logging uplift for model training purposes (command injection model) [Small change] (#6330)
  fix(goose): only send agent-session-id when a session exists (#6657)
  BERT-based command injection detection in tool calls (#6599)
  chore: [CONTRIBUTING.md] add Hermit to instructions (#6518)
  fix: update Gemini context limits (#6536)
  Document r slash command (#6724)
  Upgrade GitHub Actions to latest versions (#6700)
zanesq added a commit that referenced this pull request Jan 27, 2026
* 'main' of github.com:block/goose:
  Create default gooseignore file when missing (#6498)
  fix slash and @ keyboard navigation popover background color (#6550)
  fix[format/openai]: return error on empty msg. (#6511)
  Fix: ElevenLabs API Key Not Persisting (#6557)
  Logging uplift for model training purposes (command injection model) [Small change] (#6330)
  fix(goose): only send agent-session-id when a session exists (#6657)
  BERT-based command injection detection in tool calls (#6599)
  chore: [CONTRIBUTING.md] add Hermit to instructions (#6518)
  fix: update Gemini context limits (#6536)
  Document r slash command (#6724)
  Upgrade GitHub Actions to latest versions (#6700)
  fix: Manual compaction does not update context window. (#6682)
  Removed the Acceptable Usage Policy (#6204)
  Document spellcheck toggle (#6721)
  fix: docs workflow cleanup and prevent cancellations (#6713)
  Docs: file bug directly (#6718)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants