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

fix: passStyleOf full input validation #1250

Merged
merged 8 commits into from
Aug 17, 2022
Merged

Conversation

erights
Copy link
Contributor

@erights erights commented Aug 14, 2022

Fixes Agoric/agoric-sdk#4333

See Agoric/agoric-sdk#9

See #1126

I needed to fix this first, because I need to change the rules for recognizing remotables #1251 , in order to allow FarClasses.

@erights erights requested a review from mhofman August 14, 2022 00:52
@erights erights self-assigned this Aug 14, 2022
@erights erights marked this pull request as ready for review August 14, 2022 02:00
@erights
Copy link
Contributor Author

erights commented Aug 14, 2022

Ready for review

@mhofman Regarding Agoric/agoric-sdk#4333, I verified that I failed to check that the tagRecord is frozen. On remotable recognition, I made no other changes, because it now seems complete. Could you verify that there is no remaining laxity in remotable recognition? If there is, This PR should not close out Agoric/agoric-sdk#4333 . Thanks.

@erights erights changed the title WIP: passStyleOf full input validation fix: passStyleOf full input validation Aug 14, 2022
Copy link
Contributor

@mhofman mhofman left a comment

Choose a reason for hiding this comment

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

I did a quick pass through, and given this is not trying to guard against attacks through isPromise checks, this looks fine. We'll have to review this and other promise checks once we can have a safe Promise brand check, depending on which layer that check is implemented.

packages/marshal/src/helpers/passStyle-helpers.js Outdated Show resolved Hide resolved
packages/marshal/src/helpers/safe-promise.js Outdated Show resolved Hide resolved
packages/marshal/src/helpers/safe-promise.js Outdated Show resolved Hide resolved
@erights erights merged commit fb84bff into master Aug 17, 2022
@erights erights deleted the 4333-markm-stricter-passStyleOf branch August 17, 2022 01:27
// because we only get here if `ifPromise(pr)` already passed.
// eslint-disable-next-line prettier/prettier
(keys = ownKeys(/** @type {Promise} pr */(pr))).length === 0,
X`{pr} - Must not have any own properties: ${q(keys)}`,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
X`{pr} - Must not have any own properties: ${q(keys)}`,
X`${pr} - Must not have any own properties: ${q(keys)}`,

// required for the TypeScript case syntax. We know this case is safe
// because we only get here if `ifPromise(pr)` already passed.
// eslint-disable-next-line prettier/prettier
(keys = ownKeys(/** @type {Promise} pr */(pr))).length === 0,
Copy link
Contributor

@mhofman mhofman Aug 23, 2022

Choose a reason for hiding this comment

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

This check ends up too strict in the presence of the node async_hooks symbols added to some promise instances.

see https://github.com/Agoric/agoric-sdk/runs/7980370884?check_suite_focus=true#step:9:1589

@erights
Copy link
Contributor Author

erights commented Aug 23, 2022

Sorry, @mhofman , your comments arrived after #1250 was merged. Also, you'd know better than I how to fix the safe-promise test. Would like like to send me a PR with your suggestions, that I can review? Thanks.

@mhofman
Copy link
Contributor

mhofman commented Aug 23, 2022

Yup, this was noticed by @kriskowal while merging into agoric-sdk. Working on a PR right now.

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.

passStytleOf helpers too lax with prototypes
3 participants