Skip to content

fix(ssh): reject control characters in ssh_add_host_key inputs#1347

Open
jayantkamble10000 wants to merge 1 commit into
coinbase:mainfrom
jayantkamble10000:fix/ssh-add-host-key-validation
Open

fix(ssh): reject control characters in ssh_add_host_key inputs#1347
jayantkamble10000 wants to merge 1 commit into
coinbase:mainfrom
jayantkamble10000:fix/ssh-add-host-key-validation

Conversation

@jayantkamble10000

@jayantkamble10000 jayantkamble10000 commented Jun 27, 2026

Copy link
Copy Markdown

What

The ssh_add_host_key action builds a known_hosts line from the host, key_type, and key fields and writes it to the line-oriented known_hosts file. The host, key, and key_type fields on AddHostKeySchema are only length-validated, so a value containing a newline can write more than one line into known_hosts.

Why

known_hosts is line-oriented; an embedded newline in any of these fields breaks the one-entry-per-line invariant and lets a single call add extra entries. Rejecting control characters keeps each call to a single, well-formed entry.

Change

python/coinbase-agentkit/coinbase_agentkit/action_providers/ssh/schemas.py — add a field_validator on host, key, and key_type in AddHostKeySchema that rejects ASCII control characters (newline, CR, NUL, etc.).

@cb-heimdall

cb-heimdall commented Jun 27, 2026

Copy link
Copy Markdown

🟡 Heimdall Review Status

Requirement Status More Info
Reviews 🟡 0/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1

@github-actions github-actions Bot added action provider New action provider python labels Jun 27, 2026
ssh_add_host_key writes the host/key_type/key into the line-oriented known_hosts file. Add a field validator on host/key/key_type that rejects ASCII control characters so a value with an embedded newline cannot inject additional known_hosts entries.
@jayantkamble10000 jayantkamble10000 force-pushed the fix/ssh-add-host-key-validation branch from 241cc89 to 4dbd137 Compare June 27, 2026 06:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action provider New action provider python

Development

Successfully merging this pull request may close these issues.

2 participants