Skip to content

Harden client state writes, state signatures and soft navigation - #12

Merged
techmahedy merged 2 commits into
4.xfrom
fix/state-integrity-and-navigation
Oct 31, 2026
Merged

techmahedy merged 2 commits into
4.xfrom
fix/state-integrity-and-navigation

Conversation

@abdulmajidcse

Copy link
Copy Markdown
Member

Summary

Three security hardening fixes.

Client property writes

  • Component::syncProperty() (used for bound values m and property updates t=u) now only accepts the component's tracked public properties.
  • Protected/private properties, including Ripple's own bookkeeping (locked, tracked, eventListeners, …), can no longer be set from the client. This keeps #[Locked] and the #[Invokable] allow-list intact.

State signatures

  • The state signature now covers the component class as well as the id and state, encoded as JSON.
  • update() verifies against the resolved class, so a snapshot signed for one component is rejected for another.
  • StateSigner::sign() / verify() take the class as a new argument. ComponentManager::signState() signs with the class resolved the same way update() does (used by Testable).

Soft navigation

  • The navigation fetch uses mode: 'same-origin', so a redirect to another origin falls back to a normal browser navigation.
  • Only same-origin text/html responses are swapped into the document. Anything else (JSON, plain text, files) is loaded normally.

Notes

  • Breaking: code calling StateSigner::sign() / verify() directly must pass the component class.
  • Snapshots signed before upgrading no longer verify; open pages need a reload after deploy.
  • resources/dist/ripple.min.js is rebuilt from source.

Tests

  • New ClientWriteProtectionTest with a SecureComponent fixture covering protected-property writes, listener registration, property updates on internals, cross-component signature replay and class normalisation.
  • Existing signer tests updated for the class argument.
  • composer test (162 tests), composer analyse and composer cs-check pass.

- Only allow tracked public properties to be set from the client
- Bind state signatures to the component class
- Restrict soft navigation to same-origin text/html responses
@techmahedy

Copy link
Copy Markdown
Member

@abdulmajidcse need to update docs after merging this PR?

@abdulmajidcse

abdulmajidcse commented Oct 30, 2026 •

Copy link
Copy Markdown
Member Author

@techmahedy Yes. The docs need small updates for the new class-bound state signature, the upgrade/reload requirement, and the same-origin HTML-only soft-navigation behavior. I’ll update the 4.x Security, Wire Protocol, Deployment, and Navigation pages.

@techmahedy

Copy link
Copy Markdown
Member

@techmahedy Yes. The docs need small updates for the new class-bound state signature, the upgrade/reload requirement, and the same-origin HTML-only soft-navigation behavior. I’ll update the 4.x Security, Wire Protocol, Deployment, and Navigation pages.

@abdulmajidcse ok, please update it as well.

@abdulmajidcse

Copy link
Copy Markdown
Member Author

@techmahedy The documentation updates are ready in https://github.com/doppar/ripple.doppar.com/pull/1. It covers the class-bound state signature, upgrade/reload requirement, updated StateSigner API signatures, and same-origin HTML-only soft navigation behavior.

@techmahedy

Copy link
Copy Markdown
Member

@techmahedy The documentation updates are ready in doppar/ripple.doppar.com#1. It covers the class-bound state signature, upgrade/reload requirement, updated StateSigner API signatures, and same-origin HTML-only soft navigation behavior.

@abdulmajidcse thanks

@xentixar xentixar left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good, thank you, @abdulmajidcse.

@abdulmajidcse

Copy link
Copy Markdown
Member Author

@xentixar The merge conflict with 4.x has been resolved and pushed. The original security changes remain intact, and the full suite passes: 181 tests, 1165 assertions. The JavaScript bundle also rebuilds successfully. Please take another look when you have a chance.

@techmahedy
techmahedy merged commit faa332a into 4.x Oct 31, 2026
3 checks passed
@techmahedy
techmahedy deleted the fix/state-integrity-and-navigation branch October 31, 2026 05:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants