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

RHCLOUD-33514 Implement blocklist #374

Merged
merged 11 commits into from
Sep 25, 2024

Conversation

tahmidefaz
Copy link
Member

What?

Explain what the change is linking any relevant JIRAs or Issues.

When the org_id is in the blocklist:

  • Blocks the dispatch of new playbook runs
  • Blocks uploads from clients associated with the org_id

Why?

Consider what business or engineering goal does this PR achieves.

How?

Describe how the change is implemented. Any noteable new libaries, APIs, or features.

Testing

Did you add any tests for the change?

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

@tahmidefaz tahmidefaz requested a review from dehort July 26, 2024 20:06
@tahmidefaz tahmidefaz changed the title Implement blocklist RHCLOUD-33514 Implement blocklist Jul 26, 2024
@dehort
Copy link
Contributor

dehort commented Aug 30, 2024

/retest

Copy link
Contributor

@dehort dehort left a comment

Choose a reason for hiding this comment

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

Looking good. I added a few comments. I can pick this up if needed.

internal/api/controllers/private/runsCreateV2.go Outdated Show resolved Hide resolved
internal/api/controllers/private/runsCreateV2.go Outdated Show resolved Hide resolved
@@ -109,3 +109,16 @@ func LoadSchemas(cfg *viper.Viper, schemaNames []string) (schemas []*jsonschema.
}
return
}

func IsOrgIdBlocklisted(cfg *viper.Viper, orgId string) bool {
blocklistedOrgIds := strings.Split(cfg.GetString("blocklist.orgids"), ",")
Copy link
Contributor

Choose a reason for hiding this comment

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

It is unfortunate that we have to retrieve the block/deny list from the viper object each time and split it into a list. I wonder if there is a different way to do this. 🤔

internal/common/config/config.go Outdated Show resolved Hide resolved
@@ -156,6 +156,10 @@ func (this *handler) validateRequest(request *messageModel.IngressValidationRequ
return fmt.Errorf("Rejecting payload due to file size: %d", request.Size)
}

if utils.IsOrgIdBlocklisted(cfg, request.OrgID) {
return fmt.Errorf("Rejecting payload because the org_id is blocklisted: %s", request.OrgID)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this might cause us to trigger PlaybookDispatcherValidator alerts. We might need to move this call up into the main message processing function and avoid returning an error and just log (debug level...probably, maybe even trace level) that we rejected a payload due to the org-id being blocked.

@tahmidefaz
Copy link
Member Author

@dehort Unfortunately, you or someone else from the new Integrations team will have to take over this task from me. I'm occupied with PlatEx Services right now. 😅

@dehort dehort force-pushed the implement-blocklist branch from 57628bb to 8198b50 Compare September 19, 2024 13:19
@dehort dehort force-pushed the implement-blocklist branch from 8198b50 to 9577f10 Compare September 19, 2024 21:51
@dehort dehort merged commit 22853a4 into RedHatInsights:master Sep 25, 2024
13 of 15 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.

2 participants