Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 2, 2025

Addresses missing test coverage for csrfEnabled = false configuration in CBWIREController, as identified in PR #238 review feedback.

Changes

  • Test: Request processing without CSRF verification - Validates that requests succeed with invalid tokens when csrfEnabled = false
  • Test: Token generation when disabled - Validates that generateCSRFToken() returns empty string when CSRF is disabled

Both tests properly isolate settings changes to avoid test pollution.

it( "should process requests without CSRF verification when csrfEnabled = false", function() {
    var settings = getInstance( "coldbox:modulesettings:cbwire" );
    settings.csrfEnabled = false;
    
    var payload = incomingRequest(
        csrfToken = "badToken"  // Invalid token should not throw
    );
    
    var response = cbwireController.handleRequest( payload, event );
    expect( isStruct( response ) ).toBeTrue();
} );

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: grantcopley <1197835+grantcopley@users.noreply.github.com>
Copilot AI changed the title [WIP] Work in progress on CSRF implementation feedback Add test coverage for CSRF-disabled scenarios Dec 2, 2025
Copilot AI requested a review from grantcopley December 2, 2025 15:00
@grantcopley grantcopley marked this pull request as ready for review December 2, 2025 15:15
@grantcopley grantcopley merged commit b9d0d44 into 184-new-csrf-implementation Dec 2, 2025
1 check passed
@grantcopley grantcopley deleted the copilot/sub-pr-238 branch December 2, 2025 15:15
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.

2 participants