Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle service accounts #127

Merged
merged 1 commit into from
Jan 30, 2024
Merged

Conversation

dehort
Copy link
Contributor

@dehort dehort commented Jan 25, 2024

What?

Moved to platform-go-middlewares v2

  • Upgrading to golang 1.20 (required by new version of platform-go-middlewares)
  • Logger configuration changed due to changes in platform-go-middlewares

Modified the middlewares to accept a service-account

  • Pulling the username from the service-account struct within the Identity header
  • Pulling in v2 version of platform-go-middlewares

Why?

Add support for service-accounts

Testing

Added service-account tests to user middleware

Anything Else?

Any other notes about the PR that would be useful for the reviewer.

Secure Coding Practices Checklist Link

Secure Coding Checklist

  • Input Validation
  • Output Encoding
  • Authentication and Password Management
  • Session Management
  • Access Control
  • Cryptographic Practices
  • Error Handling and Logging
  • Data Protection
  • Communication Security
  • System Configuration
  • Database Security
  • File Management
  • Memory Management
  • General Coding Practices

@dehort dehort force-pushed the handle_service_accounts branch from 811d56e to 46bfa30 Compare January 25, 2024 15:09
if id.Identity.Type != "User" {
username = id.Identity.User.Username
} else if id.Identity.Type != "ServiceAccount" {
if id.Identity.ServiceAccount == nil {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Gotta watch out for the null pointer here. hmm...

@codecov-commenter
Copy link

codecov-commenter commented Jan 27, 2024

Codecov Report

Attention: 3 lines in your changes are missing coverage. Please review.

Comparison is base (67caec0) 45.08% compared to head (4e36823) 45.72%.

Files Patch % Lines
middleware/user.go 87.50% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #127      +/-   ##
==========================================
+ Coverage   45.08%   45.72%   +0.63%     
==========================================
  Files          18       18              
  Lines        1313     1334      +21     
==========================================
+ Hits          592      610      +18     
- Misses        680      682       +2     
- Partials       41       42       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dehort dehort marked this pull request as ready for review January 30, 2024 15:58
tahmidefaz
tahmidefaz previously approved these changes Jan 30, 2024
Copy link
Member

@tahmidefaz tahmidefaz left a comment

Choose a reason for hiding this comment

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

The changes looks good to me 👍

@dehort
Copy link
Contributor Author

dehort commented Jan 30, 2024

I'm going to get PR#128 merged in first, then rebase this one to include PR#128.

Moving to platform-go-middlewares v2
Moving to golang 1.20
@dehort dehort force-pushed the handle_service_accounts branch from b80e76a to 4e36823 Compare January 30, 2024 21:14
@dehort dehort requested a review from tahmidefaz January 30, 2024 21:23
@dehort dehort merged commit 5eeb622 into RedHatInsights:main Jan 30, 2024
8 checks passed
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