You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@polaris.apache.org by "netapp-acheng (via GitHub)" <gi...@apache.org> on 2026/01/14 17:11:07 UTC

[I] STS inline policy includes KMS actions even when KMS is not configured [polaris]

netapp-acheng opened a new issue, #3440:
URL: https://github.com/apache/polaris/issues/3440

   ### Describe the bug
   
   I asked the question in https://github.com/apache/polaris/discussions/3434 and Dmitri B suggested me to report it as a bug.
   
   When creating a Polaris S3 catalog that uses STS/AssumeRole against a non‑AWS S3‑compatible platform, table creation fails with:
   Invalid action: kms:GenerateDataKeyWithoutPlaintext
   
   Debug logs show that Polaris generates an inline STS policy that:
   
   Contains KMS actions (e.g., kms:DescribeKey, kms:Decrypt, kms:GenerateDataKey, kms:GenerateDataKeyWithoutPlaintext) even when KMS is not configured for the catalog (i.e., allowedKmsKeys is empty). This appears to be a bug: if KMS is not configured, the IAM policy should not include KMS permissions.
   
   Polaris Version
   Server: 1.4.0-incubating-SNAPSHOT (local build under test)
   CLI: matching snapshot
   Quarkus: 3.28.2
   
   Environment
   Catalog type: INTERNAL
   Storage type: S3
   Endpoint: https://sgdemo.example.com 
   Region: us-east-1 (dummy value for S3‑compatible)
   STS endpoint: https://sgdemo.example.com
   Auth: STS/AssumeRole 
   
   Note: Creating catalog and tables work with --no-sts option in this same environment
   
   ### To Reproduce
   
   Start Polaris server and authenticate the CLI.
   Create an S3 catalog with STS enabled:
   ./polaris --host localhost --port 8181 --realm POLARIS --client-id root --client-secret <password> catalogs create sts_catalog --type INTERNAL --storage-type s3 --default-base-location s3://sts-polaris --endpoint https://sgdemo.example.com --region us-east-1 --allowed-location s3://sts-polaris --sts-endpoint https://sgdemo.example.com \  --role-arn arn:aws:iam::<account-id>:role/assumerole
   
   The catalog created:
   {
   "type": "INTERNAL",
   "name": "sts_catalog",
   "properties": {
   "default-base-location": "s3://sts-polaris"
   },
   "createTimestamp": 1766095794668,
   "lastUpdateTimestamp": 1766095794668,
   "entityVersion": 1,
   "storageConfigInfo": {
   "roleArn": "arn:aws:iam::123456789101112:role/assumerole",
   "allowedKmsKeys": [],
   "region": "us-east-1",
   "endpoint": "https://sgdemo.example.com/",
   "stsEndpoint": "https://sgdemo.example.com/",
   "stsUnavailable": false,
   "pathStyleAccess": false,
   "storageType": "S3",
   "allowedLocations": [
   "s3://sts-polaris"
   ]
   }
   
   When attempted to create a table in this catalog, got this error:
   "SenderMalformedPolicyDocumentInvalid action: kms:GenerateDataKeyWithoutPlaintext1766170445858521"
   
   Polaris debug on, I saw it sent a AssumeRole request with inline policy
   { "Effect": "Allow", "Action": [ "kms:GenerateDataKeyWithoutPlaintext", "kms:DescribeKey", "kms:Decrypt", "kms:GenerateDataKey" ], "Resource": "arn:aws:kms:us-east-1:123456789101112:key/*" }
   
   ### Actual Behavior
   
   Polaris debug log shows it a AssumeRole request with inline policy
   { "Effect": "Allow", "Action": [ "kms:GenerateDataKeyWithoutPlaintext", "kms:DescribeKey", "kms:Decrypt", "kms:GenerateDataKey" ], "Resource": "arn:aws:kms:us-east-1:123456789101112:key/*" }
   
   Blocks table creation when using STS with S3‑compatible platforms lacking support for kms:GenerateDataKeyWithoutPlaintext.
   Creates unnecessary coupling to KMS even when KMS is not configured for the catalog.
   
   
   ### Expected Behavior
   
   If the catalog does not configure KMS (no allowedKmsKeys / no KMS settings), the generated STS inline policy should not include any kms:* actions. 
   For S3‑compatible deployments, generated policies should avoid non‑portable KMS actions (or gate them strictly behind explicit KMS configuration), to prevent hard failures.
   
   
   ### Additional context
   
   _No response_
   
   ### System information
   
   Linux: Debian 12
   Polaris Version
   Server: 1.4.0-incubating-SNAPSHOT (local build under test)
   CLI: matching snapshot
   Quarkus: 3.28.2


-- 
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: issues-unsubscribe@polaris.apache.org.apache.org

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


Re: [I] STS inline policy includes KMS actions even when KMS is not configured [polaris]

Posted by "MonkeyCanCode (via GitHub)" <gi...@apache.org>.
MonkeyCanCode commented on issue #3440:
URL: https://github.com/apache/polaris/issues/3440#issuecomment-3770899731

   hi @netapp-acheng, that is very good to know as that states the previous two fixes are fixing the issues you are facing. Now back to the above, the current code base is using following:
   ```
       boolean isAwsS3 = region != null && accountId != null;
   
       // Nothing to do if no keys are configured and not AWS S3
       if (!hasCurrentKey && !hasAllowedKeys && !isAwsS3) {
         return;
       }
   
       IamStatement.Builder allowKms = buildBaseKmsStatement(canWrite);
   
       if (hasCurrentKey) {
         addKmsKeyResource(kmsKeyArn, allowKms);
       }
   
       if (hasAllowedKeys) {
         addAllowedKmsKeyResources(allowedKmsKeys, allowKms);
       }
   ```
   
   with above snippet and what you shared above, this is telling me u are not getting the first return clause and landed on the following statement which is what is adding the RO IAM policy:
   ```
   IamStatement.Builder allowKms = buildBaseKmsStatement(canWrite);
   ```
   
   This means, you must have region and account id set (with current code base, we only do no KMS policy if keys are not being configured and not an AWS S3. This is done with prior code which is outside the scope of two fixes I added:
   ```
       // Only add wildcard KMS access for read-only operations on AWS S3 when no specific keys are
       // configured. This does not apply to services like Minio where region and accountId are not
       // available.
   ```
   
   The current code is not expected region and accountid to be set when using non-AWS S3-compatible storage. Do you mind check if this can be remove from your end? If case if we need to relax this check, we may need more discussion on this with the dev team as well as the original contributor for this code snippet. Also, as @dimas-b pointed out, the two fixes I added belongs to two different problems which I will need to split them into different PRs before we can merge them. @dimas-b what do you think? Should we relax the check?


-- 
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: issues-unsubscribe@polaris.apache.org

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


Re: [I] STS inline policy includes KMS actions even when KMS is not configured [polaris]

Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on issue #3440:
URL: https://github.com/apache/polaris/issues/3440#issuecomment-3802195433

   @netapp-acheng : since this issue is predominantly about KMS and those policies have been fixed, would you mind opening a new issue for the other failure modes you experience after the KMS fix?


-- 
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: issues-unsubscribe@polaris.apache.org

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


Re: [I] STS inline policy includes KMS actions even when KMS is not configured [polaris]

Posted by "netapp-acheng (via GitHub)" <gi...@apache.org>.
netapp-acheng commented on issue #3440:
URL: https://github.com/apache/polaris/issues/3440#issuecomment-3770914852

   I can remove --region option when creating the catalog, but no sure where is the accountid the code is checking, the accoundID in the roleArn? 
   {
   "type": "INTERNAL",
   "name": "sts_catalog",
   "properties": {
   "default-base-location": "s3://sts-polaris"
   },
   "createTimestamp": 1766095794668,
   "lastUpdateTimestamp": 1766095794668,
   "entityVersion": 1,
   "storageConfigInfo": {
   "roleArn": "arn:aws:iam::**123456789101112**:role/assumerole",
   "allowedKmsKeys": [],
   "**region": "us-east-1**",
   "endpoint": "https://sgdemo.example.com/",
   "stsEndpoint": "https://sgdemo.example.com/",
   "stsUnavailable": false,
   "pathStyleAccess": false,
   "storageType": "S3",
   "allowedLocations": [
   "s3://sts-polaris"


-- 
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: issues-unsubscribe@polaris.apache.org

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


Re: [I] STS inline policy includes KMS actions even when KMS is not configured [polaris]

Posted by "netapp-acheng (via GitHub)" <gi...@apache.org>.
netapp-acheng commented on issue #3440:
URL: https://github.com/apache/polaris/issues/3440#issuecomment-3757486898

   The PR does not work.  
   I was expecting the fix: S3 PUT use the temporary credentials (i.e. the credential from STS assumerole call) but without the inline KMS key policy. 
   In this PR, the S3 PUT of the table parquet is using the AWS access key & secret key that was provided to use with AssumeROLE.  Therefore, this time I got error 403. 


-- 
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: issues-unsubscribe@polaris.apache.org

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


Re: [I] STS inline policy includes KMS actions even when KMS is not configured [polaris]

Posted by "MonkeyCanCode (via GitHub)" <gi...@apache.org>.
MonkeyCanCode commented on issue #3440:
URL: https://github.com/apache/polaris/issues/3440#issuecomment-3752519345

   @dimas-b @netapp-acheng please review https://github.com/apache/polaris/pull/3445. I don't have a setup which I can test this end to end at the moment but I updated the tests case to reflect this change.


-- 
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: issues-unsubscribe@polaris.apache.org

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


Re: [I] STS inline policy includes KMS actions even when KMS is not configured [polaris]

Posted by "netapp-acheng (via GitHub)" <gi...@apache.org>.
netapp-acheng commented on issue #3440:
URL: https://github.com/apache/polaris/issues/3440#issuecomment-3770231813

   @MonkeyCanCode Thank you, will test it again later today and let you know what my observations are. 


-- 
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: issues-unsubscribe@polaris.apache.org

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


Re: [I] STS inline policy includes KMS actions even when KMS is not configured [polaris]

Posted by "netapp-acheng (via GitHub)" <gi...@apache.org>.
netapp-acheng commented on issue #3440:
URL: https://github.com/apache/polaris/issues/3440#issuecomment-3770899690

   I read the change you made today (Jan 19) in pr-3445, you have 
   
   - Added KMS options to Polaris CLI.
   - Changed from Poetry to UV for Python package management.
   - Exclude KMS policies when KMS is not being used for S3.
   
   Looked at ./polaris catalogs create -h, did not see new KMS related option.  These two options were there before pr-3445. 
         --current-kms-key  (Only for AWS S3) The AWS KMS key ARN to be used for encrypting new S3 data
         --allowed-kms-key  (Only for AWS S3) AWS KMS key ARN(s) that this catalog and its clients are allowed to use for reading S3 data (zero or more)
   
   When I created the catalogs, I did not specify any of these kms option. 
   "roleArn": "arn:aws:iam::123456789101112:role/assumerole",
   "allowedKmsKeys": [],
   "region": "us-east-1",
   "endpoint": "https://sgdemo.example.com/",
   "stsEndpoint": "https://sgdemo.example.com/",
   "stsUnavailable": false,
   
   May be should add --no-kms option for catalogs create CLI. 


-- 
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: issues-unsubscribe@polaris.apache.org

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


Re: [I] STS inline policy includes KMS actions even when KMS is not configured [polaris]

Posted by "MonkeyCanCode (via GitHub)" <gi...@apache.org>.
MonkeyCanCode commented on issue #3440:
URL: https://github.com/apache/polaris/issues/3440#issuecomment-3762883238

   thanks for sharing the details @netapp-acheng . I think we may be mixing two difference issues here:
   1. the initial reported issue is the create table failed due to extra kms policies being added when using non-aws s3 compatible storage without KMS which is now fixed with PR-3445 as you are now able to create table with above examples.
   2. the new reported issue seems to be related to the client (in this case spark) tried to write to the table where it was not using vending credential during insert (based on my understanding, it is not related to PR-3445).
   
   If the initial issue is resolved, I would suggest to close this one and the PR-3445 then start a new issue for the write issue you are facing. I think the most important info to share in this case is spark client config (do remove anything sensitive such as auth endpoint, bucket name, and auth info).
   
   cc @dimas-b 
   


-- 
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: issues-unsubscribe@polaris.apache.org

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


Re: [I] STS inline policy includes KMS actions even when KMS is not configured [polaris]

Posted by "netapp-acheng (via GitHub)" <gi...@apache.org>.
netapp-acheng commented on issue #3440:
URL: https://github.com/apache/polaris/issues/3440#issuecomment-3762414875

    I gave the same AWS user with the AWS credential set in the environment variables with all S3 permission to this s3 path (i.e. allow the user to perform all s3 actions within the subfolder table2 only.
   "Resource": "arn:aws:s3:::sts1-polaris/ns1/table2/*"
   
   From the spark-shell, create the table2 under ns1.
   Polaris using the temporary credential  + token to PUT this:
   PUT /ns1/table2/metadata/00000-70be4d0b-4132-4b98-aed4-59b74a13ee7c.metadata.json
   
   Polaris using the credential from environment variables to perform these s3 requests.  Because I gave the S3 permission to the user (without using AssumeRole) under subfolder table2, the table2 is created successfully.
   PUT /ns1/table2/data/00001-4-a7768eac-d5a7-4f89-9058-822c3c2e5197-0-00001.parquet
   PUT /ns1/table2/data/00000-3-a7768eac-d5a7-4f89-9058-822c3c2e5197-0-00001.parquet
   PUT /ns1/table2/data/00002-5-a7768eac-d5a7-4f89-9058-822c3c2e5197-0-00001.parquet
   PUT /ns1/table2/metadata/9562e1bf-1734-41c7-a005-110af905b287-m0.avro
   PUT /ns1/table2/metadata/snap-7024417234542457332-1-9562e1bf-1734-41c7-a005-110af905b287.avro
   HEAD /ns1/table2/metadata/snap-7024417234542457332-1-9562e1bf-1734-41c7-a005-110af905b287.avro
   GET /ns1/table2/metadata/snap-7024417234542457332-1-9562e1bf-1734-41c7-a005-110af905b287.avro
   
   Within the same spark-shell session, create table3 in ns1.  Table created successfully. But again fail when insert data to table3 (because I did not give S3 permission to table3 subfolder to this AWS user).  This user gets the permission only through the AssumeRole. 
   scala> spark.sql("""
        |   CREATE TABLE IF NOT EXISTS sts1_catalog.ns1.table3 (
        |     id   INT,
        |     data STRING
        |   )
        |   USING iceberg
        |   TBLPROPERTIES ('format-version'='2')
        | """)
   res14: org.apache.spark.sql.DataFrame = []
   
   scala> spark.sql("""
        |   INSERT INTO sts1_catalog.ns1.table3 VALUES
        |     (1, 'alpha'),
        |     (2, 'beta'),
        |     (3, 'gamma')
        | """)
   26/01/16 19:52:13 ERROR Utils: Aborting task
   java.io.UncheckedIOException: Failed to close current writer
   
   This proves that pr-3445 is not using sts token + temporary credentials when inserting data into the table.  
   


-- 
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: issues-unsubscribe@polaris.apache.org

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


Re: [I] STS inline policy includes KMS actions even when KMS is not configured [polaris]

Posted by "MonkeyCanCode (via GitHub)" <gi...@apache.org>.
MonkeyCanCode commented on issue #3440:
URL: https://github.com/apache/polaris/issues/3440#issuecomment-3752062873

   > @MonkeyCanCode : please go ahead - thx!
   
   Sounds good. Will raise a PR later tonight. 


-- 
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: issues-unsubscribe@polaris.apache.org

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


Re: [I] STS inline policy includes KMS actions even when KMS is not configured [polaris]

Posted by "netapp-acheng (via GitHub)" <gi...@apache.org>.
netapp-acheng commented on issue #3440:
URL: https://github.com/apache/polaris/issues/3440#issuecomment-3756311622

   I will test it later today or tomorrow.  Thank you for the quick turnaround.
   


-- 
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: issues-unsubscribe@polaris.apache.org

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


Re: [I] STS inline policy includes KMS actions even when KMS is not configured [polaris]

Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on issue #3440:
URL: https://github.com/apache/polaris/issues/3440#issuecomment-3751958459

   @MonkeyCanCode : please go ahead - thx!


-- 
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: issues-unsubscribe@polaris.apache.org

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


Re: [I] STS inline policy includes KMS actions even when KMS is not configured [polaris]

Posted by "netapp-acheng (via GitHub)" <gi...@apache.org>.
netapp-acheng commented on issue #3440:
URL: https://github.com/apache/polaris/issues/3440#issuecomment-3774359822

   I ran additional tests today to see whether omitting the --region option during catalog creation would avoid the residual KMS behavior described in this issue.
   Test setup: I created a new S3 catalog without specifying --region:
   
   "storageConfigInfo": {
     "storageType": "S3",
     "allowedLocations": ["s3://sts2-polaris"],
     "roleArn": "arn:aws:iam::<acct>:role/assumerole",
     "currentKmsKey": null,
     "allowedKmsKeys": [],
     "region": null,
     "endpoint": "https://sgdemo.example.com",
     "stsEndpoint": "https://sgdemo.example.com"
   }
   
   Results
   Spark can list namespaces and create tables
   The catalog loads correctly and Polaris vends temporary STS credentials during table creation, just like before.
   Spark INSERT still fails
   INSERT INTO sts2_catalog.ns1.table1 VALUES (1,'alpha'), …
   
   Failed with S3Exception: Access Denied (403)
   
   On the S3 object storage server side, I can see that Polaris sends the data file PUT using the static AWS access key, not the temporary STS credentials. This is the same failure mode we saw before Jan 19: INSERT falls back to the long‑lived IAM credentials instead of using vended STS credentials.
   So even with region=null, Polaris still does not use the temporary AssumeRole credentials during data writes.
   Conclusion
   Removing the --region field does not fix the problem, and it does not disable KMS. 
   This confirms that the underlying issue remains in the policy‑generation logic (addKmsKeyPolicy) and not in how the catalog is configured.


-- 
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: issues-unsubscribe@polaris.apache.org

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


Re: [I] STS inline policy includes KMS actions even when KMS is not configured [polaris]

Posted by "MonkeyCanCode (via GitHub)" <gi...@apache.org>.
MonkeyCanCode commented on issue #3440:
URL: https://github.com/apache/polaris/issues/3440#issuecomment-3807262462

   > [@dimas-b](https://github.com/dimas-b) [@MonkeyCanCode](https://github.com/MonkeyCanCode) This week I am busy with other work. Do you mean create another issue re this problem: Insert data to iceberg table, AssumeRole request sent this inline policy even KMS is not set i.e "allowedKmsKeys": [], { "Effect": "Allow", "Action": ["kms:DescribeKey", "kms:Decrypt"], "Resource": "arn:aws:kms:us-east-1:123456789101112:key/" },
   
   Hello @netapp-acheng,
   
   So the above issue should be fixed (subject of this issue). However, for your specific setup, there appears to be another issue with spark not using STS token during write. We would like to see if we can get a small reproducible so we can better handle this edge case.
   
   Thanks,
   Yong


-- 
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: issues-unsubscribe@polaris.apache.org

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


Re: [I] STS inline policy includes KMS actions even when KMS is not configured [polaris]

Posted by "netapp-acheng (via GitHub)" <gi...@apache.org>.
netapp-acheng commented on issue #3440:
URL: https://github.com/apache/polaris/issues/3440#issuecomment-3775222727

   @MonkeyCanCode insert data into iceberg table in the catalog without region works now. 
    
   I re-tested the behavior of Polaris after PR‑3445, and running Spark with the correct vended‑credentials configuration and full catalog permissions (NAMESPACE_*, TABLE_*, READ/WRITE_DATA). Below are the results.
       {
         "type": "INTERNAL",
         "name": "**sts_noregion**",
         "properties": {
           "default-base-location": "s3://sts-noregion"
         },
         "createTimestamp": 1768943653438,
         "lastUpdateTimestamp": 1768943653438,
         "entityVersion": 1,
         "storageConfigInfo": {
           "roleArn": "arn:aws:iam::123456789101112:role/assumerole",
           **"allowedKmsKeys": [],**
           "endpoint": "https://sgdemo.example.com",
           "stsEndpoint": "https://sgdemo.example.com",
           "stsUnavailable": false,
           "pathStyleAccess": false,
           "storageType": "S3",
           "allowedLocations": [
             "s3://sts-noregion"
           ]
         }
       },
       {
         "type": "INTERNAL",
         **"name": "sts_east1",**
         "properties": {
           "default-base-location": "s3://sts-east1"
         },
         "createTimestamp": 1768943671346,
         "lastUpdateTimestamp": 1768943671346,
         "entityVersion": 1,
         "storageConfigInfo": {
           "roleArn": "arn:aws:iam::123456789101112:role/assumerole",
           **"allowedKmsKeys": [],**
           **"region": "us-east-1",**
           "endpoint": "https://sgdemo.example.com",
           "stsEndpoint": "https://sgdemo.example.com",
           "stsUnavailable": false,
           "pathStyleAccess": false,
           "storageType": "S3",
           "allowedLocations": [
             "s3://sts-east1"
           ]
   Spark was started with the correct Iceberg REST settings:
   --conf spark.sql.catalog.sts2_catalog.header.X-Iceberg-Access-Delegation=vended-credentials
   --conf spark.sql.catalog.sts2_catalog.token-refresh-enabled=true
   (so vended STS credentials are used during writes, per REST spec)
   
   Also granted these catalog privileges to my principal for each catalog:
   NAMESPACE_LIST, NAMESPACE_CREATE,
   TABLE_CREATE,
   TABLE_READ_DATA, TABLE_WRITE_DATA
   
   sts_noregion — SUCCESS
   
   CREATE TABLE works
   INSERT works
   STS inline policies contain only S3 actions
   StorageGRID logs show temporary STS keys (vended credentials)
   No KMS actions appear anywhere
   Behavior is correct
   
   
   sts_east1 — FAILURE (Residual KMS Policy)
   CREATE TABLE succeeds, but INSERT fails with:
   Failed to get subscoped credentials:
   Invalid action: kms:DescribeKey
   (Service: Sts, Status Code: 400)
   
   Polaris log shows that PR-3445 still emits KMS read-only actions when region is set, even though KMS is not configured.
   Below is the decoded inline AssumeRole policy from Polaris during the failing INSERT:
   
   {
     "Version": "2012-10-17",
     "Statement": [
       {
         "Effect": "Allow",
         "Action": ["kms:DescribeKey", "kms:Decrypt"],
         "Resource": "arn:aws:kms:us-east-1:123456789101112:key/*"
       },
       {
         "Effect": "Allow",
         "Action": "s3:ListBucket",
         "Resource": "arn:aws:s3:::sts-east1",
         "Condition": {
           "StringLike": {
             "s3:prefix": "ns1/table1/metadata/*"
           }
         }
       },
       {
         "Effect": "Allow",
         "Action": "s3:GetBucketLocation",
         "Resource": "arn:aws:s3:::sts-east1"
       },
       {
         "Effect": "Allow",
         "Action": ["s3:GetObject", "s3:GetObjectVersion"],
         "Resource": "arn:aws:s3:::sts-east1/ns1/table1/metadata/*"
       }
     ]
   }
   This KMS statement: 
   
   {
     "Action": ["kms:DescribeKey", "kms:Decrypt"],
     "Resource": "arn:aws:kms:us-east-1:<acct>:key/*"
   }
   appears even though:
   currentKmsKey = null
   allowedKmsKeys = []
   Catalog has no KMS settings
   Only difference from sts_noregion is region = "us-east-1"
   
   Because the backend STS service is non-AWS, it rejects the unsupported kms:* actions, causing AssumeRole to fail and Spark’s write to abort.
   
   Conclusion: 
   When region is unset, Polaris emits correct S3-only policies.
   When region is set, Polaris still emits a wildcard KMS read-only statement, even with no KMS keys configured.
   


-- 
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: issues-unsubscribe@polaris.apache.org

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


Re: [I] STS inline policy includes KMS actions even when KMS is not configured [polaris]

Posted by "netapp-acheng (via GitHub)" <gi...@apache.org>.
netapp-acheng commented on issue #3440:
URL: https://github.com/apache/polaris/issues/3440#issuecomment-3775311856

   Thank you for the clarification. I understand the distinction between omitting KMS only when KMS is not being used vs. globally disabling KMS logic. My testing goal here is specifically aligned with the former: ensuring that when a catalog is intentionally created without any KMS configuration, Polaris produces only S3‑related permissions in the STS session policy.
   I performed an A/B test using two catalogs that are identical except for the presence or absence of a region setting:
   
   Catalog A (region unset)
   allowedKmsKeys = [], no currentKmsKey, no region
   → STS policies contain only S3 actions, and INSERT succeeds.
   
   
   Catalog B (region = us-east-1)
   allowedKmsKeys = [], no currentKmsKey, region present
   → STS policies still include
   { "Action": ["kms:DescribeKey", "kms:Decrypt"], "Resource": "arn:aws:kms:us-east-1:<acct>:key/*" }
   
   even though the catalog does not configure or allow any KMS keys.
   
   This causes the AssumeRole request to fail with:
   Invalid action: kms:DescribeKey
   
   which in turn causes a failure when Spark attempts to write data.
   So the issue is not that the storage system lacks KMS support, and it is not about disabling KMS entirely. Rather, the mismatch is:
   
   The catalog is explicitly configured with no KMS (allowedKmsKeys = [], no currentKmsKey).
   Yet the generated STS session policy still includes KMS actions, depending on whether region was set.
   
   From the user perspective, the expectation is:
   “If I did not configure any KMS keys in the catalog, then the generated STS policy should not contain any kms:* actions.”
   
   This matches the intent described in the changelog entry from PR‑3445 (“exclude KMS policies when KMS is not being used for S3”).
   The current behavior means that two catalogs with the same KMS configuration behave differently depending solely on whether a region was provided, which makes the experience inconsistent for users who rely on AssumeRole to access S3-compatible storage.
   A small adjustment to addKmsKeyPolicy(...)—only attaching a KMS policy when hasCurrentKey || hasAllowedKey should fixes the issue for both catalog types without modifying any other KMS logic.
   


-- 
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: issues-unsubscribe@polaris.apache.org

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


Re: [I] STS inline policy includes KMS actions even when KMS is not configured [polaris]

Posted by "netapp-acheng (via GitHub)" <gi...@apache.org>.
netapp-acheng commented on issue #3440:
URL: https://github.com/apache/polaris/issues/3440#issuecomment-3770666737

   I redo the test and the issue partially resolved. 
   Here is summary of test.
   Create table and insert data to the table, Polaris correctly uses the STS temporary credentials with AssumeRole Action. 
   However, insert data still failing.  It is back to original issue re the AssumeRole Policy with kms related action even when KMS is not cofigured for the catalog. 
   
   Before the pr-3445 fix, during Iceberg write commit (e.g. Spark INSERT INTO), Polaris sent this AssumeRole request:
   
   { "Effect": "Allow", "Action": [ "kms:GenerateDataKeyWithoutPlaintext", "kms:DescribeKey", "kms:Decrypt", "kms:GenerateDataKey" ], "Resource": "arn:aws:kms:us-east-1:123456789101112:key/*" }
   
   =================================
   With your latest change in pr-3445 today, it removed some kms related actions but below 2 actions still remain.  
   during Iceberg write commit (e.g. Spark INSERT INTO), Polaris sent this AssumeRole request:
   
   {
     "Version": "2012-10-17",
     "Statement": [
       {
         "Effect": "Allow",
         "Action": [
           "kms:DescribeKey",
           "kms:Decrypt"
         ],
         "Resource": "arn:aws:kms:us-east-1:123456789101112:key/*"
       }
   
   Expected solution summary:
   Polaris should omit all KMS actions (kms:*) when:
   •	allowedKmsKeys is empty ([]), or
   •	KMS integration is not configured
   
    


-- 
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: issues-unsubscribe@polaris.apache.org

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


Re: [I] STS inline policy includes KMS actions even when KMS is not configured [polaris]

Posted by "MonkeyCanCode (via GitHub)" <gi...@apache.org>.
MonkeyCanCode commented on issue #3440:
URL: https://github.com/apache/polaris/issues/3440#issuecomment-3775262492

   Hello @netapp-acheng,
   
   Thanks for the test again and the conclusion is expected. The primary change I made is the emit of KMS policy when KMS are not defined. However, the existed code base does include wildcard KMS policy when it is not defined unless it is non-AWS S3 policy (I think the assumption was if not being implicitly defined, it may be better to use wildcard). 
   
   And just to be clear on the changes we made/tested:
   1. We removed the KMS policies when KMS keys are not being set if the backend is a non-AWS S3-compatible storage. If the backend got classified as AWS S3 (in this case, have accoundid and region, it will still do wildcard with current code. We may need a better way to check if there is a way to distinguish between AWS and non-AWS S3 or update the doc to include this info to avoid confusion). I will create a dev mailing list for this later today.
   2. During table refresh, we implicitly returned a fully functional state to include WRITE primission as the refresh is READ-ONLY and the subsequent attempt to write data can then failed. This was validated last night as with the change, it is able to use the  STS temporary credentials with AssumeRole action.
   
   I am not sure if that is possible, do you think we can get a minimal reproducible from your end so we can have better code coverage for this edge case? For the setup I have, I went with slightly different route with IAM role and KMS keys and both are working fine since 1.1.0 release. Thus, I would think it is something specifically which may be fully covered with current code. Please help confirm is above reflected your observations then I will raise two different PRs for adding these the corresponding fixes. Again, thanks for working with us to have this edge case covered.
   
   Thanks,
   Yong Zheng


-- 
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: issues-unsubscribe@polaris.apache.org

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


Re: [I] STS inline policy includes KMS actions even when KMS is not configured [polaris]

Posted by "MonkeyCanCode (via GitHub)" <gi...@apache.org>.
MonkeyCanCode commented on issue #3440:
URL: https://github.com/apache/polaris/issues/3440#issuecomment-3780101621

   > [@MonkeyCanCode](https://github.com/MonkeyCanCode) You wrote: Do you mind also help to confirm if the second fix is necessary in case we mixed changes due to alignment in the testing (which you reported without it, it won't be using the right STS credential but AWS secret/key instead)? Based on my understanding, without the 2nd fix, table would lost its write capabilities after a metadata refresh (thus I implicitly added it back). If preferred, I can submit 2 PRs later tonight then wait for final confirmation before merge them in assuming approved by the Polaris dev team.
   > 
   > I assume the 2nd fix referring to the change you made on Jan 19:
   > 
   > > I am suspected the issue is within table refresh and I had pushed additional changes to [#3445](https://github.com/apache/polaris/pull/3445).
   > 
   > Yes, this fix is necessary.
   
   Yes, that is correct. I got some feedback on the 3 PRs above. I will work with community to have them resolved. 


-- 
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: issues-unsubscribe@polaris.apache.org

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


Re: [I] STS inline policy includes KMS actions even when KMS is not configured [polaris]

Posted by "netapp-acheng (via GitHub)" <gi...@apache.org>.
netapp-acheng commented on issue #3440:
URL: https://github.com/apache/polaris/issues/3440#issuecomment-3820932035

   https://github.com/apache/polaris/issues/3617 created as per request.  The issue likely on my side using incorrect spark-shell configuration options. 


-- 
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: issues-unsubscribe@polaris.apache.org

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


Re: [I] STS inline policy includes KMS actions even when KMS is not configured [polaris]

Posted by "netapp-acheng (via GitHub)" <gi...@apache.org>.
netapp-acheng commented on issue #3440:
URL: https://github.com/apache/polaris/issues/3440#issuecomment-3762242894

   I used below environment variables for Polaris to get the temporary credentials using AssumeRole
   export AWS_ACCESS_KEY_ID=EYGCX5XXXXXXXXXXXXXXXXX
   export AWS_SECRET_ACCESS_KEY=+Ea3YoWLXXXXXXXXXXXXXXXXXX
   export AWS_ROLE_ARN="arn:aws:iam::123456789101112:role/assumerole"
   
   I created a catalog to use sts 
   {
     "type": "INTERNAL",
     "name": "sts1_catalog",
     "properties": {
       "default-base-location": "s3://sts1-polaris"
     },
     "createTimestamp": 1768449279366,
     "lastUpdateTimestamp": 1768449279366,
     "entityVersion": 1,
     "storageConfigInfo": {
       "storageType": "S3",
       "allowedLocations": [
         "s3://sts1-polaris"
       ],
       "roleArn": "arn:aws:iam::123456789101112:role/assumerole",
       "allowedKmsKeys": [],
       "region": "us-east-1",
       "endpoint": "https://sgdemo.example.com",
       "stsEndpoint": "https://sgdemo.example.com",
       "stsUnavailable": false,
       "pathStyleAccess": false
     }
   }
   
   Created a namespace ns1 and table1 in this catalog.
   scala> spark.sql("CREATE NAMESPACE IF NOT EXISTS sts1_catalog.ns1")
   res8: org.apache.spark.sql.DataFrame = []
   
   scala> spark.sql("""
        |   CREATE TABLE IF NOT EXISTS sts1_catalog.ns1.table1 (
        |     id   INT,
        |     data STRING
        |   )
        |   USING iceberg
        |   TBLPROPERTIES ('format-version'='2')
        | """)
   res9: org.apache.spark.sql.DataFrame = []
   
   I saw Polaris sending AssumeRole request to get the temporary credential and used the temporary credential to PUT this /ns1/table1/metadata/00000-0c05b20d-9475-41ac-a6e1-c41a1a49817a.metadata.json in s3://sts1-polaris
   
   When trying to insert data into this table1
   scala> spark.sql("""
        |   INSERT INTO sts1_catalog.ns1.table1 VALUES
        |     (1, 'alpha'),
        |     (2, 'beta'),
        |     (3, 'gamma')
        | """)
   26/01/16 17:42:41 ERROR Utils: Aborting task                        (0 + 3) / 3]
   java.io.UncheckedIOException: Failed to close current writer
           at org.apache.iceberg.io.RollingFileWriter.closeCurrentWriter(RollingFileWriter.java:128)
           at org.apache.iceberg.io.RollingFileWriter.close(RollingFileWriter.java:156)
           at org.apache.iceberg.io.RollingDataWriter.close(RollingDataWriter.java:32)
           at org.apache.iceberg.spark.source.SparkWrite$UnpartitionedDataWriter.close(SparkWrite.java:778)
           at org.apache.iceberg.spark.source.SparkWrite$UnpartitionedDataWriter.commit(SparkWrite.java:760)
           at org.apache.spark.sql.execution.datasources.v2.WritingSparkTask.$anonfun$run$5(WriteToDataSourceV2Exec.scala:475)
           at org.apache.spark.util.Utils$.tryWithSafeFinallyAndFailureCallbacks(Utils.scala:1397)
           at org.apache.spark.sql.execution.datasources.v2.WritingSparkTask.run(WriteToDataSourceV2Exec.scala:491)
           at org.apache.spark.sql.execution.datasources.v2.WritingSparkTask.run$(WriteToDataSourceV2Exec.scala:430)
           at org.apache.spark.sql.execution.datasources.v2.DataWritingSparkTask$.run(WriteToDataSourceV2Exec.scala:496)
           at org.apache.spark.sql.execution.datasources.v2.V2TableWriteExec.$anonfun$writeWithV2$2(WriteToDataSourceV2Exec.scala:393)
           at org.apache.spark.scheduler.ResultTask.runTask(ResultTask.scala:93)
           at org.apache.spark.TaskContext.runTaskWithListeners(TaskContext.scala:166)
           at org.apache.spark.scheduler.Task.run(Task.scala:141)
           at org.apache.spark.executor.Executor$TaskRunner.$anonfun$run$4(Executor.scala:620)
           at org.apache.spark.util.SparkErrorUtils.tryWithSafeFinally(SparkErrorUtils.scala:64)
           at org.apache.spark.util.SparkErrorUtils.tryWithSafeFinally$(SparkErrorUtils.scala:61)
           at org.apache.spark.util.Utils$.tryWithSafeFinally(Utils.scala:94)
           at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:623)
           at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
           at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
           at java.base/java.lang.Thread.run(Thread.java:1583)
   Caused by: java.io.IOException: software.amazon.awssdk.services.s3.model.S3Exception: Access Denied (Service: S3, Status Code: 403, Request ID: 1768603361795122, Extended Request ID: 12295001) (SDK Attempt Count: 1)
   
   From object storage log, I can see the above PUT request was using the credential from environment variable (i.e. no STS token).  Not like the PUT request when Polaris created the metadata.json (it is using temporary credential + STS token). 
   
   I can send you logs from object storage server side to see the details (don't want to expose any credential details in public accessible webpage). 
   
   


-- 
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: issues-unsubscribe@polaris.apache.org

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


Re: [I] STS inline policy includes KMS actions even when KMS is not configured [polaris]

Posted by "MonkeyCanCode (via GitHub)" <gi...@apache.org>.
MonkeyCanCode commented on issue #3440:
URL: https://github.com/apache/polaris/issues/3440#issuecomment-3770935284

   > I can remove --region option when creating the catalog, but no sure where is the accountid the code is checking, the accoundID in the roleArn? { "type": "INTERNAL", "name": "sts_catalog", "properties": { "default-base-location": "s3://sts-polaris" }, "createTimestamp": 1766095794668, "lastUpdateTimestamp": 1766095794668, "entityVersion": 1, "storageConfigInfo": { "roleArn": "arn:aws:iam::**123456789101112**:role/assumerole", "allowedKmsKeys": [], "**region": "us-east-1**", "endpoint": "https://sgdemo.example.com/", "stsEndpoint": "https://sgdemo.example.com/", "stsUnavailable": false, "pathStyleAccess": false, "storageType": "S3", "allowedLocations": [ "s3://sts-polaris"
   
   Yes. That is correct. But remove region should be sufficient as it is and operation for the check. Please give it a try and let me know how it goes.


-- 
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: issues-unsubscribe@polaris.apache.org

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


Re: [I] STS inline policy includes KMS actions even when KMS is not configured [polaris]

Posted by "MonkeyCanCode (via GitHub)" <gi...@apache.org>.
MonkeyCanCode commented on issue #3440:
URL: https://github.com/apache/polaris/issues/3440#issuecomment-3769477793

   > Let's keep issues isolated, indeed. This issue has been filed about KMS policies being present, when they are not supposed to be. IMHO, @MonkeyCanCode 's PR fixes that. Let's merge and close this issue. 
   > 
   > @netapp-acheng : Please open separate issues for other problems :)
   
   Thanks for the review. I will merge the PR shortly. @netapp-acheng please include the spark config on the new bug then I can help look into as well. I don have this setup running on my end (but with AWS only) and I am not seeing the issue you described. Please include some setup info (for the S3 compatible storage, any non-sensitive configs) 


-- 
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: issues-unsubscribe@polaris.apache.org

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


Re: [I] STS inline policy includes KMS actions even when KMS is not configured [polaris]

Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on issue #3440:
URL: https://github.com/apache/polaris/issues/3440#issuecomment-3769445499

   Let's keep issues isolated, indeed. This issue has been filed about KMS policies being present, when they are not supposed to be. IMHO, @MonkeyCanCode 's PR fixes that. Let's merge and close this issue. 
   
   @netapp-acheng : Please open separate issues for other problems :)


-- 
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: issues-unsubscribe@polaris.apache.org

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


Re: [I] STS inline policy includes KMS actions even when KMS is not configured [polaris]

Posted by "netapp-acheng (via GitHub)" <gi...@apache.org>.
netapp-acheng commented on issue #3440:
URL: https://github.com/apache/polaris/issues/3440#issuecomment-3780079794

   @MonkeyCanCode 
   You wrote:
   Do you mind also help to confirm if the second fix is necessary in case we mixed changes due to alignment in the testing (which you reported without it, it won't be using the right STS credential but AWS secret/key instead)? Based on my understanding, without the 2nd fix, table would lost its write capabilities after a metadata refresh (thus I implicitly added it back). If preferred, I can submit 2 PRs later tonight then wait for final confirmation before merge them in assuming approved by the Polaris dev team.
   
   I assume the 2nd fix referring to the change you made on Jan 19:
   > I am suspected the issue is within table refresh and I had pushed additional changes to https://github.com/apache/polaris/pull/3445. 
   
   Yes, this fix is necessary. 


-- 
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: issues-unsubscribe@polaris.apache.org

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


Re: [I] STS inline policy includes KMS actions even when KMS is not configured [polaris]

Posted by "MonkeyCanCode (via GitHub)" <gi...@apache.org>.
MonkeyCanCode commented on issue #3440:
URL: https://github.com/apache/polaris/issues/3440#issuecomment-3802177450

   @netapp-acheng @dimas-b so 2/3 fixes are now merged. To handle this specific issue, we will need to have some sort of reproducible. Currently this is happening for the setup described in this PR where spark when using assume role via client id/secret (and this client id/secret only have RO and assume role access and the target role has the write access) when dealing with non-AWS S3-compatible backend. This issue is not there as far as i know from my setup when using AWS S3.
   
   Now back to the problem, the issue appears to be the FileIO object returned via `io` function during insert. This is "problematic" for this specific setup as before insert can happen, `refresh` function will be call which will set the cached FileIO object to have only READ and LIST privileges. This is validated by implicitly setting WRITE access within `refresh` function as we don't have a reproducible locally. However, we can't put WRITE access here as it can break RO use case where only READ is allowed. Based on my understanding, Spark use the FileIO object returned to do `newOutputFile` which is what could caused the issue.
   
   To better resolve this last piece, we should get a reproducible to ensure the change if efficient and not changing the other behaviors.


-- 
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: issues-unsubscribe@polaris.apache.org

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


Re: [I] STS inline policy includes KMS actions even when KMS is not configured [polaris]

Posted by "netapp-acheng (via GitHub)" <gi...@apache.org>.
netapp-acheng commented on issue #3440:
URL: https://github.com/apache/polaris/issues/3440#issuecomment-3807186046

   @dimas-b @MonkeyCanCode This week I am busy with other work.  Do you mean create another issue re this problem:
   Insert data to iceberg table, AssumeRole request sent this inline policy even KMS is not set i.e "allowedKmsKeys": [],
   {
   "Effect": "Allow",
   "Action": ["kms:DescribeKey", "kms:Decrypt"],
   "Resource": "arn:aws:kms:us-east-1:123456789101112:key/"
   },
   


-- 
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: issues-unsubscribe@polaris.apache.org

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


Re: [I] STS inline policy includes KMS actions even when KMS is not configured [polaris]

Posted by "MonkeyCanCode (via GitHub)" <gi...@apache.org>.
MonkeyCanCode commented on issue #3440:
URL: https://github.com/apache/polaris/issues/3440#issuecomment-3758267924

   @netapp-acheng I don't think the change I made altered the behavior of vending credential as the only change I made was not add kms policy when using non-aws S3-compatible storage. The vending credential will has something to do with your role and setup and likely not related to this change. That being said, the original error you faced should be gone now and likely now you are hitting another issue (either bug or setup issue). Do you mind check if my understanding is correct? If yes, do you think we can get a reproducible which we can then help to debug more.


-- 
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: issues-unsubscribe@polaris.apache.org

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


Re: [I] STS inline policy includes KMS actions even when KMS is not configured [polaris]

Posted by "MonkeyCanCode (via GitHub)" <gi...@apache.org>.
MonkeyCanCode commented on issue #3440:
URL: https://github.com/apache/polaris/issues/3440#issuecomment-3775405520

   > Thank you for the clarification. I understand the distinction between omitting KMS only when KMS is not being used vs. globally disabling KMS logic. My testing goal here is specifically aligned with the former: ensuring that when a catalog is intentionally created without any KMS configuration, Polaris produces only S3‑related permissions in the STS session policy. I performed an A/B test using two catalogs that are identical except for the presence or absence of a region setting:
   > 
   > Catalog A (region unset) allowedKmsKeys = [], no currentKmsKey, no region → STS policies contain only S3 actions, and INSERT succeeds.
   > 
   > Catalog B (region = us-east-1) allowedKmsKeys = [], no currentKmsKey, region present → STS policies still include { "Action": ["kms:DescribeKey", "kms:Decrypt"], "Resource": "arn:aws:kms:us-east-1::key/*" }
   > 
   > even though the catalog does not configure or allow any KMS keys.
   > 
   > This causes the AssumeRole request to fail with: Invalid action: kms:DescribeKey
   > 
   > which in turn causes a failure when Spark attempts to write data. So the issue is not that the storage system lacks KMS support, and it is not about disabling KMS entirely. Rather, the mismatch is:
   > 
   > The catalog is explicitly configured with no KMS (allowedKmsKeys = [], no currentKmsKey). Yet the generated STS session policy still includes KMS actions, depending on whether region was set.
   > 
   > From the user perspective, the expectation is: “If I did not configure any KMS keys in the catalog, then the generated STS policy should not contain any kms:* actions.”
   > 
   > This matches the intent described in the changelog entry from PR‑3445 (“exclude KMS policies when KMS is not being used for S3”). The current behavior means that two catalogs with the same KMS configuration behave differently depending solely on whether a region was provided, which makes the experience inconsistent for users who rely on AssumeRole to access S3-compatible storage. A small adjustment to addKmsKeyPolicy(...)—only attaching a KMS policy when hasCurrentKey || hasAllowedKey should fixes the issue for both catalog types without modifying any other KMS logic.
   
   As mentioned above, that is mainly for the wildcard KMS policy when it thinks the target backend is AWS S3 (which in this case, it is using accountid and region which may not be sufficient to distinguish AWS vs non-AWS S3). But we may need to check with original contributor on this before we can attempt a fix if by mistake as the comment in the code is stating wildcard kms policy should be put if it is an "AWS S3" (this will be covert in the dev mailing list later tonight as mentioned above).
   
   Do you mind also help to confirm if the second fix is necessary in case we mixed changes due to alignment in the testing (which you reported without it, it won't be using the right STS credential but AWS secret/key instead)? Based on my understanding, without the 2nd fix, table would lost its write capabilities after a metadata refresh (thus I implicitly added it back). If preferred, I can submit 2 PRs later tonight then wait for final confirmation before merge them in assuming approved by the Polaris dev team.


-- 
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: issues-unsubscribe@polaris.apache.org

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


Re: [I] STS inline policy includes KMS actions even when KMS is not configured [polaris]

Posted by "MonkeyCanCode (via GitHub)" <gi...@apache.org>.
MonkeyCanCode closed issue #3440: STS inline policy includes KMS actions even when KMS is not configured
URL: https://github.com/apache/polaris/issues/3440


-- 
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: issues-unsubscribe@polaris.apache.org

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


Re: [I] STS inline policy includes KMS actions even when KMS is not configured [polaris]

Posted by "MonkeyCanCode (via GitHub)" <gi...@apache.org>.
MonkeyCanCode commented on issue #3440:
URL: https://github.com/apache/polaris/issues/3440#issuecomment-3770205994

   @netapp-acheng thanks for the detail response above and I will hold on the merge for now to avoid potential of breaking system. I am suspected the issue is within table refresh and I had pushed additional changes to https://github.com/apache/polaris/pull/3445. Do you mind test again and let me know how it goes? If case if this continue to fail, do u mind run polaris in debug logging and share me the spark client config which you are using for connection?


-- 
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: issues-unsubscribe@polaris.apache.org

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


Re: [I] STS inline policy includes KMS actions even when KMS is not configured [polaris]

Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on issue #3440:
URL: https://github.com/apache/polaris/issues/3440#issuecomment-3750675754

   @netapp-acheng : just to sync up: do you have plans / capacity to make a PR to fix this? If not, it's ok, I can take a look... just trying to avoid duplicate efforts :)


-- 
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: issues-unsubscribe@polaris.apache.org

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


Re: [I] STS inline policy includes KMS actions even when KMS is not configured [polaris]

Posted by "netapp-acheng (via GitHub)" <gi...@apache.org>.
netapp-acheng commented on issue #3440:
URL: https://github.com/apache/polaris/issues/3440#issuecomment-3750696848

   @dimas-b I don't have capacity to fix this.  Please help to provide a fix and I am happy to test it. Thank you. 


-- 
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: issues-unsubscribe@polaris.apache.org

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


Re: [I] STS inline policy includes KMS actions even when KMS is not configured [polaris]

Posted by "MonkeyCanCode (via GitHub)" <gi...@apache.org>.
MonkeyCanCode commented on issue #3440:
URL: https://github.com/apache/polaris/issues/3440#issuecomment-3751939736

   the needed changes seems to be fairly simple. let me know if u would me to take this up @dimas-b in case if u are busy.


-- 
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: issues-unsubscribe@polaris.apache.org

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


Re: [I] STS inline policy includes KMS actions even when KMS is not configured [polaris]

Posted by "MonkeyCanCode (via GitHub)" <gi...@apache.org>.
MonkeyCanCode commented on issue #3440:
URL: https://github.com/apache/polaris/issues/3440#issuecomment-3821642235

   @netapp-acheng Closed this one as original report issue is fixed and added comment to #3617 


-- 
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: issues-unsubscribe@polaris.apache.org

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


Re: [I] STS inline policy includes KMS actions even when KMS is not configured [polaris]

Posted by "MonkeyCanCode (via GitHub)" <gi...@apache.org>.
MonkeyCanCode commented on issue #3440:
URL: https://github.com/apache/polaris/issues/3440#issuecomment-3756831849

   @netapp-acheng thanks for testing. Let me know how it goes then I will merge above once validated (as I don't have a working setup for end to end validation atm)


-- 
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: issues-unsubscribe@polaris.apache.org

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


Re: [I] STS inline policy includes KMS actions even when KMS is not configured [polaris]

Posted by "netapp-acheng (via GitHub)" <gi...@apache.org>.
netapp-acheng commented on issue #3440:
URL: https://github.com/apache/polaris/issues/3440#issuecomment-3769391796

   PR #3445 removes the KMS inline policy, but it does not fix the credential‑usage bug.
   With STS + AssumeRole enabled, Polaris correctly uses STS temporary credentials when creating the table (PUT metadata.json). However, when inserting data, Polaris falls back to the original static AWS access/secret key instead of the STS credentials (which include the session token).
   This causes S3 PUTs for data files to fail with 403 AccessDenied, because the static key is only intended to acquire the STS token and has no direct bucket access.
   The correct fix is for Polaris to continue using the STS temporary credentials for all FileIO operations (metadata + data files), without adding any KMS permissions when allowedKmsKeys is empty.
   In short: removing KMS actions is necessary, but not sufficient — the FileIO layer must be updated to consistently use STS credentials.


-- 
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: issues-unsubscribe@polaris.apache.org

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


Re: [I] STS inline policy includes KMS actions even when KMS is not configured [polaris]

Posted by "netapp-acheng (via GitHub)" <gi...@apache.org>.
netapp-acheng commented on issue #3440:
URL: https://github.com/apache/polaris/issues/3440#issuecomment-3769717881

   Hi team, I want to clarify why PR #3445, if merged as‑is, will actually break S3 write‑paths for any catalog configured with STS + AssumeRole, even if it fixes the KMS inline‑policy issue.
   Root problem (not addressed by PR‑3445)
   With an STS-enabled catalog, Polaris correctly calls AssumeRole and obtains temporary STS credentials (AccessKey + SecretKey + SessionToken).
   Polaris must use those temporary credentials for all subsequent S3 operations.
   Here’s what currently happens:
   
   Table creation works
   When creating the table, Polaris correctly uses the STS temporary credentials to PUT metadata.json — this succeeds.
   
   Data inserts fail (using PR #3445)
   During INSERT, Polaris does not reuse the temporary STS credentials.
   Instead, it falls back to the original static AWS access key + secret key, which were intended only for acquiring the STS token.
   Since these static credentials do not have direct S3 access, the data file PUT fails with:
   403 AccessDenied.
   
   
   PR‑3445 does not touch this credential path
   The PR removes KMS actions (because it is NOT using AssumeRole inline policy, it is using static AWS access key + secret key), but the S3 FileIO layer continues using the wrong credentials.
   That means after merging PR‑3445, STS catalogs will still fail on data writes.
   
   What the correct fix needs to include
   Polaris must continue using the STS temporary credentials (including the SessionToken) for all S3 I/O:
   
   metadata files
   manifest files
   data files
   deletes / updates
   
   
   When allowedKmsKeys is empty:
   
   Do not add any KMS actions to the inline STS policy
   But still return STS temporary credentials, and Polaris must keep using them
   
   Right now, STS credentials are used only during table creation, and then silently discarded — causing the insert‑path breakage.
   Summary
   
   The fix cannot be limited to removing KMS actions.
   The core bug is that Polaris stops using STS temporary credentials after table creation and reverts to the static key, causing 403 failures during data inserts.
   PR‑3445 does not address this, so merging it alone will still result in broken STS catalogs.


-- 
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: issues-unsubscribe@polaris.apache.org

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