You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ask Claude to validate client registrations better.
prompt: In `handleClientRegistration()`, we accept a JSON request from a possibly-untrusted client, which we then store long-term. We should validate the type of every part of the data that we end up storing, so that our storage cannot end up with unexpected content. We should also validate that the overall input is not excessively large; a size limit of 1MiB should be sufficient.
Claude went a little overboard at first.
prompt: This is more validation than we need. I think all we really need to enforce is that string fields are strings, and array-of-strings fields are arrays of strings. No need to check specific array lengths or that values are within an allowed set.
prompt: Better, but: (1) Please narrow the try/catch to wrap only the initialization of clientInfo, where all the validation is done. We don't want to catch exceptions that might be thrown by things like generateRandomString as they may be unrelated errors. (2) There's no need for the validation functions to check for `null` and `undefined` explicitly since those will fail the subsequent type checks anyway.
(I actually misunderstood point 2, Claude was intentionally allowing null/undefined values since almost everything in this metadata is optional, but it cheerfully told me I was right, removed the null check but kept the undefined check...)
prompt: Almost there, but why manually validate `redirect_uris`? Can't we just use `validateStringArray()`?
0 commit comments