AWS neptune medium security documentation change
Summary
Updated documentation to replace curl examples with insecure SSL bypass (-k flag) and localhost references with proper AWS CLI, SDK, awscurl, and secure curl examples using actual endpoints and authentication
Security assessment
The change removes the '-k' flag (which disables SSL certificate verification) from curl examples and replaces localhost endpoints with proper endpoint URLs. This addresses a security weakness by preventing users from inadvertently disabling SSL verification in production environments, which could expose them to man-in-the-middle attacks. The addition of AWS CLI and SDK examples with proper authentication also promotes secure access patterns.
Diff
diff --git a/neptune/latest/userguide/opencypher-parameterized-queries.md b/neptune/latest/userguide/opencypher-parameterized-queries.md index b76c3d96a..523f55dd3 100644 --- a//neptune/latest/userguide/opencypher-parameterized-queries.md +++ b//neptune/latest/userguide/opencypher-parameterized-queries.md @@ -24 +24 @@ The parameters are defined as follows: -Using `GET`, you can submit the parameterized query like this: +You can submit the parameterized query like this: @@ -25,0 +26 @@ Using `GET`, you can submit the parameterized query like this: +AWS CLI @@ -27,2 +27,0 @@ Using `GET`, you can submit the parameterized query like this: - curl -k \ - "https://localhost:8182/openCypher?query=MATCH%20%28n%20%7Bname:\$name,age:\$age%7D%29%20RETURN%20n¶meters=%7B%22name%22:%22john%22,%22age%22:20%7D" @@ -30 +28,0 @@ Using `GET`, you can submit the parameterized query like this: -Alternatively, you can use `POST`: @@ -31,0 +30,4 @@ Alternatively, you can use `POST`: + aws neptunedata execute-open-cypher-query \ + --endpoint-url https://your-neptune-endpoint:port \ + --open-cypher-query "MATCH (n {name: \$name, age: \$age}) RETURN n" \ + --parameters '{"name": "john", "age": 20}' @@ -33,2 +35,46 @@ Alternatively, you can use `POST`: - curl -k \ - https://localhost:8182/openCypher \ +For more information, see [execute-open-cypher-query](https://docs.aws.amazon.com/cli/latest/reference/neptunedata/execute-open-cypher-query.html) in the AWS CLI Command Reference. + +SDK + + + + import boto3 + from botocore.config import Config + + client = boto3.client( + 'neptunedata', + endpoint_url='https://your-neptune-endpoint:port', + config=Config(read_timeout=None, retries={'total_max_attempts': 1}) + ) + + response = client.execute_open_cypher_query( + openCypherQuery='MATCH (n {name: $name, age: $age}) RETURN n', + parameters='{"name": "john", "age": 20}' + ) + + print(response['results']) + +For AWS SDK examples in other languages, see [AWS SDK](./access-graph-opencypher-sdk.html). + +awscurl + + + + awscurl https://your-neptune-endpoint:port/openCypher \ + --region us-east-1 \ + --service neptune-db \ + -X POST \ + -d "query=MATCH (n {name: \$name, age: \$age}) RETURN n" \ + -d 'parameters={"name": "john", "age": 20}' + +###### Note + +This example assumes that your AWS credentials are configured in your environment. Replace `us-east-1` with the Region of your Neptune cluster. + +curl + + +Using `POST`: + + + curl https://your-neptune-endpoint:port/openCypher \ @@ -38 +84,7 @@ Alternatively, you can use `POST`: -Or, using `DIRECT POST`: +Using `GET` (URL-encoded): + + + curl -X GET \ + "https://your-neptune-endpoint:port/openCypher?query=MATCH%20%28n%20%7Bname:\$name,age:\$age%7D%29%20RETURN%20n¶meters=%7B%22name%22:%22john%22,%22age%22:20%7D" + +Using `DIRECT POST`: @@ -41,3 +93,2 @@ Or, using `DIRECT POST`: - curl -k \ - -H "Content-Type: application/opencypher" \ - "https://localhost:8182/openCypher?parameters=%7B%22name%22:%22john%22,%22age%22:20%7D" \ + curl -H "Content-Type: application/opencypher" \ + "https://your-neptune-endpoint:port/openCypher?parameters=%7B%22name%22:%22john%22,%22age%22:20%7D" \