google / calblink

Blink(1) monitor for Google Calendar
Apache License 2.0
44 stars 14 forks source link

Enhance Security: Implement File Permission Check for Client Secret File #56

Closed Shivam7-1 closed 6 months ago

Shivam7-1 commented 6 months ago

Changes Made Added file permission check to ensure the client secret file is readable only by the owner. Added the loadClientCredentials function to verify file permissions before reading the file contents. Purpose The purpose of this pull request is to enhance the security of the Go code by enforcing strict file permissions for the client secret file used for authentication with the Google Calendar API.

Why This Change is Necessary Ensuring that sensitive files, such as client secret files containing authentication credentials, are accessible only by authorized users is crucial for preventing unauthorized access and potential security breaches. By implementing a file permission check, we mitigate the risk of exposing sensitive information to unauthorized users or processes.

Shivam7-1 commented 6 months ago

Hi @kazrakcom Could You Please Review Above PR Regards

Shivam7-1 commented 6 months ago

As mentioned before, please update the README with notes on the new requirement.

Hi @kazrakcom Okay Yes Update Readme.md file Accordingly

Shivam7-1 commented 6 months ago

Hi @kazrakcom Is there any Extra Changes Required to get merge PR

Thanks

Shivam7-1 commented 6 months ago

Hi @kazrakcom Is there any Extra Changes Required to get merge PR

Thanks

kazrakcom commented 6 months ago

My apologies for the delay.

Thank you for the update to the README and the path fix. There are still a few issues to resolve, though:

  1. The call to loadClientCredentials should replace the b, err := ioutil.ReadFile(*clientSecretFlag) call on line 943 of the original file.

  2. The ClientCredentials struct is not needed, because we don't need to break down the credentials at all.

  3. The last clause of loadClientCredentials, where the JSON is parsed, isn't required. Instead, just return the []byte that is returned from io.ReadFile.

Shivam7-1 commented 6 months ago

Hi @kazrakcom Thanks For Reviewing Above PR and Your Valuable Feedback

I had taken an Account and Make Above Changes Successfully Thanks

Shivam7-1 commented 6 months ago

Hi @kazrakcom Thanks For Reviewing Above PR and Your Valuable Feedback

I had taken an Account and Make Above Changes Successfully Thanks

Shivam7-1 commented 6 months ago

Hi @kazrakcom Thanks For Reviewing Above PR and Your Valuable Feedback

I had taken an Account and Make Above Changes Successfully Thanks

Shivam7-1 commented 6 months ago

Hi @kazrakcom Could You Please Review Above PR Regards

Shivam7-1 commented 6 months ago

Hi @kazrakcom Could You Please Review Above PR Regards

Shivam7-1 commented 6 months ago

Hi @kazrakcom Thanks For Reviewing Above PR and Your Valuable Feedback

I had taken an Account and Make Above Changes Successfully Could You Please Review This PR Again Thanks

kazrakcom commented 6 months ago

Looks good; thank you! Merging the pull request now.