Skip to content

Latest commit

 

History

History
128 lines (92 loc) · 2.57 KB

File metadata and controls

128 lines (92 loc) · 2.57 KB

data-policy service

manage and applies data policies to events

.
├── README.md
├── event.json
├── response.json
├── script
│   ├── create-bucket
│   ├── deploy
│   └── package
├── src
│   ├── __tests__
│   │   └── unit
│   │       └── test-handler.js
│   ├── index.js
│   └── package.json
└── template.yaml

Requirements

Setup process

Building the project

. script/build

By default, this command writes built artifacts to .aws-sam/build folder.

Local development

. script/invoke

Packaging and deployment

If you need to create the bucket for this package...

. script/create-bucket

Run the following command to package our Lambda function to S3:

. script/package

Next, the following command will create a Cloudformation Stack and deploy your SAM resources.

. script/deploy

Testing

  1. put a file on your pod for testing policies
# /data-policy/test-data-policy.json

HTTP PUT /public/test-data-policy.json
content-type: application/json
x-api-key:  xxxx

{
  "type": "test",
  "description": "this object had two fields that should have policies applied, additionalProperty.originalAffiliationDate and additionalProperty.",
  "testdate": "2020-10-21T19:49:01Z"
}
  1. get the file and note the value of "testdate"
HTTP GET /public/test-data-policy.json

{
  "type": "test",
  "description": "this object had two fields that should have policies applied, additionalProperty.originalAffiliationDate and additionalProperty.",
  "testdate": "2020-10-21T19:49:01Z"
}
  1. put a @redact data policy on that field in your pod data-policiy file /public/yodata/data-policy.json
# /data-policy/data-policy.json

HTTP PUT /public/yodata/data-policy.json
content-type: application/json
x-api-key: xxx
{
	"redacttestdate": {
		"effect": "Transform",
		"processor": "Yodata",
		"type": "DataPolicy",
		"value": "{\"testdate\":{\"@redacted\":true}}"
	}
}
  1. get the file again and confirm the value of "testdate" has been redacted
HTTP GET /public/test-data-policy.json

{
  "type": "test",
  "description": "this object had two fields that should have policies applied, additionalProperty.originalAffiliationDate and additionalProperty.",
  "testdate": "@redacted"
}