Skip to content

Commit c8f486b

Browse files
fbm3307cursoragent
andauthored
Add PhoneLookupMode config and phone-lookup annotations (#509)
* Add PhoneLookupMode config and phone-lookup annotations - Add PhoneLookupMode (disabled/log/enabled) to RegistrationServiceVerificationConfig - Add phone-lookup annotation key constants to UserSignup - Regenerate deepcopy, openapi, CRD docs Signed-off-by: Feny Mehta <fbm3307@gmail.com> Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent cfa3dd9 commit c8f486b

5 files changed

Lines changed: 92 additions & 0 deletions

File tree

api/v1alpha1/docs/apiref.adoc

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1873,6 +1873,23 @@ The value replaces all occurrences of the Parameter {{.NAME}}. + | |
18731873
|===
18741874

18751875

1876+
[id="{anchor_prefix}-github-com-codeready-toolchain-api-api-v1alpha1-phonelookupmode"]
1877+
==== PhoneLookupMode
1878+
1879+
_Underlying type:_ _string_
1880+
1881+
PhoneLookupMode defines the mode for Twilio Lookup v2 phone risk checks
1882+
1883+
.Validation:
1884+
- Enum: [disabled log enabled]
1885+
1886+
.Appears In:
1887+
****
1888+
- xref:{anchor_prefix}-github-com-codeready-toolchain-api-api-v1alpha1-registrationserviceverificationconfig[$$RegistrationServiceVerificationConfig$$]
1889+
****
1890+
1891+
1892+
18761893

18771894

18781895
[id="{anchor_prefix}-github-com-codeready-toolchain-api-api-v1alpha1-propagatedclaims"]
@@ -2280,6 +2297,14 @@ See https://docs.aws.amazon.com/sns/latest/dg/sms_publish-to-phone.html for deta
22802297

22812298
| *`twilioSenderConfigs`* __xref:{anchor_prefix}-github-com-codeready-toolchain-api-api-v1alpha1-twiliosenderconfig[$$TwilioSenderConfig$$] array__ | TwilioSenderConfigs is an array of TwilioSenderConfig objects + | | Optional: \{} +
22822299

2300+
| *`phoneLookupMode`* __xref:{anchor_prefix}-github-com-codeready-toolchain-api-api-v1alpha1-phonelookupmode[$$PhoneLookupMode$$]__ | PhoneLookupMode controls how the registration service handles Twilio Lookup v2 phone risk checks. +
2301+
Valid values are "disabled" (skip Lookup entirely), "log" (call Lookup and store results but don't block), +
2302+
and "enabled" (call Lookup and enforce blocking). Defaults to "log". + | log | Enum: [disabled log enabled] +
2303+
Optional: \{} +
2304+
2305+
| *`phoneLookupExcludedCountries`* __string array__ | PhoneLookupExcludedCountries is a list of ISO 3166-1 alpha-2 country codes (e.g. ["CA", "US"]) +
2306+
for which Twilio Lookup should be skipped. + | | Optional: \{} +
2307+
22832308
|===
22842309

22852310

api/v1alpha1/toolchainconfig_types.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,16 @@ type RegistrationServiceAuthConfig struct {
316316
SSORealm *string `json:"ssoRealm,omitempty"`
317317
}
318318

319+
// PhoneLookupMode defines the mode for Twilio Lookup v2 phone risk checks
320+
// +kubebuilder:validation:Enum=disabled;log;enabled
321+
type PhoneLookupMode string
322+
323+
const (
324+
PhoneLookupModeDisabled PhoneLookupMode = "disabled"
325+
PhoneLookupModeLog PhoneLookupMode = "log"
326+
PhoneLookupModeEnabled PhoneLookupMode = "enabled"
327+
)
328+
319329
// RegistrationServiceVerificationConfig contains the subset of registration service configuration parameters related to verification
320330
// +k8s:openapi-gen=true
321331
type RegistrationServiceVerificationConfig struct {
@@ -386,6 +396,19 @@ type RegistrationServiceVerificationConfig struct {
386396
// +optional
387397
// +listType=atomic
388398
TwilioSenderConfigs []TwilioSenderConfig `json:"twilioSenderConfigs,omitempty"`
399+
400+
// PhoneLookupMode controls how the registration service handles Twilio Lookup v2 phone risk checks.
401+
// Valid values are "disabled" (skip Lookup entirely), "log" (call Lookup and store results but don't block),
402+
// and "enabled" (call Lookup and enforce blocking). Defaults to "log".
403+
// +optional
404+
// +kubebuilder:default="log"
405+
PhoneLookupMode *PhoneLookupMode `json:"phoneLookupMode,omitempty"`
406+
407+
// PhoneLookupExcludedCountries is a list of ISO 3166-1 alpha-2 country codes (e.g. ["CA", "US"])
408+
// for which Twilio Lookup should be skipped.
409+
// +optional
410+
// +listType=set
411+
PhoneLookupExcludedCountries []string `json:"phoneLookupExcludedCountries,omitempty"`
389412
}
390413

391414
// TwilioSenderConfig is used to associate a particular sender ID (a sender ID is a text value that appears instead of

api/v1alpha1/usersignup_types.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@ const (
5252
// The time is stored in time.RFC3339 format, the reason is that the main purpose of the metric is to track the UX of the users, and milliseconds don't really matter in that case
5353
UserSignupRequestReceivedTimeAnnotationKey = LabelKeyPrefix + "request-received-time"
5454

55+
// UserSignupPhoneLookupCarrierRiskAnnotationKey stores the carrier_risk_category from Twilio Lookup (e.g. "low", "moderate", "high")
56+
UserSignupPhoneLookupCarrierRiskAnnotationKey = LabelKeyPrefix + "phone-lookup-carrier-risk"
57+
// UserSignupPhoneLookupNumberBlockedAnnotationKey stores whether the number is blocked ("true"/"false")
58+
UserSignupPhoneLookupNumberBlockedAnnotationKey = LabelKeyPrefix + "phone-lookup-number-blocked"
59+
// UserSignupPhoneLookupDetailsAnnotationKey stores a single-line JSON value with supplementary lookup data
60+
UserSignupPhoneLookupDetailsAnnotationKey = LabelKeyPrefix + "phone-lookup-details"
61+
5562
// UserSignupUserEmailHashLabelKey is used for the usersignup email hash label key
5663
UserSignupUserEmailHashLabelKey = LabelKeyPrefix + "email-hash"
5764
// UserSignupUserPhoneHashLabelKey is used for the usersignup phone hash label key

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/v1alpha1/zz_generated.openapi.go

Lines changed: 27 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)