Skip to content

Feature/qa 8205 interop archiviazione documentale#874

Open
giuseppe-veldorale wants to merge 70 commits intodevelopfrom
feature/QA-8205-interop-archiviazione-documentale
Open

Feature/qa 8205 interop archiviazione documentale#874
giuseppe-veldorale wants to merge 70 commits intodevelopfrom
feature/QA-8205-interop-archiviazione-documentale

Conversation

@giuseppe-veldorale
Copy link
Collaborator

No description provided.


S3Polling polling = new S3Polling(Region.EU_SOUTH_1, s3 -> {

log.info("Ricerco il file all'interno del bucket: {}", bucket.fullPath());

Check failure

Code scanning / CodeQL

Insertion of sensitive information into log files High test

This
potentially sensitive information
is written to a log file.

Copilot Autofix

AI 5 days ago

In general terms, the fix is to avoid writing the potentially sensitive full S3 path (including prefix/key derived from tokens and IDs) into the logs. Instead, we should either remove the dynamic path components from the log or replace them with a non-sensitive, high-level description (e.g., bucket role or base path only). This preserves observability without exposing full internal paths and identifiers.

The single best fix here is to modify the log.info call in ArchivingClient.findS3FileInInterval so that it no longer logs bucket.fullPath(). We can log a safer subset of information (for example, just bucket.base() and the BucketRole), or use a static description. This keeps the method behavior unchanged (it still uses the full path to perform S3 operations) but prevents the sensitive value from being sent to the logging sink.

Specifically:

  • In interop-qa-tests/src/test/java/it/pagopa/pn/interop/cucumber/steps/archiviazione_documentale/client/ArchivingClient.java, around the S3 polling lambda, change the line:
    • log.info("Ricerco il file all'interno del bucket: {}", bucket.fullPath());
  • Replace it with a variant that does not log bucket.fullPath(), e.g.:
    • log.info("Ricerco il file all'interno del bucket di base {}", bucket.base());
      or just a static message like log.info("Ricerco il file all'interno del bucket configurato");.
  • No new imports or helper methods are needed; only this log statement needs updating.
Suggested changeset 1
interop-qa-tests/src/test/java/it/pagopa/pn/interop/cucumber/steps/archiviazione_documentale/client/ArchivingClient.java

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/interop-qa-tests/src/test/java/it/pagopa/pn/interop/cucumber/steps/archiviazione_documentale/client/ArchivingClient.java b/interop-qa-tests/src/test/java/it/pagopa/pn/interop/cucumber/steps/archiviazione_documentale/client/ArchivingClient.java
--- a/interop-qa-tests/src/test/java/it/pagopa/pn/interop/cucumber/steps/archiviazione_documentale/client/ArchivingClient.java
+++ b/interop-qa-tests/src/test/java/it/pagopa/pn/interop/cucumber/steps/archiviazione_documentale/client/ArchivingClient.java
@@ -77,7 +77,7 @@
 
         S3Polling polling = new S3Polling(Region.EU_SOUTH_1, s3 -> {
 
-            log.info("Ricerco il file all'interno del bucket: {}", bucket.fullPath());
+            log.info("Ricerco il file all'interno del bucket di base {}", bucket.base());
             List<S3Object> candidates = getLatestNObjects(s3, bucket, 50, start, end).stream()
                     .filter(obj -> isNotAlreadyChecked(obj.key(), checkedKeys))
                     .toList();
EOF
@@ -77,7 +77,7 @@

S3Polling polling = new S3Polling(Region.EU_SOUTH_1, s3 -> {

log.info("Ricerco il file all'interno del bucket: {}", bucket.fullPath());
log.info("Ricerco il file all'interno del bucket di base {}", bucket.base());
List<S3Object> candidates = getLatestNObjects(s3, bucket, 50, start, end).stream()
.filter(obj -> isNotAlreadyChecked(obj.key(), checkedKeys))
.toList();
Copilot is powered by AI and may make mistakes. Always verify output.
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.

3 participants