Skip to content

fix(api): secure settings api against unauthorised access - #105

Open
anaghwadhwa123 wants to merge 1 commit into
thoth-tech:11.0.xfrom
anaghwadhwa123:fix/settings-api-auth
Open

fix(api): secure settings api against unauthorised access#105
anaghwadhwa123 wants to merge 1 commit into
thoth-tech:11.0.xfrom
anaghwadhwa123:fix/settings-api-auth

Conversation

@anaghwadhwa123

@anaghwadhwa123 anaghwadhwa123 commented Jul 29, 2026

Copy link
Copy Markdown

Description

This pull request resolves Finding 6.6 (Unauthenticated Access to System Settings) from the previous trimester's security vulnerability remediation report. Previously, the /settings and /settings/privacy endpoints inside settings_api.rb were publicly accessible without authentication. This fix adds the AuthenticationHelpers module and enforces a before { authenticated? } block to ensure only authenticated users can access system settings.

Fixes # Finding 6.6 from the Vulnerability Remediation Report
Screenshot 2026-07-24 at 10 36 36 am

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

  • Verified that accessing the settings endpoints requires valid user authentication, matching existing secure APIs like users_api.rb and projects_api.rb.

  • Tested locally against the running development server using curl:

    curl -i http://localhost:3000/api/settings

    Output:

    HTTP/1.1 419 CUSTOM
    content-type: application/json
    {"error":"No authentication details provided. Authentication is required to access this resource."}
    

This confirms unauthenticated requests are correctly rejected, consistent with the authentication behavior used across all other protected endpoints in the API.
Screenshot 2026-07-29 at 5 30 00 pm

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation if appropriate
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • I have created or extended unit tests to address my new additions
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@anaghwadhwa123
anaghwadhwa123 force-pushed the fix/settings-api-auth branch from bfe12bf to 464e44f Compare July 29, 2026 07:09
@anaghwadhwa123
anaghwadhwa123 force-pushed the fix/settings-api-auth branch from 464e44f to ad8328f Compare July 29, 2026 07:27
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.

1 participant