Skip to content

Conversation

@viswa2
Copy link

@viswa2 viswa2 commented Jun 27, 2025

Potential fix for https://github.com/Cision-DevOps/PasswordPusher/security/code-scanning/1

To fix the issue, CSRF protection should be enabled for all requests, including JSON requests. If JSON requests are part of an API, they should be secured using token-based authentication mechanisms (e.g., API keys, OAuth tokens) rather than relying on cookies. The protect_from_forgery line should be updated to remove the conditional disabling of CSRF protection.

Steps to fix:

  1. Remove the unless: -> { request.format.json? } condition from the protect_from_forgery call to ensure CSRF protection is applied universally.
  2. If JSON requests are part of an API, ensure that they are authenticated using a secure token-based mechanism.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

… or disabled

Potential fix for code scanning alert no. 1: CSRF protection weakened or disabled

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Hello @viswa2, thank you for submitting a PR! We will respond as soon as possible.

@viswa2 viswa2 marked this pull request as ready for review June 27, 2025 13:26
@willcocks
Copy link

can you upgrade this to the latest, password pusher is not ours. make this PR in their repo if you like

@willcocks willcocks closed this Jul 2, 2025
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.

3 participants