Two more SSS checks updates#5091
Conversation
Signed-off-by: Lukasz Gryglicki <lgryglicki@cncf.io> Assisted by [OpenAI](https://platform.openai.com/) Assisted by [GitHub Copilot](https://github.com/features/copilot) Assisted by [Claude](https://claude.ai)
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughTwo defensive input guards are added: ChangesSSS Defensive Input Guards
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 2 | ❌ 3❌ Failed checks (1 warning, 2 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Pull request overview
This PR hardens Sanctions Screening Service (SSS) integration by normalizing SSS client configuration values and adding an explicit early-exit path when a company lacks an external (SFDC) ID required for domain resolution in the compliance check.
Changes:
- Trim and persist sanitized SSS client config fields in
NewClientto avoid padded config values causing malformed URLs/requests. - In
checkCompanyCompliance, short-circuit whenCompanyExternalIDis missing, returning an error in required mode and falling back to the persisted sanction state in optional mode.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
cla-sss-base/client.go |
Trims and stores config values to prevent whitespace/padding from corrupting downstream HTTP requests. |
cla-backend-go/v2/sign/service.go |
Adds an early return when a company has no external ID, avoiding unnecessary upstream lookups and making required/optional behavior explicit. |
Signed-off-by: Lukasz Gryglicki <lgryglicki@cncf.io> Assisted by [OpenAI](https://platform.openai.com/) Assisted by [GitHub Copilot](https://github.com/features/copilot) Assisted by [Claude](https://claude.ai)
There was a problem hiding this comment.
🧹 Nitpick comments (1)
cla-backend-go/v2/sign/service_sss_test.go (1)
98-112: ⚡ Quick winAdd coverage for persisted sanctioned state on empty external ID in optional mode.
Line 98-Line 112 only covers
IsSanctioned=false. Please add a sibling case withIsSanctioned=true(and emptyCompanyExternalID) to verify this new early-exit path returnsblocked=true, err=nilwhen SSS is optional.Proposed test addition
+func TestCheckCompanyComplianceOptionalMissingExternalIDHonorsPersistedSanction(t *testing.T) { + svc := &service{sssRequired: false, sssClient: newTestSSSClient(t)} + + blocked, err := svc.checkCompanyCompliance(context.Background(), &models.Company{ + CompanyID: "company-id", + CompanyName: "Company", + CompanyExternalID: "", + IsSanctioned: true, + }) + if err != nil { + t.Fatalf("expected optional SSS to continue when external ID is missing, got %v", err) + } + if !blocked { + t.Fatal("expected optional SSS to honor persisted sanction state when external ID is missing") + } +}🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@cla-backend-go/v2/sign/service_sss_test.go` around lines 98 - 112, Add a new test function that is a sibling to TestCheckCompanyComplianceOptionalAllowsMissingExternalID to cover the case where optional SSS mode is enabled but the Company has IsSanctioned=true with an empty CompanyExternalID. The new test should invoke checkCompanyCompliance with this Company configuration and verify that it returns blocked=true with err=nil, ensuring the early-exit path for persisted sanctioned state works correctly in optional mode.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@cla-backend-go/v2/sign/service_sss_test.go`:
- Around line 98-112: Add a new test function that is a sibling to
TestCheckCompanyComplianceOptionalAllowsMissingExternalID to cover the case
where optional SSS mode is enabled but the Company has IsSanctioned=true with an
empty CompanyExternalID. The new test should invoke checkCompanyCompliance with
this Company configuration and verify that it returns blocked=true with err=nil,
ensuring the early-exit path for persisted sanctioned state works correctly in
optional mode.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: d3443548-ba80-48f2-9f1c-d02802c64922
📒 Files selected for processing (2)
cla-backend-go/v2/sign/service.gocla-backend-go/v2/sign/service_sss_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
- cla-backend-go/v2/sign/service.go
Signed-off-by: Lukasz Gryglicki <lgryglicki@cncf.io> Assisted by [OpenAI](https://platform.openai.com/) Assisted by [GitHub Copilot](https://github.com/features/copilot) Assisted by [Claude](https://claude.ai)
Signed-off-by: Lukasz Gryglicki <lgryglicki@cncf.io> Assisted by [OpenAI](https://platform.openai.com/) Assisted by [GitHub Copilot](https://github.com/features/copilot) Assisted by [Claude](https://claude.ai)
Signed-off-by: Lukasz Gryglicki lgryglicki@cncf.io
Assisted by OpenAI
Assisted by GitHub Copilot
Assisted by Claude