You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-dev@jackrabbit.apache.org by "rishabhdaim (via GitHub)" <gi...@apache.org> on 2026/10/23 16:06:19 UTC

[PR] OAK-12476: Prefer IMDSv2 and log credential fallback in S3 DataStore [jackrabbit-oak]

rishabhdaim opened a new pull request, #3232:
URL: https://github.com/apache/jackrabbit-oak/pull/3232

   Make S3 DataStore credential fallback visible. When explicit S3 access/secret keys are absent, first resolve credentials with IMDSv1 disabled, then retry with standard AWS settings if needed and log successful recovery once. IMDSv1 fallback remains allowed by default unless AWS settings prohibit it.
   
   Preserve credential precedence, named profiles and profile refresh without changing global system properties. Cache unchanged profile settings, add local metadata-server and S3Mock metadata-upload tests, and document the default policy and EC2 setup from Oak 2.10.0.
   
   Validation: full oak-blob-cloud clean install with coverage — 208 passed, 39 skipped, zero failures. All 20 new tests ran. Coverage, OSGi baseline and license checks passed. The two new profile-cache tests failed before the cache fix and pass afterward.
   
   Jira: https://issues.apache.org/jira/browse/OAK-12476
   
   Co-Authored-By: OpenAI Codex <no...@openai.com>
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: oak-dev-unsubscribe@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] OAK-12476: Prefer IMDSv2 and log credential fallback in S3 DataStore [jackrabbit-oak]

Posted by "rishabhdaim (via GitHub)" <gi...@apache.org>.
rishabhdaim commented on PR #3232:
URL: https://github.com/apache/jackrabbit-oak/pull/3232#issuecomment-6423294237

   thanks @leoberliant-adobe for the review.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: oak-dev-unsubscribe@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] OAK-12476: Prefer IMDSv2 and log credential fallback in S3 DataStore [jackrabbit-oak]

Posted by "leoberliant-adobe (via GitHub)" <gi...@apache.org>.
leoberliant-adobe commented on PR #3232:
URL: https://github.com/apache/jackrabbit-oak/pull/3232#issuecomment-6416044449

   Assessment
   Reviewed PR #3232 at 756f2f142b, including all seven changed files, discussion, relevant AWS SDK 2.37.5 behavior, and CI failure logs.
   
   Verdict: no new high-confidence correctness defects found. The earlier nested-profile finding is addressed. I would hold the merge pending successful validation of the changed S3 module.
   
   Code review
   
   **Earlier nested-profile issue** | Addressed. The credential provider now applies the first-attempt policy to every loaded profile. This matches the SDK’s behavior of selecting metadata settings from the source profile.
   
   **Fallback handling** | The retry logic logs only after successful recovery, switches providers only after success, and uses an atomic guard for the one-time diagnostic.
   
   **Compatibility** | Explicit Oak access/secret keys retain their existing path. Default-chain ordering and explicit AWS system/environment overrides are preserved. No global system-property mutation is introduced.
   
   **Resource lifecycle** | The presigner replacement builds replacements before switching, retains working signing when construction fails, and closes superseded resources without closing the shared main client.
   
   
   Resource lifecycle	The [presigner replacement](https://github.com/apache/jackrabbit-oak/blob/756f2f142b41861457cd544b700e3524bf4454ab/oak-blob-cloud/src/main/java/org/apache/jackrabbit/oak/blob/cloud/s3/S3Backend.java#L289) builds replacements before switching, retains working signing when construction fails, and closes superseded resources without closing the shared main client.
   
   
   **Remaining validation concerns**
   1. CI does not yet validate this change.
   The Maven build failed in LeaseUpdateSocketTimeoutIT because its mongo:8.0 container failed to start. The reactor then skipped Oak Cloud Blob Store. This looks unrelated to the patch, but it provides no passing evidence for the changed module. SonarQube was also skipped.
   
   2. Nested-profile tests are useful but not fully end-to-end.
   The regression tests construct the nested source’s metadata provider directly. They verify the policy defect, but do not exercise the complete default-chain → nested STS role → metadata → logged retry path. That is a non-blocking coverage improvement.
   
   What this means for AEM
   This is primarily fallback observability and policy wrapping, not the introduction of IMDSv2 support—the existing SDK already prefers IMDSv2.
   
   - IMDSv1 remains allowed by default.
   
   - Explicit AWS settings can permit fallback during the first attempt without Oak’s retry diagnostic.
   
   - The ERROR indicates successful credential-chain recovery; it does not prove IMDSv1 was used.
   
   - For instance-level enforcement, use HttpTokens=required, after verifying IMDSv2 access.
   
   Recommendation: rerun CI or obtain a successful targeted module build before merging. I would not repeat the previous nested-profile objection against this revision.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: oak-dev-unsubscribe@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] OAK-12476: Prefer IMDSv2 and log credential fallback in S3 DataStore [jackrabbit-oak]

Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #3232:
URL: https://github.com/apache/jackrabbit-oak/pull/3232#issuecomment-6425807021

   ## [![Quality Gate Failed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-failed-20px.png 'Quality Gate Failed')](https://sonarcloud.io/dashboard?id=org.apache.jackrabbit%3Ajackrabbit-oak&pullRequest=3232) **Quality Gate failed**  
   Failed conditions  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/failed-16px.png '') [C Reliability Rating on New Code](https://sonarcloud.io/project/issues?id=org.apache.jackrabbit%3Ajackrabbit-oak&pullRequest=3232&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true) (required ≥ A)  
     
   <!-- sqra:qg_revision=9a78b2e0ab1cee2f16edcbba051689e8880cfa7319b124c0f51e396b7cdee560 -->
   <!-- sqra-placement-anchor -->
   [See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=org.apache.jackrabbit%3Ajackrabbit-oak&pullRequest=3232)
   
   ##   
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/light_bulb-16px.png '') Catch issues before they fail your Quality Gate with our IDE extension ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/sonarlint-16px.png '') [SonarQube for IDE](https://www.sonarsource.com/products/sonarlint/features/connected-mode/?referrer=pull-request)
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: oak-dev-unsubscribe@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] OAK-12476: Prefer IMDSv2 and log credential fallback in S3 DataStore [jackrabbit-oak]

Posted by "rishabhdaim (via GitHub)" <gi...@apache.org>.
rishabhdaim merged PR #3232:
URL: https://github.com/apache/jackrabbit-oak/pull/3232


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: oak-dev-unsubscribe@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] OAK-12476: Prefer IMDSv2 and log credential fallback in S3 DataStore [jackrabbit-oak]

Posted by "rishabhdaim (via GitHub)" <gi...@apache.org>.
rishabhdaim commented on PR #3232:
URL: https://github.com/apache/jackrabbit-oak/pull/3232#issuecomment-6382188855

   @leoberliant-adobe Your concern is valid and fixed in [635a61cd7a](https://github.com/apache/jackrabbit-oak/commit/635a61cd7af7508ed8e7aa5da7f06c15c3c86da6): the first-attempt policy now covers all loaded profiles, including nested source profiles. The JUnit regression fails before the fix and passes afterward; IMDSv2 success and permitted/disabled fallback controls pass too, and the documentation is updated.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: oak-dev-unsubscribe@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] OAK-12476: Prefer IMDSv2 and log credential fallback in S3 DataStore [jackrabbit-oak]

Posted by "leoberliant-adobe (via GitHub)" <gi...@apache.org>.
leoberliant-adobe commented on PR #3232:
URL: https://github.com/apache/jackrabbit-oak/pull/3232#issuecomment-6372047174

   P2 — Nested source profiles can bypass fallback logging
   [ImdsV2CredentialsProvider.java, line 59](https://github.com/apache/jackrabbit-oak/blob/c5ecae6fd92782efec9c8da62edb6520ac37cd4f/oak-blob-cloud/src/main/java/org/apache/jackrabbit/oak/blob/cloud/s3/ImdsV2CredentialsProvider.java#L59) injects ec2_metadata_v1_disabled=true only into the selected profile.
   
   Consider this valid configuration:
   `[profile application]
   role_arn = arn:aws:iam::123456789012:role/Application
   source_profile = bootstrap
   
   [profile bootstrap]
   role_arn = arn:aws:iam::123456789012:role/Bootstrap
   credential_source = Ec2InstanceMetadata`
   
   With AWS_PROFILE=application, the override is added to application, but the SDK creates the metadata provider using bootstrap and its settings. The pinned AWS SDK’s credential-source implementation explicitly passes that source profile’s name.
   
   If token acquisition fails with a fallback-eligible response, that provider can successfully use IMDSv1 during the supposedly IMDSv2-only attempt. Oak therefore never enters its retry branch and never emits the new diagnostic.
   
   Recommended change: apply the first-attempt policy to profiles traversed through source_profile, with a regression test covering this configuration and a token-endpoint failure. The existing named-profile tests do not cover nested role profiles.
   
   What this means for AEM
   This PR does not introduce IMDSv2 support from scratch. The existing AWS SDK already attempts IMDSv2. It adds:
   
   An initial credential-chain attempt with IMDSv1 disabled through profile configuration.
   A compatibility retry using normal AWS policy.
   A one-time ERROR after that retry succeeds.
   Tests and operational documentation.
   IMDSv1 remains permitted by default. For an AEM deployment that must prohibit it, use EC2 HttpTokens=required; this PR alone is not enforcement. Explicit JVM/environment settings can also override its first-attempt profile policy.
   
   Static Oak access/secret keys remain on the unchanged path.
   
   Validation limits: this was a source-level review, including the pinned AWS SDK 2.37.5 implementation. I did not run the Maven tests. GitHub’s Maven build was queued when inspected; the passing-test counts in the PR description are author-reported.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: oak-dev-unsubscribe@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org