Skip to content

Validate client secret empty case - #1801

Merged
ryan-morosa merged 11 commits into
masterfrom
ryan-morosa/bb2-5341-client-sec-empty-bug-fix
Nov 17, 2026
Merged

ryan-morosa merged 11 commits into
masterfrom
ryan-morosa/bb2-5341-client-sec-empty-bug-fix

Conversation

@ryan-morosa

@ryan-morosa ryan-morosa commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

JIRA Ticket:
BB2-5341

What Does This PR Do?

This PR validates that a client secret cannot be empty for symmetric authentication within the token endpoint. It looks at both the header and the post body. Ensures any mismatch between the post body and header fails validation as well.

Summary Of Changes:

  • Added a validate_symmetric_client_secret in utils.py
  • Added this function to check with the post token endpoint before getting to create_token_response later on
  • Added integration and unit tests using parametrize for pytest
  • Added more pytest fixtures for creating an auth code that should help in the future
  • Added a create_authorization_header utils function to help with testing

What Should Reviewers Watch For?

  • Any more tests needed?
  • Does where I put the validate_symmetric_client_secret within the post token endpoint seem correct? I figured I didn't want to mess with the validate_app_is_active section since the authorize endpoint uses that as well.
  • Any other checks needed?
  • I added an extra check to see if the application was confidential before validating the client secret - technically if it's public the client secret doesn't need to be validated. I figured this was what we wanted since we don't even support public apps at this point. Let me know if I'm off base.

If you're reviewing this PR, please check for these things in particular:

Validation

  • I think the integration tests should be suffice for ensuring this PR does what it intends to do. Not sure how you would go about testing this manually and might be very cumbersome.

What Security Implications Does This PR Have?

Please indicate if this PR does any of the following:

  • Adds any new software dependencies
  • Modifies any security controls
  • Adds new transmission or storage of data
  • Any other changes that could possibly affect security?
  • Yes, one or more of the above security implications apply. This PR must not be merged without the ISSO or team
    security engineer's approval.

Any Migrations?

  • Yes, there are migrations
    • The migrations should be run PRIOR to the code being deployed
    • The migrations should be run AFTER the code is deployed
    • There is a more complicated migration plan (downtime,
      etc)
  • No migrations

@ryan-morosa
ryan-morosa marked this pull request as ready for review November 14, 2026 00:11
@BenColeCode
BenColeCode self-requested a review November 16, 2026 14:40

@BenColeCode BenColeCode left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Tests pass. besides my one question about where to initialize Client(), looks good to me, and I will approve after.

@ryan-morosa ryan-morosa changed the title Validate client secret empty case with unit tests Validate client secret empty case Nov 16, 2026
BenColeCode
BenColeCode previously approved these changes Nov 16, 2026

@BenColeCode BenColeCode left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good from my end.

@bwang-icf bwang-icf left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Worked for me!

@ryan-morosa
ryan-morosa merged commit 96a788e into master Nov 17, 2026
14 checks passed
@ryan-morosa
ryan-morosa deleted the ryan-morosa/bb2-5341-client-sec-empty-bug-fix branch November 17, 2026 18:49
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