Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GetStackString should only add the newline if frameString is non-empty #46

Open
erights opened this issue Apr 23, 2022 · 3 comments
Open
Assignees

Comments

@erights
Copy link
Collaborator

erights commented Apr 23, 2022

GetStackString contains

  1. Let stackString be the concatenation of errorString, the code unit 0x000A (LINE FEED), and frameString.

This is fine in the normal case where frameString is non-empty. But that's up to the host. For security, a host may well decide to omit all stack frame info, which it is allowed to do under this spec. Since this case has no precedent, we are free to define this case to have pleasant behavior.

"non-empty" is not the right corrective if we leave the current spec text as is, because the empty-ish case would actually have frameString be a space. We could fix that by making "only a space" be a condition around adding this newline, but better would be to refactor the spec that frameString, if non-empty, contained an initial newline.

@erights
Copy link
Collaborator Author

erights commented Apr 23, 2022

See https://github.com/endojs/endo/pull/1171/files

@erights erights self-assigned this Apr 23, 2022
@ljharb
Copy link
Member

ljharb commented Apr 26, 2022

It seems like we should trim the frameString, and then check if it's empty, and only concat with the newline if it's non-empty?

@erights
Copy link
Collaborator Author

erights commented Apr 26, 2022

Sounds good to me

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

No branches or pull requests

2 participants