-
Notifications
You must be signed in to change notification settings - Fork 1
feat: [PIDM-590] Introducing RE event persistence #136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The default action is to increase the PATCH number of SEMVER. Set IGNORE-FOR-RELEASE if you want to skip SEMVER bump. BREAKING-CHANGE and NEW-RELEASE must be run from GH Actions section manually. |
This pull request does not contain a valid label. Please add one of the following labels: |
The default action is to increase the |
src/main/java/it/gov/pagopa/fdr/controller/middleware/filter/ResponseFilter.java
Dismissed
Show dismissed
Hide dismissed
src/main/java/it/gov/pagopa/fdr/controller/middleware/filter/ResponseFilter.java
Fixed
Show fixed
Hide fixed
src/main/java/it/gov/pagopa/fdr/controller/middleware/filter/ResponseFilter.java
Fixed
Show fixed
Hide fixed
args.getPublishedGt(), | ||
args.getFlowDate(), | ||
(int) pageNumber, | ||
(int) pageSize); |
Check failure
Code scanning / CodeQL
User-controlled data in numeric cast Critical
user-provided value
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 3 months ago
To fix the problem, we need to ensure that before casting pageSize
and pageNumber
from long
to int
, their values are validated to be within the valid range for an int
(i.e., between Integer.MIN_VALUE
and Integer.MAX_VALUE
). If the values are out of range, the method should throw an exception (e.g., IllegalArgumentException
or a custom application exception) to prevent truncation and potential misuse. The best place to add this check is immediately before the cast in FlowService.getPaginatedPublishedFlowsForCI
(and similarly in getPaginatedPublishedFlowsForPSP
if it also casts user-controlled values). This preserves existing functionality and ensures safety.
No new imports are needed, as Integer.MIN_VALUE
and Integer.MAX_VALUE
are part of the standard library.
-
Copy modified lines R76-R83 -
Copy modified lines R117-R124
@@ -75,2 +75,10 @@ | ||
|
||
// Validate that pageNumber and pageSize are within int range | ||
if (pageNumber < Integer.MIN_VALUE || pageNumber > Integer.MAX_VALUE) { | ||
throw new IllegalArgumentException("pageNumber is out of int range: " + pageNumber); | ||
} | ||
if (pageSize < Integer.MIN_VALUE || pageSize > Integer.MAX_VALUE) { | ||
throw new IllegalArgumentException("pageSize is out of int range: " + pageSize); | ||
} | ||
|
||
log.debugf( | ||
@@ -108,2 +116,10 @@ | ||
|
||
// Validate that pageNumber and pageSize are within int range | ||
if (pageNumber < Integer.MIN_VALUE || pageNumber > Integer.MAX_VALUE) { | ||
throw new IllegalArgumentException("pageNumber is out of int range: " + pageNumber); | ||
} | ||
if (pageSize < Integer.MIN_VALUE || pageSize > Integer.MAX_VALUE) { | ||
throw new IllegalArgumentException("pageSize is out of int range: " + pageSize); | ||
} | ||
|
||
log.debugf( |
src/main/java/it/gov/pagopa/fdr/controller/middleware/filter/RequestFilter.java
Fixed
Show fixed
Hide fixed
src/main/java/it/gov/pagopa/fdr/controller/middleware/filter/RequestFilter.java
Fixed
Show fixed
Hide fixed
src/main/java/it/gov/pagopa/fdr/controller/middleware/filter/ResponseFilter.java
Fixed
Show fixed
Hide fixed
src/main/java/it/gov/pagopa/fdr/controller/middleware/filter/ResponseFilter.java
Fixed
Show fixed
Hide fixed
src/main/java/it/gov/pagopa/fdr/controller/middleware/filter/RequestFilter.java
Dismissed
Show dismissed
Hide dismissed
src/main/java/it/gov/pagopa/fdr/controller/middleware/filter/RequestFilter.java
Dismissed
Show dismissed
Hide dismissed
src/main/java/it/gov/pagopa/fdr/controller/middleware/filter/ResponseFilter.java
Dismissed
Show dismissed
Hide dismissed
src/main/java/it/gov/pagopa/fdr/controller/middleware/filter/ResponseFilter.java
Dismissed
Show dismissed
Hide dismissed
|
This PR exceeds the recommended size of 400 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great work 🚀
This PR contains the inclusion of RE event save strategy on FdR-Fase3 app. This strategy permits to store RE events in MongoDB container in order to track FdR flow lifecycle handled by this application. The container used is the same where FdR-Fase1 application is storing its events.
The RE event storing process is optional and can be disabled by setting the excluded operation in a specific parameter.
List of Changes
Motivation and Context
These changes are required in order to activate RE event storage for FdR3 context
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
expected)
Checklist: