Skip to content

fix: Skip reserved attribute names when loading a resource - #579

Open
razor-x wants to merge 1 commit into
mainfrom
claude/ruby-sdk-audit-xbhaia-reserved-attributes
Open

fix: Skip reserved attribute names when loading a resource#579
razor-x wants to merge 1 commit into
mainfrom
claude/ruby-sdk-audit-xbhaia-reserved-attributes

Conversation

@razor-x

@razor-x razor-x commented Sep 1, 2026

Copy link
Copy Markdown
Member

Problem

SDK audit finding M10 (first part). BaseResource#process_data_attributes sets an instance variable for every response key with no reserved-name guard, so an API field named data or client clobbers the resource's own @data hash or its Faraday client. The audit verified the client case includes the client a later action-attempt poll needs.

Fix

data and client are never assigned as attributes. They stay readable through resource.data["client"], and resource.client / resource.data keep meaning what the SDK defines them to mean. Invalid Ruby identifiers were already skipped this way.

Tests

spec/resources/base_resource_spec.rb: a data field leaves resource.data as the full response hash, a client field leaves the injected client in place both on construction and through update_from_response on an action attempt.

Revert-check against main: 3 failures, resource.data became 1 and resource.client became the string from the response.

🤖 Generated with Claude Code

https://claude.ai/code/session_01SQW83gyXeUG61RDrHEky97


Generated by Claude Code

BaseResource stored every response key as an instance variable with no
reserved-name check, so a field named data or client overwrote the
resource's own data hash or the Faraday client. An action attempt whose
response carried a client field lost the client its next poll needed.

Leave the data and client keys in the data hash without assigning them as
attributes.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SQW83gyXeUG61RDrHEky97
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.

2 participants