├── samples ├── data │ ├── media_advertiser │ │ ├── media │ │ │ ├── docs.txt │ │ │ ├── query.sql │ │ │ ├── media_exposures.csv │ │ │ └── media_subscriptions.csv │ │ └── advertisers │ │ │ └── docs.txt │ └── advertiser_publisher_data │ │ ├── publisher │ │ └── publisher.csv │ │ └── advertiser │ │ └── advertiser.csv ├── test_graph │ ├── test_onedepth │ │ ├── old_idea.png │ │ ├── c3_pkg │ │ │ ├── destinations.yaml │ │ │ └── sources.yaml │ │ ├── c2_pkg │ │ │ ├── destinations.yaml │ │ │ ├── transformations.yaml │ │ │ └── sources.yaml │ │ ├── one_depth_graph.png │ │ └── c1_pkg │ │ │ ├── transformations.yaml │ │ │ └── sources.yaml │ └── test_twodepth │ │ ├── old_idea.png │ │ ├── c3_pkg │ │ ├── destinations.yaml │ │ ├── transformations.yaml │ │ └── sources.yaml │ │ ├── c1_pkg │ │ ├── destinations.yaml │ │ ├── transformations.yaml │ │ └── sources.yaml │ │ ├── c2_pkg │ │ ├── destinations.yaml │ │ ├── sources.yaml │ │ └── transformations.yaml │ │ └── two_depth_graph.png └── init_collaboration │ ├── research_pkg │ ├── destinations.yaml │ ├── go_app │ │ ├── go.mod │ │ ├── go.sum │ │ └── main.tpl │ └── transformations.yaml │ ├── airline_pkg │ └── sources.yaml │ └── media_pkg │ └── sources.yaml ├── go.work ├── main.go ├── makefile ├── .github ├── ISSUE_TEMPLATE.md ├── workflows │ ├── test.yml │ ├── CI.yml │ └── semantic_pr.yaml └── PULL_REQUEST_TEMPLATE.md ├── go.work.sum ├── lib ├── collaboration │ ├── address │ │ ├── transformation │ │ │ ├── compile_test.go │ │ │ ├── compile.go │ │ │ └── transformation.go │ │ ├── destination │ │ │ └── destination.go │ │ ├── ref.go │ │ ├── source │ │ │ └── source.go │ │ ├── types.go │ │ ├── topo.go │ │ └── address.go │ ├── config │ │ ├── constants.go │ │ ├── spec.go │ │ └── config.go │ ├── misc.go │ ├── collaboration_test.go │ └── collaboration.go ├── service │ ├── service_test.go │ ├── temp_enclave.json │ ├── service.go │ └── event.go └── utils │ ├── hash.go │ └── misc.go ├── .gitignore ├── go.mod ├── cmd ├── run.go └── root.go ├── CONTRIBUTING.md ├── go.sum ├── GSSoC_GUIDELINES.md ├── README.md ├── CODE_OF_CONDUCT.md └── LICENSE /samples/data/media_advertiser/media/docs.txt: -------------------------------------------------------------------------------- 1 | Media here is the one who will provide ad spots. 2 | -------------------------------------------------------------------------------- /go.work: -------------------------------------------------------------------------------- 1 | go 1.20 2 | 3 | use ( 4 | . 5 | ./samples/init_collaboration/research_pkg/go_app 6 | ) 7 | -------------------------------------------------------------------------------- /main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "github.com/qascade/dcr/cmd" 4 | 5 | func main() { 6 | cmd.Execute() 7 | } 8 | -------------------------------------------------------------------------------- /samples/test_graph/test_onedepth/old_idea.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qascade/dcr/HEAD/samples/test_graph/test_onedepth/old_idea.png -------------------------------------------------------------------------------- /samples/test_graph/test_twodepth/old_idea.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qascade/dcr/HEAD/samples/test_graph/test_twodepth/old_idea.png -------------------------------------------------------------------------------- /samples/data/media_advertiser/advertisers/docs.txt: -------------------------------------------------------------------------------- 1 | Advertisers advertised their product on media platform. For them conversion means product sales. -------------------------------------------------------------------------------- /samples/test_graph/test_onedepth/c3_pkg/destinations.yaml: -------------------------------------------------------------------------------- 1 | collaborator: c3 2 | destinations: 3 | - name: d1 4 | ref: /c2/transformation/t1 -------------------------------------------------------------------------------- /samples/test_graph/test_twodepth/c3_pkg/destinations.yaml: -------------------------------------------------------------------------------- 1 | collaborator: c3 2 | destinations: 3 | - name: d1 4 | ref: /c2/transformation/t1 -------------------------------------------------------------------------------- /samples/test_graph/test_onedepth/c2_pkg/destinations.yaml: -------------------------------------------------------------------------------- 1 | collaborator: c2 2 | destinations: 3 | - name: d1 4 | ref: /c1/transformation/t1 5 | -------------------------------------------------------------------------------- /samples/test_graph/test_onedepth/one_depth_graph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qascade/dcr/HEAD/samples/test_graph/test_onedepth/one_depth_graph.png -------------------------------------------------------------------------------- /samples/test_graph/test_twodepth/c1_pkg/destinations.yaml: -------------------------------------------------------------------------------- 1 | collaborator: c1 2 | destinations: 3 | - name: d1 4 | ref: /c3/transformation/t1 5 | -------------------------------------------------------------------------------- /samples/test_graph/test_twodepth/c2_pkg/destinations.yaml: -------------------------------------------------------------------------------- 1 | collaborator: c2 2 | destinations: 3 | - name: d1 4 | ref: /c1/transformation/t1 5 | -------------------------------------------------------------------------------- /samples/test_graph/test_twodepth/two_depth_graph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qascade/dcr/HEAD/samples/test_graph/test_twodepth/two_depth_graph.png -------------------------------------------------------------------------------- /makefile: -------------------------------------------------------------------------------- 1 | build: 2 | go build -o bin/dcr 3 | tidy: 4 | go mod tidy 5 | vendor: 6 | go mod vendor 7 | fmt: 8 | go fmt ./... 9 | test: build 10 | go test ./... -------------------------------------------------------------------------------- /samples/init_collaboration/research_pkg/destinations.yaml: -------------------------------------------------------------------------------- 1 | collaborator: Research 2 | destinations: 3 | - name: customer_overlap_count 4 | ref: /Research/transformation/private_total_customers -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## Description 2 | Add description of issue here. 3 | 4 | ## Screenshots 5 | Put any screenshot(s) here. 6 | 7 | ## Are you raising this PR under GSSoC'23? 8 | Yes/No 9 | 10 | ## How are you planning to resolve on this issue? 11 | Introducing few code changes 12 | 13 | 14 | -------------------------------------------------------------------------------- /samples/init_collaboration/research_pkg/go_app/go.mod: -------------------------------------------------------------------------------- 1 | module collab1/private_count 2 | 3 | go 1.20 4 | 5 | require github.com/google/differential-privacy/go/v2 v2.1.0 6 | 7 | require ( 8 | github.com/golang/glog v1.1.1 // indirect 9 | golang.org/x/exp v0.0.0-20230321023759-10a507213a29 // indirect 10 | gonum.org/v1/gonum v0.12.0 // indirect 11 | ) 12 | -------------------------------------------------------------------------------- /go.work.sum: -------------------------------------------------------------------------------- 1 | github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= 2 | github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= 3 | github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= 4 | golang.org/x/sys v0.1.0 h1:kunALQeHf1/185U1i0GOB/fy1IPRDDpuoOOqRReG57U= 5 | golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 6 | -------------------------------------------------------------------------------- /samples/test_graph/test_onedepth/c1_pkg/transformations.yaml: -------------------------------------------------------------------------------- 1 | collaborator: c1 2 | transformations: 3 | - name: t1 # research/tranformation/private_total_count/output 4 | type: go_code 5 | from: 6 | - name: c3_s1_alias 7 | ref: /c3/source/s1 8 | - name: c2_t1_alias 9 | ref: /c2/transformation/t1 10 | noise_parameters: 11 | - epsilon 12 | - delta 13 | destination_owners_allowed: 14 | - c2 -------------------------------------------------------------------------------- /samples/test_graph/test_twodepth/c1_pkg/transformations.yaml: -------------------------------------------------------------------------------- 1 | collaborator: c1 2 | transformations: 3 | - name: t1 # research/tranformation/private_total_count/output 4 | type: go_code 5 | from: 6 | - name: c3_s1_alias 7 | ref: /c3/source/s1 8 | - name: c2_t1_alias 9 | ref: /c2/transformation/t1 10 | noise_parameters: 11 | - epsilon 12 | - delta 13 | destination_owners_allowed: 14 | - c2 -------------------------------------------------------------------------------- /samples/test_graph/test_twodepth/c3_pkg/transformations.yaml: -------------------------------------------------------------------------------- 1 | collaborator: c3 2 | transformations: 3 | - name: t1 # research/tranformation/private_total_count/output 4 | type: go_code 5 | from: 6 | - name: c1_t1_alias 7 | ref: /c1/transformation/t1 8 | - name: c2_t1_alias 9 | ref: /c2/transformation/t1 10 | noise_parameters: 11 | - epsilon 12 | - delta 13 | destination_owners_allowed: 14 | - c1 -------------------------------------------------------------------------------- /samples/test_graph/test_onedepth/c1_pkg/sources.yaml: -------------------------------------------------------------------------------- 1 | collaborator: c1 2 | sources: 3 | - name: s1 4 | csv_location: c1_s1_loc 5 | description: table having data for c1/s1 6 | columns: 7 | - name: col1 8 | type: string 9 | masking_type: sha256 10 | transformation_owners_allowed: 11 | - c2 12 | destinations_allowed: 13 | - ref: /c3/destination/d1 14 | noise_parameters: 15 | - epsilon: ln3 16 | - delta: 1e-4 -------------------------------------------------------------------------------- /samples/test_graph/test_twodepth/c1_pkg/sources.yaml: -------------------------------------------------------------------------------- 1 | collaborator: c1 2 | sources: 3 | - name: s1 4 | csv_location: c1_s1_loc 5 | description: table having data for c1/s1 6 | columns: 7 | - name: col1 8 | type: string 9 | masking_type: sha256 10 | transformation_owners_allowed: 11 | - c2 12 | destinations_allowed: 13 | - ref: /c3/destination/d1 14 | noise_parameters: 15 | - epsilon: ln3 16 | - delta: 1e-4 -------------------------------------------------------------------------------- /samples/test_graph/test_onedepth/c2_pkg/transformations.yaml: -------------------------------------------------------------------------------- 1 | collaborator: c2 2 | transformations: 3 | - name: t1 # research/tranformation/private_total_count/output 4 | type: go_code 5 | from: 6 | - name: c1_s1_alias 7 | ref: /c1/source/s1 8 | - name: c2_s1_alias 9 | ref: /c2/source/s1 10 | - name: c3_s1_alias 11 | ref: /c3/source/s1 12 | noise_parameters: 13 | - epsilon 14 | - delta 15 | destination_owners_allowed: 16 | - c3 -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: Go 2 | 3 | on: 4 | push: 5 | branches: [ "main", "feat.*" ] 6 | pull_request: 7 | branches: [ "main", "feat.*" ] 8 | 9 | jobs: 10 | 11 | build: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - uses: actions/checkout@v3 15 | 16 | - name: Set up Go 17 | uses: actions/setup-go@v3 18 | with: 19 | go-version: 1.19 20 | 21 | - name: Build 22 | run: go build -v ./... 23 | 24 | - name: Test 25 | run: go test -v ./... 26 | -------------------------------------------------------------------------------- /lib/collaboration/address/transformation/compile_test.go: -------------------------------------------------------------------------------- 1 | package transformation 2 | 3 | import ( 4 | "fmt" 5 | "testing" 6 | 7 | "github.com/flosch/pongo2/v6" 8 | "github.com/stretchr/testify/require" 9 | ) 10 | 11 | func TestCompile(t *testing.T) { 12 | template := `{{hello}} {{world}}` 13 | context := pongo2.Context{ 14 | "hello": "Hello", 15 | "world": "World", 16 | } 17 | compilation, err := ExecuteSqlTemplate(template, context) 18 | fmt.Println(compilation) 19 | require.NoError(t, err) 20 | } 21 | -------------------------------------------------------------------------------- /lib/service/service_test.go: -------------------------------------------------------------------------------- 1 | package service 2 | 3 | // Have to disable this test because there is no CI on Github actions to test this. 4 | // Uncomment to test locally. 5 | 6 | import ( 7 | // "github.com/stretchr/testify/require" 8 | "testing" 9 | ) 10 | 11 | func TestService(t *testing.T) { 12 | // testPkgPath := "../../samples/init_collaboration" 13 | // service, err := NewService(testPkgPath) 14 | // require.NoError(t, err) 15 | 16 | // err = service.Run() 17 | // require.NoError(t, err) 18 | } 19 | -------------------------------------------------------------------------------- /samples/test_graph/test_onedepth/c2_pkg/sources.yaml: -------------------------------------------------------------------------------- 1 | collaborator: c2 #name of collaborator 2 | sources: 3 | - name: s1 4 | csv_location: c2_s1_loc 5 | description: table having data for c2_s1 6 | columns: 7 | - name: col1 8 | type: string 9 | masking_type: sha256 10 | transformation_owners_allowed: 11 | - c1 12 | destinations_allowed: 13 | - ref: /c3/destination/d1 14 | noise_parameters: 15 | - epsilon: ln3 16 | - delta: 1e-5 -------------------------------------------------------------------------------- /samples/test_graph/test_twodepth/c2_pkg/sources.yaml: -------------------------------------------------------------------------------- 1 | collaborator: c2 #name of collaborator 2 | sources: 3 | - name: s1 4 | csv_location: c2_s1_loc 5 | description: table having data for c2_s1 6 | columns: 7 | - name: col1 8 | type: string 9 | masking_type: sha256 10 | transformation_owners_allowed: 11 | - c1 12 | destinations_allowed: 13 | - ref: /c3/destination/d1 14 | noise_parameters: 15 | - epsilon: ln3 16 | - delta: 1e-5 -------------------------------------------------------------------------------- /lib/service/temp_enclave.json: -------------------------------------------------------------------------------- 1 | { 2 | "exe": "main", 3 | "key": "private.pem", 4 | "debug": true, 5 | "heapSize": 512, 6 | "executableHeap": false, 7 | "productID": 1, 8 | "securityVersion": 1, 9 | "mounts": null, 10 | "env": null, 11 | "files": [ 12 | { 13 | "source": "./test1.csv", 14 | "target": "./test1.csv" 15 | }, 16 | { 17 | "source": "./test2.csv", 18 | "target": "./test2.csv" 19 | } 20 | ] 21 | } -------------------------------------------------------------------------------- /samples/test_graph/test_twodepth/c2_pkg/transformations.yaml: -------------------------------------------------------------------------------- 1 | collaborator: c2 2 | transformations: 3 | - name: t1 # research/tranformation/private_total_count/output 4 | type: go_code 5 | from: 6 | - name: c1_s1_alias 7 | ref: /c1/source/s1 8 | - name: c2_s1_alias 9 | ref: /c2/source/s1 10 | - name: c3_s1_alias 11 | ref: /c3/source/s1 12 | noise_parameters: 13 | - epsilon 14 | - delta 15 | destination_owners_allowed: 16 | - c1 17 | - c2 18 | - c3 -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Binaries for programs and plugins 2 | *.exe 3 | *.exe~ 4 | *.dll 5 | *.so 6 | *.dylib 7 | .vscode 8 | .idea 9 | 10 | dcr 11 | bin/ 12 | samples/*/*/go_app/*.go 13 | samples/*/*/go_app/main 14 | results.txt 15 | samples/*/*/results.txt 16 | samples/*/*/go_app/enclave.json 17 | samples/*/*/go_app/private.pem 18 | samples/*/*/go_app/pubic.pem 19 | 20 | # Test binary, built with `go test -c` 21 | *.test 22 | 23 | # Output of the go coverage tool, specifically when used with LiteIDE 24 | *.out 25 | 26 | # Dependency directories (remove the comment below to include it) 27 | # vendor/ 28 | *.env 29 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/qascade/dcr 2 | 3 | go 1.19 4 | 5 | require ( 6 | github.com/edwingeng/deque v1.0.3 7 | github.com/flosch/pongo2/v6 v6.0.0 8 | github.com/sirupsen/logrus v1.9.0 9 | github.com/spf13/cobra v1.6.1 10 | github.com/stretchr/testify v1.8.2 11 | gopkg.in/yaml.v3 v3.0.1 12 | ) 13 | 14 | require ( 15 | github.com/davecgh/go-spew v1.1.1 // indirect 16 | github.com/inconshreveable/mousetrap v1.1.0 // indirect 17 | github.com/pmezard/go-difflib v1.0.0 // indirect 18 | github.com/spf13/pflag v1.0.5 // indirect 19 | golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 // indirect 20 | ) 21 | -------------------------------------------------------------------------------- /lib/collaboration/config/constants.go: -------------------------------------------------------------------------------- 1 | package config 2 | 3 | type WarehouseType string 4 | type QueryType string 5 | type MaskingType string 6 | type SpecType string 7 | 8 | const ( 9 | SnowFlake WarehouseType = "snowflake" 10 | BigQuery WarehouseType = "bigquery" 11 | ) 12 | 13 | const ( 14 | Select QueryType = "select" 15 | ) 16 | 17 | const ( 18 | SHA256 MaskingType = "sha256" 19 | ) 20 | 21 | const ( 22 | CollaborationSpecType SpecType = "collaboration_spec" 23 | SourceSpecType SpecType = "source_spec" 24 | TransformationSpecType SpecType = "transformation_spec" 25 | DestinationSpecType SpecType = "destination_spec" 26 | ) 27 | -------------------------------------------------------------------------------- /samples/test_graph/test_onedepth/c3_pkg/sources.yaml: -------------------------------------------------------------------------------- 1 | collaborator: c3 #name of collaborator 2 | sources: 3 | - name: s1 4 | csv_location: c3_s1_loc 5 | description: table having data for c3_s1 6 | columns: 7 | - name: col1 8 | type: string 9 | transformation_owners_allowed: # who is allowed to use this source in transformation 10 | - c2 11 | - c1 12 | destinations_allowed: 13 | - ref: /c3/destination/d1 14 | noise_parameters: 15 | - epsilon: ln3 16 | - delta: 1e-5 17 | - ref: /c2/destination/d1 18 | noise_parameters: 19 | - epsilon: ln3 20 | - delta: 1e-5 -------------------------------------------------------------------------------- /samples/test_graph/test_twodepth/c3_pkg/sources.yaml: -------------------------------------------------------------------------------- 1 | collaborator: c3 #name of collaborator 2 | sources: 3 | - name: s1 4 | csv_location: c3_s1_loc 5 | description: table having data for c3_s1 6 | columns: 7 | - name: col1 8 | type: string 9 | transformation_owners_allowed: # who is allowed to use this source in transformation 10 | - c2 11 | - c1 12 | destinations_allowed: 13 | - ref: /c3/destination/d1 14 | noise_parameters: 15 | - epsilon: ln3 16 | - delta: 1e-5 17 | - ref: /c2/destination/d1 18 | noise_parameters: 19 | - epsilon: ln3 20 | - delta: 1e-5c -------------------------------------------------------------------------------- /.github/workflows/CI.yml: -------------------------------------------------------------------------------- 1 | #CI Workflow file to enforce gofmt style. 2 | name: CI 3 | on: 4 | push: 5 | branches: [ main, feat.* ] 6 | pull_request: 7 | branches: [ main, feat.* ] 8 | jobs: 9 | gofmt-lint: 10 | strategy: 11 | matrix: 12 | go-version: [ 1.19.x ] 13 | os: [ ubuntu-latest ] 14 | runs-on: ${{ matrix.os }} 15 | steps: 16 | - name: Install Go 17 | uses: actions/setup-go@v2 18 | with: 19 | go-version: ${{ matrix.go-version }} 20 | - name: Checkout code 21 | uses: actions/checkout@v2 22 | - name: Format 23 | run: if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then exit 1; fi 24 | if: matrix.os == 'ubuntu-latest' 25 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## Description 2 | 3 | ## Related Issue 4 | - Info about Issue or bug 5 | 6 | Closes: #[issue_no] 7 | 8 | ### Describe the changes you've made 9 | few code changes are done 10 | 11 | ### Checklist: 12 | 16 | - [x] My code follows the style guidelines of this project. 17 | - [x] I have performed a self-review of my own code. 18 | - [x] I have commented my code, particularly in hard-to-understand areas. 19 | - [x] Does this code have any breaking changes? 20 | - [x] Does this code have any yaml schema changes? 21 | 22 | ### Screenshots 23 | Put any screenshot(s) of the project here. 24 | -------------------------------------------------------------------------------- /samples/init_collaboration/research_pkg/transformations.yaml: -------------------------------------------------------------------------------- 1 | collaborator: Research 2 | transformations: 3 | - name: private_total_customers # /Research/tranformation/private_total_customers 4 | type: go_code 5 | app_location: ./go_app 6 | unique_id: EMAIL 7 | from: 8 | - name: table1 9 | ref: /Airline/source/Airline_customers 10 | location_tag: csvLocation1 11 | - name: table2 12 | ref: /Media/source/Media_customers 13 | location_tag: csvLocation2 14 | noise_parameters: 15 | - noiseType 16 | - epsilon 17 | - maxPartitionsPerUser 18 | destination_owners_allowed: # who is allowed to send its sources for this transformation 19 | - Media -------------------------------------------------------------------------------- /lib/collaboration/address/transformation/compile.go: -------------------------------------------------------------------------------- 1 | package transformation 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | 7 | "github.com/flosch/pongo2/v6" 8 | log "github.com/sirupsen/logrus" 9 | ) 10 | 11 | func init() { 12 | log.SetLevel(log.DebugLevel) 13 | log.SetOutput(os.Stdout) 14 | } 15 | 16 | func ExecuteSqlTemplate(template string, pongoCtx pongo2.Context) (sqlString string, err error) { 17 | tpl, err := pongo2.FromString(template) 18 | if err != nil { 19 | err = fmt.Errorf("generating sql template: %w", err) 20 | log.Error(err) 21 | return sqlString, err 22 | } 23 | 24 | sqlString, err = tpl.Execute(pongoCtx) 25 | if err != nil { 26 | err = fmt.Errorf("executing sql template: %w", err) 27 | log.Error(err) 28 | return sqlString, err 29 | } 30 | return sqlString, nil 31 | } 32 | -------------------------------------------------------------------------------- /samples/init_collaboration/research_pkg/go_app/go.sum: -------------------------------------------------------------------------------- 1 | github.com/golang/glog v1.1.1 h1:jxpi2eWoU84wbX9iIEyAeeoac3FLuifZpY9tcNUD9kw= 2 | github.com/golang/glog v1.1.1/go.mod h1:zR+okUeTbrL6EL3xHUDxZuEtGv04p5shwip1+mL/rLQ= 3 | github.com/google/differential-privacy/go/v2 v2.1.0 h1:v3hCOAaUMnY7Fkk+osv3cgMXUAFqaI2l8agICV6IJl4= 4 | github.com/google/differential-privacy/go/v2 v2.1.0/go.mod h1:KRaNc5O0mzJ6cBC3iJbQNk9OHTzRLdmp1IXMaFlOxt8= 5 | github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= 6 | golang.org/x/exp v0.0.0-20230321023759-10a507213a29 h1:ooxPy7fPvB4kwsA2h+iBNHkAbp/4JxTSwCmvdjEYmug= 7 | golang.org/x/exp v0.0.0-20230321023759-10a507213a29/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= 8 | gonum.org/v1/gonum v0.12.0 h1:xKuo6hzt+gMav00meVPUlXwSdoEJP46BR+wdxQEFK2o= 9 | gonum.org/v1/gonum v0.12.0/go.mod h1:73TDxJfAAHeA8Mk9mf8NlIppyhQNo5GLTcYeqgo2lvY= 10 | -------------------------------------------------------------------------------- /samples/data/advertiser_publisher_data/publisher/publisher.csv: -------------------------------------------------------------------------------- 1 | Customer ID,First Name,Last Name,Email Address,Phone Number,City,State,Country 2 | 10001,John,Doe,john.doe@example.com,(123) 456-7890,New York,NY,USA 3 | 10002,Jane,Doe,jane.doe@example.com,(234) 567-8901,Los Angeles,CA,USA 4 | 10003,David,Smith,david.smith@example.com,(345) 678-9012,Chicago,IL,USA 5 | 10004,Emily,Jones,emily.jones@example.com,(456) 789-0123,Miami,FL,USA 6 | 10005,Michael,Ng,michael.ng@example.com,(567) 890-1234,San Francisco,CA,USA 7 | 10006,Sarah,Johnson,sarah.johnson@example.com,(678) 901-2345,Boston,MA,USA 8 | 10007,Chris,Wilson,chris.wilson@example.com,(789) 012-3456,Seattle,WA,USA 9 | 10008,Emma,Johnson,emma.johnson@example.com,(890) 123-4567,Miami,FL,USA 10 | 10009,Grace,Kim,grace.kim@example.com,(901) 234-5678,Los Angeles,CA,USA 11 | 10010,Michael,Wang,michael.wang@example.com,(012) 345-6789,San Francisco,CA,USA 12 | 10011,Alex,Parker,alex.parker@example.com,(123) 456-7890,Chicago,IL,USA 13 | -------------------------------------------------------------------------------- /lib/collaboration/address/destination/destination.go: -------------------------------------------------------------------------------- 1 | // This package will have all the different types of destinations 2 | package destination 3 | 4 | import ( 5 | log "github.com/sirupsen/logrus" 6 | "os" 7 | 8 | "github.com/qascade/dcr/lib/collaboration/config" 9 | ) 10 | 11 | // All Destination types must implement this interface 12 | func init() { 13 | log.SetLevel(log.DebugLevel) 14 | log.SetOutput(os.Stdout) 15 | } 16 | 17 | type Destination interface { 18 | GetTransformationRef() string 19 | } 20 | 21 | type LocalDestination struct { 22 | CollaboratorName string 23 | DestinationName string 24 | transformationRef string 25 | } 26 | 27 | func NewLocalDestination(cName string, dSpec config.DestinationSpec) Destination { 28 | return &LocalDestination{ 29 | CollaboratorName: cName, 30 | DestinationName: dSpec.Name, 31 | transformationRef: dSpec.Ref, 32 | } 33 | } 34 | 35 | func (ld *LocalDestination) GetTransformationRef() string { 36 | return ld.transformationRef 37 | } 38 | -------------------------------------------------------------------------------- /cmd/run.go: -------------------------------------------------------------------------------- 1 | package cmd 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/qascade/dcr/lib/service" 7 | "github.com/spf13/cobra" 8 | ) 9 | 10 | var ( 11 | pkgPath string 12 | ) 13 | 14 | // runCmd represents the run command 15 | // dcr run -p 16 | var runCmd = &cobra.Command{ 17 | Use: "run", 18 | Short: "Run Transformation and Destination", 19 | Long: `CLI Command to run mentioned transformation and destination`, 20 | RunE: func(cmd *cobra.Command, args []string) error { 21 | pkgPath := cmd.Flag("pkgpath").Value.String() 22 | service, err := service.NewService(pkgPath) 23 | if err != nil { 24 | err = fmt.Errorf("err creating new service with package path: %s", pkgPath) 25 | return err 26 | } 27 | err = service.Run() 28 | if err != nil { 29 | err := fmt.Errorf("err running service: %s", err) 30 | return err 31 | } 32 | return nil 33 | }, 34 | } 35 | 36 | func init() { 37 | rootCmd.AddCommand(runCmd) 38 | runCmd.Flags().StringP("pkgpath", "p", "", "reference of the destination") 39 | } 40 | -------------------------------------------------------------------------------- /lib/utils/hash.go: -------------------------------------------------------------------------------- 1 | package utils 2 | 3 | import ( 4 | "crypto/sha256" 5 | "fmt" 6 | "sort" 7 | "strconv" 8 | ) 9 | 10 | func HashBool(b bool) string { 11 | return HashString(strconv.FormatBool(b)) 12 | } 13 | 14 | func HashInt(i int) string { 15 | return HashString(strconv.Itoa(i)) 16 | } 17 | 18 | func HashString(str string) string { 19 | return HashBytes([]byte(str)) 20 | } 21 | 22 | func HashBytes(data []byte) string { 23 | hash := sha256.Sum256(data) 24 | return fmt.Sprintf("%x", hash[:])[0:8] 25 | } 26 | 27 | func HashStringMap(stringMap map[string]string) string { 28 | h := sha256.New() 29 | keys := make([]string, len(stringMap)) 30 | i := 0 31 | for k := range stringMap { 32 | keys[i] = k 33 | i += 1 34 | } 35 | sort.Strings(keys) 36 | for _, k := range keys { 37 | h.Write([]byte(k)) 38 | h.Write([]byte(stringMap[k])) 39 | } 40 | sum := h.Sum(nil) 41 | hashStr := fmt.Sprintf("%x", sum)[0:8] 42 | return hashStr 43 | } 44 | 45 | func HashUnorderedStringList(stringList []string) string { 46 | sort.Strings(stringList) 47 | return HashOrderedStringList(stringList) 48 | } 49 | 50 | func HashOrderedStringList(stringList []string) string { 51 | h := sha256.New() 52 | for _, s := range stringList { 53 | h.Write([]byte(s)) 54 | } 55 | sum := h.Sum(nil) 56 | hashStr := fmt.Sprintf("%x", sum)[0:8] 57 | return hashStr 58 | } 59 | -------------------------------------------------------------------------------- /samples/data/media_advertiser/media/query.sql: -------------------------------------------------------------------------------- 1 | # common customer count 2 | select count(distinct email) from media_customers as m join ad_customers as a on a.email = m.email 3 | 4 | select count({{}}) from {{table1}} as {{}} join {{table2}} as {{}} on {{}} = {{}} 5 | 6 | 7 | 8 | # advertiser 9 | select media_exposures.campaign, count(*) as impressions, count(distinct ad_conversions.email) as conversions from media_exposures left join ad_conversions on media.email = ad.email 10 | CTR = no. of conversions/impressions 11 | 12 | # media 13 | # join exposures, media_customers and conversions, their own user base better 14 | # purchasing power of their customers across different age groups.. 15 | 16 | # given that the customer who bought some product is our subscriber, which type of ad_campaign generated the best revenue for the advertisers. 17 | 18 | 19 | # PoC1 20 | Advertisers Postgres Container 21 | Media Postgres Container 22 | Intel SGX Edgeless DB Instance -> Result + Noise(To make private) 23 | 24 | #PoC2 25 | Advertisers and Media have separate snowflake accounts on same cloud provider . 26 | We will generate the data loading/giving privelege/data sharing sql. 27 | We will give udfs for query matching/query validation/query running along with privacy measures 28 | Results will be visible to whoever is eligible according to contract 29 | 30 | 31 | -------------------------------------------------------------------------------- /lib/collaboration/misc.go: -------------------------------------------------------------------------------- 1 | package collaboration 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | 7 | log "github.com/sirupsen/logrus" 8 | 9 | "github.com/qascade/dcr/lib/collaboration/address" 10 | ) 11 | 12 | func init() { 13 | log.SetLevel(log.DebugLevel) 14 | log.SetOutput(os.Stdout) 15 | } 16 | 17 | func (c *Collaboration) DeRefSource(ref address.AddressRef) (address.DcrAddress, error) { 18 | if add, ok := c.AddressGraph.CachedSources[ref]; ok { 19 | return add, nil 20 | } 21 | return nil, fmt.Errorf("source address not found. %s", ref) 22 | } 23 | 24 | func (c *Collaboration) DeRefTransformation(ref address.AddressRef) (address.DcrAddress, error) { 25 | if add, ok := c.AddressGraph.CachedTransformations[ref]; ok { 26 | return add, nil 27 | } 28 | return nil, fmt.Errorf("transformation address not found. %s", ref) 29 | } 30 | 31 | func (c *Collaboration) DeRefDestination(ref address.AddressRef) (address.DcrAddress, error) { 32 | if add, ok := c.AddressGraph.CachedDestinations[ref]; ok { 33 | return add, nil 34 | } 35 | return nil, fmt.Errorf("transformation address not found. %s", ref) 36 | } 37 | 38 | // This function returns the path, where to put the destination result. 39 | func (c *Collaboration) GetOutputPath(destOwner address.AddressRef) (string, error) { 40 | owner := string(destOwner) 41 | owner = owner[1:] 42 | pkgInfo, ok := c.collaborationConfig.PackagesInfo[owner] 43 | if !ok { 44 | err := fmt.Errorf("collaborator with name: %s does not exist", owner) 45 | log.Error(err) 46 | return "", err 47 | } 48 | return pkgInfo.PkgPath, nil 49 | } 50 | -------------------------------------------------------------------------------- /samples/init_collaboration/airline_pkg/sources.yaml: -------------------------------------------------------------------------------- 1 | collaborator: Airline #name of collaborator 2 | sources: 3 | - name: Airline_customers 4 | csv_location: ./airline_customers.csv 5 | description: table having data for airline customers 6 | columns: 7 | - name: email 8 | type: string 9 | masking_type: sha256 10 | selectable: false # can you run select query on this col 11 | aggregates_allowed: # no other aggregates are to be allowed. 12 | - private_count 13 | - private_count_distinct 14 | join_key: true # can this column be used as a join_key 15 | - name: phone_number # if aggregates_allowed not mentioned assume aggregates not allowed. 16 | type: string 17 | masking_type: sha256 18 | selectable: false 19 | join_key: true 20 | - name: zip 21 | type: string 22 | making_type: none 23 | selectable: true 24 | aggregates_allowed: 25 | - count 26 | join_key: false 27 | - name: pets 28 | type: string 29 | masking_type: none 30 | aggregates_allowed: 31 | - count 32 | selectable: true 33 | join_key: true 34 | transformation_owners_allowed: # who is allowed to write transformations on my sources. 35 | - Research 36 | - Media 37 | destinations_allowed: 38 | - ref: /Research/destination/customer_overlap_count 39 | noise_parameters: 40 | - noiseType: Laplace 41 | - epsilon: math.Log(2) 42 | - maxPartitionPerUser: 1 -------------------------------------------------------------------------------- /samples/init_collaboration/media_pkg/sources.yaml: -------------------------------------------------------------------------------- 1 | collaborator: Media #name of collaborator 2 | sources: 3 | - name: Media_customers 4 | csv_location: ./media_customers.csv 5 | description: table having data for media customer 6 | columns: 7 | - name: email 8 | type: string 9 | masking_type: sha256 10 | selectable: true # can you run select query on this col 11 | aggregates_allowed: # no other aggregates are to be allowed. 12 | - private_count 13 | - private_count_distinct 14 | join_key: true # can this column be used as a join_key 15 | - name: phone_number # if aggregates_allowed not mentioned assume aggregates not allowed. 16 | type: string 17 | masking_type: sha256 18 | selectable: false 19 | join_key: true 20 | - name: zip 21 | type: string 22 | selectable: true 23 | aggregates_allowed: 24 | - count 25 | masking_type: none 26 | join_key: false 27 | - name: age_band 28 | type: number 29 | masking_type: none 30 | aggregates_allowed: 31 | - private_avg 32 | - std_dev 33 | selectable: true 34 | join_key: false 35 | transformation_owners_allowed: # who is allowed to use this source in transformation 36 | - Research 37 | destinations_allowed: 38 | - ref: /Research/destination/customer_overlap_count 39 | noise_parameters: 40 | - noiseType: Laplace 41 | - epsilon: math.Log(2) 42 | - maxPartitionsPerUser: 1 -------------------------------------------------------------------------------- /samples/data/advertiser_publisher_data/advertiser/advertiser.csv: -------------------------------------------------------------------------------- 1 | Customer ID,First Name,Last Name,Email Address,Phone Number,Number of Purchases,Page Visited,Time Spent on Page (in seconds),Age Range,Marital Status,Children Status,Education Level,Occupation 2 | 20001,John,Smith,john.smith@example.com,(123) 456-7890,3,Homepage,60,25-34,Single,No Children,College Graduate,Professional 3 | 20002,Jane,Doe,jane.doe@example.com,(234) 567-8901,2,Product Page,90,18-24,Single,No Children,High School Graduate,Student 4 | 20003,Mark,Johnson,mark.johnson@example.com,(345) 678-9012,5,Contact Us,15,35-44,Married,Has Children,Graduate Degree,Professional 5 | 20004,Emily,Jones,emily.jones@example.com,(456) 789-0123,1,FAQ,15,25-34,Single,No Children,College Graduate,Professional 6 | 20005,David,Lee,david.lee@example.com,(567) 890-1234,2,Homepage,30,35-44,Married,Has Children,College Graduate,Service 7 | 20006,Sarah,Johnson,sarah.johnson@example.com,(678) 901-2345,4,Homepage,60,25-34,Single,No Children,High School Graduate,Service 8 | 20007,Chris,Green,chris.green@example.com,(789) 012-3456,1,Homepage,30,45-54,Married,Has Children,High School Graduate,Service 9 | 20008,Emma,Johnson,emma.johnson@example.com,(890) 123-4567,1,Product Page,45,18-24,Single,No Children,High School Graduate,Student 10 | 20009,Lisa,Wang,lisa.wang@example.com,(901) 234-5678,3,About Us,45,35-44,Married,Has Children,College Graduate,Professional 11 | 20010,Ryan,Chen,ryan.chen@example.com,(012) 345-6789,2,FAQ,30,25-34,Married,Has Children,College Graduate,Service 12 | 20011,Alex,Parker,alex.parker@example.com,(123) 456-7890,4,About Us,30,25-34,Married,Has Children,College Graduate,Professional 13 | -------------------------------------------------------------------------------- /lib/collaboration/address/ref.go: -------------------------------------------------------------------------------- 1 | package address 2 | 3 | import ( 4 | "os" 5 | "strings" 6 | 7 | log "github.com/sirupsen/logrus" 8 | ) 9 | 10 | func init() { 11 | log.SetLevel(log.DebugLevel) 12 | log.SetOutput(os.Stdout) 13 | } 14 | 15 | // AddressRef structure: 16 | // //// 17 | // : will not come into play until we enter support multiple collaborations at the same time. 18 | // : _HASH 19 | type AddressRef string 20 | 21 | func (a AddressRef) IsSource() bool { 22 | return strings.Contains(string(a), string(ADDRESS_TYPE_SOURCE)) 23 | } 24 | 25 | func (a AddressRef) IsTransformation() bool { 26 | return strings.Contains(string(a), string(ADDRESS_TYPE_TRANSFORMATION)) 27 | } 28 | 29 | func (a AddressRef) IsDestination() bool { 30 | return strings.Contains(string(a), string(ADDRESS_TYPE_DESTINATION)) 31 | } 32 | 33 | func (a AddressRef) Collaborator() AddressRef { 34 | s := strings.Split(string(a), "/") 35 | return AddressRef("/" + s[1]) 36 | } 37 | 38 | func (a AddressType) Name() string { 39 | s := strings.Split(string(a), "/") 40 | return s[2] 41 | } 42 | 43 | // This function will take in the name of the address and the name of the collaborator and return the absolute addressRef 44 | func Abs(addressName string, collaboratorName string, addType AddressType) AddressRef { 45 | return AddressRef(ADDRESS_TYPE_ROOT) + AddressRef(collaboratorName) + AddressRef("/") + AddressRef(addType) + AddressRef(addressName) 46 | } 47 | 48 | func NewCollaboratorRef(collaboratorName string) AddressRef { 49 | return AddressRef(ADDRESS_TYPE_ROOT) + AddressRef(collaboratorName) 50 | } 51 | -------------------------------------------------------------------------------- /cmd/root.go: -------------------------------------------------------------------------------- 1 | package cmd 2 | 3 | import ( 4 | "os" 5 | 6 | "github.com/spf13/cobra" 7 | ) 8 | 9 | // rootCmd represents the base command when called without any subcommands 10 | var rootCmd = &cobra.Command{ 11 | Use: "dcr", 12 | Short: "CLI tool for clean room service", 13 | Long: `This tool is used to orchestrate clean room services based on a PoC framework that, 14 | lets you build data clean room services.A data clean room is a secure environment where organizations 15 | can collect data from multiple sources and combine it with their first-party data. 16 | Doing so allows marketers to leverage large, aggregated datasets of customer behavior to provide insight 17 | into critical factors like performance, demographics, campaigns, etc.`, 18 | // Uncomment the following line if your bare application 19 | // has an action associated with it: 20 | // Run: func(cmd *cobra.Command, args []string) { }, 21 | } 22 | 23 | // Execute adds all child commands to the root command and sets flags appropriately. 24 | // This is called by main.main(). It only needs to happen once to the rootCmd. 25 | func Execute() { 26 | err := rootCmd.Execute() 27 | if err != nil { 28 | os.Exit(1) 29 | } 30 | } 31 | 32 | func init() { 33 | // Here you will define your flags and configuration settings. 34 | // Cobra supports persistent flags, which, if defined here, 35 | // will be global for your application. 36 | 37 | // rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.dcr.yaml)") 38 | 39 | // Cobra also supports local flags, which will only run 40 | // when this action is called directly. 41 | rootCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") 42 | } 43 | -------------------------------------------------------------------------------- /lib/collaboration/address/source/source.go: -------------------------------------------------------------------------------- 1 | // This package will have all the different types of sources 2 | package source 3 | 4 | import ( 5 | "os" 6 | 7 | "github.com/qascade/dcr/lib/collaboration/config" 8 | log "github.com/sirupsen/logrus" 9 | ) 10 | 11 | func init() { 12 | log.SetLevel(log.DebugLevel) 13 | log.SetOutput(os.Stdout) 14 | } 15 | 16 | // All source types must implement this interface. 17 | type Source interface { 18 | Extract() string 19 | } 20 | 21 | type Column struct { 22 | Name string 23 | Type string 24 | MaskingType string 25 | Selectable bool 26 | JoinKey bool 27 | AggregatesAllowed []string 28 | } 29 | 30 | type LocalSource struct { 31 | CollaboratorName string 32 | CsvLocation string 33 | Columns []Column 34 | } 35 | 36 | func NewLocalSource(cName string, sPec config.SourceSpec) Source { 37 | var columns []Column 38 | for _, col := range sPec.Columns { 39 | col := Column{ 40 | Name: col.Name, 41 | Type: col.Type, 42 | MaskingType: col.MaskingType, 43 | Selectable: col.Selectable, 44 | JoinKey: col.JoinKey, 45 | AggregatesAllowed: col.AggregatesAllowed, 46 | } 47 | columns = append(columns, col) 48 | } 49 | return &LocalSource{ 50 | CollaboratorName: cName, 51 | CsvLocation: sPec.CSVLocation, 52 | Columns: columns, 53 | } 54 | } 55 | 56 | // Need this function to copy the CsvLocation to the go_app 57 | func (ls *LocalSource) Extract() string { 58 | return ls.CsvLocation 59 | } 60 | 61 | func (ls *LocalSource) GetColumns() []Column { 62 | return ls.Columns 63 | } 64 | 65 | func (ls *LocalSource) GetCsvLocation() string { 66 | return ls.CsvLocation 67 | } 68 | -------------------------------------------------------------------------------- /lib/collaboration/address/transformation/transformation.go: -------------------------------------------------------------------------------- 1 | // This package will contain transformation types 2 | package transformation 3 | 4 | import ( 5 | "os" 6 | 7 | log "github.com/sirupsen/logrus" 8 | 9 | "github.com/qascade/dcr/lib/collaboration/config" 10 | ) 11 | 12 | func init() { 13 | log.SetLevel(log.DebugLevel) 14 | log.SetOutput(os.Stdout) 15 | } 16 | 17 | type Transformation interface { 18 | GetSourcesInfo() []SourceMetadata 19 | GetPongoInputs() map[string]string 20 | AppLocation() string 21 | } 22 | 23 | type SourceMetadata struct { 24 | CollaboratorName string 25 | SourceName string 26 | LocationPongoInput string 27 | AddressRef string 28 | } 29 | 30 | // A go binary code that takes lists csv's as input and outputs a list of csv's 31 | type GoApp struct { 32 | CollaboratorName string 33 | pongoInputs map[string]string 34 | appLocation string 35 | sourcesInfo []SourceMetadata 36 | } 37 | 38 | func NewGoApp(cName string, tSpec config.TransformationSpec) Transformation { 39 | pongoInputs := make(map[string]string) 40 | pongoInputs["uniqueID"] = tSpec.UniqueId 41 | sources := getSourcesFromSpec(cName, tSpec) 42 | registerNoiseParams(tSpec, pongoInputs, sources) 43 | return &GoApp{ 44 | CollaboratorName: cName, 45 | pongoInputs: pongoInputs, 46 | appLocation: tSpec.AppLocation, 47 | sourcesInfo: sources, 48 | } 49 | } 50 | 51 | func (ga *GoApp) GetSourcesInfo() []SourceMetadata { 52 | return ga.sourcesInfo 53 | } 54 | 55 | func (ga *GoApp) GetPongoInputs() map[string]string { 56 | return ga.pongoInputs 57 | } 58 | 59 | func (ga *GoApp) AppLocation() string { 60 | return ga.appLocation 61 | } 62 | func getSourcesFromSpec(cName string, tSpec config.TransformationSpec) []SourceMetadata { 63 | var sources []SourceMetadata 64 | for _, source := range tSpec.From { 65 | metadata := SourceMetadata{ 66 | CollaboratorName: cName, 67 | SourceName: source.Name, 68 | LocationPongoInput: source.LocationTag, 69 | AddressRef: source.Ref, 70 | } 71 | sources = append(sources, metadata) 72 | } 73 | return sources 74 | } 75 | 76 | func registerNoiseParams(tSpec config.TransformationSpec, pongoInputs map[string]string, sources []SourceMetadata) { 77 | for _, noiseParam := range tSpec.NoiseParams { 78 | // These will be populated by transformation runner. 79 | pongoInputs[noiseParam] = "" 80 | } 81 | for _, source := range sources { 82 | pongoInputs[source.LocationPongoInput] = "" 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /.github/workflows/semantic_pr.yaml: -------------------------------------------------------------------------------- 1 | name: "Semantic pull requests" 2 | 3 | on: 4 | pull_request: 5 | types: 6 | - opened 7 | - edited 8 | - labeled 9 | - unlabeled 10 | - converted_to_draft 11 | - ready_for_review 12 | - synchronize 13 | 14 | permissions: 15 | pull-requests: read 16 | 17 | jobs: 18 | main: 19 | name: Validate PR title 20 | runs-on: ubuntu-latest 21 | steps: 22 | - uses: amannn/action-semantic-pull-request@v5 23 | env: 24 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 25 | with: 26 | types: | 27 | build 28 | chore 29 | doc 30 | exp 31 | feat 32 | fix 33 | hotfix 34 | refactor 35 | test 36 | ci 37 | # Configure which scopes are allowed (newline-delimited). 38 | # These are regex patterns auto-wrapped in `^ $`. 39 | # Configure that a scope must always be provided. 40 | requireScope: false 41 | scopes: | 42 | config 43 | source 44 | transformation 45 | destination 46 | service 47 | address 48 | collaboration 49 | event 50 | logger 51 | error 52 | dp 53 | intelsgx 54 | # Configure which scopes are disallowed in PR titles (newline-delimited). 55 | # For instance by setting the value below, `chore(release): ...` (lowercase) 56 | # and `ci(e2e,release): ...` (unknown scope) will be rejected. 57 | # These are regex patterns auto-wrapped in `^ $`. 58 | disallowScopes: | 59 | release 60 | [A-Z]+ 61 | # Configure additional validation for the subject based on a regex. 62 | # This example ensures the subject doesn't start with an uppercase character. 63 | subjectPattern: ^(?![A-Z]).+$ 64 | # If `subjectPattern` is configured, you can use this property to override 65 | # the default error message that is shown when the pattern doesn't match. 66 | # The variables `subject` and `title` can be used within the message. 67 | subjectPatternError: | 68 | The subject "{subject}" found in the pull request title "{title}" 69 | didn't match the configured pattern. Please ensure that the subject 70 | doesn't start with an uppercase character. 71 | ignoreLabels: | 72 | bot 73 | -------------------------------------------------------------------------------- /lib/utils/misc.go: -------------------------------------------------------------------------------- 1 | package utils 2 | 3 | import ( 4 | "bytes" 5 | "fmt" 6 | "io" 7 | "os" 8 | "os/exec" 9 | 10 | log "github.com/sirupsen/logrus" 11 | "gopkg.in/yaml.v3" 12 | ) 13 | 14 | func init() { 15 | log.SetLevel(log.DebugLevel) 16 | log.SetOutput(os.Stdout) 17 | } 18 | 19 | func UnmarshalStrict(in []byte, out interface{}) (err error) { 20 | knownFieldsDecoder := yaml.NewDecoder(bytes.NewReader(in)) 21 | knownFieldsDecoder.KnownFields(true) 22 | return knownFieldsDecoder.Decode(out) 23 | } 24 | 25 | func RunCmd(cmd *exec.Cmd) (string, error) { 26 | output, err := cmd.CombinedOutput() 27 | if err != nil { 28 | log.Error(err) 29 | return "", fmt.Errorf("unable to capture output for command:%s err: %s", cmd.String(), err) 30 | } 31 | //log.Infof("Output of cmd %s: %s", cmd.String(), output) 32 | return string(output), err 33 | } 34 | 35 | // Give full path to the new file including the new name. 36 | func CopyFile(dest string, src string) error { 37 | srcFile, err := os.Open(src) 38 | if err != nil { 39 | err = fmt.Errorf("not able to open file:%s ", src) 40 | log.Error(err) 41 | return err 42 | } 43 | defer srcFile.Close() 44 | destFile, err := os.Create(dest) 45 | if err != nil { 46 | err = fmt.Errorf("not able to create file:%s ", dest) 47 | log.Error(err) 48 | return err 49 | } 50 | defer destFile.Close() 51 | _, err = io.Copy(destFile, srcFile) 52 | if err != nil { 53 | err = fmt.Errorf("unable to copy %s to %s", src, dest) 54 | log.Error(err) 55 | return err 56 | } 57 | log.Infof("copyfile from %s to %s", src, dest) 58 | return nil 59 | } 60 | 61 | func Remove(filePath string) error { 62 | if !FileExists(filePath) { 63 | return nil 64 | } 65 | err := os.Remove(filePath) 66 | if err != nil { 67 | err = fmt.Errorf("unable to remove file: %s", filePath) 68 | log.Error(err) 69 | return err 70 | } 71 | return nil 72 | } 73 | 74 | func FileExists(filePath string) bool { 75 | info, err := os.Stat(filePath) 76 | if os.IsNotExist(err) { 77 | return false 78 | } 79 | return !info.IsDir() 80 | } 81 | 82 | func WriteStringToFile(filePath string, content string) error { 83 | newFile, err := os.Create(filePath) 84 | 85 | if err != nil { 86 | err = fmt.Errorf("unable to create file %s, err:%s ", filePath, err) 87 | log.Error(err) 88 | return err 89 | } 90 | 91 | _, err = io.WriteString(newFile, content) 92 | if err != nil { 93 | err = fmt.Errorf("unable to write to file %s", filePath) 94 | log.Error(err) 95 | return err 96 | } 97 | log.Infof("Writing to file %s", filePath) 98 | return nil 99 | } 100 | -------------------------------------------------------------------------------- /lib/collaboration/collaboration_test.go: -------------------------------------------------------------------------------- 1 | package collaboration 2 | 3 | import ( 4 | "fmt" 5 | "path/filepath" 6 | "testing" 7 | 8 | "github.com/stretchr/testify/require" 9 | 10 | "github.com/qascade/dcr/lib/collaboration/config" 11 | ) 12 | 13 | func TestGraph(t *testing.T) { 14 | fmt.Println("Running TestCollaboration") 15 | testInitCollaborationPath, err := filepath.Abs("../../samples/init_collaboration") 16 | require.NoError(t, err) 17 | 18 | testAddressGraph(t, testInitCollaborationPath) 19 | 20 | testOneDepthPath, err := filepath.Abs("../../samples/test_graph/test_onedepth") 21 | require.NoError(t, err) 22 | 23 | testAddressGraph(t, testOneDepthPath) 24 | 25 | testTwoDepthPath, err := filepath.Abs("../../samples/test_graph/test_twodepth") 26 | require.NoError(t, err) 27 | 28 | testAddressGraph(t, testTwoDepthPath) 29 | } 30 | 31 | func TestParse(t *testing.T) { 32 | testInitCollaborationPath, err := filepath.Abs("../../samples/init_collaboration") 33 | require.NoError(t, err) 34 | testConfig(t, testInitCollaborationPath) 35 | 36 | testOneDepthPath, err := filepath.Abs("../../samples/init_collaboration") 37 | require.NoError(t, err) 38 | testConfig(t, testOneDepthPath) 39 | 40 | testTwoDepthPath, err := filepath.Abs("../../samples/test_graph/test_twodepth") 41 | require.NoError(t, err) 42 | testConfig(t, testTwoDepthPath) 43 | } 44 | 45 | func testAddressGraph(t *testing.T, pkgPath string) *Collaboration { 46 | fmt.Printf("Running TestAddressGraph, for pkgPath = %s\n", pkgPath) 47 | collaboration, err := NewCollaboration(pkgPath) 48 | require.NoError(t, err) 49 | graph := *collaboration.AddressGraph 50 | 51 | fmt.Println("AddressGraph =============") 52 | fmt.Println("Count of AddressNodes =============") 53 | fmt.Println(graph.Count) 54 | fmt.Println("AdjacencyList =============") 55 | fmt.Println(graph.AdjacencyList) 56 | 57 | refs, err := graph.GetOrderedRunnableRefs() 58 | require.NoError(t, err) 59 | fmt.Println("OrderedRunnableRefs =============") 60 | fmt.Println(refs) 61 | fmt.Println("AuthorityStatus =============") 62 | fmt.Println(graph.AuthorityStatus) 63 | require.NotNil(t, collaboration.AddressGraph) 64 | return collaboration 65 | } 66 | 67 | func testConfig(t *testing.T, path string) *config.CollaborationConfig { 68 | parser := config.Parser(config.NewCollaborationConfig()) 69 | pkgConfig, err := parser.Parse(path) 70 | require.NoError(t, err) 71 | for _, pkg := range pkgConfig.PackagesInfo { 72 | fmt.Println("SourceSpec =============") 73 | fmt.Println(*pkg.SourceSpec) 74 | fmt.Println("DestinationSpec =============") 75 | fmt.Println(*pkg.DestinationGroupSpec) 76 | fmt.Println("TransformationSpec =============") 77 | fmt.Println(*pkg.TransformationGroupSpec) 78 | } 79 | return pkgConfig 80 | 81 | } 82 | -------------------------------------------------------------------------------- /lib/collaboration/config/spec.go: -------------------------------------------------------------------------------- 1 | package config 2 | 3 | type Spec interface{} 4 | 5 | type TransformationGroupSpec struct { 6 | CollaboratorRef string `yaml:"collaborator"` 7 | Transformations []TransformationSpec `yaml:"transformations"` 8 | } 9 | 10 | // For now only supporting Count Query. 11 | // TODO - Make this Spec such that any type of transformation can be parsed using this spec. 12 | type TransformationSpec struct { 13 | Name string `yaml:"name"` 14 | Type string `yaml:"type"` 15 | UniqueId string `yaml:"unique_id,omitempty"` 16 | AppLocation string `yaml:"app_location"` 17 | From []FromSpec `yaml:"from"` 18 | JoinKey string `yaml:"join_key,omitempty"` 19 | NoiseParams []string `yaml:"noise_parameters,omitempty"` 20 | Template string `yaml:"template,omitempty"` 21 | DestinationOwnersAllowed []string `yaml:"destination_owners_allowed"` 22 | // TODO - do we need access control at destination level granularity? 23 | DestinationsAllowed []string `yaml:"destination_allowed,omitempty"` 24 | } 25 | 26 | type SourceGroupSpec struct { 27 | CollaboratorRef string `yaml:"collaborator"` 28 | Sources []SourceSpec `yaml:"sources"` 29 | } 30 | 31 | type SourceSpec struct { 32 | Name string `yaml:"name"` 33 | CSVLocation string `yaml:"csv_location"` 34 | Description string `yaml:"description"` 35 | Columns []ColumnSpec `yaml:"columns"` 36 | // TODO- Do we need to add addressRef here? 37 | TransformationOwnersAllowed []string `yaml:"transformation_owners_allowed"` 38 | DestinationsAllowed []SourceDestinationAllowedSpec `yaml:"destinations_allowed"` 39 | } 40 | 41 | type ColumnSpec struct { 42 | Name string `yaml:"name"` 43 | Type string `yaml:"type"` 44 | MaskingType string `yaml:"masking_type"` 45 | Selectable bool `yaml:"selectable,omitempty"` 46 | AggregatesAllowed []string `yaml:"aggregates_allowed,omitempty"` 47 | JoinKey bool `yaml:"join_key,omitempty"` 48 | } 49 | 50 | type DestinationGroupSpec struct { 51 | CollaboratorRef string `yaml:"collaborator"` 52 | Destinations []DestinationSpec `yaml:"destinations"` 53 | } 54 | 55 | type DestinationSpec struct { 56 | Name string `yaml:"name"` 57 | Ref string `yaml:"ref"` 58 | } 59 | 60 | type SourceDestinationAllowedSpec struct { 61 | Ref string `yaml:"ref"` 62 | NoiseParams []map[string]string `yaml:"noise_parameters"` 63 | } 64 | 65 | type FromSpec struct { 66 | Name string `yaml:"name"` 67 | Ref string `yaml:"ref"` 68 | LocationTag string `yaml:"location_tag"` 69 | } 70 | -------------------------------------------------------------------------------- /lib/service/service.go: -------------------------------------------------------------------------------- 1 | package service 2 | 3 | import ( 4 | _ "embed" 5 | "fmt" 6 | "os" 7 | 8 | "github.com/qascade/dcr/lib/collaboration" 9 | "github.com/qascade/dcr/lib/collaboration/address" 10 | 11 | log "github.com/sirupsen/logrus" 12 | ) 13 | 14 | func init() { 15 | log.SetLevel(log.DebugLevel) 16 | log.SetOutput(os.Stdout) 17 | } 18 | 19 | type ResultStore struct { 20 | Store map[address.AddressRef]string 21 | } 22 | 23 | func NewResultStore() *ResultStore { 24 | return &ResultStore{ 25 | Store: make(map[address.AddressRef]string), 26 | } 27 | } 28 | 29 | type Service struct { 30 | collaboration *collaboration.Collaboration 31 | orderedCollabEvents []Event 32 | ResultStore *ResultStore 33 | eventStatus map[Event]EventStatus 34 | } 35 | 36 | func NewService(pkgPath string) (*Service, error) { 37 | collab, err := collaboration.NewCollaboration(pkgPath) 38 | if err != nil { 39 | err = fmt.Errorf("err creating new collaboration with package path: %s", pkgPath) 40 | log.Error(err) 41 | return nil, err 42 | } 43 | resultStore := NewResultStore() 44 | runnableEvents, err := GetOrderedRunnableEvents(collab, resultStore) 45 | if err != nil { 46 | err = fmt.Errorf("err getting runnable events: %s", err) 47 | log.Error(err) 48 | return nil, err 49 | } 50 | 51 | eventStatus := make(map[Event]EventStatus) 52 | 53 | service := &Service{ 54 | collaboration: collab, 55 | orderedCollabEvents: runnableEvents, 56 | ResultStore: resultStore, 57 | eventStatus: eventStatus, 58 | } 59 | return service, nil 60 | } 61 | 62 | func (s *Service) Run() error { 63 | // Every event is already authorized to run 64 | // Run all transformations and store them in ResultStore. 65 | for _, event := range s.orderedCollabEvents { 66 | if event.Type() == RUN_TRANSFORMATION_EVENT_TYPE { 67 | output, err := event.Run() 68 | s.ResultStore.Store[event.AddressRef()] = output 69 | if err != nil { 70 | err = fmt.Errorf("err running event: %s", err) 71 | log.Error(err) 72 | s.eventStatus[event] = EventStatus{ 73 | statusType: NOT_READY, 74 | ErrorMsg: err.Error(), 75 | } 76 | return err 77 | } 78 | s.eventStatus[event] = EventStatus{ 79 | statusType: READY, 80 | ErrorMsg: "", 81 | } 82 | } 83 | } 84 | 85 | for _, event := range s.orderedCollabEvents { 86 | if event.Type() == SEND_DESTINATION_EVENT_TYPE { 87 | _, err := event.Run() 88 | if err != nil { 89 | err = fmt.Errorf("err running event: %s", err) 90 | log.Error(err) 91 | s.eventStatus[event] = EventStatus{ 92 | statusType: NOT_READY, 93 | ErrorMsg: err.Error(), 94 | } 95 | return err 96 | } 97 | s.eventStatus[event] = EventStatus{ 98 | statusType: READY, 99 | ErrorMsg: "", 100 | } 101 | } 102 | } 103 | return nil 104 | } 105 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # DCR Contributing Guidelines 2 | 3 | ## Code Style 4 | 5 | This repository uses `gofmt` to maintain code style and consistency. 6 | Please run `gofmt -s -w .` and `go vet ./...` before pushing the commits. 7 | 8 | Use `go generate ./...` to generate mocks. 9 | 10 | This Repo will incorporate all the recommendations of [effective go doc](https://go.dev/doc/effective_go) and addition to that will be following [Uber Go Style Guide](https://github.com/uber-go/guide/blob/master/style.md) 11 | 12 | ### Rules 13 | 14 | There are a few basic ground-rules for contributors: 15 | 16 | 1. Non-main branches should be used for ongoing work. 17 | 2. Make sure you use Linux or WSL to contribute to this Project. You won't be able to contribute to this project on a Windows Host. 18 | 3. **Pull requests** must pass all the workflows and should have atleast one approval before merging into **main**. 19 | - Workflows (non-exhaustive) includes Code Linters, Testers, PR Linters, PR Commit Linters, Issue/PR Template Linters, etc. 20 | 3. Each PR has to be atomic. No additional code/feature is to be added/modified or removed unless in the scope of the PR title. `tests` are exempted from this rule unless the PR specifically have `test:*` as title. 21 | 4. **Commits** should be as atomic as possible. Don't commit before a small milestone is achieved. Use [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) to log commit messages. Divide the full issue into subtasks that are independent of each other and make a single commit for them. A commit should not have any errors/incomplete or dead code. 22 | 6. PR is subject to be closed if commit conventions not followed. 23 | 6. A Draft PR should have `wip` tag to indicate that its a draft PR. Remove the tag if ready to be reviewed. 24 | 7. Every PR is to be to merged using squash and merge. The final Commit message title should also conform to **conventional commits spec**. 25 | 7. We will be following [semantic versioning](https://semver.org/). This along with point will help in auto-generating changelogs. 26 | 8. Everything is to be tracked through Github issues. Raise an issue with appropriate tags and link a PR with it. 27 | 9. Any addition of third party dependency is to justified during Code Review. 28 | 10. We don't mind force pushes as long as there are no additional diffs getting introduced, that are not in the scope of the PR. 29 | 30 | ## PR Title Scopes Allowed: 31 | - config 32 | - source 33 | - transformation 34 | - destination 35 | - service 36 | - address 37 | - doc 38 | - collaboration 39 | - event 40 | - logger 41 | - error 42 | - dp 43 | - intelsgx 44 | 45 | ### Example PR Titles: 46 | PR subject must not start with Capital Letters. 47 | 1. Normal PR Titles: 48 | - ci: propose an automated way to generate changelogs 49 | - refactor: migrate the ego-server code from different repo to dcr 50 | 2. Breaking Change: 51 | - feat!: create a collaboration.yaml 52 | 3. Scoped Title: 53 | - feat(config): enable use of relative addresses in config yaml 54 | 55 | ### Releases 56 | Declaring formal releases remains the prerogative of the project maintainer. First Release yet to be done. 57 | 58 | -------------------------------------------------------------------------------- /lib/collaboration/address/types.go: -------------------------------------------------------------------------------- 1 | package address 2 | 3 | import ( 4 | "github.com/qascade/dcr/lib/collaboration/address/destination" 5 | "github.com/qascade/dcr/lib/collaboration/address/source" 6 | "github.com/qascade/dcr/lib/collaboration/address/transformation" 7 | "github.com/qascade/dcr/lib/collaboration/config" 8 | ) 9 | 10 | type AddressType string 11 | 12 | const ( 13 | ADDRESS_TYPE_ROOT AddressType = "/" 14 | ADDRESS_TYPE_SOURCE AddressType = "source/" 15 | ADDRESS_TYPE_DESTINATION AddressType = "destination/" 16 | ADDRESS_TYPE_TRANSFORMATION AddressType = "transformation/" 17 | ) 18 | 19 | // All Address types will implement this interface 20 | //SourceRef : /collaborator_name/source/source_table_name 21 | //DestinationRef : /collaborator_name/destination/destination_table_name 22 | //TransformationRef : /collaborator_name/transformation/transformation_group_name 23 | 24 | func CacheAddresses(collabConfig config.CollaborationConfig) (map[AddressRef]DcrAddress, map[AddressRef]DcrAddress, map[AddressRef]DcrAddress) { 25 | cSources := make(map[AddressRef]DcrAddress) 26 | cTransformations := make(map[AddressRef]DcrAddress) 27 | cDestinations := make(map[AddressRef]DcrAddress) 28 | 29 | for _, pkgConfig := range collabConfig.PackagesInfo { 30 | // TODO - Need to create all these address through a AddressFactory 31 | collaboratorName := pkgConfig.CollaboratorName 32 | for _, sSpec := range pkgConfig.SourceSpec.Sources { 33 | s := source.NewLocalSource(collaboratorName, sSpec) 34 | //noiseParams := extractNoiseParams(sSpec) 35 | ref := Abs(sSpec.Name, collaboratorName, ADDRESS_TYPE_SOURCE) 36 | sAddress := NewSourceAddress(ref, collaboratorName, getAddressRefSlice(sSpec.TransformationOwnersAllowed), getTransformationRefSlice(sSpec.DestinationsAllowed), s, registerSourceNoises(sSpec.DestinationsAllowed)) 37 | cSources[ref] = sAddress 38 | } 39 | 40 | for _, tSpec := range pkgConfig.TransformationGroupSpec.Transformations { 41 | t := transformation.NewGoApp(collaboratorName, tSpec) 42 | ref := Abs(tSpec.Name, collaboratorName, ADDRESS_TYPE_TRANSFORMATION) 43 | tAddress := NewTransformationAddress(ref, collaboratorName, getAddressRefSlice(tSpec.DestinationOwnersAllowed), getAddressRefSlice(tSpec.DestinationsAllowed), t, tSpec.NoiseParams) 44 | cTransformations[ref] = tAddress 45 | } 46 | 47 | for _, dSpec := range pkgConfig.DestinationGroupSpec.Destinations { 48 | d := destination.NewLocalDestination(collaboratorName, dSpec) 49 | ref := Abs(dSpec.Name, collaboratorName, ADDRESS_TYPE_DESTINATION) 50 | requester := NewCollaboratorRef(collaboratorName) 51 | dAddress := NewDestinationAddress(ref, requester, d) 52 | cDestinations[ref] = dAddress 53 | } 54 | } 55 | return cSources, cTransformations, cDestinations 56 | } 57 | 58 | func registerSourceNoises(sourceNoises []config.SourceDestinationAllowedSpec) map[AddressRef]map[string]string { 59 | noiseMap := make(map[AddressRef]map[string]string) 60 | for _, sourceNoise := range sourceNoises { 61 | noiseMapList := sourceNoise.NoiseParams 62 | singleNoiseMap := make(map[string]string) 63 | for _, noiseMap := range noiseMapList { 64 | for k, v := range noiseMap { 65 | singleNoiseMap[k] = v 66 | } 67 | } 68 | noiseMap[AddressRef(sourceNoise.Ref)] = singleNoiseMap 69 | } 70 | return noiseMap 71 | } 72 | -------------------------------------------------------------------------------- /go.sum: -------------------------------------------------------------------------------- 1 | github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= 2 | github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 3 | github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= 4 | github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 5 | github.com/edwingeng/deque v1.0.3 h1:gx+5OnQK8qMcYNUxcD/M76BT/LujVNVAZEP/MGF8WNw= 6 | github.com/edwingeng/deque v1.0.3/go.mod h1:3Ys1pJhyVaB6iWigv4o2r6Ug1GZmfDWqvqmO6bjojg0= 7 | github.com/flosch/pongo2/v6 v6.0.0 h1:lsGru8IAzHgIAw6H2m4PCyleO58I40ow6apih0WprMU= 8 | github.com/flosch/pongo2/v6 v6.0.0/go.mod h1:CuDpFm47R0uGGE7z13/tTlt1Y6zdxvr2RLT5LJhsHEU= 9 | github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= 10 | github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= 11 | github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= 12 | github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= 13 | github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= 14 | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= 15 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 16 | github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= 17 | github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= 18 | github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= 19 | github.com/spf13/cobra v1.6.1 h1:o94oiPyS4KD1mPy2fmcYYHHfCxLqYjJOhGsCHFZtEzA= 20 | github.com/spf13/cobra v1.6.1/go.mod h1:IOw/AERYS7UzyrGinqmz6HLUo219MORXGxhbaJUqzrY= 21 | github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= 22 | github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= 23 | github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= 24 | github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= 25 | github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= 26 | github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= 27 | github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= 28 | github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= 29 | github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= 30 | github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= 31 | golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 h1:0A+M6Uqn+Eje4kHMK80dtF3JCXC4ykBgQG4Fe06QRhQ= 32 | golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 33 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 34 | gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= 35 | gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 36 | gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= 37 | gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 38 | -------------------------------------------------------------------------------- /GSSoC_GUIDELINES.md: -------------------------------------------------------------------------------- 1 | # GSSoC'23 Guidelines 2 | 3 | This documents have basic guidelines that are to followed during the GSSoC'23. 4 | 5 | Please make sure to go through the Spec Docs and the introductory video before starting on any issue. Both the links are present on the [Readme](/README.md) 6 | 7 | I (@qascade) will personally mentor/guide you through the PR if you chose any of the hard tasks.😄 8 | 9 | Each of the following guidelines are subject to change/bend on the discretion of code owners only. 10 | 11 | ## For Beginners: 12 | 13 | 1. Some References to get familiar with Go : 14 | - [Go By Examples](https://gobyexample.com/) 15 | - [Effective Go doc](https://go.dev/doc/effective_go) 16 | - [learn TDD with Go](https://quii.gitbook.io/learn-go-with-tests/) 17 | - [Debugging with delve](https://youtu.be/a1SneuI65O0_) 18 | - [Testing All the things playlist](https://www.youtube.com/playlist?list=PLtFquUj7IL8VpSL98BTvl3lnD8HS4NGlA) 19 | 20 | 2. YAML Ref: https://github.com/qascade/YAML-Notes 21 | 3. To Learn Git: 22 | - Missing Sem MIT Version Control: https://youtu.be/2sjqTHE0zok 23 | - https://ohshitgit.com 24 | - How to become git experts: https://youtu.be/hZS96dwKvt0 25 | - Git Internals (optional): https://youtu.be/lG90LZotrpo 26 | 27 | Pick up a beginner-friendly project and start contributing. Make sure to read all the guidelines as well as the spec docs of the project. You can start with the issues related to theory stuff well, if you are interested, which I highly encourage you to do. Mostly of them are under `medium/hard` category. 28 | 29 | Don't forget [giybf](https://giybf.com) 😁 30 | 31 | ## Guidelines: 32 | 33 | 1. Each issue can only have one assignee at a time, but the assignment is subject to rules. 34 | 2. Issues around docs/CI Flows/Project Contributing Conventions are only to be released/updated by project owners themselves, if/when deemed necessary. Rest will be closed automatically. 35 | In general, docs are to updated according the context of PR Title. 36 | 3. Each Issue will have `beginner-friendly`, `medium` and `hard` tag. This will be helpful in chosing an issue as per your expertise. In addition to that I have added `differential-privacy` and `confidential-computing` tag to differentiate between the underlying concept required. 37 | 4. For `differential-privacy` issues you should throughly understand how Google's Differential Privacy Library works. 38 | 5. For `confidential-computing` issues you should understand how Intel SGX enclaves behave and work. You can look at the [E-Go](https://github.com/edgelesssys/ego) docs for the same. For additional resources you can look at Confidential Computing Consortium Refs at the end of README.md 39 | 6. A `beginner-friendly` task will be unassigned on inactivity of 24 hrs. This PR should hardly take 2-3 days. These tasks are good to learn about git/github eco-system but won't make you good software developer. 40 | 7. A `medium` task will be unassigned on inactivity over 3 days. This PR should take around 7-10 days to complete. This will help you learn how to dabble a large code base. 41 | 8. A `hard` task will be unassigned, if you are inactive for over 7 days. This PR will take around 30 days to complete but will be much more meaningful. If you want to apply CS Concepts that you learn in your class in real-life these are the issues you should aim for. 42 | 43 | Looking forward to some meaningful contributions and collaborations. 44 | 45 | Wishing you the Best of Luck!!🚀 46 | Shubh Karman Singh 47 | -------------------------------------------------------------------------------- /samples/init_collaboration/research_pkg/go_app/main.tpl: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "encoding/csv" 5 | "fmt" 6 | "math" 7 | "io" 8 | "os" 9 | 10 | "github.com/google/differential-privacy/go/v2/dpagg" 11 | "github.com/google/differential-privacy/go/v2/noise" 12 | ) 13 | 14 | func extractUniqueId(loc string, UniqueID string) ([]string, error) { 15 | unique_id_list := []string{} 16 | // Open the csv file 17 | csvFile, err := os.Open(loc) 18 | if err != nil { 19 | fmt.Println(err) 20 | } 21 | defer csvFile.Close() 22 | 23 | // Read the csv file 24 | r := csv.NewReader(csvFile) 25 | 26 | // Iterate through the csv file 27 | firstLine := true 28 | uniqueIdx := -1 // Index of the column with name UniqueID 29 | for { 30 | record, err := r.Read() 31 | if err == io.EOF { 32 | return unique_id_list, nil 33 | } 34 | if firstLine { 35 | // Get the index of the column with name UniqueID 36 | for i, col := range record { 37 | if col == UniqueID { 38 | uniqueIdx = i 39 | break 40 | } 41 | } 42 | if uniqueIdx == -1 { 43 | return nil, fmt.Errorf("column with name %s not found", UniqueID) 44 | } 45 | firstLine = false 46 | continue 47 | } 48 | // Add the value of the column with name UniqueID to the list 49 | unique_id_list = append(unique_id_list, record[uniqueIdx]) 50 | } 51 | return unique_id_list, nil 52 | } 53 | 54 | // This function just combines all the unique ids from the two csv files 55 | //nolint 56 | func joinUniqueIds(loc1 string, loc2 string, UniqueID string) ([]string, []string, error) { 57 | // Open the first csv file 58 | // Combine The values of col with name UniqueId from both the csv files 59 | list1, err := extractUniqueId(loc1, UniqueID) 60 | if err != nil { 61 | return nil, nil,err 62 | } 63 | list2, err := extractUniqueId(loc2, UniqueID) 64 | if err != nil { 65 | return nil, nil, err 66 | } 67 | return list1, list2,nil 68 | } 69 | 70 | func CalculatePrivateCount(unique_id_list1, unique_id_list2 []string) (int64, int64, error){ 71 | var count int64 = 0 72 | privateCount, err := dpagg.NewCount(&dpagg.CountOptions{ 73 | Noise: noise.{{noiseType}}(), 74 | Epsilon: {{epsilon}}, 75 | MaxPartitionsContributed: {{maxPartitionsPerUser}}, 76 | }) 77 | if err != nil { 78 | return -1, -1, err 79 | } 80 | // no. of common ids 81 | for _, x := range unique_id_list1 { 82 | for _, y := range unique_id_list2 { 83 | if x == y { 84 | count++; 85 | privateCount.Increment() 86 | } 87 | } 88 | } 89 | result, err := privateCount.Result() 90 | if err != nil { 91 | return -1, -1, err 92 | } 93 | return count, result, nil 94 | } 95 | 96 | func writeToCSV(count int64, privateCountResult int64, outputFolderLocation string) { 97 | // Create a new file 98 | file, err := os.Create(outputFolderLocation + "/output.csv") 99 | if err != nil { 100 | panic(err) 101 | } 102 | defer file.Close() 103 | // Write the header 104 | file.WriteString("count, privateCountResult\n") 105 | // Write the data 106 | file.WriteString(fmt.Sprintf("%d, %d\n", count, privateCountResult)) 107 | } 108 | 109 | //nolint 110 | func main() { 111 | csvlocation1 := "{{csvLocation1}}" 112 | csvlocation2 := "{{csvLocation2}}" 113 | //outputFolderLocation := "{{outputFolderLocation}}" 114 | unique_Id := "{{uniqueID}}" 115 | unique_id_list1, unique_id_list2, err := joinUniqueIds(csvlocation1, csvlocation2, unique_Id) 116 | if err != nil { 117 | panic(err) 118 | } 119 | count, privateCountResult, err := CalculatePrivateCount(unique_id_list1, unique_id_list2) 120 | if err != nil { 121 | panic(err) 122 | } 123 | fmt.Println(count, privateCountResult) 124 | //writeToCSV(count, privateCountResult, outputFolderLocation) 125 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # dcr ⭐️ 2 | 3 | [![forthebadge](http://forthebadge.com/images/badges/made-with-go.svg)](http://forthebadge.com) 4 | [![forthebadge](http://forthebadge.com/images/badges/built-with-love.svg)](http://forthebadge.com) 5 | 6 | [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=shields)](http://makeapullrequest.com) 7 | 8 | A proof of concept framework to orchestrate Interoperable Differentially Private Data Clean Room Services on Intel SGX. 9 | 10 | A Data Clean Room is a secure environment where organizations can collect data from multiple sources and combine it with their first-party data. Doing so allows marketers to leverage large, aggregated datasets of consumer behavior to provide insight into critical factors like performance, demographics, campaigns, etc. 11 | 12 | *Data clean rooms allow companies to extract value from aggregate datasets sourced from multiple parties while prioritizing user privacy and maintaining strict security measures.* 13 | ## Contributing Guidelines 14 | This Repo follows following [Contributing Guidelines](https://github.com/qascade/dcr/blob/main/CONTRIBUTING.md) 15 | 16 | NOTE: This project is hosted under [GSSoC'23](https://gssoc.girlscript.tech/). Please go through [GSSoc_CONTRIBUTING.md](/GSSoC_GUIDELINES.md) before moving on the any issues. You can ask any queries on discord channel or Discussion Board mentioned. 17 | 18 | ## NOTE: 19 | 1. As of now this framework is only able to show a Proof of Concept for the architecture described in the spec. This framework will be used in a paper that I will be publishing soon. The paper will try to formalise data clean rooms. So, any thing that deviates this project from realising the paper is not in the scope of this project. 20 | 2. Current PoC only shows an example of three collaborators, out of which two provide sources and one provides the transformation. 21 | 3. Currently only Confidential GoApps are supported for transformations. 22 | 4. The Code is not production ready and does not partake any security measures other than access control and differential privacy. 23 | 5. The library is still not tested on actual SGX backed machines and but the PoC can be tested on simulation mode. 24 | 25 | To Run an example Data Clean Room Scenario. 26 | 1. This framework will not work on Windows. Make sure you have a linux machine installed. 27 | 2. (Optional) Install [Intel-SGX](https://github.com/intel/linux-sgx-driver) SDK 28 | 3. Make sure you have [Go](https://go.dev/) 1.20+ installed. 29 | 4. Make sure you have [E-Go](https://github.com/edgelesssys/ego) Compiler installed on your PC's 30 | 31 | You can see the sample collaboration package in samples/init_collaboration. You can also look at some sample packages under construction along with their graph images in samples/test_graph 32 | 33 | ## ⚡️ Quick Start: 34 | 1. 🏗 Build the `dcr` binary. 35 | ```bash 36 | make build 37 | ``` 38 | Screenshot 2023-05-11 at 4 09 17 AM 39 | 40 | Screenshot 2023-05-11 at 4 10 33 AM 41 | 42 | 2. 🏃🏻‍♀️ Run the demonstration 43 | ```bash 44 | ./bin/dcr run --pkgpath samples/init_collaboration 45 | ``` 46 | 47 | Links: 48 | 1. [Spec Doc]( https://cliff-colt-e2a.notion.site/Solution-3-07d81059daab40cb84180336a33c3dd9) 49 | 2. [Research Doc](https://cliff-colt-e2a.notion.site/Clean-Room-Doc-f606d90163ff4ca9b14bae92c0db328d) 50 | 3. [dcr YouTube Video](https://youtu.be/uQIePGL3kT8) 51 | 3. https://confidentialcomputing.io 52 | 4. https://differentialprivacy.org 53 | 54 | ## Contributors 55 | 56 |

57 | 58 | 59 |

60 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | We as members, contributors, and leaders pledge to make participation in our 6 | community a harassment-free experience for everyone, regardless of age, body 7 | size, visible or invisible disability, ethnicity, sex characteristics, gender 8 | identity and expression, level of experience, education, socio-economic status, 9 | nationality, personal appearance, race, religion, or sexual identity 10 | and orientation. 11 | 12 | We pledge to act and interact in ways that contribute to an open, welcoming, 13 | diverse, inclusive, and healthy community. 14 | 15 | ## Our Standards 16 | 17 | Examples of behavior that contributes to a positive environment for our 18 | community include: 19 | 20 | * Demonstrating empathy and kindness toward other people 21 | * Being respectful of differing opinions, viewpoints, and experiences 22 | * Giving and gracefully accepting constructive feedback 23 | * Accepting responsibility and apologizing to those affected by our mistakes, 24 | and learning from the experience 25 | * Focusing on what is best not just for us as individuals, but for the 26 | overall community 27 | 28 | Examples of unacceptable behavior include: 29 | 30 | * The use of sexualized language or imagery, and sexual attention or 31 | advances of any kind 32 | * Trolling, insulting or derogatory comments, and personal or political attacks 33 | * Public or private harassment 34 | * Publishing others' private information, such as a physical or email 35 | address, without their explicit permission 36 | * Other conduct which could reasonably be considered inappropriate in a 37 | professional setting 38 | 39 | ## Enforcement Responsibilities 40 | 41 | Community leaders are responsible for clarifying and enforcing our standards of 42 | acceptable behavior and will take appropriate and fair corrective action in 43 | response to any behavior that they deem inappropriate, threatening, offensive, 44 | or harmful. 45 | 46 | Community leaders have the right and responsibility to remove, edit, or reject 47 | comments, commits, code, wiki edits, issues, and other contributions that are 48 | not aligned to this Code of Conduct, and will communicate reasons for moderation 49 | decisions when appropriate. 50 | 51 | ## Scope 52 | 53 | This Code of Conduct applies within all community spaces, and also applies when 54 | an individual is officially representing the community in public spaces. 55 | Examples of representing our community include using an official e-mail address, 56 | posting via an official social media account, or acting as an appointed 57 | representative at an online or offline event. 58 | 59 | ## Enforcement 60 | 61 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 62 | reported to the community leaders responsible for enforcement at 63 | sksingh2211@gmail.com. 64 | All complaints will be reviewed and investigated promptly and fairly. 65 | 66 | All community leaders are obligated to respect the privacy and security of the 67 | reporter of any incident. 68 | 69 | ## Enforcement Guidelines 70 | 71 | Community leaders will follow these Community Impact Guidelines in determining 72 | the consequences for any action they deem in violation of this Code of Conduct: 73 | 74 | ### 1. Correction 75 | 76 | **Community Impact**: Use of inappropriate language or other behavior deemed 77 | unprofessional or unwelcome in the community. 78 | 79 | **Consequence**: A private, written warning from community leaders, providing 80 | clarity around the nature of the violation and an explanation of why the 81 | behavior was inappropriate. A public apology may be requested. 82 | 83 | ### 2. Warning 84 | 85 | **Community Impact**: A violation through a single incident or series 86 | of actions. 87 | 88 | **Consequence**: A warning with consequences for continued behavior. No 89 | interaction with the people involved, including unsolicited interaction with 90 | those enforcing the Code of Conduct, for a specified period of time. This 91 | includes avoiding interactions in community spaces as well as external channels 92 | like social media. Violating these terms may lead to a temporary or 93 | permanent ban. 94 | 95 | ### 3. Temporary Ban 96 | 97 | **Community Impact**: A serious violation of community standards, including 98 | sustained inappropriate behavior. 99 | 100 | **Consequence**: A temporary ban from any sort of interaction or public 101 | communication with the community for a specified period of time. No public or 102 | private interaction with the people involved, including unsolicited interaction 103 | with those enforcing the Code of Conduct, is allowed during this period. 104 | Violating these terms may lead to a permanent ban. 105 | 106 | ### 4. Permanent Ban 107 | 108 | **Community Impact**: Demonstrating a pattern of violation of community 109 | standards, including sustained inappropriate behavior, harassment of an 110 | individual, or aggression toward or disparagement of classes of individuals. 111 | 112 | **Consequence**: A permanent ban from any sort of public interaction within 113 | the community. 114 | 115 | ## Attribution 116 | 117 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], 118 | version 2.0, available at 119 | https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. 120 | 121 | Community Impact Guidelines were inspired by [Mozilla's code of conduct 122 | enforcement ladder](https://github.com/mozilla/diversity). 123 | 124 | [homepage]: https://www.contributor-covenant.org 125 | 126 | For answers to common questions about this code of conduct, see the FAQ at 127 | https://www.contributor-covenant.org/faq. Translations are available at 128 | https://www.contributor-covenant.org/translations. 129 | -------------------------------------------------------------------------------- /lib/collaboration/address/topo.go: -------------------------------------------------------------------------------- 1 | package address 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | 7 | "github.com/edwingeng/deque" 8 | log "github.com/sirupsen/logrus" 9 | ) 10 | 11 | func init() { 12 | log.SetLevel(log.DebugLevel) 13 | log.SetOutput(os.Stdout) 14 | } 15 | 16 | type TopoOrder struct { 17 | List []AddressRef 18 | IndegreeList map[AddressRef]int 19 | } 20 | 21 | func NewTopoOrder(adjList map[AddressRef][]AddressRef) *TopoOrder { 22 | indegreeList := make(map[AddressRef]int) 23 | // Create indegreeList 24 | for v, neighbourList := range adjList { 25 | if _, ok := indegreeList[v]; !ok { 26 | indegreeList[v] = 0 27 | } 28 | for _, neighbour := range neighbourList { 29 | if _, ok := indegreeList[neighbour]; !ok { 30 | indegreeList[neighbour] = 0 31 | } 32 | indegreeList[neighbour]++ 33 | } 34 | } 35 | return &TopoOrder{ 36 | List: make([]AddressRef, 0), 37 | IndegreeList: indegreeList, 38 | } 39 | } 40 | 41 | func (g *Graph) GetOrderedRunnableRefs() ([]AddressRef, error) { 42 | topoOrder := NewTopoOrder(g.AdjacencyList) 43 | return topoOrder.AuthorizedSort(g) 44 | } 45 | 46 | // A Destination is the ultimate requester of authorization. 47 | // If a transformation is requesting authorization, it needs to have a list of associated parent destinations along with it. 48 | // Otherwise, its an error. 49 | func (g *Graph) AuthorizeAddress(root AddressRef) (bool, error) { 50 | if root.IsSource() { 51 | return true, nil 52 | } 53 | visited := make(map[AddressRef]bool) 54 | parents := make([]AddressRef, 0) 55 | parents = append(parents, root) 56 | for _, neighbour := range g.AdjacencyList[root] { 57 | if visited[neighbour] { 58 | continue 59 | } 60 | visited[neighbour] = true 61 | movementPermission, err := g.Authorizer(neighbour, parents, visited) 62 | if !movementPermission { 63 | return false, err 64 | } 65 | } 66 | g.AuthorityStatus[root] = true 67 | return true, nil 68 | } 69 | 70 | // Helper function for AuthorizeAddress. 71 | func (g *Graph) Authorizer(root AddressRef, parents []AddressRef, visited map[AddressRef]bool) (bool, error) { 72 | var err error 73 | var movementPermission bool 74 | if root.IsSource() { 75 | sAddress, ok := g.CachedSources[root] 76 | if !ok { 77 | return false, fmt.Errorf("source address with given address ref not found. %s", root) 78 | } 79 | log.Infof("Authorizing root %s for source address. %s", root, sAddress.(*SourceAddress).Ref) 80 | return sAddress.Authorize(parents, root) 81 | } 82 | for _, neighbour := range g.AdjacencyList[root] { 83 | if visited[neighbour] { 84 | continue 85 | } 86 | visited[neighbour] = true 87 | if neighbour.IsTransformation() { 88 | neighbourAddress, ok := g.CachedTransformations[neighbour] 89 | if !ok { 90 | return false, fmt.Errorf("address with given address ref not found. %s", root) 91 | } 92 | log.Infof("Authorizing transformation %s for address. %s", root, neighbour) 93 | movementPermission, err = neighbourAddress.Authorize(parents, root) 94 | if err != nil { 95 | log.Error(err) 96 | return false, err 97 | } 98 | } else if neighbour.IsDestination() { 99 | neighbourAddress, ok := g.CachedDestinations[neighbour] 100 | if !ok { 101 | return false, fmt.Errorf("address with given address ref not found. %s", root) 102 | } 103 | log.Infof("Authorizing root %s for destination address. %s", root, neighbour) 104 | movementPermission, err = neighbourAddress.Authorize(parents, root) 105 | if err != nil { 106 | log.Error(err) 107 | return false, err 108 | } 109 | } else if neighbour.IsSource() { 110 | neighbourAddress, ok := g.CachedSources[neighbour] 111 | if !ok { 112 | return false, fmt.Errorf("address with given address ref not found. %s", root) 113 | } 114 | log.Infof("Authorizing root %s for source address. %s", root, neighbour) 115 | movementPermission, err = neighbourAddress.Authorize(parents, root) 116 | if err != nil { 117 | log.Error(err) 118 | return false, err 119 | } 120 | } else { 121 | err := fmt.Errorf("invalid address type. %s", root) 122 | log.Error(err) 123 | return false, err 124 | } 125 | if !movementPermission { 126 | return false, err 127 | } 128 | // TODO- Can we remove the redundant call to neighbour as a source? 129 | // parents = append(parents, neighbour) 130 | // movementPermission, err = g.Authorizer(neighbour, parents, visited) 131 | // g.AuthorityStatus[neighbour] = movementPermission 132 | } 133 | return movementPermission, err 134 | } 135 | 136 | // This function returns the topological order of all the addresses that are runnable in the current graph. 137 | func (t *TopoOrder) AuthorizedSort(g *Graph) ([]AddressRef, error) { 138 | // Create a queue and enqueue all vertices with indegree 0 139 | var queue deque.Deque = deque.NewDeque() 140 | for k, v := range t.IndegreeList { 141 | isAuthorized, err := g.AuthorizeAddress(k) 142 | if err != nil { 143 | log.Error(err) 144 | return nil, err 145 | } 146 | if v == 0 && isAuthorized { 147 | queue.PushBack(k) 148 | } 149 | } 150 | var topoOrder []AddressRef 151 | 152 | for queue.Len() != 0 { 153 | // Dequeue a vertex from queue and add it to topoOrder 154 | v, ok := queue.PopFront().(AddressRef) 155 | if !ok { 156 | err := fmt.Errorf("could not convert to AddressRef, %v", v) 157 | log.Error(err) 158 | return nil, err 159 | } 160 | topoOrder = append(topoOrder, v) 161 | // Iterate through all its neighbouring nodes of dequeued node u and decrease their in-degree by 1 162 | for _, neighbour := range g.AdjacencyList[v] { 163 | t.IndegreeList[neighbour]-- 164 | // If in-degree becomes zero, add it to queue 165 | if t.IndegreeList[neighbour] == 0 { 166 | queue.PushBack(neighbour) 167 | } 168 | } 169 | } 170 | // Check if there was a cycle 171 | if len(topoOrder) != g.Count { 172 | err := fmt.Errorf("there exists a cycle in the graph") 173 | log.Error(err) 174 | return nil, err 175 | } 176 | return topoOrder, nil 177 | } 178 | -------------------------------------------------------------------------------- /lib/collaboration/collaboration.go: -------------------------------------------------------------------------------- 1 | package collaboration 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | "path/filepath" 7 | 8 | "github.com/flosch/pongo2/v6" 9 | log "github.com/sirupsen/logrus" 10 | 11 | "github.com/qascade/dcr/lib/collaboration/address" 12 | "github.com/qascade/dcr/lib/collaboration/address/transformation" 13 | "github.com/qascade/dcr/lib/collaboration/config" 14 | "github.com/qascade/dcr/lib/utils" 15 | ) 16 | 17 | func init() { 18 | log.SetLevel(log.DebugLevel) 19 | log.SetOutput(os.Stdout) 20 | } 21 | 22 | type Collaboration struct { 23 | AddressGraph *address.Graph 24 | Collaborators []string 25 | collaborationConfig config.CollaborationConfig 26 | } 27 | 28 | func NewCollaboration(pkgPath string) (*Collaboration, error) { 29 | var collaborators []string 30 | 31 | collabConfig, err := config.Parser(config.NewCollaborationConfig()).Parse(pkgPath) 32 | if err != nil { 33 | err = fmt.Errorf("err parsing collaboration package with package path: %s", pkgPath) 34 | log.Error(err) 35 | return nil, err 36 | } 37 | 38 | for _, pkgConfig := range collabConfig.PackagesInfo { 39 | collaboratorName := pkgConfig.CollaboratorName 40 | collaborators = append(collaborators, collaboratorName) 41 | } 42 | cSources, cTransformations, cDestinations := address.CacheAddresses(*collabConfig) 43 | graph, err := address.NewGraph(cSources, cTransformations, cDestinations) 44 | if err != nil { 45 | err = fmt.Errorf("err while topologically sorting the address graph: %s", err) 46 | log.Error(err) 47 | return nil, err 48 | } 49 | collaboration := &Collaboration{ 50 | AddressGraph: graph, 51 | Collaborators: collaborators, 52 | collaborationConfig: *collabConfig, 53 | } 54 | return collaboration, nil 55 | } 56 | 57 | // Compile Transformation will prepare a go_app package that will return the path for the same, Also the path of the output folder on where to put the results. 58 | func (c *Collaboration) CompileTransformation(tRef address.AddressRef) (string, error) { 59 | tDcrAdd, ok := c.AddressGraph.CachedTransformations[tRef] 60 | if !ok { 61 | return "", fmt.Errorf("address with given address ref not found. %s", tRef) 62 | } 63 | 64 | if tDcrAdd.Type() != address.ADDRESS_TYPE_TRANSFORMATION { 65 | return "", fmt.Errorf("invalid address type. %s. Should be of type transformation", tDcrAdd) 66 | } 67 | 68 | tAdd, ok := tDcrAdd.(*address.TransformationAddress) 69 | if !ok { 70 | return "", fmt.Errorf("could not cast address to transformation address type: %v", tDcrAdd) 71 | } 72 | // TODO - Add Authorizer code here. 73 | 74 | dRef, err := c.findParentDestination(tRef) 75 | if err != nil { 76 | return "", err 77 | } 78 | 79 | t := tAdd.Transformation 80 | appLocation := t.AppLocation() 81 | sourceInfo := t.GetSourcesInfo() 82 | pongoInputs := t.GetPongoInputs() 83 | 84 | log.Info("Validating Noises as per trust Group Policy") 85 | err = validateNoises(sourceInfo) 86 | if err != nil { 87 | err = fmt.Errorf("err source noises not compliant to trust group policy, %s", err) 88 | log.Error(err) 89 | return "", err 90 | } 91 | // Fill rest of the pongo inputs 92 | for _, source := range sourceInfo { 93 | sAddI := c.AddressGraph.CachedSources[address.AddressRef(source.AddressRef)] 94 | sAdd := sAddI.(*address.SourceAddress) 95 | // Fill CSVLocations 96 | for k := range pongoInputs { 97 | if pongoInputs[k] == "" { 98 | noiseParams := sAdd.SourceNoises[dRef] 99 | if _, ok := noiseParams[k]; ok { 100 | pongoInputs[k] = noiseParams[k] 101 | } 102 | } 103 | if k == source.LocationPongoInput { 104 | pongoInputs[k] = sAdd.Source.Extract() 105 | } 106 | } 107 | } 108 | _, err = prepareGoApp(appLocation, pongoInputs) 109 | if err != nil { 110 | return "", err 111 | } 112 | // TODO- HardCoding outputPath will have to populate later. 113 | return appLocation, nil 114 | } 115 | 116 | func (c *Collaboration) findParentDestination(tRef address.AddressRef) (address.AddressRef, error) { 117 | cDestinations := c.AddressGraph.CachedDestinations 118 | for _, dest := range cDestinations { 119 | dAdd, ok := dest.(*address.DestinationAddress) 120 | if !ok { 121 | err := fmt.Errorf("not able to convert %s to destination address type", dest) 122 | log.Error(err) 123 | return "", err 124 | } 125 | if string(tRef) == dAdd.Destination.GetTransformationRef() { 126 | return dAdd.Ref, nil 127 | } 128 | } 129 | err := fmt.Errorf("parent destination for transformation %s not found", tRef) 130 | log.Error(err) 131 | return "", err 132 | } 133 | 134 | // This function validate noises for the members in the trust group. 135 | // A trust group is a set of sources who have given permission to the same transformation. 136 | func validateNoises(sourceInfo []transformation.SourceMetadata) error { 137 | // This validateNoises will also need all the list of collaborators who gives permission to same destination. 138 | // This list will be fetched from address graph. All these collaborators will form a Trust Group 139 | // After this we will have three options for noise Validation/Propagation 140 | // 1. Only one collaborator from the trust Group is allowed to define noises. 141 | // a. This validation can be simplified in yaml where other callaborators can acknowledge that by refering the noise parameters which can introduced as a address_type. 142 | // 2. All collaborators that form a trust group have to give same noises at source level. If the noises mismatch, it will result in an error. 143 | // 3. There is no such thing as a trust group everybody is free to define whatever amount of noise they want. We will have to define a mechanism such that from all the lists of noises. 144 | // that contributes the largest noise in the result will end up getting selected. 145 | log.Info("Noise Validation yet to be implemented") 146 | return nil 147 | 148 | } 149 | 150 | func prepareGoApp(appLocation string, pongoInputs map[string]string) (string, error) { 151 | ctx := pongo2.Context{} 152 | for k, v := range pongoInputs { 153 | ctx[k] = v 154 | } 155 | // Hardcoding the csv into pongo inputs 156 | ctx["csvLocation1"] = "./test1.csv" 157 | ctx["csvLocation2"] = "./test2.csv" 158 | 159 | mainFilePath := filepath.Join(appLocation, "main.tpl") 160 | tpl, err := pongo2.FromFile(mainFilePath) 161 | if err != nil { 162 | return "", err 163 | } 164 | output, err := tpl.Execute(ctx) 165 | if err != nil { 166 | return "", fmt.Errorf("error while executing the template: %v", err) 167 | } 168 | compiledMainPath := filepath.Join(appLocation, "main.go") 169 | compiledMain, err := os.Create(compiledMainPath) 170 | if err != nil { 171 | return "", fmt.Errorf("error while creating the main.go file: %v", err) 172 | } 173 | log.Infof("Writing the compiled main.go file to %s", compiledMainPath) 174 | 175 | _, err = compiledMain.WriteString(output) 176 | if err != nil { 177 | return "", fmt.Errorf("error while writing the main.go file: %v", err) 178 | } 179 | 180 | csvLocation1 := pongoInputs["csvLocation1"] 181 | csvLocation2 := pongoInputs["csvLocation2"] 182 | 183 | // Copying the csv's to the go_app folder. 184 | newCsV1Path := filepath.Join(appLocation, "test1.csv") 185 | err = utils.CopyFile(newCsV1Path, csvLocation1) 186 | if err != nil { 187 | return "", err 188 | } 189 | 190 | newCsV2Path := filepath.Join(appLocation, "test2.csv") 191 | err = utils.CopyFile(newCsV2Path, csvLocation2) 192 | if err != nil { 193 | return "", err 194 | } 195 | return compiledMainPath, nil 196 | } 197 | -------------------------------------------------------------------------------- /lib/collaboration/config/config.go: -------------------------------------------------------------------------------- 1 | package config 2 | 3 | // This package will contain all the Config extraction logic. 4 | 5 | import ( 6 | "fmt" 7 | "os" 8 | "path/filepath" 9 | "strings" 10 | 11 | log "github.com/sirupsen/logrus" 12 | "gopkg.in/yaml.v3" 13 | 14 | "github.com/qascade/dcr/lib/utils" 15 | ) 16 | 17 | // Interface that will be implemented by all contract types 18 | func init() { 19 | log.SetLevel(log.DebugLevel) 20 | log.SetOutput(os.Stdout) 21 | } 22 | 23 | type Parser interface { 24 | Parse(path string) (*CollaborationConfig, error) 25 | } 26 | 27 | // CollaborationConfig is the root folder for all the config files and implements Parser. 28 | 29 | func NewCollaborationConfig() CollaborationConfig { 30 | return CollaborationConfig{} 31 | } 32 | 33 | // All the Specs associated with a single Collaborator 34 | type CollaborationConfig struct { 35 | CollaborationFolderPath string 36 | PackagesInfo map[string]*PackageConfig 37 | } 38 | 39 | type PackageConfig struct { 40 | CollaboratorName string 41 | PkgPath string 42 | OutputFolderPath string 43 | SourceSpec *SourceGroupSpec 44 | TransformationGroupSpec *TransformationGroupSpec 45 | DestinationGroupSpec *DestinationGroupSpec 46 | } 47 | 48 | func (c CollaborationConfig) Parse(path string) (*CollaborationConfig, error) { 49 | log.Infof("Parsing the config folder with path %s", path) 50 | var err error 51 | path, err = filepath.Abs(path) 52 | if err != nil { 53 | err = fmt.Errorf("err unable to get absolute path of %s, %s", path, err) 54 | log.Error(err) 55 | return nil, err 56 | } 57 | pkgsInfo := make(map[string]*PackageConfig) 58 | var pkgPaths []string 59 | err = filepath.Walk(path, func(path string, info os.FileInfo, err error) error { 60 | if err != nil { 61 | return err 62 | } 63 | if info.IsDir() { 64 | if strings.Contains(path, "go_app") { 65 | return filepath.SkipDir 66 | } 67 | pkgPaths = append(pkgPaths, path) 68 | } 69 | return nil 70 | }) 71 | if err != nil { 72 | return nil, fmt.Errorf("error while walking through the path: %v", err) 73 | } 74 | pkgPaths = pkgPaths[1:] 75 | for _, pkgPath := range pkgPaths { 76 | var pkgConfig *PackageConfig 77 | pkgConfig, err = c.newPackageConfig(pkgPath) 78 | if err != nil { 79 | return nil, err 80 | } 81 | pkgsInfo[pkgConfig.CollaboratorName] = pkgConfig 82 | } 83 | collabConfig := &CollaborationConfig{ 84 | CollaborationFolderPath: path, 85 | PackagesInfo: pkgsInfo, 86 | } 87 | return collabConfig, nil 88 | } 89 | 90 | func (c *CollaborationConfig) newPackageConfig(pkgPath string) (*PackageConfig, error) { 91 | log.Infof("Creating new Package Config for pkgPath %s", pkgPath) 92 | sSpec, err := c.parseSourceSpec(pkgPath) 93 | if err != nil { 94 | return nil, fmt.Errorf("error while parsing the source spec: %v, with pkgPath %s", err, pkgPath) 95 | } 96 | 97 | tSpec, err := c.parseTransformationSpec(pkgPath) 98 | if err != nil { 99 | return nil, fmt.Errorf("error while parsing the transformation spec: %v, with pkgPath %s", err, pkgPath) 100 | } 101 | 102 | dSpec, err := c.parseDestinationSpec(pkgPath) 103 | if err != nil { 104 | return nil, fmt.Errorf("error while parsing the destination spec: %v, with pkgPath %s", err, pkgPath) 105 | } 106 | 107 | cName, err := getCollaboratorNameFromConfig(sSpec, tSpec, dSpec) 108 | if err != nil { 109 | return nil, err 110 | } 111 | 112 | pkgConfig := &PackageConfig{ 113 | CollaboratorName: cName, 114 | PkgPath: pkgPath, 115 | OutputFolderPath: filepath.Join(pkgPath, "output"), 116 | SourceSpec: sSpec, 117 | TransformationGroupSpec: tSpec, 118 | DestinationGroupSpec: dSpec, 119 | } 120 | return pkgConfig, nil 121 | } 122 | func (c *CollaborationConfig) parseSourceSpec(path string) (*SourceGroupSpec, error) { 123 | sourceYamlPath := path + "/sources.yaml" 124 | sourceSpecB, err := os.ReadFile(sourceYamlPath) 125 | if err != nil { 126 | // If the file does not exist, return nil 127 | return &SourceGroupSpec{}, nil 128 | } 129 | sSpec, err := ParseSpec(sourceSpecB, SourceSpecType) 130 | if err != nil { 131 | return nil, fmt.Errorf("error while reading the file: %w", err) 132 | } 133 | sBytes, err := yaml.Marshal(sSpec) 134 | if err != nil { 135 | return nil, fmt.Errorf("error while marshalling the file: %w", err) 136 | } 137 | var sResult SourceGroupSpec 138 | err = yaml.Unmarshal(sBytes, &sResult) 139 | if err != nil { 140 | return nil, fmt.Errorf("unable to unmarshal to SourceGroupSpec, %s", sourceYamlPath) 141 | } 142 | for i, sourceSpec := range sResult.Sources { 143 | sResult.Sources[i].CSVLocation = filepath.Join(path, sourceSpec.CSVLocation) 144 | } 145 | return &sResult, nil 146 | } 147 | 148 | func (c *CollaborationConfig) parseTransformationSpec(path string) (*TransformationGroupSpec, error) { 149 | transformationYamlPath := path + "/transformations.yaml" 150 | transformationSpecB, err := os.ReadFile(transformationYamlPath) 151 | if err != nil { 152 | // If the file is not present, then return nil 153 | return &TransformationGroupSpec{}, nil 154 | } 155 | tSpec, err := ParseSpec(transformationSpecB, TransformationSpecType) 156 | if err != nil { 157 | return nil, fmt.Errorf("error while reading the file: %w", err) 158 | } 159 | tBytes, err := yaml.Marshal(tSpec) 160 | if err != nil { 161 | return nil, fmt.Errorf("error while marshalling the file: %w", err) 162 | } 163 | var tResult TransformationGroupSpec 164 | err = utils.UnmarshalStrict(tBytes, &tResult) 165 | if err != nil { 166 | return nil, fmt.Errorf("unable to unmarshal to TransformationGroupSpec %s", transformationYamlPath) 167 | } 168 | for i, tSpec := range tResult.Transformations { 169 | tResult.Transformations[i].AppLocation = filepath.Join(path, tSpec.AppLocation) 170 | } 171 | return &tResult, nil 172 | } 173 | 174 | func (c *CollaborationConfig) parseDestinationSpec(path string) (*DestinationGroupSpec, error) { 175 | destinationYamlPath := path + "/destinations.yaml" 176 | destinationSpecB, err := os.ReadFile(destinationYamlPath) 177 | if err != nil { 178 | // If the file is not present, then return nil 179 | return &DestinationGroupSpec{}, nil 180 | } 181 | dSpec, err := ParseSpec(destinationSpecB, DestinationSpecType) 182 | if err != nil { 183 | return nil, fmt.Errorf("error while reading the file: %w", err) 184 | } 185 | dBytes, err := yaml.Marshal(dSpec) 186 | if err != nil { 187 | return nil, fmt.Errorf("error while marshalling the file: %w", err) 188 | } 189 | var dResult DestinationGroupSpec 190 | err = yaml.Unmarshal(dBytes, &dResult) 191 | if err != nil { 192 | return nil, fmt.Errorf("unable to unmarshal to DestinationGroupSpec, %s", destinationYamlPath) 193 | } 194 | return &dResult, nil 195 | } 196 | 197 | func ParseSpec(yamlBytes []byte, specType SpecType) (Spec, error) { 198 | var bs Spec 199 | switch specType { 200 | case SourceSpecType: 201 | bs = SourceGroupSpec{} 202 | case TransformationSpecType: 203 | bs = TransformationGroupSpec{} 204 | case DestinationSpecType: 205 | bs = DestinationGroupSpec{} 206 | } 207 | err := utils.UnmarshalStrict(yamlBytes, &bs) 208 | if err != nil { 209 | var bs2 Spec 210 | err2 := yaml.Unmarshal(yamlBytes, &bs2) 211 | if err2 != nil { 212 | return bs, fmt.Errorf("error parsing yaml: %w", err2) 213 | } 214 | partialSpecYaml, err3 := yaml.Marshal(bs2) 215 | if err3 != nil { 216 | return bs, fmt.Errorf("error marshaling partial build spec: %w", err3) 217 | } 218 | return bs, fmt.Errorf("error parsing yaml. Parse result:\n%s\nParse error:%s", partialSpecYaml, err) 219 | } 220 | return bs, err 221 | } 222 | 223 | func getCollaboratorNameFromConfig(sSpec *SourceGroupSpec, tSpec *TransformationGroupSpec, dSpec *DestinationGroupSpec) (string, error) { 224 | if sSpec != nil && sSpec.CollaboratorRef != "" { 225 | return sSpec.CollaboratorRef, nil 226 | } 227 | if tSpec != nil && tSpec.CollaboratorRef != "" { 228 | return tSpec.CollaboratorRef, nil 229 | } 230 | if dSpec != nil && dSpec.CollaboratorRef != "" { 231 | return dSpec.CollaboratorRef, nil 232 | } 233 | return "", fmt.Errorf("unable to find the collaborator name in the config") 234 | } 235 | -------------------------------------------------------------------------------- /lib/service/event.go: -------------------------------------------------------------------------------- 1 | package service 2 | 3 | import ( 4 | _ "embed" 5 | "fmt" 6 | "os" 7 | "os/exec" 8 | "path/filepath" 9 | "strings" 10 | 11 | log "github.com/sirupsen/logrus" 12 | 13 | "github.com/qascade/dcr/lib/collaboration" 14 | "github.com/qascade/dcr/lib/collaboration/address" 15 | "github.com/qascade/dcr/lib/utils" 16 | ) 17 | 18 | func init() { 19 | log.SetLevel(log.DebugLevel) 20 | log.SetOutput(os.Stdout) 21 | } 22 | 23 | type EventType string 24 | 25 | var ( 26 | RUN_TRANSFORMATION_EVENT_TYPE EventType = "/transformation/run" 27 | SEND_DESTINATION_EVENT_TYPE EventType = "/destination/send" 28 | ) 29 | 30 | // These are status values. 31 | const ( 32 | READY = iota // Event Completed and results are stored. 33 | NOT_READY // Yet to be computed 34 | ) 35 | 36 | type Event interface { 37 | Run() (string, error) 38 | Status() EventStatus 39 | Type() EventType 40 | AddressRef() address.AddressRef 41 | } 42 | 43 | // This function returns the list ordered runnable events with the event increasing graph depth. 44 | // These events are yet to be authorized and are to be done by Authorizer when triggered by Service. 45 | // Runnable events are already authorized. All the unauthorized addresses and their corresponding dependent addresses should not show up in the topo Order. 46 | func GetOrderedRunnableEvents(collab *collaboration.Collaboration, resultStore *ResultStore) ([]Event, error) { 47 | runnableRefs, err := collab.AddressGraph.GetOrderedRunnableRefs() 48 | if err != nil { 49 | err := fmt.Errorf("err while getting ordered runnable refs: %s", err) 50 | log.Error(err) 51 | return nil, err 52 | } 53 | 54 | events := make([]Event, 0) 55 | for _, ref := range runnableRefs { 56 | if ref.IsDestination() { 57 | dAddI, ok := collab.AddressGraph.CachedDestinations[ref] 58 | if !ok { 59 | err = fmt.Errorf("err while getting cached destination: %s", ref) 60 | log.Error(err) 61 | return nil, err 62 | } 63 | parentTRef := dAddI.(*address.DestinationAddress).Destination.GetTransformationRef() 64 | dEvent, err := NewSendDestinationEvent(collab, ref, address.AddressRef(parentTRef), resultStore) 65 | if err != nil { 66 | err = fmt.Errorf("err creating new destination event: %s", err) 67 | log.Error(err) 68 | return nil, err 69 | } 70 | events = append(events, dEvent) 71 | 72 | } 73 | if ref.IsTransformation() { 74 | tEvent, err := NewRunTransformationEvent(collab, ref) 75 | if err != nil { 76 | err = fmt.Errorf("err creating new transformation event: %s", err) 77 | log.Error(err) 78 | return nil, err 79 | } 80 | events = append(events, tEvent) 81 | } 82 | } 83 | return events, nil 84 | } 85 | 86 | type EventStatus struct { 87 | statusType int 88 | ErrorMsg string 89 | } 90 | 91 | // Transformation event is an event that runs a transformation. It is to be computed if Destination, is triggered. 92 | type TransformationEvent struct { 93 | ref address.AddressRef 94 | eventType EventType 95 | goAppLocation string 96 | Result string 97 | status EventStatus 98 | } 99 | 100 | func NewRunTransformationEvent(collab *collaboration.Collaboration, ref address.AddressRef) (Event, error) { 101 | // TODO- Make this generic, maybe compiled transformation?? 102 | goAppLocation, err := collab.CompileTransformation(ref) 103 | if err != nil { 104 | err = fmt.Errorf("err compiling transformation: %s", err) 105 | log.Error(err) 106 | return nil, err 107 | } 108 | return &TransformationEvent{ 109 | ref: ref, 110 | eventType: RUN_TRANSFORMATION_EVENT_TYPE, 111 | goAppLocation: goAppLocation, 112 | status: EventStatus{ 113 | statusType: NOT_READY, 114 | }, 115 | }, nil 116 | } 117 | 118 | //go:embed temp_enclave.json 119 | var newEnclaveContent string 120 | 121 | func (te *TransformationEvent) Run() (string, error) { 122 | err := os.Chdir(te.goAppLocation) 123 | if err != nil { 124 | err = fmt.Errorf("couldn't change directory path to %s", te.goAppLocation) 125 | log.Error(err) 126 | return "", err 127 | } 128 | 129 | tidyCmd := exec.Command("go", "mod", "tidy") 130 | _, err = utils.RunCmd(tidyCmd) 131 | if err != nil { 132 | return "", nil 133 | } 134 | 135 | buildCmd := exec.Command("ego-go", "build", "main.go") 136 | _, err = utils.RunCmd(buildCmd) 137 | if err != nil { 138 | return "", err 139 | } 140 | 141 | // Put harcoded csv names to enclave.json 142 | oldEnclave := "./enclave.json" 143 | err = utils.Remove(oldEnclave) 144 | if err != nil { 145 | return "", err 146 | } 147 | 148 | err = utils.WriteStringToFile("./enclave.json", newEnclaveContent) 149 | if err != nil { 150 | return "", err 151 | } 152 | 153 | signCmd := exec.Command("ego", "sign", "main") 154 | _, err = utils.RunCmd(signCmd) 155 | if err != nil { 156 | return "", err 157 | } 158 | 159 | // Set Simulation Mode by Default 160 | err = os.Setenv("OE_SIMULATION", "1") 161 | if err != nil { 162 | err = fmt.Errorf("unable to set env variable %s", "OE_SIMULATION") 163 | log.Error(err) 164 | return "", err 165 | } 166 | 167 | log.Info("Running the Transformation!!") 168 | mainRunCmd := exec.Command("ego", "run", "main") 169 | output, err := utils.RunCmd(mainRunCmd) 170 | if err != nil { 171 | return "", err 172 | } 173 | filterIntelPrompts(output) 174 | output = filterResults(output) 175 | te.Result = output 176 | 177 | err = te.Cleanup() 178 | if err != nil { 179 | return output, err 180 | } 181 | 182 | return output, nil 183 | } 184 | 185 | func (te *TransformationEvent) Cleanup() error { 186 | goAppPath := te.goAppLocation 187 | log.Info("Initiating Cleanup") 188 | err := filepath.Walk(goAppPath, func(path string, info os.FileInfo, err error) error { 189 | if err != nil { 190 | return err 191 | } 192 | if !info.IsDir() && (filepath.Ext(path) == ".go" || filepath.Ext(path) == ".pem" || filepath.Ext(path) == ".csv" || info.Name() == "enclave.json" || info.Name() == "main") { 193 | err := os.Remove(path) 194 | if err != nil { 195 | return err 196 | } 197 | log.Infof("Removed file: %s\n", path) 198 | } 199 | 200 | return nil 201 | }) 202 | 203 | if err != nil { 204 | err = fmt.Errorf("err unable to perform cleanup") 205 | log.Error(err) 206 | return err 207 | } 208 | return nil 209 | } 210 | 211 | func (te *TransformationEvent) Status() EventStatus { 212 | return te.status 213 | } 214 | 215 | func (te *TransformationEvent) Type() EventType { 216 | return te.eventType 217 | } 218 | 219 | func (te *TransformationEvent) AddressRef() address.AddressRef { 220 | return te.ref 221 | } 222 | 223 | type DestinationEvent struct { 224 | ref address.AddressRef 225 | eventType EventType 226 | status EventStatus 227 | parentTransformationRef address.AddressRef 228 | OutputLocation string 229 | ResultStore *ResultStore 230 | } 231 | 232 | func NewSendDestinationEvent(collab *collaboration.Collaboration, ref address.AddressRef, parentTRef address.AddressRef, resultStore *ResultStore) (Event, error) { 233 | destAddI, err := collab.DeRefDestination(ref) 234 | if err != nil { 235 | err = fmt.Errorf("err dereferencing destination: %s", err) 236 | log.Error(err) 237 | return nil, err 238 | } 239 | destAdd, ok := destAddI.(*address.DestinationAddress) 240 | if !ok { 241 | err = fmt.Errorf("err dereferencing destination: %s", err) 242 | log.Error(err) 243 | return nil, err 244 | } 245 | 246 | outputLocation, err := collab.GetOutputPath(destAdd.Owner) 247 | if err != nil { 248 | err = fmt.Errorf("err getting output path: %s", err) 249 | log.Error(err) 250 | return nil, err 251 | } 252 | 253 | destEvent := &DestinationEvent{ 254 | status: EventStatus{ 255 | statusType: NOT_READY, 256 | }, 257 | ref: ref, 258 | parentTransformationRef: parentTRef, 259 | OutputLocation: outputLocation, 260 | eventType: SEND_DESTINATION_EVENT_TYPE, 261 | ResultStore: resultStore, 262 | } 263 | return destEvent, nil 264 | } 265 | 266 | func (de *DestinationEvent) Run() (string, error) { 267 | outputPath := de.OutputLocation 268 | outputPath = outputPath + "/results.txt" 269 | 270 | output, ok := de.ResultStore.Store[de.parentTransformationRef] 271 | if !ok { 272 | err := fmt.Errorf("result not found for transformaton %s in result store", de.parentTransformationRef) 273 | return "", err 274 | } 275 | utils.WriteStringToFile(outputPath, output) 276 | return "", nil 277 | } 278 | 279 | // This function returns the status of the destination event 280 | func (de *DestinationEvent) Status() EventStatus { 281 | return de.status 282 | } 283 | 284 | func (de *DestinationEvent) Type() EventType { 285 | return de.eventType 286 | } 287 | 288 | func (de *DestinationEvent) AddressRef() address.AddressRef { 289 | return de.ref 290 | } 291 | 292 | // This is a helper function for the unique email specific example. To be removed later. 293 | func filterResults(output string) string { 294 | s := strings.Split(output, " ") 295 | n := len(s) 296 | return fmt.Sprintf("NonPrivateCount:%s PrivateCount:%s", strings.TrimLeft(s[n-2], "...\n"), strings.Trim(s[n-1], "\n")) 297 | } 298 | func filterIntelPrompts(output string) { 299 | s := strings.Split(output, "\n") 300 | fmt.Println(s[0]) 301 | fmt.Println(s[1]) 302 | fmt.Println(s[2]) 303 | } 304 | -------------------------------------------------------------------------------- /lib/collaboration/address/address.go: -------------------------------------------------------------------------------- 1 | package address 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | 7 | log "github.com/sirupsen/logrus" 8 | 9 | "github.com/qascade/dcr/lib/collaboration/address/destination" 10 | "github.com/qascade/dcr/lib/collaboration/address/source" 11 | "github.com/qascade/dcr/lib/collaboration/address/transformation" 12 | "github.com/qascade/dcr/lib/collaboration/config" 13 | ) 14 | 15 | func init() { 16 | log.SetLevel(log.DebugLevel) 17 | log.SetOutput(os.Stdout) 18 | } 19 | 20 | type Graph struct { 21 | Count int 22 | AdjacencyList map[AddressRef][]AddressRef 23 | AuthorityStatus map[AddressRef]bool 24 | CachedSources map[AddressRef]DcrAddress 25 | CachedTransformations map[AddressRef]DcrAddress 26 | CachedDestinations map[AddressRef]DcrAddress 27 | } 28 | 29 | func NewGraph(cSources map[AddressRef]DcrAddress, cTransformations map[AddressRef]DcrAddress, cDestinations map[AddressRef]DcrAddress) (*Graph, error) { 30 | log.Info("Graph is being populated...") 31 | count := len(cSources) + len(cTransformations) + len(cDestinations) 32 | adjList := make(map[AddressRef][]AddressRef) 33 | authorityStatus := make(map[AddressRef]bool) 34 | for tRef, tAddressI := range cTransformations { 35 | authorityStatus[tRef] = false 36 | tAddress, ok := tAddressI.(*TransformationAddress) 37 | if !ok { 38 | log.Error("The address is not of type TransformationAddress") 39 | return nil, fmt.Errorf("the address is not of type TransformationAddress for addressRef: %s", tRef) 40 | } 41 | 42 | sourcesInfo := tAddress.Transformation.GetSourcesInfo() 43 | for _, sourceMetadata := range sourcesInfo { 44 | sAddress := cSources[AddressRef(sourceMetadata.AddressRef)] 45 | if sAddress != nil { 46 | adjList[tRef] = append(adjList[tRef], AddressRef(sourceMetadata.AddressRef)) 47 | continue 48 | } 49 | // A transformation may consume another transformation output as a potential source. 50 | if AddressRef(sourceMetadata.AddressRef).IsTransformation() { 51 | fmt.Printf("Info::transformation %s is consuming transformation output %s as a source\n", tRef, sourceMetadata.AddressRef) 52 | adjList[tRef] = append(adjList[tRef], AddressRef(sourceMetadata.AddressRef)) 53 | } else { 54 | log.Error("Source Address not found") 55 | return nil, fmt.Errorf("source Address not found for addressRef: %s", sourceMetadata.AddressRef) 56 | } 57 | } 58 | } 59 | for dRef, dAddressI := range cDestinations { 60 | authorityStatus[dRef] = false 61 | dAddress, ok := dAddressI.(*DestinationAddress) 62 | if !ok { 63 | log.Error("The address is not of type DestinationAddress") 64 | return nil, fmt.Errorf("the address is not of type DestinationAddress for addressRef: %s", dRef) 65 | } 66 | adjList[dRef] = append(adjList[dRef], AddressRef(dAddress.Destination.GetTransformationRef())) 67 | } 68 | 69 | for sRef := range cSources { 70 | authorityStatus[sRef] = true // Sources are always authorized. 71 | } 72 | 73 | graph := &Graph{ 74 | Count: count, 75 | AdjacencyList: adjList, 76 | AuthorityStatus: authorityStatus, 77 | CachedSources: cSources, 78 | CachedTransformations: cTransformations, 79 | CachedDestinations: cDestinations, 80 | } 81 | return graph, nil 82 | } 83 | 84 | // All AddressNodeTypes must implement this interface 85 | type DcrAddress interface { 86 | Authorize([]AddressRef, AddressRef) (bool, error) // Are we allowed to move further down the graph? 87 | //Deref // Function that returns the real transformation 88 | Type() AddressType // Returns the type of Address. 89 | } 90 | 91 | type SourceAddress struct { 92 | Ref AddressRef 93 | Source source.Source 94 | Owner AddressRef //CollaboratorName 95 | TransformationOwnersAllowed []AddressRef 96 | DestinationsAllowed []AddressRef 97 | SourceNoises map[AddressRef]map[string]string 98 | } 99 | 100 | func NewSourceAddress(ref AddressRef, owner string, transformationOwnersAllowed []AddressRef, destAllowed []AddressRef, source source.Source, sourceNoises map[AddressRef]map[string]string) DcrAddress { 101 | // Owner is always allowed to consume its own source. 102 | transformationOwnersAllowed = append(transformationOwnersAllowed, NewCollaboratorRef(owner)) 103 | return &SourceAddress{ 104 | Ref: ref, 105 | Owner: NewCollaboratorRef(owner), 106 | TransformationOwnersAllowed: transformationOwnersAllowed, 107 | DestinationsAllowed: destAllowed, 108 | Source: source, 109 | SourceNoises: sourceNoises, 110 | } 111 | } 112 | 113 | // Transformaton Owner is checked against Source TransformationOwnersAllowed. 114 | // Destination owner is checked against Source DestinationsAllowed. 115 | func (sa *SourceAddress) Authorize(parents []AddressRef, root AddressRef) (bool, error) { 116 | for _, ref := range parents { 117 | if ref.IsDestination() { 118 | isAuthorized, err := sa.AuthorizeDestination(ref) 119 | if !isAuthorized { 120 | return false, err 121 | } 122 | } 123 | if ref.IsTransformation() { 124 | isAuthorized, err := sa.AuthorizeTransformation(ref) 125 | if !isAuthorized { 126 | return false, err 127 | } 128 | } 129 | } 130 | if root.IsDestination() { 131 | return sa.AuthorizeDestination(root) 132 | } 133 | if root.IsTransformation() { 134 | return sa.AuthorizeTransformation(root) 135 | } 136 | // If root is a source, it is always authorized. 137 | return true, nil 138 | } 139 | 140 | func (sa *SourceAddress) AuthorizeTransformation(root AddressRef) (bool, error) { 141 | tOwner := root.Collaborator() 142 | tAllowed := false 143 | for _, c := range sa.TransformationOwnersAllowed { 144 | if c == tOwner { 145 | tAllowed = true 146 | break 147 | } 148 | } 149 | if !tAllowed { 150 | err := fmt.Errorf("transformation: %s not allowed to consume source: %s", root, sa.Ref) 151 | log.Error(err) 152 | return false, err 153 | } 154 | log.Infof("transformation: %s allowed to consume source: %s", root, sa.Ref) 155 | return true, nil 156 | } 157 | 158 | func (sa *SourceAddress) AuthorizeDestination(root AddressRef) (bool, error) { 159 | dAllowed := false 160 | for _, ref := range sa.DestinationsAllowed { 161 | if root == ref { 162 | dAllowed = true 163 | break 164 | } 165 | } 166 | if !dAllowed { 167 | err := fmt.Errorf("destination: %s not allowed to consume source: %s", root, sa.Ref) 168 | return false, err 169 | } 170 | log.Infof("destination: %s allowed to consume source: %s", root, sa.Ref) 171 | return true, nil 172 | } 173 | 174 | func (sa *SourceAddress) Type() AddressType { 175 | return ADDRESS_TYPE_SOURCE 176 | } 177 | 178 | type TransformationAddress struct { 179 | Ref AddressRef 180 | Owner AddressRef 181 | DestinationOwnersAllowed []AddressRef 182 | DestinationsAllowed []AddressRef 183 | Transformation transformation.Transformation 184 | NoiseParams []string 185 | } 186 | 187 | func NewTransformationAddress(ref AddressRef, owner string, destinationOwnersAllowed []AddressRef, destAllowed []AddressRef, t transformation.Transformation, noiseParams []string) DcrAddress { 188 | // Owner is always allowed to consume its own transformation. 189 | destinationOwnersAllowed = append(destinationOwnersAllowed, NewCollaboratorRef(owner)) 190 | destAllowed = append(destAllowed, NewCollaboratorRef(owner)) 191 | return &TransformationAddress{ 192 | Ref: ref, 193 | Owner: NewCollaboratorRef(owner), 194 | DestinationOwnersAllowed: destinationOwnersAllowed, 195 | DestinationsAllowed: destAllowed, 196 | Transformation: t, 197 | NoiseParams: noiseParams, 198 | } 199 | } 200 | 201 | // Destination Owners are to checked against transformation DestinationOwnersAllowed. 202 | func (ta *TransformationAddress) Authorize(parents []AddressRef, root AddressRef) (bool, error) { 203 | log.Infof("Root %s is trying to consume transformation %s, Performing authorization", root, ta.Ref) 204 | for _, ref := range parents { 205 | if ref.IsDestination() { 206 | isAuthorized, err := ta.AuthorizeDestination(ref) 207 | if !isAuthorized { 208 | return false, err 209 | } 210 | } 211 | } 212 | if root.IsDestination() { 213 | return ta.AuthorizeDestination(root) 214 | } 215 | // If root is not a destination, it must be transformation itself. 216 | return true, nil 217 | } 218 | 219 | func (ta *TransformationAddress) AuthorizeDestination(root AddressRef) (bool, error) { 220 | dAllowed := false 221 | dOwner := root.Collaborator() 222 | for _, ref := range ta.DestinationOwnersAllowed { 223 | if dOwner == ref { 224 | dAllowed = true 225 | break 226 | } 227 | } 228 | if !dAllowed { 229 | err := fmt.Errorf("destination: %s not allowed to consume transformation: %s", root, ta.Ref) 230 | log.Error(err) 231 | return false, err 232 | } 233 | log.Infof("destination: %s allowed to consume transformation: %s", root, ta.Ref) 234 | return true, nil 235 | } 236 | 237 | func (ta *TransformationAddress) Type() AddressType { 238 | return ADDRESS_TYPE_TRANSFORMATION 239 | } 240 | 241 | type DestinationAddress struct { 242 | Ref AddressRef 243 | Owner AddressRef 244 | Destination destination.Destination 245 | } 246 | 247 | func NewDestinationAddress(ref AddressRef, owner AddressRef, dest destination.Destination) DcrAddress { 248 | return &DestinationAddress{ 249 | Ref: ref, 250 | Owner: AddressRef(owner), 251 | Destination: dest, 252 | } 253 | } 254 | 255 | func (da *DestinationAddress) Authorize(_ []AddressRef, _ AddressRef) (bool, error) { 256 | // Movement from destination is always authorized. 257 | log.Infof("Performing authorization for Destination %s.", da.Ref) 258 | return true, nil 259 | } 260 | 261 | // Helper functions 262 | 263 | func (da *DestinationAddress) Type() AddressType { 264 | return ADDRESS_TYPE_DESTINATION 265 | } 266 | 267 | func getAddressRefSlice(s []string) []AddressRef { 268 | addRefS := make([]AddressRef, 0) 269 | for _, str := range s { 270 | addRefS = append(addRefS, NewCollaboratorRef(str)) 271 | } 272 | return addRefS 273 | } 274 | 275 | // Returns a slice of AddressRef from a slice of SourceDestinationAllowedSpec 276 | func getTransformationRefSlice(destAllowed []config.SourceDestinationAllowedSpec) []AddressRef { 277 | addS := make([]AddressRef, 0) 278 | for _, dest := range destAllowed { 279 | addS = append(addS, AddressRef(dest.Ref)) 280 | } 281 | return addS 282 | } 283 | -------------------------------------------------------------------------------- /samples/data/media_advertiser/media/media_exposures.csv: -------------------------------------------------------------------------------- 1 | EMAIL,CAMPAIGN,DEVICE_TYPE,EXP_DATE,SEC_VIEW,EXP_COST 2 | user3_1@email.com,campaign_1,DISPLAY,2021-03-19,25,2.310000 3 | user13_1@email.com,campaign_1,STREAMING,2021-03-04,35,0.060000 4 | user17_1@email.com,campaign_1,STREAMING,2021-03-11,39,0.030000 5 | user21_3@email.com,campaign_1,STREAMING,2021-04-02,15,2.500000 6 | user24_2@email.com,campaign_3,MOBILE,2021-04-08,34,2.750000 7 | user28_1@email.com,campaign_2,STREAMING,2021-05-30,46,2.090000 8 | user29_2@email.com,campaign_3,STREAMING,2021-05-04,41,1.580000 9 | user31_1@email.com,campaign_2,DISPLAY,2021-04-18,14,2.080000 10 | user34_3@email.com,campaign_2,STREAMING,2021-04-13,31,2.130000 11 | user41_2@email.com,campaign_1,LINEAR,2021-05-27,3,2.130000 12 | user43_1@email.com,campaign_2,STREAMING,2021-04-11,31,1.920000 13 | user46_3@email.com,campaign_1,STREAMING,2021-04-08,41,0.050000 14 | user52_1@email.com,campaign_3,STREAMING,2021-05-09,35,0.900000 15 | user53_1@email.com,campaign_3,STREAMING,2021-04-30,47,1.400000 16 | user60_2@email.com,campaign_2,STREAMING,2021-04-26,4,0.090000 17 | user66_2@email.com,campaign_2,STREAMING,2021-03-29,54,2.830000 18 | user69_2@email.com,campaign_1,LINEAR,2021-05-09,4,1.230000 19 | user70_1@email.com,campaign_1,STREAMING,2021-04-26,11,1.800000 20 | user75_3@email.com,campaign_3,STREAMING,2021-05-23,3,0.720000 21 | user78_2@email.com,campaign_3,MOBILE,2021-05-25,57,2.530000 22 | user80_2@email.com,campaign_1,STREAMING,2021-05-17,35,1.660000 23 | user96_2@email.com,campaign_3,STREAMING,2021-05-26,54,1.230000 24 | user98_1@email.com,campaign_1,STREAMING,2021-03-05,45,0.270000 25 | user108_3@email.com,campaign_3,STREAMING,2021-05-08,24,1.420000 26 | user110_1@email.com,campaign_1,STREAMING,2021-03-16,14,1.690000 27 | user114_2@email.com,campaign_3,MOBILE,2021-04-02,43,0.030000 28 | user117_2@email.com,campaign_1,STREAMING,2021-03-28,53,1.180000 29 | user120_3@email.com,campaign_1,STREAMING,2021-03-15,58,2.870000 30 | user122_2@email.com,campaign_2,STREAMING,2021-05-15,38,0.330000 31 | user123_1@email.com,campaign_2,STREAMING,2021-05-25,1,1.660000 32 | user124_2@email.com,campaign_1,STREAMING,2021-04-15,10,1.560000 33 | user125_2@email.com,campaign_1,MOBILE,2021-03-12,19,2.190000 34 | user129_3@email.com,campaign_2,STREAMING,2021-05-05,42,0.280000 35 | user130_3@email.com,campaign_1,STREAMING,2021-03-14,60,2.280000 36 | user137_3@email.com,campaign_1,STREAMING,2021-03-06,9,0.740000 37 | user139_3@email.com,campaign_1,MOBILE,2021-04-26,10,1.200000 38 | user142_3@email.com,campaign_2,DISPLAY,2021-05-27,53,1.240000 39 | user143_3@email.com,campaign_1,STREAMING,2021-04-13,29,2.240000 40 | user147_1@email.com,campaign_1,STREAMING,2021-03-05,30,2.100000 41 | user150_1@email.com,campaign_1,STREAMING,2021-03-09,17,0.280000 42 | user152_3@email.com,campaign_3,LINEAR,2021-04-24,54,0.520000 43 | user157_3@email.com,campaign_3,STREAMING,2021-05-01,8,1.060000 44 | user163_1@email.com,campaign_1,MOBILE,2021-03-10,4,0.990000 45 | user166_2@email.com,campaign_2,STREAMING,2021-03-22,43,1.770000 46 | user167_2@email.com,campaign_3,STREAMING,2021-03-02,46,1.050000 47 | user169_2@email.com,campaign_1,STREAMING,2021-03-11,7,0.590000 48 | user178_2@email.com,campaign_3,STREAMING,2021-03-08,35,0.960000 49 | user182_2@email.com,campaign_2,STREAMING,2021-03-04,8,2.680000 50 | user184_3@email.com,campaign_3,STREAMING,2021-05-05,43,0.690000 51 | user187_2@email.com,campaign_1,STREAMING,2021-05-25,51,0.520000 52 | user199_2@email.com,campaign_3,MOBILE,2021-04-24,3,0.930000 53 | user200_2@email.com,campaign_1,STREAMING,2021-03-04,53,1.330000 54 | user203_1@email.com,campaign_3,STREAMING,2021-05-15,2,0.630000 55 | user208_2@email.com,campaign_1,STREAMING,2021-04-16,2,0.050000 56 | user226_3@email.com,campaign_3,STREAMING,2021-05-08,10,1.870000 57 | user227_1@email.com,campaign_3,MOBILE,2021-05-18,14,2.710000 58 | user228_2@email.com,campaign_2,STREAMING,2021-04-18,60,2.070000 59 | user235_1@email.com,campaign_1,DISPLAY,2021-03-11,7,1.410000 60 | user242_2@email.com,campaign_1,STREAMING,2021-04-03,24,1.720000 61 | user256_2@email.com,campaign_1,STREAMING,2021-03-23,31,1.980000 62 | user257_2@email.com,campaign_2,STREAMING,2021-05-24,1,0.310000 63 | user261_3@email.com,campaign_2,DISPLAY,2021-05-20,33,1.490000 64 | user262_1@email.com,campaign_2,LINEAR,2021-05-11,7,0.440000 65 | user267_2@email.com,campaign_2,STREAMING,2021-04-20,9,1.570000 66 | user268_2@email.com,campaign_1,STREAMING,2021-04-21,45,0.470000 67 | user269_1@email.com,campaign_3,STREAMING,2021-04-03,18,0.670000 68 | user270_3@email.com,campaign_3,STREAMING,2021-05-28,41,2.530000 69 | user275_3@email.com,campaign_2,STREAMING,2021-03-17,51,2.280000 70 | user282_1@email.com,campaign_3,STREAMING,2021-04-10,47,0.200000 71 | user286_3@email.com,campaign_3,DISPLAY,2021-04-17,25,0.340000 72 | user289_3@email.com,campaign_1,STREAMING,2021-04-26,44,0.290000 73 | user301_1@email.com,campaign_2,STREAMING,2021-04-21,4,0.540000 74 | user302_3@email.com,campaign_1,STREAMING,2021-05-25,25,0.440000 75 | user303_3@email.com,campaign_1,STREAMING,2021-04-22,24,0.830000 76 | user310_2@email.com,campaign_2,STREAMING,2021-03-27,54,0.520000 77 | user311_3@email.com,campaign_1,STREAMING,2021-03-15,31,1.010000 78 | user313_2@email.com,campaign_1,STREAMING,2021-03-02,10,0.950000 79 | user314_1@email.com,campaign_1,MOBILE,2021-04-23,2,2.970000 80 | user316_3@email.com,campaign_3,DISPLAY,2021-03-27,11,0.300000 81 | user319_2@email.com,campaign_1,LINEAR,2021-04-16,43,2.540000 82 | user331_3@email.com,campaign_1,STREAMING,2021-05-10,6,1.660000 83 | user337_3@email.com,campaign_1,STREAMING,2021-04-07,37,1.590000 84 | user347_2@email.com,campaign_1,MOBILE,2021-05-17,18,1.170000 85 | user359_2@email.com,campaign_3,STREAMING,2021-05-06,6,2.220000 86 | user366_2@email.com,campaign_3,STREAMING,2021-05-01,45,2.900000 87 | user368_1@email.com,campaign_2,STREAMING,2021-04-27,57,1.550000 88 | user382_2@email.com,campaign_3,MOBILE,2021-03-02,53,1.650000 89 | user400_1@email.com,campaign_2,STREAMING,2021-03-26,21,0.780000 90 | user407_3@email.com,campaign_1,STREAMING,2021-04-04,21,0.960000 91 | user409_3@email.com,campaign_2,STREAMING,2021-03-22,53,2.250000 92 | user423_1@email.com,campaign_1,STREAMING,2021-05-25,36,0.880000 93 | user424_3@email.com,campaign_1,STREAMING,2021-05-20,56,0.320000 94 | user425_2@email.com,campaign_3,STREAMING,2021-03-10,45,2.450000 95 | user427_1@email.com,campaign_3,STREAMING,2021-05-08,54,2.640000 96 | user429_2@email.com,campaign_3,STREAMING,2021-04-18,57,0.320000 97 | user437_2@email.com,campaign_3,STREAMING,2021-04-28,34,2.850000 98 | user441_1@email.com,campaign_1,STREAMING,2021-03-02,35,2.610000 99 | user449_2@email.com,campaign_1,STREAMING,2021-05-17,57,0.080000 100 | user450_3@email.com,campaign_1,STREAMING,2021-05-23,15,1.300000 101 | user451_1@email.com,campaign_1,STREAMING,2021-04-30,58,2.250000 102 | user453_2@email.com,campaign_2,STREAMING,2021-04-13,36,1.930000 103 | user459_3@email.com,campaign_2,MOBILE,2021-05-11,29,0.610000 104 | user463_1@email.com,campaign_3,STREAMING,2021-04-18,24,2.660000 105 | user467_2@email.com,campaign_1,STREAMING,2021-03-10,2,2.300000 106 | user472_1@email.com,campaign_3,STREAMING,2021-03-18,52,0.220000 107 | user475_1@email.com,campaign_1,STREAMING,2021-05-04,8,0.490000 108 | user486_2@email.com,campaign_1,STREAMING,2021-05-07,5,1.240000 109 | user491_2@email.com,campaign_2,STREAMING,2021-05-20,42,0.400000 110 | user493_1@email.com,campaign_1,MOBILE,2021-05-04,55,2.500000 111 | user497_2@email.com,campaign_3,MOBILE,2021-03-14,36,0.050000 112 | user499_3@email.com,campaign_1,STREAMING,2021-04-24,15,2.310000 113 | user508_2@email.com,campaign_3,STREAMING,2021-03-07,19,1.810000 114 | user511_1@email.com,campaign_3,STREAMING,2021-03-18,27,1.030000 115 | user512_3@email.com,campaign_2,STREAMING,2021-05-14,23,1.290000 116 | user520_2@email.com,campaign_1,STREAMING,2021-05-21,1,2.550000 117 | user522_2@email.com,campaign_2,STREAMING,2021-04-13,53,1.780000 118 | user532_2@email.com,campaign_1,STREAMING,2021-04-27,57,0.520000 119 | user549_2@email.com,campaign_1,STREAMING,2021-04-05,52,1.790000 120 | user552_1@email.com,campaign_1,STREAMING,2021-04-26,46,0.190000 121 | user553_3@email.com,campaign_3,LINEAR,2021-04-06,40,0.340000 122 | user559_3@email.com,campaign_2,STREAMING,2021-05-27,49,1.260000 123 | user564_2@email.com,campaign_2,STREAMING,2021-03-08,15,1.400000 124 | user571_1@email.com,campaign_1,STREAMING,2021-04-07,21,2.430000 125 | user574_2@email.com,campaign_3,STREAMING,2021-03-29,28,0.720000 126 | user581_3@email.com,campaign_3,STREAMING,2021-05-01,42,1.510000 127 | user585_2@email.com,campaign_2,LINEAR,2021-05-10,36,2.110000 128 | user590_2@email.com,campaign_1,STREAMING,2021-03-21,34,2.890000 129 | user593_2@email.com,campaign_1,STREAMING,2021-04-04,52,1.320000 130 | user603_3@email.com,campaign_1,STREAMING,2021-04-07,53,0.340000 131 | user607_1@email.com,campaign_3,DISPLAY,2021-03-23,38,1.610000 132 | user615_2@email.com,campaign_1,STREAMING,2021-05-29,39,1.120000 133 | user617_2@email.com,campaign_2,STREAMING,2021-03-04,20,2.660000 134 | user619_1@email.com,campaign_2,STREAMING,2021-03-25,40,2.310000 135 | user623_2@email.com,campaign_3,STREAMING,2021-05-22,54,2.850000 136 | user645_2@email.com,campaign_3,STREAMING,2021-04-01,46,0.420000 137 | user652_1@email.com,campaign_1,STREAMING,2021-03-30,7,1.630000 138 | user659_2@email.com,campaign_3,STREAMING,2021-05-19,25,1.940000 139 | user663_3@email.com,campaign_3,MOBILE,2021-04-08,19,0.360000 140 | user667_3@email.com,campaign_1,STREAMING,2021-04-25,19,1.270000 141 | user673_1@email.com,campaign_2,MOBILE,2021-04-21,33,0.500000 142 | user674_1@email.com,campaign_3,DISPLAY,2021-05-29,53,1.310000 143 | user681_1@email.com,campaign_1,STREAMING,2021-04-12,37,2.070000 144 | user682_3@email.com,campaign_3,MOBILE,2021-05-08,56,0.190000 145 | user685_3@email.com,campaign_1,DISPLAY,2021-04-27,7,2.170000 146 | user689_3@email.com,campaign_1,STREAMING,2021-04-20,38,0.020000 147 | user695_1@email.com,campaign_3,MOBILE,2021-04-13,59,1.520000 148 | user702_3@email.com,campaign_2,MOBILE,2021-04-17,26,1.570000 149 | user703_1@email.com,campaign_2,STREAMING,2021-04-21,43,1.480000 150 | user709_3@email.com,campaign_3,STREAMING,2021-04-23,28,1.500000 151 | user711_1@email.com,campaign_3,LINEAR,2021-05-27,23,0.210000 152 | user712_3@email.com,campaign_2,STREAMING,2021-05-16,6,1.350000 153 | user713_2@email.com,campaign_2,MOBILE,2021-03-30,25,2.350000 154 | user716_3@email.com,campaign_3,MOBILE,2021-05-26,9,0.010000 155 | user720_3@email.com,campaign_3,DISPLAY,2021-05-05,37,1.430000 156 | user726_2@email.com,campaign_1,STREAMING,2021-05-16,48,1.940000 157 | user728_2@email.com,campaign_1,STREAMING,2021-04-01,32,2.860000 158 | user734_2@email.com,campaign_2,STREAMING,2021-05-11,19,2.820000 159 | user737_2@email.com,campaign_1,MOBILE,2021-05-27,53,2.010000 160 | user740_1@email.com,campaign_3,STREAMING,2021-03-13,6,2.980000 161 | user745_3@email.com,campaign_3,STREAMING,2021-05-25,34,0.130000 162 | user746_2@email.com,campaign_3,MOBILE,2021-04-21,2,0.770000 163 | user750_2@email.com,campaign_1,STREAMING,2021-04-19,34,2.540000 164 | user756_1@email.com,campaign_2,STREAMING,2021-05-30,14,2.900000 165 | user757_3@email.com,campaign_2,STREAMING,2021-03-21,51,2.470000 166 | user758_1@email.com,campaign_3,DISPLAY,2021-04-19,4,2.530000 167 | user766_1@email.com,campaign_3,DISPLAY,2021-03-26,38,0.310000 168 | user767_2@email.com,campaign_2,STREAMING,2021-04-10,14,2.530000 169 | user777_3@email.com,campaign_1,STREAMING,2021-05-09,38,2.580000 170 | user781_2@email.com,campaign_1,STREAMING,2021-05-21,39,0.690000 171 | user784_3@email.com,campaign_2,STREAMING,2021-04-29,52,2.310000 172 | user786_3@email.com,campaign_3,STREAMING,2021-05-06,32,1.630000 173 | user792_1@email.com,campaign_2,STREAMING,2021-05-13,20,1.700000 174 | user796_1@email.com,campaign_1,DISPLAY,2021-03-08,48,0.940000 175 | user797_3@email.com,campaign_2,STREAMING,2021-04-25,49,0.270000 176 | user798_3@email.com,campaign_2,DISPLAY,2021-04-25,39,0.480000 177 | user807_1@email.com,campaign_2,STREAMING,2021-05-25,38,1.900000 178 | user810_1@email.com,campaign_1,DISPLAY,2021-04-21,17,1.740000 179 | user814_1@email.com,campaign_2,STREAMING,2021-03-29,10,0.540000 180 | user816_2@email.com,campaign_3,DISPLAY,2021-03-05,32,0.210000 181 | user820_1@email.com,campaign_2,STREAMING,2021-03-04,57,0.470000 182 | user821_1@email.com,campaign_3,STREAMING,2021-03-14,9,0.750000 183 | user828_1@email.com,campaign_2,STREAMING,2021-04-24,52,0.540000 184 | user829_3@email.com,campaign_2,STREAMING,2021-03-30,32,1.990000 185 | user840_3@email.com,campaign_1,STREAMING,2021-04-01,59,0.190000 186 | user845_1@email.com,campaign_1,MOBILE,2021-05-02,34,0.870000 187 | user846_2@email.com,campaign_1,STREAMING,2021-04-11,35,0.790000 188 | user849_1@email.com,campaign_1,MOBILE,2021-03-03,58,1.400000 189 | user852_1@email.com,campaign_3,STREAMING,2021-04-08,23,0.540000 190 | user856_2@email.com,campaign_3,STREAMING,2021-04-02,34,2.230000 191 | user863_3@email.com,campaign_1,MOBILE,2021-04-08,42,2.320000 192 | user864_2@email.com,campaign_1,STREAMING,2021-03-22,10,2.180000 193 | user865_1@email.com,campaign_2,STREAMING,2021-03-11,4,0.960000 194 | user867_1@email.com,campaign_2,MOBILE,2021-04-20,47,0.270000 195 | user871_3@email.com,campaign_2,STREAMING,2021-03-13,42,2.820000 196 | user873_3@email.com,campaign_3,STREAMING,2021-05-09,38,2.950000 197 | user880_1@email.com,campaign_2,STREAMING,2021-05-03,3,1.420000 198 | user881_2@email.com,campaign_2,DISPLAY,2021-04-12,14,2.430000 199 | user888_2@email.com,campaign_3,STREAMING,2021-05-15,8,0.820000 200 | user910_3@email.com,campaign_1,STREAMING,2021-04-30,38,0.620000 201 | user912_1@email.com,campaign_2,STREAMING,2021-05-15,37,0.580000 202 | user914_2@email.com,campaign_1,STREAMING,2021-03-12,32,2.450000 203 | user915_3@email.com,campaign_3,DISPLAY,2021-04-12,34,2.570000 204 | user918_2@email.com,campaign_1,STREAMING,2021-03-05,53,0.700000 205 | user926_3@email.com,campaign_1,STREAMING,2021-04-13,40,2.440000 206 | user927_3@email.com,campaign_3,STREAMING,2021-05-26,57,1.280000 207 | user928_2@email.com,campaign_1,STREAMING,2021-05-13,43,2.610000 208 | user930_1@email.com,campaign_1,MOBILE,2021-05-07,48,2.230000 209 | user932_1@email.com,campaign_1,MOBILE,2021-04-22,34,2.810000 210 | user934_3@email.com,campaign_3,STREAMING,2021-03-05,3,0.850000 211 | user942_1@email.com,campaign_3,STREAMING,2021-04-30,34,1.810000 212 | user945_1@email.com,campaign_3,MOBILE,2021-04-08,25,0.080000 213 | user951_1@email.com,campaign_3,MOBILE,2021-03-17,9,0.890000 214 | user969_2@email.com,campaign_2,DISPLAY,2021-04-21,33,2.390000 215 | user973_2@email.com,campaign_3,DISPLAY,2021-05-12,28,1.200000 216 | user975_3@email.com,campaign_2,STREAMING,2021-03-04,1,1.650000 217 | user976_3@email.com,campaign_2,STREAMING,2021-04-27,33,1.750000 218 | user981_3@email.com,campaign_3,MOBILE,2021-03-13,26,2.230000 219 | user992_3@email.com,campaign_2,STREAMING,2021-03-25,53,2.780000 220 | user998_1@email.com,campaign_2,MOBILE,2021-05-22,32,0.140000 221 | -------------------------------------------------------------------------------- /samples/data/media_advertiser/media/media_subscriptions.csv: -------------------------------------------------------------------------------- 1 | EMAIL,IS_SUBSCRIBED 2 | user0_1@email.com,0 3 | user1_3@email.com,0 4 | user2_1@email.com,1 5 | user3_3@email.com,0 6 | user4_2@email.com,0 7 | user5_1@email.com,1 8 | user6_3@email.com,1 9 | user7_3@email.com,0 10 | user8_3@email.com,1 11 | user9_2@email.com,0 12 | user10_1@email.com,0 13 | user11_1@email.com,1 14 | user12_1@email.com,0 15 | user13_2@email.com,0 16 | user14_1@email.com,1 17 | user15_3@email.com,0 18 | user16_3@email.com,0 19 | user17_2@email.com,1 20 | user18_2@email.com,0 21 | user19_2@email.com,0 22 | user20_2@email.com,1 23 | user21_3@email.com,0 24 | user22_2@email.com,1 25 | user23_3@email.com,1 26 | user24_1@email.com,1 27 | user25_3@email.com,1 28 | user26_3@email.com,1 29 | user27_1@email.com,0 30 | user28_3@email.com,1 31 | user29_1@email.com,1 32 | user30_1@email.com,1 33 | user31_3@email.com,1 34 | user32_1@email.com,1 35 | user33_3@email.com,0 36 | user34_2@email.com,1 37 | user35_2@email.com,1 38 | user36_1@email.com,0 39 | user37_2@email.com,1 40 | user38_1@email.com,1 41 | user39_1@email.com,1 42 | user40_3@email.com,1 43 | user41_2@email.com,0 44 | user42_3@email.com,0 45 | user43_2@email.com,0 46 | user44_2@email.com,0 47 | user45_3@email.com,0 48 | user46_3@email.com,0 49 | user47_1@email.com,0 50 | user48_2@email.com,1 51 | user49_2@email.com,0 52 | user50_3@email.com,1 53 | user51_1@email.com,1 54 | user52_1@email.com,1 55 | user53_3@email.com,0 56 | user54_2@email.com,0 57 | user55_2@email.com,1 58 | user56_2@email.com,0 59 | user57_3@email.com,1 60 | user58_2@email.com,0 61 | user59_3@email.com,0 62 | user60_2@email.com,0 63 | user61_1@email.com,1 64 | user62_3@email.com,1 65 | user63_3@email.com,0 66 | user64_1@email.com,1 67 | user65_1@email.com,0 68 | user66_3@email.com,1 69 | user67_1@email.com,1 70 | user68_2@email.com,0 71 | user69_2@email.com,1 72 | user70_1@email.com,0 73 | user71_3@email.com,1 74 | user72_2@email.com,1 75 | user73_3@email.com,1 76 | user74_1@email.com,0 77 | user75_3@email.com,0 78 | user76_1@email.com,1 79 | user77_2@email.com,1 80 | user78_3@email.com,0 81 | user79_1@email.com,1 82 | user80_1@email.com,0 83 | user81_3@email.com,0 84 | user82_2@email.com,1 85 | user83_3@email.com,1 86 | user84_1@email.com,1 87 | user85_1@email.com,1 88 | user86_1@email.com,1 89 | user87_1@email.com,0 90 | user88_3@email.com,0 91 | user89_2@email.com,1 92 | user90_2@email.com,1 93 | user91_3@email.com,0 94 | user92_3@email.com,0 95 | user93_1@email.com,0 96 | user94_3@email.com,0 97 | user95_3@email.com,0 98 | user96_1@email.com,1 99 | user97_2@email.com,0 100 | user98_2@email.com,0 101 | user99_2@email.com,0 102 | user100_1@email.com,0 103 | user101_2@email.com,0 104 | user102_2@email.com,0 105 | user103_1@email.com,1 106 | user104_2@email.com,1 107 | user105_3@email.com,1 108 | user106_2@email.com,0 109 | user107_3@email.com,0 110 | user108_3@email.com,0 111 | user109_3@email.com,1 112 | user110_3@email.com,1 113 | user111_3@email.com,0 114 | user112_2@email.com,1 115 | user113_1@email.com,1 116 | user114_1@email.com,0 117 | user115_3@email.com,0 118 | user116_1@email.com,0 119 | user117_1@email.com,1 120 | user118_3@email.com,1 121 | user119_1@email.com,1 122 | user120_1@email.com,1 123 | user121_1@email.com,0 124 | user122_3@email.com,1 125 | user123_3@email.com,0 126 | user124_2@email.com,0 127 | user125_3@email.com,1 128 | user126_2@email.com,0 129 | user127_1@email.com,0 130 | user128_1@email.com,1 131 | user129_3@email.com,1 132 | user130_3@email.com,1 133 | user131_1@email.com,0 134 | user132_3@email.com,1 135 | user133_3@email.com,1 136 | user134_3@email.com,0 137 | user135_2@email.com,0 138 | user136_1@email.com,0 139 | user137_1@email.com,1 140 | user138_3@email.com,1 141 | user139_2@email.com,1 142 | user140_1@email.com,1 143 | user141_2@email.com,0 144 | user142_2@email.com,1 145 | user143_2@email.com,0 146 | user144_1@email.com,1 147 | user145_2@email.com,1 148 | user146_1@email.com,1 149 | user147_1@email.com,1 150 | user148_1@email.com,0 151 | user149_3@email.com,1 152 | user150_1@email.com,0 153 | user151_2@email.com,0 154 | user152_2@email.com,0 155 | user153_1@email.com,0 156 | user154_1@email.com,0 157 | user155_3@email.com,0 158 | user156_1@email.com,0 159 | user157_2@email.com,1 160 | user158_3@email.com,1 161 | user159_2@email.com,1 162 | user160_1@email.com,1 163 | user161_1@email.com,1 164 | user162_3@email.com,1 165 | user163_3@email.com,0 166 | user164_2@email.com,1 167 | user165_2@email.com,1 168 | user166_3@email.com,1 169 | user167_1@email.com,1 170 | user168_3@email.com,1 171 | user169_1@email.com,0 172 | user170_3@email.com,0 173 | user171_3@email.com,1 174 | user172_3@email.com,0 175 | user173_2@email.com,0 176 | user174_2@email.com,0 177 | user175_2@email.com,0 178 | user176_3@email.com,1 179 | user177_1@email.com,1 180 | user178_2@email.com,1 181 | user179_2@email.com,0 182 | user180_3@email.com,0 183 | user181_1@email.com,0 184 | user182_3@email.com,1 185 | user183_1@email.com,1 186 | user184_1@email.com,1 187 | user185_3@email.com,0 188 | user186_3@email.com,1 189 | user187_2@email.com,0 190 | user188_1@email.com,0 191 | user189_2@email.com,1 192 | user190_2@email.com,1 193 | user191_2@email.com,1 194 | user192_2@email.com,1 195 | user193_2@email.com,0 196 | user194_2@email.com,1 197 | user195_2@email.com,0 198 | user196_1@email.com,0 199 | user197_2@email.com,0 200 | user198_3@email.com,0 201 | user199_2@email.com,1 202 | user200_3@email.com,1 203 | user201_1@email.com,1 204 | user202_1@email.com,0 205 | user203_1@email.com,1 206 | user204_1@email.com,1 207 | user205_2@email.com,0 208 | user206_1@email.com,1 209 | user207_1@email.com,1 210 | user208_3@email.com,1 211 | user209_3@email.com,1 212 | user210_2@email.com,0 213 | user211_3@email.com,1 214 | user212_2@email.com,1 215 | user213_2@email.com,1 216 | user214_3@email.com,1 217 | user215_2@email.com,0 218 | user216_3@email.com,0 219 | user217_1@email.com,1 220 | user218_2@email.com,0 221 | user219_2@email.com,0 222 | user220_3@email.com,0 223 | user221_2@email.com,1 224 | user222_3@email.com,1 225 | user223_3@email.com,1 226 | user224_2@email.com,0 227 | user225_2@email.com,0 228 | user226_2@email.com,0 229 | user227_1@email.com,1 230 | user228_1@email.com,1 231 | user229_3@email.com,1 232 | user230_2@email.com,1 233 | user231_1@email.com,0 234 | user232_3@email.com,0 235 | user233_3@email.com,1 236 | user234_1@email.com,1 237 | user235_1@email.com,0 238 | user236_2@email.com,0 239 | user237_1@email.com,0 240 | user238_2@email.com,1 241 | user239_1@email.com,1 242 | user240_2@email.com,1 243 | user241_3@email.com,1 244 | user242_1@email.com,0 245 | user243_2@email.com,1 246 | user244_1@email.com,0 247 | user245_1@email.com,0 248 | user246_2@email.com,1 249 | user247_3@email.com,1 250 | user248_1@email.com,0 251 | user249_2@email.com,1 252 | user250_1@email.com,0 253 | user251_1@email.com,0 254 | user252_2@email.com,1 255 | user253_2@email.com,0 256 | user254_1@email.com,0 257 | user255_3@email.com,0 258 | user256_1@email.com,1 259 | user257_3@email.com,0 260 | user258_3@email.com,1 261 | user259_2@email.com,0 262 | user260_3@email.com,1 263 | user261_1@email.com,0 264 | user262_2@email.com,0 265 | user263_3@email.com,0 266 | user264_2@email.com,0 267 | user265_1@email.com,1 268 | user266_1@email.com,1 269 | user267_2@email.com,1 270 | user268_1@email.com,0 271 | user269_2@email.com,0 272 | user270_2@email.com,1 273 | user271_2@email.com,1 274 | user272_2@email.com,1 275 | user273_2@email.com,1 276 | user274_3@email.com,1 277 | user275_2@email.com,1 278 | user276_1@email.com,0 279 | user277_2@email.com,0 280 | user278_3@email.com,1 281 | user279_2@email.com,1 282 | user280_3@email.com,0 283 | user281_3@email.com,0 284 | user282_3@email.com,1 285 | user283_2@email.com,0 286 | user284_1@email.com,1 287 | user285_2@email.com,1 288 | user286_1@email.com,1 289 | user287_2@email.com,1 290 | user288_1@email.com,0 291 | user289_2@email.com,0 292 | user290_3@email.com,0 293 | user291_3@email.com,1 294 | user292_1@email.com,0 295 | user293_3@email.com,0 296 | user294_1@email.com,0 297 | user295_1@email.com,0 298 | user296_3@email.com,1 299 | user297_3@email.com,1 300 | user298_2@email.com,0 301 | user299_1@email.com,1 302 | user300_3@email.com,1 303 | user301_2@email.com,0 304 | user302_3@email.com,1 305 | user303_2@email.com,0 306 | user304_1@email.com,1 307 | user305_3@email.com,1 308 | user306_1@email.com,1 309 | user307_3@email.com,0 310 | user308_3@email.com,0 311 | user309_1@email.com,1 312 | user310_1@email.com,1 313 | user311_2@email.com,1 314 | user312_3@email.com,1 315 | user313_2@email.com,0 316 | user314_2@email.com,0 317 | user315_1@email.com,1 318 | user316_1@email.com,1 319 | user317_1@email.com,0 320 | user318_1@email.com,0 321 | user319_1@email.com,1 322 | user320_3@email.com,1 323 | user321_2@email.com,0 324 | user322_2@email.com,0 325 | user323_3@email.com,1 326 | user324_1@email.com,0 327 | user325_1@email.com,0 328 | user326_3@email.com,0 329 | user327_3@email.com,0 330 | user328_1@email.com,0 331 | user329_3@email.com,1 332 | user330_1@email.com,0 333 | user331_1@email.com,0 334 | user332_1@email.com,1 335 | user333_2@email.com,1 336 | user334_1@email.com,1 337 | user335_1@email.com,0 338 | user336_3@email.com,0 339 | user337_1@email.com,0 340 | user338_2@email.com,1 341 | user339_2@email.com,0 342 | user340_2@email.com,1 343 | user341_3@email.com,0 344 | user342_2@email.com,1 345 | user343_1@email.com,0 346 | user344_3@email.com,1 347 | user345_3@email.com,1 348 | user346_1@email.com,0 349 | user347_2@email.com,1 350 | user348_1@email.com,0 351 | user349_2@email.com,0 352 | user350_1@email.com,0 353 | user351_3@email.com,1 354 | user352_2@email.com,0 355 | user353_3@email.com,1 356 | user354_2@email.com,1 357 | user355_1@email.com,0 358 | user356_2@email.com,1 359 | user357_2@email.com,0 360 | user358_1@email.com,0 361 | user359_2@email.com,1 362 | user360_1@email.com,0 363 | user361_2@email.com,1 364 | user362_3@email.com,1 365 | user363_1@email.com,0 366 | user364_3@email.com,1 367 | user365_1@email.com,0 368 | user366_3@email.com,1 369 | user367_3@email.com,0 370 | user368_3@email.com,1 371 | user369_3@email.com,0 372 | user370_2@email.com,0 373 | user371_2@email.com,0 374 | user372_1@email.com,0 375 | user373_3@email.com,1 376 | user374_3@email.com,1 377 | user375_2@email.com,1 378 | user376_2@email.com,0 379 | user377_3@email.com,1 380 | user378_3@email.com,0 381 | user379_2@email.com,0 382 | user380_1@email.com,0 383 | user381_2@email.com,0 384 | user382_3@email.com,1 385 | user383_2@email.com,1 386 | user384_3@email.com,0 387 | user385_1@email.com,0 388 | user386_1@email.com,0 389 | user387_2@email.com,0 390 | user388_1@email.com,0 391 | user389_1@email.com,0 392 | user390_3@email.com,1 393 | user391_3@email.com,0 394 | user392_3@email.com,0 395 | user393_3@email.com,0 396 | user394_1@email.com,0 397 | user395_1@email.com,1 398 | user396_1@email.com,0 399 | user397_2@email.com,0 400 | user398_3@email.com,0 401 | user399_2@email.com,1 402 | user400_1@email.com,1 403 | user401_2@email.com,1 404 | user402_1@email.com,0 405 | user403_1@email.com,1 406 | user404_2@email.com,1 407 | user405_2@email.com,1 408 | user406_2@email.com,1 409 | user407_3@email.com,1 410 | user408_3@email.com,1 411 | user409_2@email.com,1 412 | user410_3@email.com,1 413 | user411_2@email.com,0 414 | user412_3@email.com,0 415 | user413_1@email.com,1 416 | user414_3@email.com,1 417 | user415_2@email.com,0 418 | user416_2@email.com,0 419 | user417_3@email.com,1 420 | user418_2@email.com,1 421 | user419_2@email.com,0 422 | user420_3@email.com,0 423 | user421_1@email.com,0 424 | user422_3@email.com,1 425 | user423_3@email.com,1 426 | user424_2@email.com,1 427 | user425_2@email.com,0 428 | user426_3@email.com,0 429 | user427_3@email.com,0 430 | user428_1@email.com,0 431 | user429_2@email.com,0 432 | user430_3@email.com,0 433 | user431_2@email.com,0 434 | user432_3@email.com,1 435 | user433_1@email.com,0 436 | user434_3@email.com,1 437 | user435_1@email.com,0 438 | user436_1@email.com,0 439 | user437_3@email.com,0 440 | user438_3@email.com,1 441 | user439_2@email.com,0 442 | user440_1@email.com,1 443 | user441_3@email.com,1 444 | user442_3@email.com,1 445 | user443_1@email.com,1 446 | user444_1@email.com,1 447 | user445_3@email.com,0 448 | user446_3@email.com,1 449 | user447_2@email.com,0 450 | user448_1@email.com,1 451 | user449_1@email.com,1 452 | user450_2@email.com,1 453 | user451_2@email.com,0 454 | user452_1@email.com,0 455 | user453_1@email.com,0 456 | user454_3@email.com,0 457 | user455_1@email.com,1 458 | user456_1@email.com,0 459 | user457_3@email.com,0 460 | user458_3@email.com,0 461 | user459_1@email.com,1 462 | user460_1@email.com,0 463 | user461_3@email.com,1 464 | user462_1@email.com,0 465 | user463_2@email.com,0 466 | user464_3@email.com,0 467 | user465_1@email.com,1 468 | user466_1@email.com,1 469 | user467_3@email.com,0 470 | user468_2@email.com,1 471 | user469_3@email.com,0 472 | user470_3@email.com,0 473 | user471_1@email.com,0 474 | user472_1@email.com,1 475 | user473_3@email.com,0 476 | user474_2@email.com,0 477 | user475_3@email.com,1 478 | user476_3@email.com,1 479 | user477_3@email.com,1 480 | user478_1@email.com,0 481 | user479_1@email.com,1 482 | user480_2@email.com,0 483 | user481_2@email.com,0 484 | user482_1@email.com,1 485 | user483_3@email.com,0 486 | user484_2@email.com,1 487 | user485_2@email.com,1 488 | user486_1@email.com,1 489 | user487_1@email.com,1 490 | user488_2@email.com,1 491 | user489_1@email.com,1 492 | user490_3@email.com,0 493 | user491_2@email.com,1 494 | user492_3@email.com,0 495 | user493_2@email.com,0 496 | user494_3@email.com,0 497 | user495_3@email.com,0 498 | user496_3@email.com,1 499 | user497_2@email.com,1 500 | user498_1@email.com,1 501 | user499_1@email.com,0 502 | user500_3@email.com,1 503 | user501_1@email.com,1 504 | user502_3@email.com,0 505 | user503_3@email.com,1 506 | user504_3@email.com,1 507 | user505_2@email.com,1 508 | user506_2@email.com,1 509 | user507_1@email.com,0 510 | user508_3@email.com,1 511 | user509_1@email.com,0 512 | user510_2@email.com,1 513 | user511_1@email.com,0 514 | user512_1@email.com,1 515 | user513_2@email.com,0 516 | user514_1@email.com,1 517 | user515_3@email.com,1 518 | user516_2@email.com,0 519 | user517_2@email.com,0 520 | user518_3@email.com,0 521 | user519_3@email.com,0 522 | user520_2@email.com,0 523 | user521_1@email.com,0 524 | user522_1@email.com,1 525 | user523_2@email.com,1 526 | user524_2@email.com,0 527 | user525_3@email.com,0 528 | user526_2@email.com,1 529 | user527_2@email.com,1 530 | user528_3@email.com,0 531 | user529_1@email.com,0 532 | user530_3@email.com,1 533 | user531_1@email.com,0 534 | user532_3@email.com,1 535 | user533_3@email.com,1 536 | user534_2@email.com,0 537 | user535_1@email.com,1 538 | user536_2@email.com,0 539 | user537_2@email.com,1 540 | user538_1@email.com,1 541 | user539_1@email.com,1 542 | user540_1@email.com,1 543 | user541_3@email.com,1 544 | user542_2@email.com,0 545 | user543_2@email.com,1 546 | user544_3@email.com,0 547 | user545_3@email.com,0 548 | user546_1@email.com,1 549 | user547_1@email.com,1 550 | user548_1@email.com,0 551 | user549_2@email.com,0 552 | user550_2@email.com,0 553 | user551_3@email.com,0 554 | user552_2@email.com,1 555 | user553_3@email.com,0 556 | user554_3@email.com,0 557 | user555_2@email.com,0 558 | user556_1@email.com,0 559 | user557_3@email.com,0 560 | user558_2@email.com,0 561 | user559_3@email.com,0 562 | user560_3@email.com,1 563 | user561_1@email.com,0 564 | user562_3@email.com,1 565 | user563_1@email.com,1 566 | user564_2@email.com,0 567 | user565_2@email.com,0 568 | user566_1@email.com,0 569 | user567_3@email.com,1 570 | user568_3@email.com,0 571 | user569_2@email.com,0 572 | user570_3@email.com,1 573 | user571_3@email.com,1 574 | user572_2@email.com,1 575 | user573_2@email.com,1 576 | user574_3@email.com,1 577 | user575_1@email.com,1 578 | user576_3@email.com,0 579 | user577_1@email.com,0 580 | user578_2@email.com,0 581 | user579_1@email.com,1 582 | user580_3@email.com,0 583 | user581_2@email.com,1 584 | user582_3@email.com,0 585 | user583_3@email.com,1 586 | user584_3@email.com,0 587 | user585_2@email.com,0 588 | user586_3@email.com,1 589 | user587_3@email.com,0 590 | user588_3@email.com,1 591 | user589_2@email.com,0 592 | user590_2@email.com,0 593 | user591_2@email.com,1 594 | user592_3@email.com,1 595 | user593_1@email.com,1 596 | user594_1@email.com,1 597 | user595_1@email.com,0 598 | user596_3@email.com,1 599 | user597_3@email.com,0 600 | user598_1@email.com,1 601 | user599_1@email.com,1 602 | user600_2@email.com,0 603 | user601_1@email.com,1 604 | user602_1@email.com,1 605 | user603_3@email.com,1 606 | user604_3@email.com,1 607 | user605_1@email.com,0 608 | user606_2@email.com,1 609 | user607_2@email.com,1 610 | user608_1@email.com,1 611 | user609_3@email.com,1 612 | user610_2@email.com,0 613 | user611_2@email.com,1 614 | user612_2@email.com,1 615 | user613_1@email.com,1 616 | user614_1@email.com,1 617 | user615_1@email.com,0 618 | user616_1@email.com,1 619 | user617_3@email.com,0 620 | user618_3@email.com,0 621 | user619_1@email.com,1 622 | user620_3@email.com,1 623 | user621_3@email.com,1 624 | user622_3@email.com,1 625 | user623_2@email.com,0 626 | user624_2@email.com,0 627 | user625_1@email.com,0 628 | user626_1@email.com,0 629 | user627_2@email.com,0 630 | user628_1@email.com,1 631 | user629_2@email.com,1 632 | user630_3@email.com,1 633 | user631_2@email.com,0 634 | user632_1@email.com,0 635 | user633_1@email.com,1 636 | user634_3@email.com,0 637 | user635_2@email.com,0 638 | user636_1@email.com,1 639 | user637_2@email.com,1 640 | user638_1@email.com,0 641 | user639_1@email.com,1 642 | user640_2@email.com,1 643 | user641_2@email.com,1 644 | user642_2@email.com,1 645 | user643_3@email.com,0 646 | user644_1@email.com,0 647 | user645_2@email.com,0 648 | user646_2@email.com,0 649 | user647_2@email.com,0 650 | user648_3@email.com,1 651 | user649_1@email.com,1 652 | user650_3@email.com,0 653 | user651_3@email.com,0 654 | user652_3@email.com,0 655 | user653_2@email.com,0 656 | user654_2@email.com,1 657 | user655_3@email.com,0 658 | user656_3@email.com,0 659 | user657_2@email.com,1 660 | user658_1@email.com,0 661 | user659_3@email.com,0 662 | user660_2@email.com,0 663 | user661_2@email.com,0 664 | user662_2@email.com,1 665 | user663_3@email.com,1 666 | user664_2@email.com,1 667 | user665_3@email.com,0 668 | user666_1@email.com,1 669 | user667_2@email.com,0 670 | user668_3@email.com,0 671 | user669_1@email.com,0 672 | user670_3@email.com,1 673 | user671_2@email.com,0 674 | user672_2@email.com,0 675 | user673_2@email.com,1 676 | user674_2@email.com,0 677 | user675_2@email.com,0 678 | user676_2@email.com,0 679 | user677_3@email.com,0 680 | user678_3@email.com,0 681 | user679_2@email.com,1 682 | user680_2@email.com,1 683 | user681_3@email.com,1 684 | user682_2@email.com,1 685 | user683_1@email.com,1 686 | user684_3@email.com,0 687 | user685_3@email.com,1 688 | user686_2@email.com,1 689 | user687_2@email.com,0 690 | user688_1@email.com,1 691 | user689_3@email.com,1 692 | user690_1@email.com,1 693 | user691_2@email.com,1 694 | user692_1@email.com,1 695 | user693_2@email.com,1 696 | user694_2@email.com,1 697 | user695_3@email.com,1 698 | user696_1@email.com,1 699 | user697_1@email.com,1 700 | user698_1@email.com,1 701 | user699_1@email.com,0 702 | user700_2@email.com,0 703 | user701_2@email.com,1 704 | user702_2@email.com,1 705 | user703_2@email.com,0 706 | user704_1@email.com,1 707 | user705_1@email.com,1 708 | user706_3@email.com,0 709 | user707_1@email.com,1 710 | user708_3@email.com,0 711 | user709_2@email.com,0 712 | user710_2@email.com,1 713 | user711_2@email.com,0 714 | user712_2@email.com,1 715 | user713_3@email.com,1 716 | user714_2@email.com,1 717 | user715_2@email.com,0 718 | user716_2@email.com,0 719 | user717_3@email.com,0 720 | user718_3@email.com,0 721 | user719_3@email.com,1 722 | user720_1@email.com,0 723 | user721_2@email.com,0 724 | user722_2@email.com,0 725 | user723_3@email.com,0 726 | user724_2@email.com,0 727 | user725_3@email.com,0 728 | user726_2@email.com,0 729 | user727_1@email.com,0 730 | user728_3@email.com,1 731 | user729_2@email.com,1 732 | user730_1@email.com,0 733 | user731_2@email.com,0 734 | user732_2@email.com,0 735 | user733_1@email.com,0 736 | user734_1@email.com,0 737 | user735_3@email.com,0 738 | user736_2@email.com,0 739 | user737_2@email.com,1 740 | user738_3@email.com,0 741 | user739_3@email.com,0 742 | user740_1@email.com,1 743 | user741_1@email.com,1 744 | user742_1@email.com,1 745 | user743_2@email.com,1 746 | user744_2@email.com,1 747 | user745_1@email.com,0 748 | user746_3@email.com,1 749 | user747_2@email.com,1 750 | user748_2@email.com,1 751 | user749_3@email.com,1 752 | user750_2@email.com,1 753 | user751_1@email.com,0 754 | user752_2@email.com,0 755 | user753_3@email.com,1 756 | user754_3@email.com,1 757 | user755_3@email.com,0 758 | user756_1@email.com,1 759 | user757_1@email.com,1 760 | user758_3@email.com,1 761 | user759_2@email.com,1 762 | user760_2@email.com,1 763 | user761_1@email.com,0 764 | user762_1@email.com,1 765 | user763_3@email.com,1 766 | user764_3@email.com,0 767 | user765_2@email.com,1 768 | user766_1@email.com,1 769 | user767_2@email.com,0 770 | user768_1@email.com,0 771 | user769_2@email.com,0 772 | user770_3@email.com,0 773 | user771_2@email.com,0 774 | user772_1@email.com,1 775 | user773_1@email.com,1 776 | user774_1@email.com,0 777 | user775_1@email.com,0 778 | user776_2@email.com,1 779 | user777_2@email.com,0 780 | user778_2@email.com,1 781 | user779_3@email.com,1 782 | user780_3@email.com,1 783 | user781_2@email.com,1 784 | user782_1@email.com,1 785 | user783_1@email.com,1 786 | user784_1@email.com,0 787 | user785_2@email.com,0 788 | user786_3@email.com,0 789 | user787_3@email.com,1 790 | user788_3@email.com,0 791 | user789_3@email.com,1 792 | user790_1@email.com,0 793 | user791_1@email.com,0 794 | user792_3@email.com,0 795 | user793_1@email.com,1 796 | user794_1@email.com,1 797 | user795_1@email.com,0 798 | user796_1@email.com,0 799 | user797_2@email.com,0 800 | user798_1@email.com,0 801 | user799_1@email.com,1 802 | user800_3@email.com,0 803 | user801_2@email.com,0 804 | user802_3@email.com,0 805 | user803_3@email.com,0 806 | user804_2@email.com,0 807 | user805_2@email.com,0 808 | user806_2@email.com,1 809 | user807_3@email.com,1 810 | user808_1@email.com,1 811 | user809_3@email.com,0 812 | user810_3@email.com,0 813 | user811_2@email.com,1 814 | user812_2@email.com,1 815 | user813_1@email.com,1 816 | user814_1@email.com,1 817 | user815_1@email.com,1 818 | user816_3@email.com,1 819 | user817_3@email.com,0 820 | user818_1@email.com,1 821 | user819_1@email.com,0 822 | user820_3@email.com,1 823 | user821_3@email.com,1 824 | user822_1@email.com,1 825 | user823_1@email.com,0 826 | user824_1@email.com,1 827 | user825_2@email.com,1 828 | user826_1@email.com,1 829 | user827_1@email.com,0 830 | user828_3@email.com,0 831 | user829_1@email.com,1 832 | user830_3@email.com,1 833 | user831_3@email.com,1 834 | user832_3@email.com,0 835 | user833_2@email.com,1 836 | user834_3@email.com,1 837 | user835_2@email.com,1 838 | user836_2@email.com,0 839 | user837_2@email.com,0 840 | user838_2@email.com,0 841 | user839_3@email.com,1 842 | user840_3@email.com,0 843 | user841_1@email.com,1 844 | user842_1@email.com,0 845 | user843_3@email.com,1 846 | user844_1@email.com,1 847 | user845_1@email.com,0 848 | user846_3@email.com,0 849 | user847_1@email.com,1 850 | user848_3@email.com,0 851 | user849_3@email.com,1 852 | user850_2@email.com,0 853 | user851_1@email.com,1 854 | user852_1@email.com,1 855 | user853_3@email.com,0 856 | user854_1@email.com,0 857 | user855_1@email.com,1 858 | user856_3@email.com,1 859 | user857_1@email.com,0 860 | user858_1@email.com,1 861 | user859_2@email.com,0 862 | user860_3@email.com,0 863 | user861_3@email.com,0 864 | user862_3@email.com,0 865 | user863_1@email.com,0 866 | user864_3@email.com,1 867 | user865_3@email.com,0 868 | user866_3@email.com,0 869 | user867_3@email.com,0 870 | user868_2@email.com,1 871 | user869_1@email.com,0 872 | user870_3@email.com,0 873 | user871_1@email.com,0 874 | user872_2@email.com,1 875 | user873_3@email.com,1 876 | user874_3@email.com,1 877 | user875_2@email.com,0 878 | user876_1@email.com,0 879 | user877_1@email.com,1 880 | user878_3@email.com,1 881 | user879_2@email.com,1 882 | user880_3@email.com,1 883 | user881_2@email.com,1 884 | user882_2@email.com,0 885 | user883_1@email.com,1 886 | user884_1@email.com,1 887 | user885_2@email.com,0 888 | user886_2@email.com,1 889 | user887_2@email.com,1 890 | user888_3@email.com,0 891 | user889_3@email.com,1 892 | user890_1@email.com,0 893 | user891_2@email.com,1 894 | user892_2@email.com,1 895 | user893_2@email.com,1 896 | user894_2@email.com,0 897 | user895_1@email.com,0 898 | user896_2@email.com,1 899 | user897_3@email.com,0 900 | user898_3@email.com,0 901 | user899_1@email.com,0 902 | user900_2@email.com,0 903 | user901_3@email.com,1 904 | user902_2@email.com,0 905 | user903_3@email.com,0 906 | user904_2@email.com,0 907 | user905_1@email.com,0 908 | user906_2@email.com,0 909 | user907_1@email.com,0 910 | user908_3@email.com,1 911 | user909_3@email.com,0 912 | user910_2@email.com,1 913 | user911_1@email.com,0 914 | user912_1@email.com,0 915 | user913_3@email.com,0 916 | user914_1@email.com,1 917 | user915_1@email.com,1 918 | user916_2@email.com,1 919 | user917_2@email.com,1 920 | user918_1@email.com,0 921 | user919_3@email.com,0 922 | user920_3@email.com,1 923 | user921_1@email.com,0 924 | user922_3@email.com,1 925 | user923_3@email.com,0 926 | user924_3@email.com,0 927 | user925_3@email.com,0 928 | user926_2@email.com,0 929 | user927_3@email.com,0 930 | user928_2@email.com,0 931 | user929_2@email.com,1 932 | user930_2@email.com,0 933 | user931_2@email.com,0 934 | user932_2@email.com,1 935 | user933_1@email.com,1 936 | user934_2@email.com,1 937 | user935_2@email.com,1 938 | user936_1@email.com,1 939 | user937_2@email.com,1 940 | user938_2@email.com,0 941 | user939_2@email.com,1 942 | user940_3@email.com,1 943 | user941_3@email.com,0 944 | user942_3@email.com,0 945 | user943_1@email.com,0 946 | user944_2@email.com,0 947 | user945_1@email.com,1 948 | user946_1@email.com,1 949 | user947_3@email.com,0 950 | user948_1@email.com,1 951 | user949_2@email.com,1 952 | user950_1@email.com,1 953 | user951_3@email.com,0 954 | user952_3@email.com,0 955 | user953_1@email.com,1 956 | user954_3@email.com,0 957 | user955_3@email.com,0 958 | user956_2@email.com,1 959 | user957_3@email.com,0 960 | user958_2@email.com,0 961 | user959_2@email.com,1 962 | user960_2@email.com,0 963 | user961_2@email.com,0 964 | user962_1@email.com,1 965 | user963_3@email.com,0 966 | user964_1@email.com,1 967 | user965_2@email.com,1 968 | user966_3@email.com,0 969 | user967_3@email.com,0 970 | user968_1@email.com,0 971 | user969_2@email.com,1 972 | user970_2@email.com,1 973 | user971_2@email.com,0 974 | user972_2@email.com,0 975 | user973_1@email.com,0 976 | user974_3@email.com,1 977 | user975_3@email.com,1 978 | user976_1@email.com,1 979 | user977_2@email.com,1 980 | user978_2@email.com,1 981 | user979_2@email.com,0 982 | user980_1@email.com,0 983 | user981_1@email.com,0 984 | user982_1@email.com,0 985 | user983_3@email.com,0 986 | user984_3@email.com,0 987 | user985_1@email.com,0 988 | user986_1@email.com,1 989 | user987_3@email.com,0 990 | user988_1@email.com,0 991 | user989_2@email.com,1 992 | user990_1@email.com,0 993 | user991_2@email.com,0 994 | user992_3@email.com,1 995 | user993_2@email.com,1 996 | user994_1@email.com,1 997 | user995_3@email.com,1 998 | user996_1@email.com,1 999 | user997_3@email.com,0 1000 | user998_2@email.com,0 1001 | user999_2@email.com,0 1002 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU AFFERO GENERAL PUBLIC LICENSE 2 | Version 3, 19 November 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU Affero General Public License is a free, copyleft license for 11 | software and other kinds of works, specifically designed to ensure 12 | cooperation with the community in the case of network server software. 13 | 14 | The licenses for most software and other practical works are designed 15 | to take away your freedom to share and change the works. By contrast, 16 | our General Public Licenses are intended to guarantee your freedom to 17 | share and change all versions of a program--to make sure it remains free 18 | software for all its users. 19 | 20 | When we speak of free software, we are referring to freedom, not 21 | price. Our General Public Licenses are designed to make sure that you 22 | have the freedom to distribute copies of free software (and charge for 23 | them if you wish), that you receive source code or can get it if you 24 | want it, that you can change the software or use pieces of it in new 25 | free programs, and that you know you can do these things. 26 | 27 | Developers that use our General Public Licenses protect your rights 28 | with two steps: (1) assert copyright on the software, and (2) offer 29 | you this License which gives you legal permission to copy, distribute 30 | and/or modify the software. 31 | 32 | A secondary benefit of defending all users' freedom is that 33 | improvements made in alternate versions of the program, if they 34 | receive widespread use, become available for other developers to 35 | incorporate. Many developers of free software are heartened and 36 | encouraged by the resulting cooperation. However, in the case of 37 | software used on network servers, this result may fail to come about. 38 | The GNU General Public License permits making a modified version and 39 | letting the public access it on a server without ever releasing its 40 | source code to the public. 41 | 42 | The GNU Affero General Public License is designed specifically to 43 | ensure that, in such cases, the modified source code becomes available 44 | to the community. It requires the operator of a network server to 45 | provide the source code of the modified version running there to the 46 | users of that server. Therefore, public use of a modified version, on 47 | a publicly accessible server, gives the public access to the source 48 | code of the modified version. 49 | 50 | An older license, called the Affero General Public License and 51 | published by Affero, was designed to accomplish similar goals. This is 52 | a different license, not a version of the Affero GPL, but Affero has 53 | released a new version of the Affero GPL which permits relicensing under 54 | this license. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | TERMS AND CONDITIONS 60 | 61 | 0. Definitions. 62 | 63 | "This License" refers to version 3 of the GNU Affero General Public License. 64 | 65 | "Copyright" also means copyright-like laws that apply to other kinds of 66 | works, such as semiconductor masks. 67 | 68 | "The Program" refers to any copyrightable work licensed under this 69 | License. Each licensee is addressed as "you". "Licensees" and 70 | "recipients" may be individuals or organizations. 71 | 72 | To "modify" a work means to copy from or adapt all or part of the work 73 | in a fashion requiring copyright permission, other than the making of an 74 | exact copy. The resulting work is called a "modified version" of the 75 | earlier work or a work "based on" the earlier work. 76 | 77 | A "covered work" means either the unmodified Program or a work based 78 | on the Program. 79 | 80 | To "propagate" a work means to do anything with it that, without 81 | permission, would make you directly or secondarily liable for 82 | infringement under applicable copyright law, except executing it on a 83 | computer or modifying a private copy. Propagation includes copying, 84 | distribution (with or without modification), making available to the 85 | public, and in some countries other activities as well. 86 | 87 | To "convey" a work means any kind of propagation that enables other 88 | parties to make or receive copies. Mere interaction with a user through 89 | a computer network, with no transfer of a copy, is not conveying. 90 | 91 | An interactive user interface displays "Appropriate Legal Notices" 92 | to the extent that it includes a convenient and prominently visible 93 | feature that (1) displays an appropriate copyright notice, and (2) 94 | tells the user that there is no warranty for the work (except to the 95 | extent that warranties are provided), that licensees may convey the 96 | work under this License, and how to view a copy of this License. If 97 | the interface presents a list of user commands or options, such as a 98 | menu, a prominent item in the list meets this criterion. 99 | 100 | 1. Source Code. 101 | 102 | The "source code" for a work means the preferred form of the work 103 | for making modifications to it. "Object code" means any non-source 104 | form of a work. 105 | 106 | A "Standard Interface" means an interface that either is an official 107 | standard defined by a recognized standards body, or, in the case of 108 | interfaces specified for a particular programming language, one that 109 | is widely used among developers working in that language. 110 | 111 | The "System Libraries" of an executable work include anything, other 112 | than the work as a whole, that (a) is included in the normal form of 113 | packaging a Major Component, but which is not part of that Major 114 | Component, and (b) serves only to enable use of the work with that 115 | Major Component, or to implement a Standard Interface for which an 116 | implementation is available to the public in source code form. A 117 | "Major Component", in this context, means a major essential component 118 | (kernel, window system, and so on) of the specific operating system 119 | (if any) on which the executable work runs, or a compiler used to 120 | produce the work, or an object code interpreter used to run it. 121 | 122 | The "Corresponding Source" for a work in object code form means all 123 | the source code needed to generate, install, and (for an executable 124 | work) run the object code and to modify the work, including scripts to 125 | control those activities. However, it does not include the work's 126 | System Libraries, or general-purpose tools or generally available free 127 | programs which are used unmodified in performing those activities but 128 | which are not part of the work. For example, Corresponding Source 129 | includes interface definition files associated with source files for 130 | the work, and the source code for shared libraries and dynamically 131 | linked subprograms that the work is specifically designed to require, 132 | such as by intimate data communication or control flow between those 133 | subprograms and other parts of the work. 134 | 135 | The Corresponding Source need not include anything that users 136 | can regenerate automatically from other parts of the Corresponding 137 | Source. 138 | 139 | The Corresponding Source for a work in source code form is that 140 | same work. 141 | 142 | 2. Basic Permissions. 143 | 144 | All rights granted under this License are granted for the term of 145 | copyright on the Program, and are irrevocable provided the stated 146 | conditions are met. This License explicitly affirms your unlimited 147 | permission to run the unmodified Program. The output from running a 148 | covered work is covered by this License only if the output, given its 149 | content, constitutes a covered work. This License acknowledges your 150 | rights of fair use or other equivalent, as provided by copyright law. 151 | 152 | You may make, run and propagate covered works that you do not 153 | convey, without conditions so long as your license otherwise remains 154 | in force. You may convey covered works to others for the sole purpose 155 | of having them make modifications exclusively for you, or provide you 156 | with facilities for running those works, provided that you comply with 157 | the terms of this License in conveying all material for which you do 158 | not control copyright. Those thus making or running the covered works 159 | for you must do so exclusively on your behalf, under your direction 160 | and control, on terms that prohibit them from making any copies of 161 | your copyrighted material outside their relationship with you. 162 | 163 | Conveying under any other circumstances is permitted solely under 164 | the conditions stated below. Sublicensing is not allowed; section 10 165 | makes it unnecessary. 166 | 167 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 168 | 169 | No covered work shall be deemed part of an effective technological 170 | measure under any applicable law fulfilling obligations under article 171 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 172 | similar laws prohibiting or restricting circumvention of such 173 | measures. 174 | 175 | When you convey a covered work, you waive any legal power to forbid 176 | circumvention of technological measures to the extent such circumvention 177 | is effected by exercising rights under this License with respect to 178 | the covered work, and you disclaim any intention to limit operation or 179 | modification of the work as a means of enforcing, against the work's 180 | users, your or third parties' legal rights to forbid circumvention of 181 | technological measures. 182 | 183 | 4. Conveying Verbatim Copies. 184 | 185 | You may convey verbatim copies of the Program's source code as you 186 | receive it, in any medium, provided that you conspicuously and 187 | appropriately publish on each copy an appropriate copyright notice; 188 | keep intact all notices stating that this License and any 189 | non-permissive terms added in accord with section 7 apply to the code; 190 | keep intact all notices of the absence of any warranty; and give all 191 | recipients a copy of this License along with the Program. 192 | 193 | You may charge any price or no price for each copy that you convey, 194 | and you may offer support or warranty protection for a fee. 195 | 196 | 5. Conveying Modified Source Versions. 197 | 198 | You may convey a work based on the Program, or the modifications to 199 | produce it from the Program, in the form of source code under the 200 | terms of section 4, provided that you also meet all of these conditions: 201 | 202 | a) The work must carry prominent notices stating that you modified 203 | it, and giving a relevant date. 204 | 205 | b) The work must carry prominent notices stating that it is 206 | released under this License and any conditions added under section 207 | 7. This requirement modifies the requirement in section 4 to 208 | "keep intact all notices". 209 | 210 | c) You must license the entire work, as a whole, under this 211 | License to anyone who comes into possession of a copy. This 212 | License will therefore apply, along with any applicable section 7 213 | additional terms, to the whole of the work, and all its parts, 214 | regardless of how they are packaged. This License gives no 215 | permission to license the work in any other way, but it does not 216 | invalidate such permission if you have separately received it. 217 | 218 | d) If the work has interactive user interfaces, each must display 219 | Appropriate Legal Notices; however, if the Program has interactive 220 | interfaces that do not display Appropriate Legal Notices, your 221 | work need not make them do so. 222 | 223 | A compilation of a covered work with other separate and independent 224 | works, which are not by their nature extensions of the covered work, 225 | and which are not combined with it such as to form a larger program, 226 | in or on a volume of a storage or distribution medium, is called an 227 | "aggregate" if the compilation and its resulting copyright are not 228 | used to limit the access or legal rights of the compilation's users 229 | beyond what the individual works permit. Inclusion of a covered work 230 | in an aggregate does not cause this License to apply to the other 231 | parts of the aggregate. 232 | 233 | 6. Conveying Non-Source Forms. 234 | 235 | You may convey a covered work in object code form under the terms 236 | of sections 4 and 5, provided that you also convey the 237 | machine-readable Corresponding Source under the terms of this License, 238 | in one of these ways: 239 | 240 | a) Convey the object code in, or embodied in, a physical product 241 | (including a physical distribution medium), accompanied by the 242 | Corresponding Source fixed on a durable physical medium 243 | customarily used for software interchange. 244 | 245 | b) Convey the object code in, or embodied in, a physical product 246 | (including a physical distribution medium), accompanied by a 247 | written offer, valid for at least three years and valid for as 248 | long as you offer spare parts or customer support for that product 249 | model, to give anyone who possesses the object code either (1) a 250 | copy of the Corresponding Source for all the software in the 251 | product that is covered by this License, on a durable physical 252 | medium customarily used for software interchange, for a price no 253 | more than your reasonable cost of physically performing this 254 | conveying of source, or (2) access to copy the 255 | Corresponding Source from a network server at no charge. 256 | 257 | c) Convey individual copies of the object code with a copy of the 258 | written offer to provide the Corresponding Source. This 259 | alternative is allowed only occasionally and noncommercially, and 260 | only if you received the object code with such an offer, in accord 261 | with subsection 6b. 262 | 263 | d) Convey the object code by offering access from a designated 264 | place (gratis or for a charge), and offer equivalent access to the 265 | Corresponding Source in the same way through the same place at no 266 | further charge. You need not require recipients to copy the 267 | Corresponding Source along with the object code. If the place to 268 | copy the object code is a network server, the Corresponding Source 269 | may be on a different server (operated by you or a third party) 270 | that supports equivalent copying facilities, provided you maintain 271 | clear directions next to the object code saying where to find the 272 | Corresponding Source. Regardless of what server hosts the 273 | Corresponding Source, you remain obligated to ensure that it is 274 | available for as long as needed to satisfy these requirements. 275 | 276 | e) Convey the object code using peer-to-peer transmission, provided 277 | you inform other peers where the object code and Corresponding 278 | Source of the work are being offered to the general public at no 279 | charge under subsection 6d. 280 | 281 | A separable portion of the object code, whose source code is excluded 282 | from the Corresponding Source as a System Library, need not be 283 | included in conveying the object code work. 284 | 285 | A "User Product" is either (1) a "consumer product", which means any 286 | tangible personal property which is normally used for personal, family, 287 | or household purposes, or (2) anything designed or sold for incorporation 288 | into a dwelling. In determining whether a product is a consumer product, 289 | doubtful cases shall be resolved in favor of coverage. For a particular 290 | product received by a particular user, "normally used" refers to a 291 | typical or common use of that class of product, regardless of the status 292 | of the particular user or of the way in which the particular user 293 | actually uses, or expects or is expected to use, the product. A product 294 | is a consumer product regardless of whether the product has substantial 295 | commercial, industrial or non-consumer uses, unless such uses represent 296 | the only significant mode of use of the product. 297 | 298 | "Installation Information" for a User Product means any methods, 299 | procedures, authorization keys, or other information required to install 300 | and execute modified versions of a covered work in that User Product from 301 | a modified version of its Corresponding Source. The information must 302 | suffice to ensure that the continued functioning of the modified object 303 | code is in no case prevented or interfered with solely because 304 | modification has been made. 305 | 306 | If you convey an object code work under this section in, or with, or 307 | specifically for use in, a User Product, and the conveying occurs as 308 | part of a transaction in which the right of possession and use of the 309 | User Product is transferred to the recipient in perpetuity or for a 310 | fixed term (regardless of how the transaction is characterized), the 311 | Corresponding Source conveyed under this section must be accompanied 312 | by the Installation Information. But this requirement does not apply 313 | if neither you nor any third party retains the ability to install 314 | modified object code on the User Product (for example, the work has 315 | been installed in ROM). 316 | 317 | The requirement to provide Installation Information does not include a 318 | requirement to continue to provide support service, warranty, or updates 319 | for a work that has been modified or installed by the recipient, or for 320 | the User Product in which it has been modified or installed. Access to a 321 | network may be denied when the modification itself materially and 322 | adversely affects the operation of the network or violates the rules and 323 | protocols for communication across the network. 324 | 325 | Corresponding Source conveyed, and Installation Information provided, 326 | in accord with this section must be in a format that is publicly 327 | documented (and with an implementation available to the public in 328 | source code form), and must require no special password or key for 329 | unpacking, reading or copying. 330 | 331 | 7. Additional Terms. 332 | 333 | "Additional permissions" are terms that supplement the terms of this 334 | License by making exceptions from one or more of its conditions. 335 | Additional permissions that are applicable to the entire Program shall 336 | be treated as though they were included in this License, to the extent 337 | that they are valid under applicable law. If additional permissions 338 | apply only to part of the Program, that part may be used separately 339 | under those permissions, but the entire Program remains governed by 340 | this License without regard to the additional permissions. 341 | 342 | When you convey a copy of a covered work, you may at your option 343 | remove any additional permissions from that copy, or from any part of 344 | it. (Additional permissions may be written to require their own 345 | removal in certain cases when you modify the work.) You may place 346 | additional permissions on material, added by you to a covered work, 347 | for which you have or can give appropriate copyright permission. 348 | 349 | Notwithstanding any other provision of this License, for material you 350 | add to a covered work, you may (if authorized by the copyright holders of 351 | that material) supplement the terms of this License with terms: 352 | 353 | a) Disclaiming warranty or limiting liability differently from the 354 | terms of sections 15 and 16 of this License; or 355 | 356 | b) Requiring preservation of specified reasonable legal notices or 357 | author attributions in that material or in the Appropriate Legal 358 | Notices displayed by works containing it; or 359 | 360 | c) Prohibiting misrepresentation of the origin of that material, or 361 | requiring that modified versions of such material be marked in 362 | reasonable ways as different from the original version; or 363 | 364 | d) Limiting the use for publicity purposes of names of licensors or 365 | authors of the material; or 366 | 367 | e) Declining to grant rights under trademark law for use of some 368 | trade names, trademarks, or service marks; or 369 | 370 | f) Requiring indemnification of licensors and authors of that 371 | material by anyone who conveys the material (or modified versions of 372 | it) with contractual assumptions of liability to the recipient, for 373 | any liability that these contractual assumptions directly impose on 374 | those licensors and authors. 375 | 376 | All other non-permissive additional terms are considered "further 377 | restrictions" within the meaning of section 10. If the Program as you 378 | received it, or any part of it, contains a notice stating that it is 379 | governed by this License along with a term that is a further 380 | restriction, you may remove that term. If a license document contains 381 | a further restriction but permits relicensing or conveying under this 382 | License, you may add to a covered work material governed by the terms 383 | of that license document, provided that the further restriction does 384 | not survive such relicensing or conveying. 385 | 386 | If you add terms to a covered work in accord with this section, you 387 | must place, in the relevant source files, a statement of the 388 | additional terms that apply to those files, or a notice indicating 389 | where to find the applicable terms. 390 | 391 | Additional terms, permissive or non-permissive, may be stated in the 392 | form of a separately written license, or stated as exceptions; 393 | the above requirements apply either way. 394 | 395 | 8. Termination. 396 | 397 | You may not propagate or modify a covered work except as expressly 398 | provided under this License. Any attempt otherwise to propagate or 399 | modify it is void, and will automatically terminate your rights under 400 | this License (including any patent licenses granted under the third 401 | paragraph of section 11). 402 | 403 | However, if you cease all violation of this License, then your 404 | license from a particular copyright holder is reinstated (a) 405 | provisionally, unless and until the copyright holder explicitly and 406 | finally terminates your license, and (b) permanently, if the copyright 407 | holder fails to notify you of the violation by some reasonable means 408 | prior to 60 days after the cessation. 409 | 410 | Moreover, your license from a particular copyright holder is 411 | reinstated permanently if the copyright holder notifies you of the 412 | violation by some reasonable means, this is the first time you have 413 | received notice of violation of this License (for any work) from that 414 | copyright holder, and you cure the violation prior to 30 days after 415 | your receipt of the notice. 416 | 417 | Termination of your rights under this section does not terminate the 418 | licenses of parties who have received copies or rights from you under 419 | this License. If your rights have been terminated and not permanently 420 | reinstated, you do not qualify to receive new licenses for the same 421 | material under section 10. 422 | 423 | 9. Acceptance Not Required for Having Copies. 424 | 425 | You are not required to accept this License in order to receive or 426 | run a copy of the Program. Ancillary propagation of a covered work 427 | occurring solely as a consequence of using peer-to-peer transmission 428 | to receive a copy likewise does not require acceptance. However, 429 | nothing other than this License grants you permission to propagate or 430 | modify any covered work. These actions infringe copyright if you do 431 | not accept this License. Therefore, by modifying or propagating a 432 | covered work, you indicate your acceptance of this License to do so. 433 | 434 | 10. Automatic Licensing of Downstream Recipients. 435 | 436 | Each time you convey a covered work, the recipient automatically 437 | receives a license from the original licensors, to run, modify and 438 | propagate that work, subject to this License. You are not responsible 439 | for enforcing compliance by third parties with this License. 440 | 441 | An "entity transaction" is a transaction transferring control of an 442 | organization, or substantially all assets of one, or subdividing an 443 | organization, or merging organizations. If propagation of a covered 444 | work results from an entity transaction, each party to that 445 | transaction who receives a copy of the work also receives whatever 446 | licenses to the work the party's predecessor in interest had or could 447 | give under the previous paragraph, plus a right to possession of the 448 | Corresponding Source of the work from the predecessor in interest, if 449 | the predecessor has it or can get it with reasonable efforts. 450 | 451 | You may not impose any further restrictions on the exercise of the 452 | rights granted or affirmed under this License. For example, you may 453 | not impose a license fee, royalty, or other charge for exercise of 454 | rights granted under this License, and you may not initiate litigation 455 | (including a cross-claim or counterclaim in a lawsuit) alleging that 456 | any patent claim is infringed by making, using, selling, offering for 457 | sale, or importing the Program or any portion of it. 458 | 459 | 11. Patents. 460 | 461 | A "contributor" is a copyright holder who authorizes use under this 462 | License of the Program or a work on which the Program is based. The 463 | work thus licensed is called the contributor's "contributor version". 464 | 465 | A contributor's "essential patent claims" are all patent claims 466 | owned or controlled by the contributor, whether already acquired or 467 | hereafter acquired, that would be infringed by some manner, permitted 468 | by this License, of making, using, or selling its contributor version, 469 | but do not include claims that would be infringed only as a 470 | consequence of further modification of the contributor version. For 471 | purposes of this definition, "control" includes the right to grant 472 | patent sublicenses in a manner consistent with the requirements of 473 | this License. 474 | 475 | Each contributor grants you a non-exclusive, worldwide, royalty-free 476 | patent license under the contributor's essential patent claims, to 477 | make, use, sell, offer for sale, import and otherwise run, modify and 478 | propagate the contents of its contributor version. 479 | 480 | In the following three paragraphs, a "patent license" is any express 481 | agreement or commitment, however denominated, not to enforce a patent 482 | (such as an express permission to practice a patent or covenant not to 483 | sue for patent infringement). To "grant" such a patent license to a 484 | party means to make such an agreement or commitment not to enforce a 485 | patent against the party. 486 | 487 | If you convey a covered work, knowingly relying on a patent license, 488 | and the Corresponding Source of the work is not available for anyone 489 | to copy, free of charge and under the terms of this License, through a 490 | publicly available network server or other readily accessible means, 491 | then you must either (1) cause the Corresponding Source to be so 492 | available, or (2) arrange to deprive yourself of the benefit of the 493 | patent license for this particular work, or (3) arrange, in a manner 494 | consistent with the requirements of this License, to extend the patent 495 | license to downstream recipients. "Knowingly relying" means you have 496 | actual knowledge that, but for the patent license, your conveying the 497 | covered work in a country, or your recipient's use of the covered work 498 | in a country, would infringe one or more identifiable patents in that 499 | country that you have reason to believe are valid. 500 | 501 | If, pursuant to or in connection with a single transaction or 502 | arrangement, you convey, or propagate by procuring conveyance of, a 503 | covered work, and grant a patent license to some of the parties 504 | receiving the covered work authorizing them to use, propagate, modify 505 | or convey a specific copy of the covered work, then the patent license 506 | you grant is automatically extended to all recipients of the covered 507 | work and works based on it. 508 | 509 | A patent license is "discriminatory" if it does not include within 510 | the scope of its coverage, prohibits the exercise of, or is 511 | conditioned on the non-exercise of one or more of the rights that are 512 | specifically granted under this License. You may not convey a covered 513 | work if you are a party to an arrangement with a third party that is 514 | in the business of distributing software, under which you make payment 515 | to the third party based on the extent of your activity of conveying 516 | the work, and under which the third party grants, to any of the 517 | parties who would receive the covered work from you, a discriminatory 518 | patent license (a) in connection with copies of the covered work 519 | conveyed by you (or copies made from those copies), or (b) primarily 520 | for and in connection with specific products or compilations that 521 | contain the covered work, unless you entered into that arrangement, 522 | or that patent license was granted, prior to 28 March 2007. 523 | 524 | Nothing in this License shall be construed as excluding or limiting 525 | any implied license or other defenses to infringement that may 526 | otherwise be available to you under applicable patent law. 527 | 528 | 12. No Surrender of Others' Freedom. 529 | 530 | If conditions are imposed on you (whether by court order, agreement or 531 | otherwise) that contradict the conditions of this License, they do not 532 | excuse you from the conditions of this License. If you cannot convey a 533 | covered work so as to satisfy simultaneously your obligations under this 534 | License and any other pertinent obligations, then as a consequence you may 535 | not convey it at all. For example, if you agree to terms that obligate you 536 | to collect a royalty for further conveying from those to whom you convey 537 | the Program, the only way you could satisfy both those terms and this 538 | License would be to refrain entirely from conveying the Program. 539 | 540 | 13. Remote Network Interaction; Use with the GNU General Public License. 541 | 542 | Notwithstanding any other provision of this License, if you modify the 543 | Program, your modified version must prominently offer all users 544 | interacting with it remotely through a computer network (if your version 545 | supports such interaction) an opportunity to receive the Corresponding 546 | Source of your version by providing access to the Corresponding Source 547 | from a network server at no charge, through some standard or customary 548 | means of facilitating copying of software. This Corresponding Source 549 | shall include the Corresponding Source for any work covered by version 3 550 | of the GNU General Public License that is incorporated pursuant to the 551 | following paragraph. 552 | 553 | Notwithstanding any other provision of this License, you have 554 | permission to link or combine any covered work with a work licensed 555 | under version 3 of the GNU General Public License into a single 556 | combined work, and to convey the resulting work. The terms of this 557 | License will continue to apply to the part which is the covered work, 558 | but the work with which it is combined will remain governed by version 559 | 3 of the GNU General Public License. 560 | 561 | 14. Revised Versions of this License. 562 | 563 | The Free Software Foundation may publish revised and/or new versions of 564 | the GNU Affero General Public License from time to time. Such new versions 565 | will be similar in spirit to the present version, but may differ in detail to 566 | address new problems or concerns. 567 | 568 | Each version is given a distinguishing version number. If the 569 | Program specifies that a certain numbered version of the GNU Affero General 570 | Public License "or any later version" applies to it, you have the 571 | option of following the terms and conditions either of that numbered 572 | version or of any later version published by the Free Software 573 | Foundation. If the Program does not specify a version number of the 574 | GNU Affero General Public License, you may choose any version ever published 575 | by the Free Software Foundation. 576 | 577 | If the Program specifies that a proxy can decide which future 578 | versions of the GNU Affero General Public License can be used, that proxy's 579 | public statement of acceptance of a version permanently authorizes you 580 | to choose that version for the Program. 581 | 582 | Later license versions may give you additional or different 583 | permissions. However, no additional obligations are imposed on any 584 | author or copyright holder as a result of your choosing to follow a 585 | later version. 586 | 587 | 15. Disclaimer of Warranty. 588 | 589 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 590 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 591 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 592 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 593 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 594 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 595 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 596 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 597 | 598 | 16. Limitation of Liability. 599 | 600 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 601 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 602 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 603 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 604 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 605 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 606 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 607 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 608 | SUCH DAMAGES. 609 | 610 | 17. Interpretation of Sections 15 and 16. 611 | 612 | If the disclaimer of warranty and limitation of liability provided 613 | above cannot be given local legal effect according to their terms, 614 | reviewing courts shall apply local law that most closely approximates 615 | an absolute waiver of all civil liability in connection with the 616 | Program, unless a warranty or assumption of liability accompanies a 617 | copy of the Program in return for a fee. 618 | 619 | END OF TERMS AND CONDITIONS 620 | 621 | How to Apply These Terms to Your New Programs 622 | 623 | If you develop a new program, and you want it to be of the greatest 624 | possible use to the public, the best way to achieve this is to make it 625 | free software which everyone can redistribute and change under these terms. 626 | 627 | To do so, attach the following notices to the program. It is safest 628 | to attach them to the start of each source file to most effectively 629 | state the exclusion of warranty; and each file should have at least 630 | the "copyright" line and a pointer to where the full notice is found. 631 | 632 | dcr: a framework to build differentially private data clean rooms on intel sgx. 633 | Copyright (C) 2023, Shubh Karman Singh 634 | 635 | This program is free software: you can redistribute it and/or modify 636 | it under the terms of the GNU Affero General Public License as published 637 | by the Free Software Foundation, either version 3 of the License, or 638 | (at your option) any later version. 639 | 640 | This program is distributed in the hope that it will be useful, 641 | but WITHOUT ANY WARRANTY; without even the implied warranty of 642 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 643 | GNU Affero General Public License for more details. 644 | 645 | You should have received a copy of the GNU Affero General Public License 646 | along with this program. If not, see . 647 | 648 | Also add information on how to contact you by electronic and paper mail. 649 | 650 | If your software can interact with users remotely through a computer 651 | network, you should also make sure that it provides a way for users to 652 | get its source. For example, if your program is a web application, its 653 | interface could display a "Source" link that leads users to an archive 654 | of the code. There are many ways you could offer source, and different 655 | solutions will be better for different programs; see section 13 for the 656 | specific requirements. 657 | 658 | You should also get your employer (if you work as a programmer) or school, 659 | if any, to sign a "copyright disclaimer" for the program, if necessary. 660 | For more information on this, and how to apply and follow the GNU AGPL, see 661 | . --------------------------------------------------------------------------------