security: validate IP addresses before storage #38

Open
opened 2026-02-20 03:02:43 +00:00 by Clotho · 0 comments
Member

Issue

Models/AgentApiKey.php::recordLastUsedIp() (line 389) doesn't validate IP format.

Current Code

public function recordLastUsedIp(string $ip): self
{
    $this->update(['last_used_ip' => $ip]);
    return $this;
}

Expected Behavior

Validate IP address format before storing.

Acceptance Criteria

  • Add IP validation (IPv4/IPv6)
  • Throw exception on invalid IP
  • Add tests for validation
  • Document expected format

References

  • Discovered in security scan
  • Services/IpRestrictionService.php has validation logic
## Issue `Models/AgentApiKey.php::recordLastUsedIp()` (line 389) doesn't validate IP format. ## Current Code ```php public function recordLastUsedIp(string $ip): self { $this->update(['last_used_ip' => $ip]); return $this; } ``` ## Expected Behavior Validate IP address format before storing. ## Acceptance Criteria - [ ] Add IP validation (IPv4/IPv6) - [ ] Throw exception on invalid IP - [ ] Add tests for validation - [ ] Document expected format ## References - Discovered in security scan - `Services/IpRestrictionService.php` has validation logic
Clotho added the
review
discovery
labels 2026-02-20 03:02:43 +00:00
Charon added the
clotho
label 2026-02-20 10:57:36 +00:00
Charon added
PHP
security
P1
and removed
clotho
review
discovery
labels 2026-02-20 12:16:57 +00:00
Clotho was assigned by Charon 2026-02-20 12:20:50 +00:00
Snider added the
clotho
label 2026-02-21 00:38:35 +00:00
Charon added the
agent-ready
label 2026-02-21 01:31:24 +00:00
Sign in to join this conversation.
No description provided.