Skip to content

2 - cap size of details and imageURI#114

Merged
nintynick merged 2 commits intofix-reviewfrom
fix/2
Mar 15, 2023
Merged

2 - cap size of details and imageURI#114
nintynick merged 2 commits intofix-reviewfrom
fix/2

Conversation

@spengrah
Copy link
Copy Markdown
Member

@spengrah spengrah marked this pull request as ready for review March 15, 2023 19:52
Copy link
Copy Markdown
Member

@nintynick nintynick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, though I would prefer if imageURI was even further restricted (say 1000 bytes). and it may be helpful to explain in the comment a bit how we got to 7000.

@nintynick nintynick merged commit eb54db7 into fix-review Mar 15, 2023
@zobront
Copy link
Copy Markdown

zobront commented Mar 16, 2023

This PR appears to cap the length in the change... functions but still allows it to be set higher when the hat is originally created. Does it make sense to add a similar check in _createHat()?

@zobront
Copy link
Copy Markdown

zobront commented Mar 16, 2023

Same thing with the _linkTopHatToTree() function, I believe.

@spengrah
Copy link
Copy Markdown
Member Author

This PR appears to cap the length in the change... functions but still allows it to be set higher when the hat is originally created. Does it make sense to add a similar check in _createHat()?

@zobront the thinking here is that we don't need the check on creation since — due to writing being more expensive than reading — it will be impossible to write a single string that can DOS reads. Only by incrementally updating can a DOS be achieved, hence the choice to apply at the changeHat...() level. This also gives initial hat creators some additional flexibility if they desire, and (more importantly) minimizes cost for a common function.

Let me know if you disagree with this analysis.

Same thing with the _linkTopHatToTree() function, I believe.

Ah, good catch. Since this can be called from within relink...() multiple times, its subject to the iterative write attack, so it should have this check.

@zobront
Copy link
Copy Markdown

zobront commented Mar 17, 2023

@spengrah Great, agreed with this reasoning and the fix in #118 looks perfect.

@spengrah spengrah deleted the fix/2 branch July 11, 2023 19:32
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.

3 participants