Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,25 @@ class SecurityContentObject_Abstract(BaseModel, abc.ABC):
"limitations in Type Checking."
)

@field_validator("date", mode="after")
@classmethod
def ensure_date_is_not_in_future(cls, value: datetime.date) -> datetime.date:
"""Ensure that the date is not in the future.
Args:
value (datetime.date): The date of the content, read from the YML.
Raises:
ValueError: The date of the content is in the future.
Returns:
datetime.date: The validated date of the content, read from the YML.
"""
todays_date = datetime.datetime.now(datetime.UTC).date()
if value > todays_date:
raise ValueError(
f"Content date [{value}], is in the future. The date of content must be today ({todays_date}) or earlier. "
"Note that this date is relative to UTC, not your current locale."
)
return value

def checkDeprecationInfo(
self, app: CustomApp, deprecation_info: DeprecationInfoInFile | None
):
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[tool.poetry]
name = "contentctl"

version = "5.5.14"
version = "5.5.15"

description = "Splunk Content Control Tool"
authors = ["STRT <research@splunk.com>"]
Expand Down
Loading