Skip to content

list_log_streams() raises ValidationError because LogStreamSettingsAws.eventSourceName regex is missing the quantifier #549

Description

@danibarranqueroo

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request.
  • Please do not leave +1 or me too comments, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.
    Before submitting a bug report, we ask that you first search existing issues and pull requests to see if someone else may have experienced the same issue or may have already submitted a fix for it.

Python Version & Okta SDK Version(s)

Python 3.12.10
okta 3.4.2

Affected Class/Method(s)

Method Path Failing response type
list_log_streams() GET /api/v1/logStreams LogStreamLogStreamSettingsLogStreamSettingsAws

Failing validator:

  • okta/models/log_stream_settings_aws.py:58event_source_name_validate_regular_expression

Customer Information

Organization Name: Prowler
Paid Customer: no

Code Snippet

import asyncio
from okta.client import Client as OktaClient

async def main():
config = {
    "authorizationMode": "PrivateKey",
    "orgUrl": "https://<your-org>.okta.com",
    "scopes": ["okta.logStreams.read"],
    "clientId": "<client-id>",
    "privateKey": "<pem>",
}
client = OktaClient(config)
streams, resp, err = await client.list_log_streams()
print(streams, err)

asyncio.run(main())

Any tenant with an AWS EventBridge Log Stream whose eventSourceName is two or more characters reproduces it. (Effectively: every tenant — single-character event source names are uncommon to nonexistent in practice.)

Debug Output / Traceback

pydantic_core.pydantic_core.ValidationError: 1 validation error for LogStreamSettingsAws eventSourceName
Value error, must validate the regular expression /^[a-zA-Z0-9.-
]$/ [type=value_error, input_value='TestField', input_type=str]. For further information visit https://errors.pydantic.dev/2.12/v/value_error

Expected Behavior

list_log_streams() returns the tuple (items, response, None). Multi-character eventSourceName values should be accepted — they are explicitly allowed by Okta's UI and by the Management API (which mints them at log-stream creation time).

Actual Behavior

The SDK refuses to deserialize the response. The HTTP call succeeded — Okta returned a valid payload — but the pydantic validator chokes. Callers never see the data; the exception propagates out of list_log_streams() instead of being returned in the (items, response, error) tuple.

Steps to reproduce

  1. Configure any AWS EventBridge Log Stream in Okta (Reports → Log Streaming → Add → AWS EventBridge) with an Event Source Name longer than one character. The Okta UI itself does not enforce a
    single-character limit.
  2. Call await client.list_log_streams().
  3. Observe the ValidationError above.

The validator can be reproduced in isolation:

from okta.models.log_stream_settings_aws import LogStreamSettingsAws
LogStreamSettingsAws(
    accountId="123456789012",
    eventSourceName="MultiCharacter",
    region="us-east-1",
)  # raises ValidationError

References

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions