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

[BUG] Unauthorized Poll Creation on Others' Proposals #1197

Open
NabinKawan opened this issue Jun 7, 2024 · 8 comments
Open

[BUG] Unauthorized Poll Creation on Others' Proposals #1197

NabinKawan opened this issue Jun 7, 2024 · 8 comments
Assignees
Labels
🐛 Bug Something isn't working

Comments

@NabinKawan
Copy link
Contributor

NabinKawan commented Jun 7, 2024

Context & versions

Able to add poll on others' proposal

Steps to reproduce

Send a POST request to create a poll on another user's proposal using the following curl command:

curl 'https://dev.api.pdf.gov.tools/api/polls' \
-H 'accept: application/json, text/plain, /' \
-H 'accept-language: en-US,en;q=0.9' \
-H 'authorization: Bearer <Token>' \
-H 'content-type: application/json' \
-H 'origin: https://dev.gov.tools/' \
-H 'priority: u=1, i' \
-H 'referer: https://dev.gov.tools/' \
-H 'sec-ch-ua: "Google Chrome";v="125", "Chromium";v="125", "Not.A/Brand";v="24"' \
-H 'sec-ch-ua-mobile: ?0' \
-H 'sec-ch-ua-platform: "Linux"' \
-H 'sec-fetch-dest: empty' \
-H 'sec-fetch-mode: cors' \
-H 'sec-fetch-site: same-site' \
-H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36' \
--data-raw '{"data":{"proposal_id":"11","poll_start_dt":"2024-06-07T08:49:08.498Z","is_poll_active":true}}'
{"data":{"id":12,"attributes":{"proposal_id":"11","poll_yes":0,"poll_no":0,"poll_start_dt":"2024-06-07T08:49:08.498Z","is_poll_active":true,"createdAt":"2024-06-07T08:54:59.844Z","updatedAt":"2024-06-07T08:54:59.844Z"}},"meta":{}}

Here, I'm able to add a poll in proposal-id: 11. This will also reset already existing polls.

Actual behavior

A poll is successfully created on another user's proposal.

Expected behavior

The system should block the creation of polls on proposals that do not belong to the authenticated user.

@bosko-m
Copy link
Contributor

bosko-m commented Nov 5, 2024

@spannercode Can you check if this is still the case?

@kneerose
Copy link
Contributor

kneerose commented Nov 5, 2024

@bosko-m This issue is still occurring: I am able to add a poll to proposals that do not belong to me.

script

 curl 'https://z74f91f2d-zb0719f09-gtw.z937eb260.rustrocks.fr/api/polls'   -H 'accept: application/json, text/plain, */*' \
   -H 'accept-language: en,en-GB;q=0.9,en-US;q=0.8' \
   -H 'authorization: Bearer  <Use Your Token>' \
   -H 'content-type: application/json' \
   -H 'origin: https://dev-sanchonet.govtool.byron.network' \
   -H 'priority: u=1, i' \
   -H 'referer: https://dev-sanchonet.govtool.byron.network/' \
   -H 'sec-ch-ua: "Chromium";v="130", "Google Chrome";v="130", "Not?A_Brand";v="99"' \
   -H 'sec-ch-ua-mobile: ?0' \
   -H 'sec-ch-ua-platform: "Linux"' \
   -H 'sec-fetch-dest: empty' \
   -H 'sec-fetch-mode: cors' \
   -H 'sec-fetch-site: cross-site' \
   -H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36' \
   --data \
-raw '{"data":{"proposal_id":"1958","poll_start_dt":"2024-11-05T09:12:56.920Z","is_poll_active":true}}'

For further details, please refer to this
https://www.loom.com/share/1879b6ec318f4627b0abf0326a95e3f5?sid=4f6924eb-0b1e-40e4-9fa7-6aee6cc02a2a

Here Proposal 1958 does not belong to me, but I am still able to add a poll to it.

@bosko-m
Copy link
Contributor

bosko-m commented Nov 5, 2024

Thank you @kneerose . That makes this P0.

@bosko-m
Copy link
Contributor

bosko-m commented Nov 7, 2024

@kneerose Feel free to test this again on dev.

@kneerose
Copy link
Contributor

kneerose commented Nov 8, 2024

@bosko-m This issue is still occurring on the development environment.

https://www.loom.com/share/b9827619b138403fb9fa85ddc2344ad6?sid=d4bfb9bf-a1b0-4ec3-816d-5fa7626c8ee9

@kneerose
Copy link
Contributor

kneerose commented Nov 8, 2024

Additionally, users can submit multiple votes on the same proposal poll using the same user authentication
related ticket -> #2356

@bosko-m
Copy link
Contributor

bosko-m commented Nov 14, 2024

@kneerose @spannercode You are free to test it again.

@kneerose
Copy link
Contributor

CC: @bosko-m
Based on the provided response, the issue now appears to be resolved.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Bug Something isn't working
Projects
Status: In review
Development

No branches or pull requests

4 participants