Prioritize readability in security/detect-object-injection cleanup#2106
Conversation
security/detect-object-injection warnings with safer keyed access patterns
pmcelhaney
left a comment
There was a problem hiding this comment.
@copilot Reflect.set() makes the code harder to read. Can't these objects be turned into Maps instead?
Updated in 5bb8d56: I removed |
security/detect-object-injection warnings with safer keyed access patternssecurity/detect-object-injection warnings with clearer keyed access patterns
pmcelhaney
left a comment
There was a problem hiding this comment.
@copilot I don't like the changes that use Reflect or Object.entries. If there's not a simple way to address lint warnings in those cases we'll just live with the warning.
Also I don't like the switch statement.
Updated in 6db77f9. I reverted the readability-unfriendly refactors that introduced Reflect/Object.entries/switch-based rewrites in the affected files and restored the simpler prior implementations, accepting the related lint warnings in those spots. |
security/detect-object-injection warnings with clearer keyed access patternssecurity/detect-object-injection cleanup
Summary
This PR now takes a readability-first approach to
security/detect-object-injectionhandling.Reflect/Object.entries/switch-based rewrites in runtime, REPL, generator, and related tests.Original Prompt
Reduce
security/detect-object-injectionwarnings by replacing ambiguous dynamic object indexing with safer access patterns or documenting trusted usage.Context and motivation
Many warnings come from map-like structures and route/context registries where dynamic keys are expected. We need a consistent pattern for safe keyed access so this rule remains useful.
Acceptance criteria
security/detect-object-injectionwarning sites are triagedMapusage)Manual acceptance tests
yarn lintshows no new readability-unfriendly refactor patterns (Reflect/Object.entries/switch rewrites) introduced by this PR, and object-injection warnings remain only in accepted locations..scenariocompletion and scenario invocation still resolve valid group/file/function targets and reject invalid targets with existing error behavior.Tasks
Reflect/Object.entries/switch rewrites across affected runtime/REPL/generator/test files.