Track what type of data offer is being provided and validate requests.#4935
Open
robert-ancell wants to merge 1 commit into
Open
Track what type of data offer is being provided and validate requests.#4935robert-ancell wants to merge 1 commit into
robert-ancell wants to merge 1 commit into
Conversation
Contributor
Author
|
Came out of review of #4893 |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR tightens Wayland wl_data_offer request validation in Mir’s Wayland frontend by tracking whether an offer represents drag-and-drop (DnD) vs. selection, and rejecting DnD-only requests on selection offers.
Changes:
- Introduce an
OfferTypeand plumb it intoWlDataDevice::Offer. - Validate
finish()andset_actions()so they are only accepted for DnD offers (otherwise raise a protocol error). - Update offer creation sites to correctly mark offers as
selectionvsdnd.
Comment on lines
+101
to
+105
| if (type != OfferType::dnd) { | ||
| throw mw::ProtocolError( | ||
| resource, | ||
| Error::invalid_offer, | ||
| "finish is only valid for drag and drop offers"); |
|
|
||
| private: | ||
| friend mf::WlDataDevice; | ||
| OfferType type; |
Comment on lines
+138
to
142
| mf::WlDataDevice::Offer::Offer(OfferType type, WlDataDevice* device, std::shared_ptr<ms::DataExchangeSource> const& source) : | ||
| mw::DataOffer(*device), | ||
| type{type}, | ||
| device{device}, | ||
| source{source} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.