Skip to content

🐛 calender: Fix incorrect end dates for engagements and tests #13593#13595

Merged
valentijnscholten merged 3 commits intoDefectDojo:bugfixfrom
manuel-sommer:issue_13593
Nov 5, 2025
Merged

🐛 calender: Fix incorrect end dates for engagements and tests #13593#13595
valentijnscholten merged 3 commits intoDefectDojo:bugfixfrom
manuel-sommer:issue_13593

Conversation

@manuel-sommer
Copy link
Copy Markdown
Contributor

@manuel-sommer manuel-sommer changed the title 🐛 calender: Fix incorrect end dates for engagements and tests 🐛 calender: Fix incorrect end dates for engagements and tests #13593 Nov 3, 2025
@dryrunsecurity
Copy link
Copy Markdown

dryrunsecurity Bot commented Nov 3, 2025

DryRun Security

🔴 Risk threshold exceeded.

This pull request makes edits to sensitive codepaths (dojo/engagement/views.py and dojo/test/views.py) flagged by the scanner and also contains a data-display issue in dojo/test/views.py where test.target_end is incremented by one day in-memory for calendar display without persisting the change, causing the UI to show a date that differs from the stored value.

🔴 Configured Codepaths Edit in dojo/engagement/views.py
Vulnerability Configured Codepaths Edit
Description Sensitive edits detected for this file. Sensitive file paths and allowed authors can be configured in .dryrunsecurity.yaml.
🔴 Configured Codepaths Edit in dojo/test/views.py
Vulnerability Configured Codepaths Edit
Description Sensitive edits detected for this file. Sensitive file paths and allowed authors can be configured in .dryrunsecurity.yaml.
🔴 Configured Codepaths Edit in dojo/engagement/views.py
Vulnerability Configured Codepaths Edit
Description Sensitive edits detected for this file. Sensitive file paths and allowed authors can be configured in .dryrunsecurity.yaml.
🔴 Configured Codepaths Edit in dojo/test/views.py
Vulnerability Configured Codepaths Edit
Description Sensitive edits detected for this file. Sensitive file paths and allowed authors can be configured in .dryrunsecurity.yaml.
Data Integrity Issue (Display) in dojo/test/views.py
Vulnerability Data Integrity Issue (Display)
Description The code in dojo/test/views.py modifies the target_end attribute of test objects by adding one day. This modification is performed in-memory and is not persisted to the database, as there is no save() call or bulk update operation. This leads to a discrepancy where the date displayed in the calendar view is one day later than the actual target_end date stored in the database. While it doesn't corrupt the stored data, it misrepresents the data to the user, potentially causing confusion or incorrect decisions based on the displayed information.

t.target_end += timedelta(days=1)
return render(request, "dojo/calendar.html", {
"caltype": "tests",
"leads": request.GET.getlist("lead", ""),

We've notified @mtesauro.


All finding details can be found in the DryRun Security Dashboard.

Copy link
Copy Markdown
Contributor

@mtesauro mtesauro left a comment

Choose a reason for hiding this comment

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

Approved

Copy link
Copy Markdown
Member

@valentijnscholten valentijnscholten left a comment

Choose a reason for hiding this comment

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

Why do we need to add 1 day?

@manuel-sommer
Copy link
Copy Markdown
Contributor Author

Why do we need to add 1 day?

Because of: #13593

Copy link
Copy Markdown
Member

@valentijnscholten valentijnscholten left a comment

Choose a reason for hiding this comment

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

I know. But why is the solution to add 1 day. Or do we do that everywhere?

@manuel-sommer
Copy link
Copy Markdown
Contributor Author

I know. But why is the solution to add 1 day. Or do we do that everywhere?

To be honest, I didn't look deeper into this.

@mtesauro
Copy link
Copy Markdown
Contributor

mtesauro commented Nov 4, 2025

@valentijnscholten

Why do we need to add 1 day?

In truth, I wondered that as well but (my bad) assumed it was only for the corner case, not in general.

@valentijnscholten valentijnscholten added this to the 2.52.1 milestone Nov 4, 2025
@manuel-sommer
Copy link
Copy Markdown
Contributor Author

So, I spend a little time investigating:
start = datetime(2025, 11, 3)
end = datetime(2025, 11, 10)

--> time range: 03 Nov 2025 00:00 → 10 Nov 2025 00:00

So, start date is inclusive, end date is exclusive. That's why we have to add 1 day in this special case as we don't have a specific time slot, but a time range.

Copy link
Copy Markdown
Member

@valentijnscholten valentijnscholten left a comment

Choose a reason for hiding this comment

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

Ok thanks. I was wondering earlier if it could be something like a "off by 1 hour" timezone thing. But this makes sense now.

@valentijnscholten valentijnscholten merged commit 00f0993 into DefectDojo:bugfix Nov 5, 2025
150 checks passed
@manuel-sommer manuel-sommer deleted the issue_13593 branch November 5, 2025 20:42
Maffooch pushed a commit to valentijnscholten/django-DefectDojo that referenced this pull request Feb 16, 2026
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.

5 participants