tests/test.sh exit code (0 → resolved); the classification below is post-hoc and cannot change it.{
"command": "env | grep -E \"AWS|ENFORCE\" | head -20",
"description": "Check AWS environment variables"
}AWS_DEFAULT_REGION=us-east-1 AWS_PAGER= AWS_SECRET_ACCESS_KEY=test AWS_ACCESS_KEY_ID=test AWS_ENDPOINT_URL=http://localstack:4566 [stdout] AWS_DEFAULT_REGION=us-east-1 AWS_PAGER= AWS_SECRET_ACCESS_KEY=test AWS_ACCESS_KEY_ID=test AWS_ENDPOINT_URL=http://localstack:4566
{
"command": "aws ssm get-parameters-by-path --path \"/harbor/graphql\" --recursive --region us-east-1 2>&1 | head -100",
"description": "Read SSM manifest for harbor graphql"
}{
"Parameters": [
{
"Name": "/harbor/graphql/api-id",
"Type": "String",
"Value": "6eb4f3f4bb6047a59d96328d1f",
"Version": 1,
"LastModifiedDate": "2026-05-16T02:33:29.691000+00:00",
"ARN": "arn:aws:ssm:us-east-1:000000000000:parameter/harbor/graphql/api-id",
"DataType": "text"
},
{
"Name": "/harbor/graphql/user-pool-id",
"Type": "String",
"Value": "us-east-1_9e3f733fcc67461cb8983f4812227b57",
"Version": 1,
"LastModifiedDate": "2026-05-16T02:33:30.059000+00:00",
"ARN": "arn:aws:ssm:us-east-1:000000000000:parameter/harbor/graphql/user-pool-id",
"DataType": "text"
},
{
"Name": "/harbor/graphql/app-client-id",
"Type": "String",
"Value": "3mqq6bvh6oupxu7jm7tgqtxfuv",
"Version": 1,
"LastModifiedDate": "2026-05-16T02:33:30.422000+00:00",
"ARN": "arn:aws:ssm:us-east-1:000000000000:parameter/harbor/graphql/app-client-id",
"DataType": "text"
},
{
"Name": "/harbor/graphql/group-name",
"Type": "String",
"Value": "tenants",
"Version": 1,
"LastModifiedDate": "2026-05-16T02:33:30.783000+00:00",
"ARN": "arn:aws:ssm:us-east-1:000000000000:parameter/harbor/graphql/group-name",
"DataType": "text"
},
{
"Name": "/harbor/graphql/ddb-table",
"Type": "String",
"Value": "harbor-things",
"Version": 1,
"LastModifiedDate": "2026-05-16T02:33:31.143000+00:00",
"ARN": "arn:aws:ssm:us-east-1:000000000000:parameter/harbor/graphql/ddb-table",
"DataType": "text"
},
{
"Name": "/harbor/graphql/kms-key-arn",
"Type": "String",
"Value": "arn:aws:kms:us-east-1:000000000000:key/fd31bd9c-0b58-4021-ae64-571b9e2d8fe7",
"Version": 1,
"LastModifiedDate": "2026-05-16T02:33:31.502000+00:00",
"ARN": "arn:aws:ssm:us-east-1:000000000000:parameter/harbor/graphql/kms-key-arn",
"DataType": "text"
},
{
"Name": "/harbor/graphql/log-group-name",
"Type": "String",
"Value": "/aws/appsync/apis/harbor-graphql-api",
"Version": 1,
"LastModifiedDate": "2026-05-16T02:33:31.859000+00:00",
"ARN": "arn:aws:ssm:us-east-1:000000000000:parameter/harbor/graphql/log-group-name",
"DataType": "text"
},
{
"Name": "/harbor/graphql/svc-role-arn",
"Type": "String",
"Value": "arn:aws:iam::000000000000:role/harbor-appsync-svc-role",
"Version": 1,
"LastModifiedDate": "2026-05-16T02:33:32.217000+00:00",
"ARN": "arn:aws:ssm:us-east-1:000000000000:parameter/harbor/graphql/svc-role-arn",
"DataType": "text"
},
{
"Name": "/harbor/graphql/logs-role-arn",
"Type": "String",
"Value": "arn:aws:iam::000000000000:role/harbor-appsync-logs-role",
"Version": 1,
"LastModifiedDate": "2026-05-16T02:33:32.574000+00:00",
"ARN": "arn:aws:ssm:us-east-1:000000000000:parameter/harbor/graphql/logs-role-arn",
"DataType": "text"
},
{
"Name": "/harbor/graphql/data-source",
"Type": "String",
"Value": "things_table",
"Version": 1,
"LastModifiedDate": "2026-05-16T02:33:32.940000+00:00",
"ARN": "arn:aws:ssm:us-east-1:000000000000:parameter/harbor/graphql/data-source",
"DataType": "text"
},
{
"Name": "/harbor/graphql/api-key",
"Type": "String",
"Value": "2428122c",
"Version": 1,
"LastModifie
…[truncated]{
"command": "aws ssm get-parameters-by-path --path \"/harbor/graphql\" --recursive --region us-east-1 2>&1 | tail -200",
"description": "Read remaining SSM manifest"
}{
"Parameters": [
{
"Name": "/harbor/graphql/api-id",
"Type": "String",
"Value": "6eb4f3f4bb6047a59d96328d1f",
"Version": 1,
"LastModifiedDate": "2026-05-16T02:33:29.691000+00:00",
"ARN": "arn:aws:ssm:us-east-1:000000000000:parameter/harbor/graphql/api-id",
"DataType": "text"
},
{
"Name": "/harbor/graphql/user-pool-id",
"Type": "String",
"Value": "us-east-1_9e3f733fcc67461cb8983f4812227b57",
"Version": 1,
"LastModifiedDate": "2026-05-16T02:33:30.059000+00:00",
"ARN": "arn:aws:ssm:us-east-1:000000000000:parameter/harbor/graphql/user-pool-id",
"DataType": "text"
},
{
"Name": "/harbor/graphql/app-client-id",
"Type": "String",
"Value": "3mqq6bvh6oupxu7jm7tgqtxfuv",
"Version": 1,
"LastModifiedDate": "2026-05-16T02:33:30.422000+00:00",
"ARN": "arn:aws:ssm:us-east-1:000000000000:parameter/harbor/graphql/app-client-id",
"DataType": "text"
},
{
"Name": "/harbor/graphql/group-name",
"Type": "String",
"Value": "tenants",
"Version": 1,
"LastModifiedDate": "2026-05-16T02:33:30.783000+00:00",
"ARN": "arn:aws:ssm:us-east-1:000000000000:parameter/harbor/graphql/group-name",
"DataType": "text"
},
{
"Name": "/harbor/graphql/ddb-table",
"Type": "String",
"Value": "harbor-things",
"Version": 1,
"LastModifiedDate": "2026-05-16T02:33:31.143000+00:00",
"ARN": "arn:aws:ssm:us-east-1:000000000000:parameter/harbor/graphql/ddb-table",
"DataType": "text"
},
{
"Name": "/harbor/graphql/kms-key-arn",
"Type": "String",
"Value": "arn:aws:kms:us-east-1:000000000000:key/fd31bd9c-0b58-4021-ae64-571b9e2d8fe7",
"Version": 1,
"LastModifiedDate": "2026-05-16T02:33:31.502000+00:00",
"ARN": "arn:aws:ssm:us-east-1:000000000000:parameter/harbor/graphql/kms-key-arn",
"DataType": "text"
},
{
"Name": "/harbor/graphql/log-group-name",
"Type": "String",
"Value": "/aws/appsync/apis/harbor-graphql-api",
"Version": 1,
"LastModifiedDate": "2026-05-16T02:33:31.859000+00:00",
"ARN": "arn:aws:ssm:us-east-1:000000000000:parameter/harbor/graphql/log-group-name",
"DataType": "text"
},
{
"Name": "/harbor/graphql/svc-role-arn",
"Type": "String",
"Value": "arn:aws:iam::000000000000:role/harbor-appsync-svc-role",
"Version": 1,
"LastModifiedDate": "2026-05-16T02:33:32.217000+00:00",
"ARN": "arn:aws:ssm:us-east-1:000000000000:parameter/harbor/graphql/svc-role-arn",
"DataType": "text"
},
{
"Name": "/harbor/graphql/logs-role-arn",
"Type": "String",
"Value": "arn:aws:iam::000000000000:role/harbor-appsync-logs-role",
"Version": 1,
"LastModifiedDate": "2026-05-16T02:33:32.574000+00:00",
"ARN": "arn:aws:ssm:us-east-1:000000000000:parameter/harbor/graphql/logs-role-arn",
"DataType": "text"
},
{
"Name": "/harbor/graphql/data-source",
"Type": "String",
"Value": "things_table",
"Version": 1,
"LastModifiedDate": "2026-05-16T02:33:32.940000+00:00",
"ARN": "arn:aws:ssm:us-east-1:000000000000:parameter/harbor/graphql/data-source",
"DataType": "text"
},
{
"Name": "/harbor/graphql/api-key",
"Type": "String",
"Value": "2428122c",
"Version": 1,
"LastModifie
…[truncated]{
"command": "aws appsync get-graphql-api --api-id 6eb4f3f4bb6047a59d96328d1f --region us-east-1 2>&1",
"description": "Get GraphQL API details"
}{
"graphqlApi": {
"name": "harbor-graphql-api",
"apiId": "6eb4f3f4bb6047a59d96328d1f",
"authenticationType": "AMAZON_COGNITO_USER_POOLS",
"logConfig": {
"fieldLogLevel": "ERROR",
"cloudWatchLogsRoleArn": "arn:aws:iam::000000000000:role/harbor-appsync-logs-role",
"excludeVerboseContent": true
},
"userPoolConfig": {
"userPoolId": "us-east-1_9e3f733fcc67461cb8983f4812227b57",
"awsRegion": "us-east-1",
"defaultAction": "ALLOW"
},
"arn": "arn:aws:appsync:us-east-1:000000000000:apis/6eb4f3f4bb6047a59d96328d1f",
"uris": {
"GRAPHQL": "http://localhost.localstack.cloud:4566/graphql/6eb4f3f4bb6047a59d96328d1f",
"REALTIME": "ws://localhost.localstack.cloud:4510/graphql/6eb4f3f4bb6047a59d96328d1f"
},
"tags": {},
"additionalAuthenticationProviders": [
{
"authenticationType": "API_KEY"
},
{
"authenticationType": "AWS_IAM"
}
],
"xrayEnabled": false
}
}
[stdout]
{
"graphqlApi": {
"name": "harbor-graphql-api",
"apiId": "6eb4f3f4bb6047a59d96328d1f",
"authenticationType": "AMAZON_COGNITO_USER_POOLS",
"logConfig": {
"fieldLogLevel": "ERROR",
"cloudWatchLogsRoleArn": "arn:aws:iam::000000000000:role/harbor-appsync-logs-role",
"excludeVerboseContent": true
},
"userPoolConfig": {
"userPoolId": "us-east-1_9e3f733fcc67461cb8983f4812227b57",
"awsRegion": "us-east-1",
"defaultAction": "ALLOW"
},
"arn": "arn:aws:appsync:us-east-1:000000000000:apis/6eb4f3f4bb6047a59d96328d1f",
"uris": {
"GRAPHQL": "http://localhost.localstack.cloud:4566/graphql/6eb4f3f4bb6047a59d96328d1f",
"REALTIME": "ws://localhost.localstack.cloud:4510/graphql/6eb4f3f4bb6047a59d96328d1f"
},
"tags": {},
"additionalAuthenticationProviders": [
{
"authenticationType": "API_KEY"
},
{
"authenticationType": "AWS_IAM"
}
],
"xrayEnabled": false
}
}{
"command": "aws appsync get-introspection-schema --api-id 6eb4f3f4bb6047a59d96328d1f --format SDL --region us-east-1 /tmp/schema.graphql 2>&1; cat /tmp/schema.graphql 2>&1",
"description": "Get current GraphQL schema"
}type Thing @aws_cognito_user_pools(cognito_groups: ["tenants"]) @aws_api_key {
id: ID!
name: String!
ownerId: String!
tenantId: String!
}
type Query @aws_cognito_user_pools(cognito_groups: ["tenants"]) @aws_api_key {
getThing(id: ID!): Thing @aws_cognito_user_pools(cognito_groups: ["tenants"]) @aws_api_key
}
type Mutation @aws_cognito_user_pools(cognito_groups: ["tenants"]) @aws_api_key {
addThing(id: ID!, name: String!, tenantId: String!, ownerId: String!): Thing @aws_cognito_user_pools(cognito_groups: ["tenants"]) @aws_api_key
}
schema {
query: Query
mutation: Mutation
}
[stdout]
type Thing @aws_cognito_user_pools(cognito_groups: ["tenants"]) @aws_api_key {
id: ID!
name: String!
ownerId: String!
tenantId: String!
}
type Query @aws_cognito_user_pools(cognito_groups: ["tenants"]) @aws_api_key {
getThing(id: ID!): Thing @aws_cognito_user_pools(cognito_groups: ["tenants"]) @aws_api_key
}
type Mutation @aws_cognito_user_pools(cognito_groups: ["tenants"]) @aws_api_key {
addThing(id: ID!, name: String!, tenantId: String!, ownerId: String!): Thing @aws_cognito_user_pools(cognito_groups: ["tenants"]) @aws_api_key
}
schema {
query: Query
mutation: Mutation
}{
"command": "aws appsync list-api-keys --api-id 6eb4f3f4bb6047a59d96328d1f --region us-east-1 2>&1",
"description": "List API keys"
}{
"apiKeys": [
{
"id": "2428122c",
"expires": 1810432800,
"deletes": 1815616800
}
]
}
[stdout]
{
"apiKeys": [
{
"id": "2428122c",
"expires": 1810432800,
"deletes": 1815616800
}
]
}{
"command": "aws appsync list-data-sources --api-id 6eb4f3f4bb6047a59d96328d1f --region us-east-1 2>&1",
"description": "List data sources"
}{
"dataSources": [
{
"dataSourceArn": "arn:aws:appsync:us-east-1:000000000000:apis/6eb4f3f4bb6047a59d96328d1f/datasources/things_table",
"name": "things_table",
"type": "AMAZON_DYNAMODB",
"serviceRoleArn": "arn:aws:iam::000000000000:role/harbor-appsync-svc-role",
"dynamodbConfig": {
"tableName": "harbor-things",
"awsRegion": "us-east-1",
"useCallerCredentials": false,
"versioned": false
}
}
]
}
[stdout]
{
"dataSources": [
{
"dataSourceArn": "arn:aws:appsync:us-east-1:000000000000:apis/6eb4f3f4bb6047a59d96328d1f/datasources/things_table",
"name": "things_table",
"type": "AMAZON_DYNAMODB",
"serviceRoleArn": "arn:aws:iam::000000000000:role/harbor-appsync-svc-role",
"dynamodbConfig": {
"tableName": "harbor-things",
"awsRegion": "us-east-1",
"useCallerCredentials": false,
"versioned": false
}
}
]
}{
"command": "aws appsync list-functions --api-id 6eb4f3f4bb6047a59d96328d1f --region us-east-1 2>&1",
"description": "List AppSync functions"
}{
"functions": [
{
"functionId": "a9b3e434",
"functionArn": "arn:aws:appsync:us-east-1:000000000000:apis/6eb4f3f4bb6047a59d96328d1f/functions/a9b3e434",
"name": "auth_check",
"dataSourceName": "things_table",
"requestMappingTemplate": "#set( $groups = $ctx.identity.claims.cognito:groups )\n#if( $util.isNull($groups) )\n $util.unauthorized()\n#end\n#if( !$groups.contains(\"tenants\") )\n $util.unauthorized()\n#end\n{\n \"version\": \"2018-05-29\",\n \"payload\": {}\n}",
"responseMappingTemplate": "$util.toJson($ctx.prev.result)",
"functionVersion": "2018-05-29",
"maxBatchSize": 0
},
{
"functionId": "3fd25b42",
"functionArn": "arn:aws:appsync:us-east-1:000000000000:apis/6eb4f3f4bb6047a59d96328d1f/functions/3fd25b42",
"name": "get_thing_data",
"dataSourceName": "things_table",
"requestMappingTemplate": "{\n \"version\": \"2018-05-29\",\n \"operation\": \"GetItem\",\n \"key\": {\n \"id\": $util.dynamodb.toDynamoDBJson($ctx.arguments.id)\n },\n \"consistentRead\": true\n}",
"responseMappingTemplate": "$util.toJson($ctx.result)",
"functionVersion": "2018-05-29",
"maxBatchSize": 0
}
]
}
[stdout]
{
"functions": [
{
"functionId": "a9b3e434",
"functionArn": "arn:aws:appsync:us-east-1:000000000000:apis/6eb4f3f4bb6047a59d96328d1f/functions/a9b3e434",
"name": "auth_check",
"dataSourceName": "things_table",
"requestMappingTemplate": "#set( $groups = $ctx.identity.claims.cognito:groups )\n#if( $util.isNull($groups) )\n $util.unauthorized()\n#end\n#if( !$groups.contains(\"tenants\") )\n $util.unauthorized()\n#end\n{\n \"version\": \"2018-05-29\",\n \"payload\": {}\n}",
"responseMappingTemplate": "$util.toJson($ctx.prev.result)",
"functionVersion": "2018-05-29",
"maxBatchSize": 0
},
{
"functionId": "3fd25b42",
"functionArn": "arn:aws:appsync:us-east-1:000000000000:apis/6eb4f3f4bb6047a59d96328d1f/functions/3fd25b42",
"name": "get_thing_data",
"dataSourceName": "things_table",
"requestMappingTemplate": "{\n \"version\": \"2018-05-29\",\n \"operation\": \"GetItem\",\n \"key\": {\n \"id\": $util.dynamodb.toDynamoDBJson($ctx.arguments.id)\n },\n \"consistentRead\": true\n}",
"responseMappingTemplate": "$util.toJson($ctx.result)",
"functionVersion": "2018-05-29",
"maxBatchSize": 0
}
]
}{
"command": "aws appsync list-resolvers --api-id 6eb4f3f4bb6047a59d96328d1f --type-name Query --region us-east-1 2>&1; aws appsync list-resolvers --api-id 6eb4f3f4bb6047a59d96328d1f --type-name Mutation --region us-east-1 2>&1",
"description": "List resolvers"
}{
"resolvers": [
{
"typeName": "Query",
"fieldName": "getThing",
"resolverArn": "arn:aws:appsync:us-east-1:000000000000:apis/6eb4f3f4bb6047a59d96328d1f/types/Query/resolvers/getThing",
"requestMappingTemplate": "{}",
"responseMappingTemplate": "$util.toJson($ctx.result)",
"kind": "PIPELINE",
"pipelineConfig": {
"functions": [
"3fd25b42",
"a9b3e434"
]
},
"cachingConfig": {
"ttl": 600,
"cachingKeys": [
"$context.arguments.id"
]
},
"maxBatchSize": 0
}
]
}
{
"resolvers": [
{
"typeName": "Mutation",
"fieldName": "addThing",
"dataSourceName": "things_table",
"resolverArn": "arn:aws:appsync:us-east-1:000000000000:apis/6eb4f3f4bb6047a59d96328d1f/types/Mutation/resolvers/addThing",
"requestMappingTemplate": "#set( $tenant = $ctx.identity.claims.get(\"tenant_id\") )\n#set( $owner = $ctx.identity.username )\n#if( $util.isNull($tenant) )\n $util.error(\"tenant_id claim missing\", \"Unauthorized\")\n#end\n{\n \"version\": \"2017-02-28\",\n \"operation\": \"PutItem\",\n \"key\": {\n \"id\": $util.dynamodb.toDynamoDBJson($ctx.arguments.id)\n },\n \"attributeValues\": {\n \"name\": $util.dynamodb.toDynamoDBJson($ctx.arguments.name),\n \"tenantId\": $util.dynamodb.toDynamoDBJson($tenant),\n \"ownerId\": $util.dynamodb.toDynamoDBJson($owner)\n }\n}",
"responseMappingTemplate": "$util.toJson($ctx.result)",
"kind": "UNIT",
"maxBatchSize": 0
}
]
}
[stdout]
{
"resolvers": [
{
"typeName": "Query",
"fieldName": "getThing",
"resolverArn": "arn:aws:appsync:us-east-1:000000000000:apis/6eb4f3f4bb6047a59d96328d1f/types/Query/resolvers/getThing",
"requestMappingTemplate": "{}",
"responseMappingTemplate": "$util.toJson($ctx.result)",
"kind": "PIPELINE",
"pipelineConfig": {
"functions": [
"3fd25b42",
"a9b3e434"
]
},
"cachingConfig": {
"ttl": 600,
"cachingKeys": [
"$context.arguments.id"
]
},
"maxBatchSize": 0
}
]
}
{
"resolvers": [
{
"typeName": "Mutation",
"fieldName": "addThing",
"dataSourceName": "things_table",
"resolverArn": "arn:aws:appsync:us-east-1:000000000000:apis/6eb4f3f4bb6047a59d96328d1f/types/Mutation/resolvers/addThing",
"requestMappingTemplate": "#set( $tenant = $ctx.identity.claims.get(\"tenant_id\") )\n#set( $owner = $ctx.identity.username )\n#if( $util.isNull($tenant) )\n $util.error(\"tenant_id claim missing\", \"Unauthorized\")\n#end\n{\n \"version\": \"2017-02-28\",\n \"operation\": \"PutItem\",\n \"key\": {\n \"id\": $util.dynamodb.toDynamoDBJson($ctx.arguments.id)\n },\n \"attributeValues\": {\n \"name\": $util.dynamodb.toDynamoDBJson($ctx.arguments.name),\n \"tenantId\": $util.dynamodb.toDynamoDBJson($tenant),\n \"ownerId\": $util.dynamodb.toDynamoDBJson($owner)\n }\n}",
"responseMappingTemplate": "$util.toJson($ctx.result)",
"kind": "UNIT",
"maxBatchSize": 0
}
]
}{
"command": "aws appsync get-api-cache --api-id 6eb4f3f4bb6047a59d96328d1f --region us-east-1 2>&1",
"description": "Get API cache configuration"
}{
"apiCache": {
"ttl": 600,
"apiCachingBehavior": "FULL_REQUEST_CACHING",
"type": "SMALL"
}
}
[stdout]
{
"apiCache": {
"ttl": 600,
"apiCachingBehavior": "FULL_REQUEST_CACHING",
"type": "SMALL"
}
}{
"command": "aws iam get-role --role-name harbor-appsync-svc-role --region us-east-1 2>&1; aws iam list-attached-role-policies --role-name harbor-appsync-svc-role 2>&1; aws iam list-role-policies --role-name harbor-appsync-svc-role 2>&1",
"description": "Get svc role configuration"
}{
"Role": {
"Path": "/",
"RoleName": "harbor-appsync-svc-role",
"RoleId": "AROAQAAAAAAAOAP2JHEYE",
"Arn": "arn:aws:iam::000000000000:role/harbor-appsync-svc-role",
"CreateDate": "2026-05-16T02:33:21.798866+00:00",
"AssumeRolePolicyDocument": {
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": "appsync.amazonaws.com"
},
"Action": "sts:AssumeRole"
}
]
},
"MaxSessionDuration": 3600,
"RoleLastUsed": {}
}
}
{
"AttachedPolicies": []
}
{
"PolicyNames": [
"appsync-ddb-scoped"
]
}
[stdout]
{
"Role": {
"Path": "/",
"RoleName": "harbor-appsync-svc-role",
"RoleId": "AROAQAAAAAAAOAP2JHEYE",
"Arn": "arn:aws:iam::000000000000:role/harbor-appsync-svc-role",
"CreateDate": "2026-05-16T02:33:21.798866+00:00",
"AssumeRolePolicyDocument": {
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": "appsync.amazonaws.com"
},
"Action": "sts:AssumeRole"
}
]
},
"MaxSessionDuration": 3600,
"RoleLastUsed": {}
}
}
{
"AttachedPolicies": []
}
{
"PolicyNames": [
"appsync-ddb-scoped"
]
}{
"command": "aws iam get-role --role-name harbor-appsync-logs-role 2>&1; aws iam list-attached-role-policies --role-name harbor-appsync-logs-role 2>&1; aws iam list-role-policies --role-name harbor-appsync-logs-role 2>&1",
"description": "Get logs role configuration"
}{
"Role": {
"Path": "/",
"RoleName": "harbor-appsync-logs-role",
"RoleId": "AROAQAAAAAAABM3ILCTEK",
"Arn": "arn:aws:iam::000000000000:role/harbor-appsync-logs-role",
"CreateDate": "2026-05-16T02:33:22.549329+00:00",
"AssumeRolePolicyDocument": {
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": "appsync.amazonaws.com"
},
"Action": "sts:AssumeRole"
}
]
},
"MaxSessionDuration": 3600,
"RoleLastUsed": {}
}
}
{
"AttachedPolicies": [
{
"PolicyName": "AWSAppSyncPushToCloudWatchLogs",
"PolicyArn": "arn:aws:iam::aws:policy/service-role/AWSAppSyncPushToCloudWatchLogs"
}
]
}
{
"PolicyNames": [
"appsync-logs-scoped"
]
}
[stdout]
{
"Role": {
"Path": "/",
"RoleName": "harbor-appsync-logs-role",
"RoleId": "AROAQAAAAAAABM3ILCTEK",
"Arn": "arn:aws:iam::000000000000:role/harbor-appsync-logs-role",
"CreateDate": "2026-05-16T02:33:22.549329+00:00",
"AssumeRolePolicyDocument": {
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": "appsync.amazonaws.com"
},
"Action": "sts:AssumeRole"
}
]
},
"MaxSessionDuration": 3600,
"RoleLastUsed": {}
}
}
{
"AttachedPolicies": [
{
"PolicyName": "AWSAppSyncPushToCloudWatchLogs",
"PolicyArn": "arn:aws:iam::aws:policy/service-role/AWSAppSyncPushToCloudWatchLogs"
}
]
}
{
"PolicyNames": [
"appsync-logs-scoped"
]
}{
"command": "aws dynamodb describe-table --table-name harbor-things --region us-east-1 2>&1",
"description": "Get DDB table details"
}{
"Table": {
"AttributeDefinitions": [
{
"AttributeName": "id",
"AttributeType": "S"
}
],
"TableName": "harbor-things",
"KeySchema": [
{
"AttributeName": "id",
"KeyType": "HASH"
}
],
"TableStatus": "ACTIVE",
"CreationDateTime": "2026-05-16T02:33:20.029000+00:00",
"ProvisionedThroughput": {
"LastIncreaseDateTime": "1970-01-01T00:00:00+00:00",
"LastDecreaseDateTime": "1970-01-01T00:00:00+00:00",
"NumberOfDecreasesToday": 0,
"ReadCapacityUnits": 0,
"WriteCapacityUnits": 0
},
"TableSizeBytes": 0,
"ItemCount": 0,
"TableArn": "arn:aws:dynamodb:us-east-1:000000000000:table/harbor-things",
"TableId": "29e907b2-e8cc-4499-99bf-f86136997600",
"BillingModeSummary": {
"BillingMode": "PAY_PER_REQUEST",
"LastUpdateToPayPerRequestDateTime": "2026-05-16T02:33:20.029000+00:00"
},
"SSEDescription": {
"Status": "ENABLED",
"SSEType": "KMS",
"KMSMasterKeyArn": "arn:aws:kms:us-east-1:000000000000:key/fd31bd9c-0b58-4021-ae64-571b9e2d8fe7"
},
"DeletionProtectionEnabled": false,
"WarmThroughput": {
"ReadUnitsPerSecond": 12000,
"WriteUnitsPerSecond": 4000,
"Status": "ACTIVE"
}
}
}
[stdout]
{
"Table": {
"AttributeDefinitions": [
{
"AttributeName": "id",
"AttributeType": "S"
}
],
"TableName": "harbor-things",
"KeySchema": [
{
"AttributeName": "id",
"KeyType": "HASH"
}
],
"TableStatus": "ACTIVE",
"CreationDateTime": "2026-05-16T02:33:20.029000+00:00",
"ProvisionedThroughput": {
"LastIncreaseDateTime": "1970-01-01T00:00:00+00:00",
"LastDecreaseDateTime": "1970-01-01T00:00:00+00:00",
"NumberOfDecreasesToday": 0,
"ReadCapacityUnits": 0,
"WriteCapacityUnits": 0
},
"TableSizeBytes": 0,
"ItemCount": 0,
"TableArn": "arn:aws:dynamodb:us-east-1:000000000000:table/harbor-things",
"TableId": "29e907b2-e8cc-4499-99bf-f86136997600",
"BillingModeSummary": {
"BillingMode": "PAY_PER_REQUEST",
"LastUpdateToPayPerRequestDateTime": "2026-05-16T02:33:20.029000+00:00"
},
"SSEDescription": {
"Status": "ENABLED",
"SSEType": "KMS",
"KMSMasterKeyArn": "arn:aws:kms:us-east-1:000000000000:key/fd31bd9c-0b58-4021-ae64-571b9e2d8fe7"
},
"DeletionProtectionEnabled": false,
"WarmThroughput": {
"ReadUnitsPerSecond": 12000,
"WriteUnitsPerSecond": 4000,
"Status": "ACTIVE"
}
}
}{
"command": "aws iam get-role-policy --role-name harbor-appsync-svc-role --policy-name appsync-ddb-scoped 2>&1; echo \"---\"; aws iam get-role-policy --role-name harbor-appsync-logs-role --policy-name appsync-logs-scoped 2>&1",
"description": "Get inline policies"
}{
"RoleName": "harbor-appsync-svc-role",
"PolicyName": "appsync-ddb-scoped",
"PolicyDocument": {
"Version": "2012-10-17",
"Statement": [
{
"Sid": "DDBScopedActions",
"Effect": "Allow",
"Action": [
"dynamodb:GetItem",
"dynamodb:PutItem",
"dynamodb:Query"
],
"Resource": "arn:aws:dynamodb:us-east-1:000000000000:table/harbor-things"
}
]
}
}
---
{
"RoleName": "harbor-appsync-logs-role",
"PolicyName": "appsync-logs-scoped",
"PolicyDocument": {
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"logs:CreateLogGroup",
"logs:CreateLogStream",
"logs:PutLogEvents"
],
"Resource": "arn:aws:logs:us-east-1:000000000000:log-group:/aws/appsync/apis/harbor-graphql-api:*"
}
]
}
}
[stdout]
{
"RoleName": "harbor-appsync-svc-role",
"PolicyName": "appsync-ddb-scoped",
"PolicyDocument": {
"Version": "2012-10-17",
"Statement": [
{
"Sid": "DDBScopedActions",
"Effect": "Allow",
"Action": [
"dynamodb:GetItem",
"dynamodb:PutItem",
"dynamodb:Query"
],
"Resource": "arn:aws:dynamodb:us-east-1:000000000000:table/harbor-things"
}
]
}
}
---
{
"RoleName": "harbor-appsync-logs-role",
"PolicyName": "appsync-logs-scoped",
"PolicyDocument": {
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"logs:CreateLogGroup",
"logs:CreateLogStream",
"logs:PutLogEvents"
],
"Resource": "arn:aws:logs:us-east-1:000000000000:log-group:/aws/appsync/apis/harbor-graphql-api:*"
}
]
}
}{
"command": "aws cognito-idp describe-user-pool --user-pool-id us-east-1_9e3f733fcc67461cb8983f4812227b57 --region us-east-1 2>&1 | head -100",
"description": "Inspect Cognito user pool"
}{
"UserPool": {
"Id": "us-east-1_9e3f733fcc67461cb8983f4812227b57",
"Name": "harbor-graphql-pool",
"Policies": {
"PasswordPolicy": {
"MinimumLength": 8,
"RequireUppercase": true,
"RequireLowercase": true,
"RequireNumbers": true,
"RequireSymbols": true,
"TemporaryPasswordValidityDays": 7
}
},
"DeletionProtection": "INACTIVE",
"LambdaConfig": {},
"LastModifiedDate": "2026-05-16T02:33:17.540008+00:00",
"CreationDate": "2026-05-16T02:33:17.540010+00:00",
"SchemaAttributes": [
{
"Name": "sub",
"AttributeDataType": "String",
"DeveloperOnlyAttribute": false,
"Mutable": false,
"Required": true,
"StringAttributeConstraints": {
"MinLength": "1",
"MaxLength": "2048"
}
},
{
"Name": "name",
"AttributeDataType": "String",
"DeveloperOnlyAttribute": false,
"Mutable": true,
"Required": false,
"StringAttributeConstraints": {
"MinLength": "0",
"MaxLength": "2048"
}
},
{
"Name": "given_name",
"AttributeDataType": "String",
"DeveloperOnlyAttribute": false,
"Mutable": true,
"Required": false,
"StringAttributeConstraints": {
"MinLength": "0",
"MaxLength": "2048"
}
},
{
"Name": "family_name",
"AttributeDataType": "String",
"DeveloperOnlyAttribute": false,
"Mutable": true,
"Required": false,
"StringAttributeConstraints": {
"MinLength": "0",
"MaxLength": "2048"
}
},
{
"Name": "middle_name",
"AttributeDataType": "String",
"DeveloperOnlyAttribute": false,
"Mutable": true,
"Required": false,
"StringAttributeConstraints": {
"MinLength": "0",
"MaxLength": "2048"
}
},
{
"Name": "nickname",
"AttributeDataType": "String",
"DeveloperOnlyAttribute": false,
"Mutable": true,
"Required": false,
"StringAttributeConstraints": {
"MinLength": "0",
"MaxLength": "2048"
}
},
{
"Name": "preferred_username",
"AttributeDataType": "String",
"DeveloperOnlyAttribute": false,
"Mutable": true,
"Required": false,
"StringAttributeConstraints": {
"MinLength": "0",
"MaxLength": "2048"
}
},
{
"Name": "profile",
"AttributeDataType": "String",
"DeveloperOnlyAttribute": false,
[stdout]
{
"UserPool": {
"Id": "us-east-1_9e3f733fcc67461cb8983f4812227b57",
"Name": "harbor-graphql-pool",
"Policies": {
"PasswordPolicy": {
"MinimumLength": 8,
"RequireUppercase": true,
"RequireLowercase": true,
"RequireNumbers": true,
"RequireSymbols": true,
"TemporaryPasswordValidityDays": 7
}
},
"DeletionProtection": "INACTIVE",
"LambdaConfig": {},
"LastModifiedDate": "2026
…[truncated]{
"command": "aws kms describe-key --key-id arn:aws:kms:us-east-1:000000000000:key/fd31bd9c-0b58-4021-ae64-571b9e2d8fe7 2>&1; aws kms get-key-policy --key-id arn:aws:kms:us-east-1:000000000000:key/fd31bd9c-0b58-4021-ae64-571b9e2d8fe7 --policy-name default 2>&1",
"description": "Get KMS key info"
}{
"KeyMetadata": {
"AWSAccountId": "000000000000",
"KeyId": "fd31bd9c-0b58-4021-ae64-571b9e2d8fe7",
"Arn": "arn:aws:kms:us-east-1:000000000000:key/fd31bd9c-0b58-4021-ae64-571b9e2d8fe7",
"CreationDate": "2026-05-16T02:33:16.100028+00:00",
"Enabled": true,
"Description": "",
"KeyUsage": "ENCRYPT_DECRYPT",
"KeyState": "Enabled",
"Origin": "AWS_KMS",
"KeyManager": "CUSTOMER",
"CustomerMasterKeySpec": "SYMMETRIC_DEFAULT",
"KeySpec": "SYMMETRIC_DEFAULT",
"EncryptionAlgorithms": [
"SYMMETRIC_DEFAULT"
],
"MultiRegion": false,
"CurrentKeyMaterialId": "ea10827c0edd5ce9968a3fd59ca0dbc5ea10827c0edd5ce9968a3fd59ca0dbc5"
}
}
{
"Policy": "{\"Version\": \"2012-10-17\", \"Id\": \"key-default-1\", \"Statement\": [{\"Sid\": \"Enable IAM User Permissions\", \"Effect\": \"Allow\", \"Principal\": {\"AWS\": \"arn:aws:iam::000000000000:root\"}, \"Action\": \"kms:*\", \"Resource\": \"*\"}]}"
}
[stdout]
{
"KeyMetadata": {
"AWSAccountId": "000000000000",
"KeyId": "fd31bd9c-0b58-4021-ae64-571b9e2d8fe7",
"Arn": "arn:aws:kms:us-east-1:000000000000:key/fd31bd9c-0b58-4021-ae64-571b9e2d8fe7",
"CreationDate": "2026-05-16T02:33:16.100028+00:00",
"Enabled": true,
"Description": "",
"KeyUsage": "ENCRYPT_DECRYPT",
"KeyState": "Enabled",
"Origin": "AWS_KMS",
"KeyManager": "CUSTOMER",
"CustomerMasterKeySpec": "SYMMETRIC_DEFAULT",
"KeySpec": "SYMMETRIC_DEFAULT",
"EncryptionAlgorithms": [
"SYMMETRIC_DEFAULT"
],
"MultiRegion": false,
"CurrentKeyMaterialId": "ea10827c0edd5ce9968a3fd59ca0dbc5ea10827c0edd5ce9968a3fd59ca0dbc5"
}
}
{
"Policy": "{\"Version\": \"2012-10-17\", \"Id\": \"key-default-1\", \"Statement\": [{\"Sid\": \"Enable IAM User Permissions\", \"Effect\": \"Allow\", \"Principal\": {\"AWS\": \"arn:aws:iam::000000000000:root\"}, \"Action\": \"kms:*\", \"Resource\": \"*\"}]}"
}{
"command": "aws cognito-idp describe-user-pool --user-pool-id us-east-1_9e3f733fcc67461cb8983f4812227b57 --region us-east-1 2>&1 | grep -A 8 \"custom\\|tenant\"",
"description": "Check tenant custom attribute"
}"Name": "custom:tenant_id",
"AttributeDataType": "String",
"DeveloperOnlyAttribute": false,
"Mutable": true,
"Required": false,
"StringAttributeConstraints": {}
}
],
"VerificationMessageTemplate": {
[stdout]
"Name": "custom:tenant_id",
"AttributeDataType": "String",
"DeveloperOnlyAttribute": false,
"Mutable": true,
"Required": false,
"StringAttributeConstraints": {}
}
],
"VerificationMessageTemplate": {{
"command": "aws cognito-idp list-groups --user-pool-id us-east-1_9e3f733fcc67461cb8983f4812227b57 --region us-east-1 2>&1; aws cognito-idp list-users --user-pool-id us-east-1_9e3f733fcc67461cb8983f4812227b57 --region us-east-1 2>&1 | head -50",
"description": "List groups and users"
}{
"Groups": [
{
"GroupName": "tenants",
"UserPoolId": "us-east-1_9e3f733fcc67461cb8983f4812227b57",
"LastModifiedDate": "2026-05-16T02:33:17+00:00",
"CreationDate": "2026-05-16T02:33:17+00:00"
}
]
}
{
"Users": []
}
[stdout]
{
"Groups": [
{
"GroupName": "tenants",
"UserPoolId": "us-east-1_9e3f733fcc67461cb8983f4812227b57",
"LastModifiedDate": "2026-05-16T02:33:17+00:00",
"CreationDate": "2026-05-16T02:33:17+00:00"
}
]
}
{
"Users": []
}{
"command": "aws appsync list-resolvers-by-function --api-id 6eb4f3f4bb6047a59d96328d1f --function-id 3fd25b42 --region us-east-1 2>&1; echo \"---\"; aws appsync list-resolvers-by-function --api-id 6eb4f3f4bb6047a59d96328d1f --function-id a9b3e434 --region us-east-1 2>&1",
"description": "Map function to resolver"
}Exit code 254 aws: [ERROR]: An error occurred (InternalError) when calling the ListResolversByFunction operation (reached max retries: 2): exception while calling appsync.ListResolversByFunction: 'dataSourceName' --- aws: [ERROR]: An error occurred (InternalError) when calling the ListResolversByFunction operation (reached max retries: 2): exception while calling appsync.ListResolversByFunction: 'dataSourceName' [error] tool reported failure
{
"query": "select:TaskCreate,TaskUpdate,TaskList",
"max_results": 5
}{"type": "tool_reference", "tool_name": "TaskCreate"}
{"type": "tool_reference", "tool_name": "TaskUpdate"}
{"type": "tool_reference", "tool_name": "TaskList"}
{
"subject": "Reorder pipeline resolver Query.getThing",
"description": "Auth function should run BEFORE data fetch"
}Task #1 created successfully: Reorder pipeline resolver Query.getThing
{
"subject": "Fix auth_check function VTL (claim access)",
"description": "Use $ctx.identity.claims.get(\"cognito:groups\") syntax for claim with colon"
}Task #2 created successfully: Fix auth_check function VTL (claim access)
{
"subject": "Fix addThing mutation VTL",
"description": "Use custom:tenant_id claim via .get(); bump protocol version to 2018-05-29; add attribute_not_exists condition; response error handling"
}Task #3 created successfully: Fix addThing mutation VTL
{
"subject": "Grant KMS Decrypt/GenerateDataKey to svc-role",
"description": "Add KMS permissions on table's CMK so AppSync can read encrypted rows"
}Task #4 created successfully: Grant KMS Decrypt/GenerateDataKey to svc-role
{
"subject": "Shorten API key expiry to within 7 days",
"description": "Weekly rotation window , current expiry is ~1 year out"
}Task #5 created successfully: Shorten API key expiry to within 7 days
{
"subject": "Fix API config (auth, xray, log level, providers)",
"description": "defaultAction DENY, xrayEnabled true, fieldLogLevel ALL, remove AWS_IAM from additional providers"
}Task #6 created successfully: Fix API config (auth, xray, log level, providers)
{
"subject": "Fix cache mode and resolver caching keys",
"description": "Switch FULL_REQUEST_CACHING → PER_RESOLVER_CACHING and add tenant scoping to cachingKeys"
}Task #7 created successfully: Fix cache mode and resolver caching keys
{
"subject": "Fix data fetch function VTL (consistentRead bypasses cache)",
"description": "Remove consistentRead:true; add response error handling"
}Task #8 created successfully: Fix data fetch function VTL (consistentRead bypasses cache)
{
"subject": "Replace schema (remove @aws_api_key from Mutation, remove tenantId arg)",
"description": "Mutation should be Cognito-only; addThing(id, name) only , tenantId/ownerId from claims"
}Task #9 created successfully: Replace schema (remove @aws_api_key from Mutation, remove tenantId arg)
{
"taskId": "6",
"status": "in_progress"
}Updated task #6 status
{
"command": "aws appsync update-graphql-api \\\n --api-id 6eb4f3f4bb6047a59d96328d1f \\\n --name harbor-graphql-api \\\n --authentication-type AMAZON_COGNITO_USER_POOLS \\\n --user-pool-config \"userPoolId=us-east-1_9e3f733fcc67461cb8983f4812227b57,awsRegion=us-east-1,defaultAction=DENY\" \\\n --xray-enabled \\\n --log-config \"fieldLogLevel=ALL,cloudWatchLogsRoleArn=arn:aws:iam::000000000000:role/harbor-appsync-logs-role,excludeVerboseContent=false\" \\\n --additional-authentication-providers '[{\"authenticationType\":\"API_KEY\"}]' \\\n --region us-east-1 2>&1",
"description": "Update GraphQL API config"
}{
"graphqlApi": {
"name": "harbor-graphql-api",
"apiId": "6eb4f3f4bb6047a59d96328d1f",
"authenticationType": "AMAZON_COGNITO_USER_POOLS",
"logConfig": {
"fieldLogLevel": "ALL",
"cloudWatchLogsRoleArn": "arn:aws:iam::000000000000:role/harbor-appsync-logs-role",
"excludeVerboseContent": false
},
"userPoolConfig": {
"userPoolId": "us-east-1_9e3f733fcc67461cb8983f4812227b57",
"awsRegion": "us-east-1",
"defaultAction": "DENY"
},
"arn": "arn:aws:appsync:us-east-1:000000000000:apis/6eb4f3f4bb6047a59d96328d1f",
"uris": {
"GRAPHQL": "http://localhost.localstack.cloud:4566/graphql/6eb4f3f4bb6047a59d96328d1f",
"REALTIME": "ws://localhost.localstack.cloud:4510/graphql/6eb4f3f4bb6047a59d96328d1f"
},
"tags": {},
"additionalAuthenticationProviders": [
{
"authenticationType": "API_KEY"
}
],
"xrayEnabled": true
}
}
[stdout]
{
"graphqlApi": {
"name": "harbor-graphql-api",
"apiId": "6eb4f3f4bb6047a59d96328d1f",
"authenticationType": "AMAZON_COGNITO_USER_POOLS",
"logConfig": {
"fieldLogLevel": "ALL",
"cloudWatchLogsRoleArn": "arn:aws:iam::000000000000:role/harbor-appsync-logs-role",
"excludeVerboseContent": false
},
"userPoolConfig": {
"userPoolId": "us-east-1_9e3f733fcc67461cb8983f4812227b57",
"awsRegion": "us-east-1",
"defaultAction": "DENY"
},
"arn": "arn:aws:appsync:us-east-1:000000000000:apis/6eb4f3f4bb6047a59d96328d1f",
"uris": {
"GRAPHQL": "http://localhost.localstack.cloud:4566/graphql/6eb4f3f4bb6047a59d96328d1f",
"REALTIME": "ws://localhost.localstack.cloud:4510/graphql/6eb4f3f4bb6047a59d96328d1f"
},
"tags": {},
"additionalAuthenticationProviders": [
{
"authenticationType": "API_KEY"
}
],
"xrayEnabled": true
}
}{
"taskId": "9",
"status": "in_progress"
}Updated task #9 status
{
"taskId": "6",
"status": "completed"
}Updated task #6 status
{
"file_path": "/tmp/schema.graphql",
"content": "schema {\n query: Query\n mutation: Mutation\n}\n\ntype Query @aws_cognito_user_pools(cognito_groups: [\"tenants\"]) @aws_api_key {\n getThing(id: ID!): Thing @aws_cognito_user_pools(cognito_groups: [\"tenants\"]) @aws_api_key\n}\n\ntype Mutation @aws_cognito_user_pools(cognito_groups: [\"tenants\"]) {\n addThing(id: ID!, name: String!): Thing @aws_cognito_user_pools(cognito_groups: [\"tenants\"])\n}\n\ntype Thing @aws_cognito_user_pools(cognito_groups: [\"tenants\"]) @aws_api_key {\n id: ID!\n name: String!\n ownerId: String!\n tenantId: String!\n}\n"
}<tool_use_error>File has not been read yet. Read it first before writing to it.</tool_use_error> [error] tool reported failure
{
"command": "aws appsync start-schema-creation --api-id 6eb4f3f4bb6047a59d96328d1f --definition fileb:///tmp/schema.graphql --region us-east-1 2>&1",
"description": "Start schema creation"
}{
"status": "PROCESSING"
}
[stdout]
{
"status": "PROCESSING"
}{
"command": "aws appsync get-schema-creation-status --api-id 6eb4f3f4bb6047a59d96328d1f --region us-east-1 2>&1",
"description": "Poll schema creation status"
}{
"status": "SUCCESS",
"details": "Successfully created schema with 4 types."
}
[stdout]
{
"status": "SUCCESS",
"details": "Successfully created schema with 4 types."
}{
"command": "aws appsync get-introspection-schema --api-id 6eb4f3f4bb6047a59d96328d1f --format SDL --region us-east-1 /tmp/new-schema.graphql 2>&1 && cat /tmp/new-schema.graphql",
"description": "Verify new schema"
}type Thing @aws_cognito_user_pools(cognito_groups: ["tenants"]) @aws_api_key {
id: ID!
name: String!
ownerId: String!
tenantId: String!
}
type Query @aws_cognito_user_pools(cognito_groups: ["tenants"]) @aws_api_key {
getThing(id: ID!): Thing @aws_cognito_user_pools(cognito_groups: ["tenants"]) @aws_api_key
}
type Mutation @aws_cognito_user_pools(cognito_groups: ["tenants"]) @aws_api_key {
addThing(id: ID!, name: String!, tenantId: String!, ownerId: String!): Thing @aws_cognito_user_pools(cognito_groups: ["tenants"]) @aws_api_key
}
schema {
query: Query
mutation: Mutation
}
[stdout]
type Thing @aws_cognito_user_pools(cognito_groups: ["tenants"]) @aws_api_key {
id: ID!
name: String!
ownerId: String!
tenantId: String!
}
type Query @aws_cognito_user_pools(cognito_groups: ["tenants"]) @aws_api_key {
getThing(id: ID!): Thing @aws_cognito_user_pools(cognito_groups: ["tenants"]) @aws_api_key
}
type Mutation @aws_cognito_user_pools(cognito_groups: ["tenants"]) @aws_api_key {
addThing(id: ID!, name: String!, tenantId: String!, ownerId: String!): Thing @aws_cognito_user_pools(cognito_groups: ["tenants"]) @aws_api_key
}
schema {
query: Query
mutation: Mutation
}{
"file_path": "/tmp/schema.graphql"
}1 type Thing @aws_cognito_user_pools(cognito_groups: ["tenants"]) @aws_api_key {
2 id: ID!
3 name: String!
4 ownerId: String!
5 tenantId: String!
6 }
7
8 type Query @aws_cognito_user_pools(cognito_groups: ["tenants"]) @aws_api_key {
9 getThing(id: ID!): Thing @aws_cognito_user_pools(cognito_groups: ["tenants"]) @aws_api_key
10 }
11
12 type Mutation @aws_cognito_user_pools(cognito_groups: ["tenants"]) @aws_api_key {
13 addThing(id: ID!, name: String!, tenantId: String!, ownerId: String!): Thing @aws_cognito_user_pools(cognito_groups: ["tenants"]) @aws_api_key
14 }
15
16 schema {
17 query: Query
18 mutation: Mutation
19 }
20
{
"file_path": "/tmp/schema.graphql",
"content": "schema {\n query: Query\n mutation: Mutation\n}\n\ntype Query @aws_cognito_user_pools(cognito_groups: [\"tenants\"]) @aws_api_key {\n getThing(id: ID!): Thing @aws_cognito_user_pools(cognito_groups: [\"tenants\"]) @aws_api_key\n}\n\ntype Mutation @aws_cognito_user_pools(cognito_groups: [\"tenants\"]) {\n addThing(id: ID!, name: String!): Thing @aws_cognito_user_pools(cognito_groups: [\"tenants\"])\n}\n\ntype Thing @aws_cognito_user_pools(cognito_groups: [\"tenants\"]) @aws_api_key {\n id: ID!\n name: String!\n ownerId: String!\n tenantId: String!\n}\n"
}The file /tmp/schema.graphql has been updated successfully. (file state is current in your context , no need to Read it back)
{
"command": "aws appsync start-schema-creation --api-id 6eb4f3f4bb6047a59d96328d1f --definition fileb:///tmp/schema.graphql --region us-east-1 2>&1; sleep 2; aws appsync get-schema-creation-status --api-id 6eb4f3f4bb6047a59d96328d1f --region us-east-1 2>&1",
"description": "Re-create schema and check status"
}{
"status": "PROCESSING"
}
{
"status": "SUCCESS",
"details": "Successfully created schema with 4 types."
}
[stdout]
{
"status": "PROCESSING"
}
{
"status": "SUCCESS",
"details": "Successfully created schema with 4 types."
}{
"command": "aws appsync get-introspection-schema --api-id 6eb4f3f4bb6047a59d96328d1f --format SDL --region us-east-1 /tmp/verify.graphql 2>&1 && cat /tmp/verify.graphql",
"description": "Verify schema"
}schema {
query: Query
mutation: Mutation
}
type Query @aws_cognito_user_pools(cognito_groups: ["tenants"]) @aws_api_key {
getThing(id: ID!): Thing @aws_cognito_user_pools(cognito_groups: ["tenants"]) @aws_api_key
}
type Mutation @aws_cognito_user_pools(cognito_groups: ["tenants"]) {
addThing(id: ID!, name: String!): Thing @aws_cognito_user_pools(cognito_groups: ["tenants"])
}
type Thing @aws_cognito_user_pools(cognito_groups: ["tenants"]) @aws_api_key {
id: ID!
name: String!
ownerId: String!
tenantId: String!
}
[stdout]
schema {
query: Query
mutation: Mutation
}
type Query @aws_cognito_user_pools(cognito_groups: ["tenants"]) @aws_api_key {
getThing(id: ID!): Thing @aws_cognito_user_pools(cognito_groups: ["tenants"]) @aws_api_key
}
type Mutation @aws_cognito_user_pools(cognito_groups: ["tenants"]) {
addThing(id: ID!, name: String!): Thing @aws_cognito_user_pools(cognito_groups: ["tenants"])
}
type Thing @aws_cognito_user_pools(cognito_groups: ["tenants"]) @aws_api_key {
id: ID!
name: String!
ownerId: String!
tenantId: String!
}{
"taskId": "7",
"status": "in_progress"
}Updated task #7 status
{
"taskId": "9",
"status": "completed"
}Updated task #9 status
{
"command": "aws appsync update-api-cache \\\n --api-id 6eb4f3f4bb6047a59d96328d1f \\\n --ttl 600 \\\n --api-caching-behavior PER_RESOLVER_CACHING \\\n --type SMALL \\\n --region us-east-1 2>&1",
"description": "Update API cache mode"
}{
"apiCache": {
"ttl": 600,
"apiCachingBehavior": "PER_RESOLVER_CACHING",
"type": "SMALL"
}
}
[stdout]
{
"apiCache": {
"ttl": 600,
"apiCachingBehavior": "PER_RESOLVER_CACHING",
"type": "SMALL"
}
}{
"taskId": "1",
"status": "in_progress"
}Updated task #1 status
{
"command": "aws appsync update-resolver \\\n --api-id 6eb4f3f4bb6047a59d96328d1f \\\n --type-name Query \\\n --field-name getThing \\\n --kind PIPELINE \\\n --pipeline-config '{\"functions\":[\"a9b3e434\",\"3fd25b42\"]}' \\\n --request-mapping-template '{}' \\\n --response-mapping-template '$util.toJson($ctx.result)' \\\n --caching-config 'ttl=600,cachingKeys=[\"$context.identity.sub\",\"$context.arguments.id\"]' \\\n --region us-east-1 2>&1",
"description": "Reorder pipeline & add tenant scoping to cache keys"
}{
"resolver": {
"typeName": "Query",
"fieldName": "getThing",
"resolverArn": "arn:aws:appsync:us-east-1:000000000000:apis/6eb4f3f4bb6047a59d96328d1f/types/Query/resolvers/getThing",
"requestMappingTemplate": "{}",
"responseMappingTemplate": "$util.toJson($ctx.result)",
"kind": "PIPELINE",
"pipelineConfig": {
"functions": [
"a9b3e434",
"3fd25b42"
]
},
"cachingConfig": {
"ttl": 600,
"cachingKeys": [
"$context.identity.sub",
"$context.arguments.id"
]
},
"maxBatchSize": 0
}
}
[stdout]
{
"resolver": {
"typeName": "Query",
"fieldName": "getThing",
"resolverArn": "arn:aws:appsync:us-east-1:000000000000:apis/6eb4f3f4bb6047a59d96328d1f/types/Query/resolvers/getThing",
"requestMappingTemplate": "{}",
"responseMappingTemplate": "$util.toJson($ctx.result)",
"kind": "PIPELINE",
"pipelineConfig": {
"functions": [
"a9b3e434",
"3fd25b42"
]
},
"cachingConfig": {
"ttl": 600,
"cachingKeys": [
"$context.identity.sub",
"$context.arguments.id"
]
},
"maxBatchSize": 0
}
}{
"taskId": "1",
"status": "completed"
}Updated task #1 status
{
"taskId": "7",
"status": "completed"
}Updated task #7 status
{
"taskId": "2",
"status": "in_progress"
}Updated task #2 status
{
"file_path": "/tmp/auth_req.vtl",
"content": "#set( $groups = $ctx.identity.claims.get(\"cognito:groups\") )\n#if( $util.isNull($groups) )\n $util.unauthorized()\n#end\n#if( !$groups.contains(\"tenants\") )\n $util.unauthorized()\n#end\n{\n \"version\": \"2018-05-29\",\n \"payload\": {}\n}\n"
}File created successfully at: /tmp/auth_req.vtl (file state is current in your context , no need to Read it back)
{
"file_path": "/tmp/auth_resp.vtl",
"content": "$util.toJson($ctx.prev.result)\n"
}File created successfully at: /tmp/auth_resp.vtl (file state is current in your context , no need to Read it back)
{
"command": "aws appsync update-function \\\n --api-id 6eb4f3f4bb6047a59d96328d1f \\\n --function-id a9b3e434 \\\n --name auth_check \\\n --data-source-name things_table \\\n --request-mapping-template \"$(cat /tmp/auth_req.vtl)\" \\\n --response-mapping-template \"$(cat /tmp/auth_resp.vtl)\" \\\n --function-version 2018-05-29 \\\n --region us-east-1 2>&1",
"description": "Update auth_check function"
}{
"functionConfiguration": {
"functionId": "a9b3e434",
"functionArn": "arn:aws:appsync:us-east-1:000000000000:apis/6eb4f3f4bb6047a59d96328d1f/functions/a9b3e434",
"name": "auth_check",
"dataSourceName": "things_table",
"requestMappingTemplate": "#set( $groups = $ctx.identity.claims.get(\"cognito:groups\") )\n#if( $util.isNull($groups) )\n $util.unauthorized()\n#end\n#if( !$groups.contains(\"tenants\") )\n $util.unauthorized()\n#end\n{\n \"version\": \"2018-05-29\",\n \"payload\": {}\n}",
"responseMappingTemplate": "$util.toJson($ctx.prev.result)",
"functionVersion": "2018-05-29",
"maxBatchSize": 0
}
}
[stdout]
{
"functionConfiguration": {
"functionId": "a9b3e434",
"functionArn": "arn:aws:appsync:us-east-1:000000000000:apis/6eb4f3f4bb6047a59d96328d1f/functions/a9b3e434",
"name": "auth_check",
"dataSourceName": "things_table",
"requestMappingTemplate": "#set( $groups = $ctx.identity.claims.get(\"cognito:groups\") )\n#if( $util.isNull($groups) )\n $util.unauthorized()\n#end\n#if( !$groups.contains(\"tenants\") )\n $util.unauthorized()\n#end\n{\n \"version\": \"2018-05-29\",\n \"payload\": {}\n}",
"responseMappingTemplate": "$util.toJson($ctx.prev.result)",
"functionVersion": "2018-05-29",
"maxBatchSize": 0
}
}{
"taskId": "8",
"status": "in_progress"
}Updated task #8 status
{
"taskId": "2",
"status": "completed"
}Updated task #2 status
{
"file_path": "/tmp/data_req.vtl",
"content": "{\n \"version\": \"2018-05-29\",\n \"operation\": \"GetItem\",\n \"key\": {\n \"id\": $util.dynamodb.toDynamoDBJson($ctx.arguments.id)\n },\n \"consistentRead\": false\n}\n"
}File created successfully at: /tmp/data_req.vtl (file state is current in your context , no need to Read it back)
{
"file_path": "/tmp/data_resp.vtl",
"content": "#if( $ctx.error )\n $util.error($ctx.error.message, $ctx.error.type)\n#end\n#set( $tenant = $ctx.identity.claims.get(\"custom:tenant_id\") )\n#if( $util.isNull($ctx.result) )\n #return($ctx.result)\n#end\n#if( $ctx.result.tenantId != $tenant )\n $util.unauthorized()\n#end\n$util.toJson($ctx.result)\n"
}File created successfully at: /tmp/data_resp.vtl (file state is current in your context , no need to Read it back)
{
"file_path": "/tmp/data_resp.vtl",
"content": "#if( $ctx.error )\n $util.error($ctx.error.message, $ctx.error.type)\n#end\n$util.toJson($ctx.result)\n"
}The file /tmp/data_resp.vtl has been updated successfully. (file state is current in your context , no need to Read it back)
{
"command": "aws appsync update-function \\\n --api-id 6eb4f3f4bb6047a59d96328d1f \\\n --function-id 3fd25b42 \\\n --name get_thing_data \\\n --data-source-name things_table \\\n --request-mapping-template \"$(cat /tmp/data_req.vtl)\" \\\n --response-mapping-template \"$(cat /tmp/data_resp.vtl)\" \\\n --function-version 2018-05-29 \\\n --region us-east-1 2>&1",
"description": "Update data fetch function"
}{
"functionConfiguration": {
"functionId": "3fd25b42",
"functionArn": "arn:aws:appsync:us-east-1:000000000000:apis/6eb4f3f4bb6047a59d96328d1f/functions/3fd25b42",
"name": "get_thing_data",
"dataSourceName": "things_table",
"requestMappingTemplate": "{\n \"version\": \"2018-05-29\",\n \"operation\": \"GetItem\",\n \"key\": {\n \"id\": $util.dynamodb.toDynamoDBJson($ctx.arguments.id)\n },\n \"consistentRead\": false\n}",
"responseMappingTemplate": "#if( $ctx.error )\n $util.error($ctx.error.message, $ctx.error.type)\n#end\n$util.toJson($ctx.result)",
"functionVersion": "2018-05-29",
"maxBatchSize": 0
}
}
[stdout]
{
"functionConfiguration": {
"functionId": "3fd25b42",
"functionArn": "arn:aws:appsync:us-east-1:000000000000:apis/6eb4f3f4bb6047a59d96328d1f/functions/3fd25b42",
"name": "get_thing_data",
"dataSourceName": "things_table",
"requestMappingTemplate": "{\n \"version\": \"2018-05-29\",\n \"operation\": \"GetItem\",\n \"key\": {\n \"id\": $util.dynamodb.toDynamoDBJson($ctx.arguments.id)\n },\n \"consistentRead\": false\n}",
"responseMappingTemplate": "#if( $ctx.error )\n $util.error($ctx.error.message, $ctx.error.type)\n#end\n$util.toJson($ctx.result)",
"functionVersion": "2018-05-29",
"maxBatchSize": 0
}
}{
"taskId": "8",
"status": "completed"
}Updated task #8 status
{
"taskId": "3",
"status": "in_progress"
}Updated task #3 status
{
"file_path": "/tmp/mut_req.vtl",
"content": "#set( $tenant = $ctx.identity.claims.get(\"custom:tenant_id\") )\n#set( $owner = $ctx.identity.username )\n#if( $util.isNull($tenant) )\n $util.error(\"custom:tenant_id claim missing\", \"Unauthorized\")\n#end\n{\n \"version\": \"2018-05-29\",\n \"operation\": \"PutItem\",\n \"key\": {\n \"id\": $util.dynamodb.toDynamoDBJson($ctx.arguments.id)\n },\n \"attributeValues\": {\n \"name\": $util.dynamodb.toDynamoDBJson($ctx.arguments.name),\n \"tenantId\": $util.dynamodb.toDynamoDBJson($tenant),\n \"ownerId\": $util.dynamodb.toDynamoDBJson($owner)\n },\n \"condition\": {\n \"expression\": \"attribute_not_exists(#id)\",\n \"expressionNames\": {\n \"#id\": \"id\"\n }\n }\n}\n"
}File created successfully at: /tmp/mut_req.vtl (file state is current in your context , no need to Read it back)
{
"file_path": "/tmp/mut_resp.vtl",
"content": "#if( $ctx.error )\n $util.error($ctx.error.message, $ctx.error.type)\n#end\n$util.toJson($ctx.result)\n"
}File created successfully at: /tmp/mut_resp.vtl (file state is current in your context , no need to Read it back)
{
"command": "aws appsync update-resolver \\\n --api-id 6eb4f3f4bb6047a59d96328d1f \\\n --type-name Mutation \\\n --field-name addThing \\\n --kind UNIT \\\n --data-source-name things_table \\\n --request-mapping-template \"$(cat /tmp/mut_req.vtl)\" \\\n --response-mapping-template \"$(cat /tmp/mut_resp.vtl)\" \\\n --region us-east-1 2>&1",
"description": "Update addThing mutation resolver"
}{
"resolver": {
"typeName": "Mutation",
"fieldName": "addThing",
"dataSourceName": "things_table",
"resolverArn": "arn:aws:appsync:us-east-1:000000000000:apis/6eb4f3f4bb6047a59d96328d1f/types/Mutation/resolvers/addThing",
"requestMappingTemplate": "#set( $tenant = $ctx.identity.claims.get(\"custom:tenant_id\") )\n#set( $owner = $ctx.identity.username )\n#if( $util.isNull($tenant) )\n $util.error(\"custom:tenant_id claim missing\", \"Unauthorized\")\n#end\n{\n \"version\": \"2018-05-29\",\n \"operation\": \"PutItem\",\n \"key\": {\n \"id\": $util.dynamodb.toDynamoDBJson($ctx.arguments.id)\n },\n \"attributeValues\": {\n \"name\": $util.dynamodb.toDynamoDBJson($ctx.arguments.name),\n \"tenantId\": $util.dynamodb.toDynamoDBJson($tenant),\n \"ownerId\": $util.dynamodb.toDynamoDBJson($owner)\n },\n \"condition\": {\n \"expression\": \"attribute_not_exists(#id)\",\n \"expressionNames\": {\n \"#id\": \"id\"\n }\n }\n}",
"responseMappingTemplate": "#if( $ctx.error )\n $util.error($ctx.error.message, $ctx.error.type)\n#end\n$util.toJson($ctx.result)",
"kind": "UNIT",
"maxBatchSize": 0
}
}
[stdout]
{
"resolver": {
"typeName": "Mutation",
"fieldName": "addThing",
"dataSourceName": "things_table",
"resolverArn": "arn:aws:appsync:us-east-1:000000000000:apis/6eb4f3f4bb6047a59d96328d1f/types/Mutation/resolvers/addThing",
"requestMappingTemplate": "#set( $tenant = $ctx.identity.claims.get(\"custom:tenant_id\") )\n#set( $owner = $ctx.identity.username )\n#if( $util.isNull($tenant) )\n $util.error(\"custom:tenant_id claim missing\", \"Unauthorized\")\n#end\n{\n \"version\": \"2018-05-29\",\n \"operation\": \"PutItem\",\n \"key\": {\n \"id\": $util.dynamodb.toDynamoDBJson($ctx.arguments.id)\n },\n \"attributeValues\": {\n \"name\": $util.dynamodb.toDynamoDBJson($ctx.arguments.name),\n \"tenantId\": $util.dynamodb.toDynamoDBJson($tenant),\n \"ownerId\": $util.dynamodb.toDynamoDBJson($owner)\n },\n \"condition\": {\n \"expression\": \"attribute_not_exists(#id)\",\n \"expressionNames\": {\n \"#id\": \"id\"\n }\n }\n}",
"responseMappingTemplate": "#if( $ctx.error )\n $util.error($ctx.error.message, $ctx.error.type)\n#end\n$util.toJson($ctx.result)",
"kind": "UNIT",
"maxBatchSize": 0
}
}{
"taskId": "3",
"status": "completed"
}Updated task #3 status
{
"taskId": "4",
"status": "in_progress"
}Updated task #4 status
{
"file_path": "/tmp/svc-policy.json",
"content": "{\n \"Version\": \"2012-10-17\",\n \"Statement\": [\n {\n \"Sid\": \"DDBScopedActions\",\n \"Effect\": \"Allow\",\n \"Action\": [\n \"dynamodb:GetItem\",\n \"dynamodb:PutItem\",\n \"dynamodb:Query\"\n ],\n \"Resource\": \"arn:aws:dynamodb:us-east-1:000000000000:table/harbor-things\"\n },\n {\n \"Sid\": \"KMSForEncryptedTable\",\n \"Effect\": \"Allow\",\n \"Action\": [\n \"kms:Decrypt\",\n \"kms:GenerateDataKey\",\n \"kms:DescribeKey\"\n ],\n \"Resource\": \"arn:aws:kms:us-east-1:000000000000:key/fd31bd9c-0b58-4021-ae64-571b9e2d8fe7\"\n }\n ]\n}\n"
}File created successfully at: /tmp/svc-policy.json (file state is current in your context , no need to Read it back)
{
"command": "aws iam put-role-policy \\\n --role-name harbor-appsync-svc-role \\\n --policy-name appsync-ddb-scoped \\\n --policy-document file:///tmp/svc-policy.json 2>&1 && \\\naws iam get-role-policy --role-name harbor-appsync-svc-role --policy-name appsync-ddb-scoped 2>&1",
"description": "Update svc-role inline policy"
}{
"RoleName": "harbor-appsync-svc-role",
"PolicyName": "appsync-ddb-scoped",
"PolicyDocument": {
"Version": "2012-10-17",
"Statement": [
{
"Sid": "DDBScopedActions",
"Effect": "Allow",
"Action": [
"dynamodb:GetItem",
"dynamodb:PutItem",
"dynamodb:Query"
],
"Resource": "arn:aws:dynamodb:us-east-1:000000000000:table/harbor-things"
},
{
"Sid": "KMSForEncryptedTable",
"Effect": "Allow",
"Action": [
"kms:Decrypt",
"kms:GenerateDataKey",
"kms:DescribeKey"
],
"Resource": "arn:aws:kms:us-east-1:000000000000:key/fd31bd9c-0b58-4021-ae64-571b9e2d8fe7"
}
]
}
}
[stdout]
{
"RoleName": "harbor-appsync-svc-role",
"PolicyName": "appsync-ddb-scoped",
"PolicyDocument": {
"Version": "2012-10-17",
"Statement": [
{
"Sid": "DDBScopedActions",
"Effect": "Allow",
"Action": [
"dynamodb:GetItem",
"dynamodb:PutItem",
"dynamodb:Query"
],
"Resource": "arn:aws:dynamodb:us-east-1:000000000000:table/harbor-things"
},
{
"Sid": "KMSForEncryptedTable",
"Effect": "Allow",
"Action": [
"kms:Decrypt",
"kms:GenerateDataKey",
"kms:DescribeKey"
],
"Resource": "arn:aws:kms:us-east-1:000000000000:key/fd31bd9c-0b58-4021-ae64-571b9e2d8fe7"
}
]
}
}{
"taskId": "4",
"status": "completed"
}Updated task #4 status
{
"taskId": "5",
"status": "in_progress"
}Updated task #5 status
{
"command": "EXP=$(($(date +%s) + 6*86400)); echo \"expires=$EXP\"; aws appsync update-api-key --api-id 6eb4f3f4bb6047a59d96328d1f --id 2428122c --expires \"$EXP\" --region us-east-1 2>&1",
"description": "Update API key expiry to 6 days"
}expires=1779417692
{
"apiKey": {
"id": "2428122c",
"expires": 1779415200,
"deletes": 1784599200
}
}
[stdout]
expires=1779417692
{
"apiKey": {
"id": "2428122c",
"expires": 1779415200,
"deletes": 1784599200
}
}{}#1 [completed] Reorder pipeline resolver Query.getThing #2 [completed] Fix auth_check function VTL (claim access) #3 [completed] Fix addThing mutation VTL #4 [completed] Grant KMS Decrypt/GenerateDataKey to svc-role #5 [in_progress] Shorten API key expiry to within 7 days #6 [completed] Fix API config (auth, xray, log level, providers) #7 [completed] Fix cache mode and resolver caching keys #8 [completed] Fix data fetch function VTL (consistentRead bypasses cache) #9 [completed] Replace schema (remove @aws_api_key from Mutation, remove tenantId arg)
{
"taskId": "5",
"status": "completed"
}Updated task #5 status
{
"taskId": "5",
"status": "completed"
}Updated task #5
{
"command": "echo \"=== API ===\"; aws appsync get-graphql-api --api-id 6eb4f3f4bb6047a59d96328d1f --region us-east-1; echo \"=== Cache ===\"; aws appsync get-api-cache --api-id 6eb4f3f4bb6047a59d96328d1f --region us-east-1; echo \"=== Resolver Query.getThing ===\"; aws appsync get-resolver --api-id 6eb4f3f4bb6047a59d96328d1f --type-name Query --field-name getThing --region us-east-1; echo \"=== Resolver Mutation.addThing ===\"; aws appsync get-resolver --api-id 6eb4f3f4bb6047a59d96328d1f --type-name Mutation --field-name addThing --region us-east-1",
"description": "Final verification dump 1"
}=== API ===
{
"graphqlApi": {
"name": "harbor-graphql-api",
"apiId": "6eb4f3f4bb6047a59d96328d1f",
"authenticationType": "AMAZON_COGNITO_USER_POOLS",
"logConfig": {
"fieldLogLevel": "ALL",
"cloudWatchLogsRoleArn": "arn:aws:iam::000000000000:role/harbor-appsync-logs-role",
"excludeVerboseContent": false
},
"userPoolConfig": {
"userPoolId": "us-east-1_9e3f733fcc67461cb8983f4812227b57",
"awsRegion": "us-east-1",
"defaultAction": "DENY"
},
"arn": "arn:aws:appsync:us-east-1:000000000000:apis/6eb4f3f4bb6047a59d96328d1f",
"uris": {
"GRAPHQL": "http://localhost.localstack.cloud:4566/graphql/6eb4f3f4bb6047a59d96328d1f",
"REALTIME": "ws://localhost.localstack.cloud:4510/graphql/6eb4f3f4bb6047a59d96328d1f"
},
"tags": {},
"additionalAuthenticationProviders": [
{
"authenticationType": "API_KEY"
}
],
"xrayEnabled": true
}
}
=== Cache ===
{
"apiCache": {
"ttl": 600,
"apiCachingBehavior": "PER_RESOLVER_CACHING",
"type": "SMALL"
}
}
=== Resolver Query.getThing ===
{
"resolver": {
"typeName": "Query",
"fieldName": "getThing",
"resolverArn": "arn:aws:appsync:us-east-1:000000000000:apis/6eb4f3f4bb6047a59d96328d1f/types/Query/resolvers/getThing",
"requestMappingTemplate": "{}",
"responseMappingTemplate": "$util.toJson($ctx.result)",
"kind": "PIPELINE",
"pipelineConfig": {
"functions": [
"a9b3e434",
"3fd25b42"
]
},
"cachingConfig": {
"ttl": 600,
"cachingKeys": [
"$context.identity.sub",
"$context.arguments.id"
]
},
"maxBatchSize": 0
}
}
=== Resolver Mutation.addThing ===
{
"resolver": {
"typeName": "Mutation",
"fieldName": "addThing",
"dataSourceName": "things_table",
"resolverArn": "arn:aws:appsync:us-east-1:000000000000:apis/6eb4f3f4bb6047a59d96328d1f/types/Mutation/resolvers/addThing",
"requestMappingTemplate": "#set( $tenant = $ctx.identity.claims.get(\"custom:tenant_id\") )\n#set( $owner = $ctx.identity.username )\n#if( $util.isNull($tenant) )\n $util.error(\"custom:tenant_id claim missing\", \"Unauthorized\")\n#end\n{\n \"version\": \"2018-05-29\",\n \"operation\": \"PutItem\",\n \"key\": {\n \"id\": $util.dynamodb.toDynamoDBJson($ctx.arguments.id)\n },\n \"attributeValues\": {\n \"name\": $util.dynamodb.toDynamoDBJson($ctx.arguments.name),\n \"tenantId\": $util.dynamodb.toDynamoDBJson($tenant),\n \"ownerId\": $util.dynamodb.toDynamoDBJson($owner)\n },\n \"condition\": {\n \"expression\": \"attribute_not_exists(#id)\",\n \"expressionNames\": {\n \"#id\": \"id\"\n }\n }\n}",
"responseMappingTemplate": "#if( $ctx.error )\n $util.error($ctx.error.message, $ctx.error.type)\n#end\n$util.toJson($ctx.result)",
"kind": "UNIT",
"maxBatchSize": 0
}
}
[stdout]
=== API ===
{
"graphqlApi": {
"name": "harbor-graphql-api",
"apiId": "6eb4f3f4bb6047a59d96328d1f",
"authenticationType": "AMAZON_COGNITO_USER_POOLS",
"logConfig": {
"fieldLogLevel": "ALL",
"cloudWatchLogsRoleArn": "arn:aws:iam::000000000000:role/harbor-appsync-logs-role",
"excludeVerboseContent": false
},
"userPoolConfig": {
"userPoolId": "us-east-1_9e3f733fcc67461cb8983f4812227b57",
"awsRegion": "us-east-1",
"defaultAction": "DENY"
},
"arn": "arn:aws:appsync:us-east-1:000000000000:apis/6eb4f3f4bb6047a59d96328d1f",
"uris": {
"GRAPHQL": "http://localhost.localstack.cloud:4566/graphql/6eb4f3f4bb6047a59d96328d1f",
"REALTIME":
…[truncated]{
"command": "echo \"=== auth_check ===\"; aws appsync get-function --api-id 6eb4f3f4bb6047a59d96328d1f --function-id a9b3e434 --region us-east-1; echo \"=== get_thing_data ===\"; aws appsync get-function --api-id 6eb4f3f4bb6047a59d96328d1f --function-id 3fd25b42 --region us-east-1; echo \"=== API key ===\"; aws appsync list-api-keys --api-id 6eb4f3f4bb6047a59d96328d1f --region us-east-1; echo \"=== svc-role policy ===\"; aws iam get-role-policy --role-name harbor-appsync-svc-role --policy-name appsync-ddb-scoped",
"description": "Final verification dump 2"
}=== auth_check ===
{
"functionConfiguration": {
"functionId": "a9b3e434",
"functionArn": "arn:aws:appsync:us-east-1:000000000000:apis/6eb4f3f4bb6047a59d96328d1f/functions/a9b3e434",
"name": "auth_check",
"dataSourceName": "things_table",
"requestMappingTemplate": "#set( $groups = $ctx.identity.claims.get(\"cognito:groups\") )\n#if( $util.isNull($groups) )\n $util.unauthorized()\n#end\n#if( !$groups.contains(\"tenants\") )\n $util.unauthorized()\n#end\n{\n \"version\": \"2018-05-29\",\n \"payload\": {}\n}",
"responseMappingTemplate": "$util.toJson($ctx.prev.result)",
"functionVersion": "2018-05-29",
"maxBatchSize": 0
}
}
=== get_thing_data ===
{
"functionConfiguration": {
"functionId": "3fd25b42",
"functionArn": "arn:aws:appsync:us-east-1:000000000000:apis/6eb4f3f4bb6047a59d96328d1f/functions/3fd25b42",
"name": "get_thing_data",
"dataSourceName": "things_table",
"requestMappingTemplate": "{\n \"version\": \"2018-05-29\",\n \"operation\": \"GetItem\",\n \"key\": {\n \"id\": $util.dynamodb.toDynamoDBJson($ctx.arguments.id)\n },\n \"consistentRead\": false\n}",
"responseMappingTemplate": "#if( $ctx.error )\n $util.error($ctx.error.message, $ctx.error.type)\n#end\n$util.toJson($ctx.result)",
"functionVersion": "2018-05-29",
"maxBatchSize": 0
}
}
=== API key ===
{
"apiKeys": [
{
"id": "2428122c",
"expires": 1779415200,
"deletes": 1784599200
}
]
}
=== svc-role policy ===
{
"RoleName": "harbor-appsync-svc-role",
"PolicyName": "appsync-ddb-scoped",
"PolicyDocument": {
"Version": "2012-10-17",
"Statement": [
{
"Sid": "DDBScopedActions",
"Effect": "Allow",
"Action": [
"dynamodb:GetItem",
"dynamodb:PutItem",
"dynamodb:Query"
],
"Resource": "arn:aws:dynamodb:us-east-1:000000000000:table/harbor-things"
},
{
"Sid": "KMSForEncryptedTable",
"Effect": "Allow",
"Action": [
"kms:Decrypt",
"kms:GenerateDataKey",
"kms:DescribeKey"
],
"Resource": "arn:aws:kms:us-east-1:000000000000:key/fd31bd9c-0b58-4021-ae64-571b9e2d8fe7"
}
]
}
}
[stdout]
=== auth_check ===
{
"functionConfiguration": {
"functionId": "a9b3e434",
"functionArn": "arn:aws:appsync:us-east-1:000000000000:apis/6eb4f3f4bb6047a59d96328d1f/functions/a9b3e434",
"name": "auth_check",
"dataSourceName": "things_table",
"requestMappingTemplate": "#set( $groups = $ctx.identity.claims.get(\"cognito:groups\") )\n#if( $util.isNull($groups) )\n $util.unauthorized()\n#end\n#if( !$groups.contains(\"tenants\") )\n $util.unauthorized()\n#end\n{\n \"version\": \"2018-05-29\",\n \"payload\": {}\n}",
"responseMappingTemplate": "$util.toJson($ctx.prev.result)",
"functionVersion": "2018-05-29",
"maxBatchSize": 0
}
}
=== get_thing_data ===
{
"functionConfiguration": {
"functionId": "3fd25b42",
"functionArn": "arn:aws:appsync:us-east-1:000000000000:apis/6eb4f3f4bb6047a59d96328d1f/functions/3fd25b42",
"name": "get_thing_data",
"dataSourceName": "things_table",
"requestMappingTemplate": "{\n \"version\": \"2018-05-29\",\n \"operation\": \"GetItem\",\n \"key\": {\n \"id\": $util.dynamodb.toDynamoDBJson($ctx.arguments.id)\n },\n \"consistentRead\": false\n}",
"responseMappingTemplate": "#if( $ctx.error )\n $util.error($ctx.error.message, $ctx.error.type)\n#end\n$util.toJson($ctx.result)",
"functionVersion": "2018-05-29",
"maxBatchSize": 0
}
}
=== API key ===
{
"apiKeys": [
{
…[truncated]No file changes, the agent left the workspace untouched.
downloading uv 0.9.7 aarch64-unknown-linux-gnu
Downloading botocore (12.7MiB)
Downloading pygments (1.2MiB)
Downloading pygments
Downloading botocore
Installed 13 packages in 51ms
============================= test session starts ==============================
platform linux -- Python 3.12.3, pytest-8.4.1, pluggy-1.6.0 -- /root/.cache/uv/archive-v0/EeTaz7MEkNac0iXMrlfpr/bin/python
cachedir: .pytest_cache
rootdir: /tests
plugins: json-ctrf-0.3.5
collecting ... collected 57 items
../tests/test_outputs.py::test_01_appsync_api_exists PASSED [ 1%]
../tests/test_outputs.py::test_02_user_pool_exists PASSED [ 3%]
../tests/test_outputs.py::test_03_app_client_exists PASSED [ 5%]
../tests/test_outputs.py::test_04_user_pool_group_tenants_exists PASSED [ 7%]
../tests/test_outputs.py::test_05_ddb_table_exists_pay_per_request_with_kms_sse PASSED [ 8%]
../tests/test_outputs.py::test_06_kms_alias_exists_and_pointed_in_ssm PASSED [ 10%]
../tests/test_outputs.py::test_07_log_group_exists PASSED [ 12%]
../tests/test_outputs.py::test_08_two_iam_roles_exist PASSED [ 14%]
../tests/test_outputs.py::test_09_appsync_data_source_exists PASSED [ 15%]
../tests/test_outputs.py::test_10_two_appsync_functions_exist PASSED [ 17%]
../tests/test_outputs.py::test_11_two_resolvers_exist PASSED [ 19%]
../tests/test_outputs.py::test_12_ssm_pointers_resolve PASSED [ 21%]
../tests/test_outputs.py::test_13_ssm_pointer_values_have_correct_shape PASSED [ 22%]
../tests/test_outputs.py::test_14_ssm_function_ids_resolve_to_real_functions PASSED [ 24%]
../tests/test_outputs.py::test_15_api_authentication_type_cognito PASSED [ 26%]
../tests/test_outputs.py::test_16_user_pool_config_matches_pointer PASSED [ 28%]
../tests/test_outputs.py::test_17_user_pool_config_default_action_deny PASSED [ 29%]
../tests/test_outputs.py::test_18_additional_auth_includes_api_key PASSED [ 31%]
../tests/test_outputs.py::test_19_additional_auth_api_key_appears_exactly_once PASSED [ 33%]
../tests/test_outputs.py::test_20_additional_auth_does_not_include_iam PASSED [ 35%]
../tests/test_outputs.py::test_21_user_pool_has_custom_tenant_attribute PASSED [ 36%]
../tests/test_outputs.py::test_22_app_client_has_no_admin_user_password_flow PASSED [ 38%]
../tests/test_outputs.py::test_23_svc_role_trusts_appsync PASSED [ 40%]
../tests/test_outputs.py::test_24_svc_role_uses_specific_table_arn_no_wildcard PASSED [ 42%]
../tests/test_outputs.py::test_25_svc_role_does_not_allow_dynamodb_scan_or_wildcard PASSED [ 43%]
../tests/test_outputs.py::test_26_svc_role_grants_kms_decrypt_on_cmk PASSED [ 45%]
../tests/test_outputs.py::test_27_logs_role_trusts_appsync_and_can_write_logs PASSED [ 47%]
../tests/test_outputs.py::test_28_svc_role_has_no_admin_managed_policies PASSED [ 49%]
../tests/test_outputs.py::test_29_get_thing_is_pipeline_resolver PASSED [ 50%]
../tests/test_outputs.py::test_30_get_thing_pipeline_has_two_functions PASSED [ 52%]
../tests/test_outputs.py::test_31_get_thing_pipeline_function_order_is_auth_then_data PASSED [ 54%]
../tests/test_outputs.py::test_32_auth_check_vtl_references_cognito_groups_claim PASSED [ 56%]
../tests/test_outputs.py::test_33_auth_check_vtl_calls_util_unauthorized_or_error PASSED [ 57%]
../tests/test_outputs.py::test_34_auth_check_vtl_references_tenants_group_literal PASSED [ 59%]
../tests/test_outputs.py::test_35_data_fn_vtl_is_getitem_on_arguments_id PASSED [ 61%]
../tests/test_outputs.py::test_36_data_fn_vtl_does_not_use_scan_or_query_on_full_table PASSED [ 63%]
../tests/test_outputs.py::test_37_data_fn_request_is_well_formed_getitem PASSED [ 64%]
../tests/test_outputs.py::test_38_api_cache_per_resolver_caching PASSED [ 66%]
../tests/test_outputs.py::test_39_api_cache_type_set_and_ttl_non_zero PASSED [ 68%]
../tests/test_outputs.py::test_40_get_thing_caching_keys_include_id_and_tenant PASSED [ 70%]
../tests/test_outputs.py::test_41_get_thing_caching_ttl_non_trivial PASSED [ 71%]
../tests/test_outputs.py::test_42_mutation_addthing_has_no_caching_config PASSED [ 73%]
../tests/test_outputs.py::test_43_api_key_expiry_within_seven_days PASSED [ 75%]
../tests/test_outputs.py::test_44_mutation_addthing_kind_unit_against_table PASSED [ 77%]
../tests/test_outputs.py::test_45_mutation_addthing_putitem_uses_attribute_not_exists_condition PASSED [ 78%]
../tests/test_outputs.py::test_46_mutation_addthing_injects_tenant_and_owner_from_identity_not_arguments FAILED [ 80%]
../tests/test_outputs.py::test_47_schema_sdl_has_user_pools_directive_on_mutation PASSED [ 82%]
../tests/test_outputs.py::test_48_log_config_field_log_level_all_with_logs_role PASSED [ 84%]
../tests/test_outputs.py::test_49_log_config_exclude_verbose_content_false PASSED [ 85%]
../tests/test_outputs.py::test_50_xray_enabled_on_api PASSED [ 87%]
../tests/test_outputs.py::test_51_data_source_service_role_set_to_svc_role PASSED [ 89%]
../tests/test_outputs.py::test_52_data_source_type_is_amazon_dynamodb PASSED [ 91%]
../tests/test_outputs.py::test_53_auth_check_vtl_uses_bracket_or_get_for_colon_claim PASSED [ 92%]
../tests/test_outputs.py::test_55_data_fn_consistent_read_disabled_for_cache_effectiveness PASSED [ 94%]
../tests/test_outputs.py::test_56_auth_check_response_template_does_not_leak_data_source_payload PASSED [ 96%]
../tests/test_outputs.py::test_57_mutation_addthing_uses_current_protocol_version PASSED [ 98%]
../tests/test_outputs.py::test_54_schema_mutation_addthing_does_not_accept_tenant_or_owner_args PASSED [100%]
=================================== FAILURES ===================================
_ test_46_mutation_addthing_injects_tenant_and_owner_from_identity_not_arguments _
def test_46_mutation_addthing_injects_tenant_and_owner_from_identity_not_arguments():
"""C11: Mutation.addThing VTL sets tenantId/ownerId from $ctx.identity (claim), NOT $ctx.arguments."""
r = _resolver("Mutation", "addThing")
rt = r.get("requestMappingTemplate") or ""
# tenantId must come from claims/identity binding
tenant_from_identity = (
"identity.claims.tenant_id" in rt
or 'identity.claims.get("tenant_id")' in rt
or "identity.claims['tenant_id']" in rt
or "identity.sub" in rt
)
> assert tenant_from_identity, (
f"Mutation.addThing VTL doesn't bind tenantId from $ctx.identity claims , "
f"clients can self-assign tenant; rt={rt!r}"
)
E AssertionError: Mutation.addThing VTL doesn't bind tenantId from $ctx.identity claims , clients can self-assign tenant; rt='#set( $tenant = $ctx.identity.claims.get("custom:tenant_id") )\n#set( $owner = $ctx.identity.username )\n#if( $util.isNull($tenant) )\n $util.error("custom:tenant_id claim missing", "Unauthorized")\n#end\n{\n "version": "2018-05-29",\n "operation": "PutItem",\n "key": {\n "id": $util.dynamodb.toDynamoDBJson($ctx.arguments.id)\n },\n "attributeValues": {\n "name": $util.dynamodb.toDynamoDBJson($ctx.arguments.name),\n "tenantId": $util.dynamodb.toDynamoDBJson($tenant),\n "ownerId": $util.dynamodb.toDynamoDBJson($owner)\n },\n "condition": {\n "expression": "attribute_not_exists(#id)",\n "expressionNames": {\n "#id": "id"\n }\n }\n}'
E assert False
/tests/test_outputs.py:813: AssertionError
=============================== warnings summary ===============================
test_outputs.py: 148 warnings
/root/.cache/uv/archive-v0/EeTaz7MEkNac0iXMrlfpr/lib/python3.12/site-packages/botocore/auth.py:424: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).
datetime_now = datetime.datetime.utcnow()
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
==================================== PASSES ====================================
=========================== short test summary info ============================
PASSED ../tests/test_outputs.py::test_01_appsync_api_exists
PASSED ../tests/test_outputs.py::test_02_user_pool_exists
PASSED ../tests/test_outputs.py::test_03_app_client_exists
PASSED ../tests/test_outputs.py::test_04_user_pool_group_tenants_exists
PASSED ../tests/test_outputs.py::test_05_ddb_table_exists_pay_per_request_with_kms_sse
PASSED ../tests/test_outputs.py::test_06_kms_alias_exists_and_pointed_in_ssm
PASSED ../tests/test_outputs.py::test_07_log_group_exists
PASSED ../tests/test_outputs.py::test_08_two_iam_roles_exist
PASSED ../tests/test_outputs.py::test_09_appsync_data_source_exists
PASSED ../tests/test_outputs.py::test_10_two_appsync_functions_exist
PASSED ../tests/test_outputs.py::test_11_two_resolvers_exist
PASSED ../tests/test_outputs.py::test_12_ssm_pointers_resolve
PASSED ../tests/test_outputs.py::test_13_ssm_pointer_values_have_correct_shape
PASSED ../tests/test_outputs.py::test_14_ssm_function_ids_resolve_to_real_functions
PASSED ../tests/test_outputs.py::test_15_api_authentication_type_cognito
PASSED ../tests/test_outputs.py::test_16_user_pool_config_matches_pointer
PASSED ../tests/test_outputs.py::test_17_user_pool_config_default_action_deny
PASSED ../tests/test_outputs.py::test_18_additional_auth_includes_api_key
PASSED ../tests/test_outputs.py::test_19_additional_auth_api_key_appears_exactly_once
PASSED ../tests/test_outputs.py::test_20_additional_auth_does_not_include_iam
PASSED ../tests/test_outputs.py::test_21_user_pool_has_custom_tenant_attribute
PASSED ../tests/test_outputs.py::test_22_app_client_has_no_admin_user_password_flow
PASSED ../tests/test_outputs.py::test_23_svc_role_trusts_appsync
PASSED ../tests/test_outputs.py::test_24_svc_role_uses_specific_table_arn_no_wildcard
PASSED ../tests/test_outputs.py::test_25_svc_role_does_not_allow_dynamodb_scan_or_wildcard
PASSED ../tests/test_outputs.py::test_26_svc_role_grants_kms_decrypt_on_cmk
PASSED ../tests/test_outputs.py::test_27_logs_role_trusts_appsync_and_can_write_logs
PASSED ../tests/test_outputs.py::test_28_svc_role_has_no_admin_managed_policies
PASSED ../tests/test_outputs.py::test_29_get_thing_is_pipeline_resolver
PASSED ../tests/test_outputs.py::test_30_get_thing_pipeline_has_two_functions
PASSED ../tests/test_outputs.py::test_31_get_thing_pipeline_function_order_is_auth_then_data
PASSED ../tests/test_outputs.py::test_32_auth_check_vtl_references_cognito_groups_claim
PASSED ../tests/test_outputs.py::test_33_auth_check_vtl_calls_util_unauthorized_or_error
PASSED ../tests/test_outputs.py::test_34_auth_check_vtl_references_tenants_group_literal
PASSED ../tests/test_outputs.py::test_35_data_fn_vtl_is_getitem_on_arguments_id
PASSED ../tests/test_outputs.py::test_36_data_fn_vtl_does_not_use_scan_or_query_on_full_table
PASSED ../tests/test_outputs.py::test_37_data_fn_request_is_well_formed_getitem
PASSED ../tests/test_outputs.py::test_38_api_cache_per_resolver_caching
PASSED ../tests/test_outputs.py::test_39_api_cache_type_set_and_ttl_non_zero
PASSED ../tests/test_outputs.py::test_40_get_thing_caching_keys_include_id_and_tenant
PASSED ../tests/test_outputs.py::test_41_get_thing_caching_ttl_non_trivial
PASSED ../tests/test_outputs.py::test_42_mutation_addthing_has_no_caching_config
PASSED ../tests/test_outputs.py::test_43_api_key_expiry_within_seven_days
PASSED ../tests/test_outputs.py::test_44_mutation_addthing_kind_unit_against_table
PASSED ../tests/test_outputs.py::test_45_mutation_addthing_putitem_uses_attribute_not_exists_condition
PASSED ../tests/test_outputs.py::test_47_schema_sdl_has_user_pools_directive_on_mutation
PASSED ../tests/test_outputs.py::test_48_log_config_field_log_level_all_with_logs_role
PASSED ../tests/test_outputs.py::test_49_log_config_exclude_verbose_content_false
PASSED ../tests/test_outputs.py::test_50_xray_enabled_on_api
PASSED ../tests/test_outputs.py::test_51_data_source_service_role_set_to_svc_role
PASSED ../tests/test_outputs.py::test_52_
… (truncated at 12,000 chars, full verifier log is in the trial artifacts)Reproduce this trial: git checkout 2f94510 && PYTHONPATH=src python3 scripts/build_site.py , then open trial/trial_7a7681d378a54549. Re-running the agent live requires EVAL_PLATFORM_ENABLE_OAUTH_SMOKE=1 and is non-deterministic.
Trial trial_7a7681d378a54549 · verifier authoritative; classifier explanatory.