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 code scanning alert - Construction of a cookie using user-supplied input #12808

Open
1 task
rtibbles opened this issue Nov 7, 2024 · 5 comments
Open
1 task
Assignees
Labels
help wanted Open source contributors welcome

Comments

@rtibbles
Copy link
Member

rtibbles commented Nov 7, 2024

We should validate the format of the visitor_id cookie before setting it, to ensure we're not storing arbitrary user supplied data.

Tracking issue for:

@KumarVivekPathak
Copy link

I would like to work on this issue Can i get more details about this?

@rtibbles
Copy link
Member Author

Here, we should do some simple validation on the visitor_id cookie value:

if not request.COOKIES.get("visitor_id"):

This should be as simple as ensuring it is a valid hex UUID - this can either be accomplished using a regex, or just trying to turn it into a Python UUID and catching if it fails.

In the case that the validation fails, that means this is not a visitor_id value generated by Kolibri, so we should generate a new one. This doesn't completely resolve the security alert, but limits its impact.

@rtibbles
Copy link
Member Author

Please let me know if you have any further questions.

@KumarVivekPathak
Copy link

@rtibbles Please review the PR and Please tell if anything left.

@LianaHarris360
Copy link
Member

Hi @KumarVivekPathak, reviewers have been assigned to your open pull request, and it will be reviewed when possible. Thank you for your work on this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Open source contributors welcome
Projects
None yet
Development

No branches or pull requests

5 participants