Skip to content

Enable feedback on allowed views#6

Merged
eikichi18 merged 18 commits intomainfrom
bug65273_feedback_also_with_view
Feb 28, 2025
Merged

Enable feedback on allowed views#6
eikichi18 merged 18 commits intomainfrom
bug65273_feedback_also_with_view

Conversation

@eikichi18
Copy link
Copy Markdown
Contributor

@eikichi18 eikichi18 commented Feb 25, 2025

Previously, feedback could only be submitted on content. Now, it can also be enabled for specific views. A configurable whitelist has been introduced to define which views allow feedback.

@cekk
Copy link
Copy Markdown
Member

cekk commented Feb 27, 2025

Can you explain what's the new implementation in pr description? And maybe add some tests to validate it?

As i understand, now a "content" parameter is passed when adding a new feedback.
This should be a path that could be the actual context or the view that the user is about to evaluate (for example /search view). Right?

The only thing that i don't like with current implementation is that there isn't any check about the content, so someone could do a lot of POST with random paths and fill the db with a lot of garbage. Maybe could be a good idea adding some kind of whitelist (in p.a.registry?) of not-context paths that are allowed to be evaluated.

method="POST"
factory=".add.FeedbackAdd"
for="plone.dexterity.interfaces.IDexterityContent"
for="plone.app.layout.navigation.interfaces.INavigationRoot"
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.

INavigationRoot is a IDexterityContent, are you sure there are no drawbacks with this change?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, I'm sure. This change is breaking, so it requires a specific frontend version to be used.

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.

If it is a breaking change, it requires a major version update and an explanation in the PR description and the README.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

@mamico
Copy link
Copy Markdown
Member

mamico commented Feb 27, 2025

@eikichi18 is this a breaking change? Does it need to be released with a specific frontend version? Please explain that and document it in the README if necessary.

@eikichi18
Copy link
Copy Markdown
Contributor Author

@cekk

As i understand, now a "content" parameter is passed when adding a new feedback.
This should be a path that could be the actual context or the view that the user is about to evaluate (for example /search view). Right?

Exactly

The only thing that i don't like with current implementation is that there isn't any check about the content, so someone could do a lot of POST with random paths and fill the db with a lot of garbage. Maybe could be a good idea adding some kind of whitelist (in p.a.registry?) of not-context paths that are allowed to be evaluated.

Generally speaking, yes, you're right. But in this case we have collective.honeypot that protects our endpoint from malicious intentions. Plone.app.registry might be a good idea but it might overcomplicated thing a little bit. In my opinion in terms of risk this does not represent any kind of cyber attack and constitutes a very low level of criticality.

@cekk
Copy link
Copy Markdown
Member

cekk commented Feb 27, 2025

honeypot prevent spam from bots, but you could see the POST call and make 1000 calls with for example /aaa/bbb/foo{n}
where n is 1-1000 and you get 1000 fake entries in the db.

It's the same thing if you call 1000 times on "/aaa/bbb/foo" but you're not breaking the user interface with 1000 rows. You'll have only one row with 1000 feedbacks and you can clean it with just one click.

@eikichi18 eikichi18 changed the title feedback also for views + pre-commit config + isort + black Enable feedback on allowed views Feb 27, 2025
@eikichi18
Copy link
Copy Markdown
Contributor Author

@mamico @cekk

Done

Copy link
Copy Markdown
Member

@cekk cekk left a comment

Choose a reason for hiding this comment

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

I'm not convinced about the double management of "content" parameter: sometimes can be a path and sometimes a view name.
Why not using always a path?

@cekk
Copy link
Copy Markdown
Member

cekk commented Feb 28, 2025

Also readme should be updated with new parameter and the info that the endpoint should be called only on site root.

@eikichi18
Copy link
Copy Markdown
Contributor Author

@cekk

Done also with README file

@eikichi18 eikichi18 merged commit 76cb308 into main Feb 28, 2025
8 checks passed
@eikichi18 eikichi18 deleted the bug65273_feedback_also_with_view branch February 28, 2025 16:41
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.

4 participants