Vikas Kumar created RANGER-3965:
-----------------------------------

             Summary: When creating a key with too long attribute values, KMS 
returns OK but key not really added
                 Key: RANGER-3965
                 URL: https://issues.apache.org/jira/browse/RANGER-3965
             Project: Ranger
          Issue Type: Bug
          Components: kms
            Reporter: Vikas Kumar
            Assignee: Vikas Kumar


When creating a key with a too long attribute values, KMS returns OK but key 
not really added. Here's the curl command I used:
{code:java}
Note: Unnecessary use of -X or --request, POST is already inferred.
*   Trying 192.168.56.116...
* TCP_NODELAY set
* Connected to centos79 (192.168.56.116) port 9292 (#0)
> POST /kms/v1/keys/?user.name=geasop HTTP/1.1
> Host: centos79:9292
> User-Agent: curl/7.61.1
> Content-Type: application/json
> Accept: application/json
> Content-Length: 1298
> Expect: 100-continue
>
< HTTP/1.1 100 Continue
* We are completely uploaded and fine
< HTTP/1.1 201 Created
< Set-Cookie: 
hadoop.auth="u=geasop&p=geasop&t=simple-dt&e=1667976698923&s=1xmGwdiYcOSSNLsK9JUi62KtvsffGh8nplekjP7MEc8=";
 HttpOnly
< Location: http://centos79:9292/kms/v1/keys/v1/key/ubuntu-passphrase
< Content-Type: application/json
< Content-Length: 116
< Date: Tue, 08 Nov 2022 20:51:38 GMT
< Server: Apache Ranger
<
{
  "material" : "8V53MUwqqEOSQ8DvEPVkXA",
  "name" : "ubuntu-passphrase",
  "versionName" : "ubuntu-passphrase@0"
* Connection #0 to host centos79 left intact
}[geasop@RH84 ~]  {code}
We can see from the PostgreSQL log there's a error:
{code:java}
2022-11-08 12:51:38.970 PST [9933] ERROR:  value too long for type character 
varying(1024)
2022-11-08 12:51:38.970 PST [9933] STATEMENT:  INSERT INTO ranger_keystore (ID, 
ADDED_BY_ID, kms_alias, kms_attributes, kms_bitLength, kms_cipher, CREATE_TIME, 
kms_createdDate, kms_description, kms_encoded, UPDATE_TIME, UPD_BY_ID, 
kms_version) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13)
2022-11-08 12:51:38.972 PST [9933] ERROR:  current transaction is aborted, 
commands ignored until end of transaction block
2022-11-08 12:51:38.972 PST [9933] STATEMENT:  SELECT 1
2022-11-08 12:51:38.989 PST [10423] ERROR:  value too long for type character 
varying(1024)
2022-11-08 12:51:38.989 PST [10423] STATEMENT:  INSERT INTO ranger_keystore 
(ID, ADDED_BY_ID, kms_alias, kms_attributes, kms_bitLength, kms_cipher, 
CREATE_TIME, kms_createdDate, kms_description, kms_encoded, UPDATE_TIME, 
UPD_BY_ID, kms_version) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, 
$12, $13)
2022-11-08 12:51:38.989 PST [10423] ERROR:  current transaction is aborted, 
commands ignored until end of transaction block
2022-11-08 12:51:38.989 PST [10423] STATEMENT:  SELECT 1  {code}
Now when we use the API to see if the key has been created we don't see it. The 
KMS UI give the same result.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to