Skip to content

Commit

Permalink
Do not export individual client audit attachments in .csv.zip
Browse files Browse the repository at this point in the history
  • Loading branch information
matthew-white committed Aug 4, 2023
1 parent ba6ee47 commit 8d42e36
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 23 deletions.
1 change: 1 addition & 0 deletions lib/model/query/submission-attachments.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ where submission_defs.current=true
and "deletedAt" is null
and ${odataFilter(options.filter, odataToColumnMap)}
and submission_attachments.name is distinct from submission_defs."encDataAttachmentName"
and submission_attachments."isClientAudit" is not true
and (form_defs."keyId" is null or form_defs."keyId" in (${keyIdCondition(keyIds)}))`);

module.exports = {
Expand Down
29 changes: 9 additions & 20 deletions test/integration/api/submissions.js
Original file line number Diff line number Diff line change
Expand Up @@ -1859,10 +1859,8 @@ describe('api: /forms/:id/submissions', () => {
.then(() => exhaust(container))
.then(() => pZipStreamToFiles(asAlice.get('/v1/projects/1/forms/audits/submissions.csv.zip'))
.then((result) => {
result.filenames.should.containDeep([
result.filenames.should.eql([
'audits.csv',
'media/audit.csv',
'media/log.csv',
'audits - audit.csv'
]);

Expand Down Expand Up @@ -1898,10 +1896,8 @@ two,h,/data/h,2000-01-01T00:06,2000-01-01T00:07,-5,-6,,ee,ff
.expect(201))
.then(() => pZipStreamToFiles(asAlice.get('/v1/projects/1/forms/audits/submissions.csv.zip'))
.then((result) => {
result.filenames.should.containDeep([
result.filenames.should.eql([
'audits.csv',
'media/audit.csv',
'media/log.csv',
'audits - audit.csv'
]);

Expand Down Expand Up @@ -1936,9 +1932,8 @@ two,h,/data/h,2000-01-01T00:06,2000-01-01T00:07,-5,-6,,ee,ff
.expect(201))
.then(() => pZipStreamToFiles(asAlice.get('/v1/projects/1/forms/audits/submissions.csv.zip?$filter=__system/submitterId eq 5'))
.then((result) => {
result.filenames.should.containDeep([
result.filenames.should.eql([
'audits.csv',
'media/audit.csv',
'audits - audit.csv'
]);

Expand Down Expand Up @@ -1973,9 +1968,8 @@ one,e,/data/e,2000-01-01T00:11,,,,,hh,ii
.expect(201))
.then(() => pZipStreamToFiles(asAlice.get('/v1/projects/1/forms/audits/submissions.csv.zip?$filter=__system/reviewState eq \'approved\''))
.then((result) => {
result.filenames.should.containDeep([
result.filenames.should.eql([
'audits.csv',
'media/audit.csv',
'audits - audit.csv'
]);

Expand Down Expand Up @@ -2009,9 +2003,8 @@ one,e,/data/e,2000-01-01T00:11,,,,,hh,ii
.expect(200)
.then(() => pZipStreamToFiles(asAlice.get('/v1/projects/1/forms/audits/submissions.csv.zip'))
.then((result) => {
result.filenames.should.containDeep([
result.filenames.should.eql([
'audits.csv',
'media/audit.csv',
'audits - audit.csv'
]);

Expand Down Expand Up @@ -2042,9 +2035,8 @@ one,h,/data/h,2000-01-01T00:06,2000-01-01T00:07,-5,-6,,ee,ff
.expect(200)
.then(() => pZipStreamToFiles(asAlice.get('/v1/projects/1/forms/audits/submissions.csv.zip'))
.then((result) => {
result.filenames.should.containDeep([
result.filenames.should.eql([
'audits.csv',
'media/audit.csv',
'audits - audit.csv'
]);

Expand All @@ -2071,9 +2063,8 @@ one,h,/data/h,2000-01-01T00:06,2000-01-01T00:07,-5,-6,,ee,ff
.expect(200)
.then(() => pZipStreamToFiles(asAlice.get('/v1/projects/1/forms/audits/submissions.csv.zip'))
.then((result) => {
result.filenames.should.containDeep([
result.filenames.should.eql([
'audits.csv',
'media/audit.csv',
'audits - audit.csv'
]);

Expand Down Expand Up @@ -2101,9 +2092,8 @@ one,e,/data/e,2000-01-01T00:11,,,,,hh,ii
.expect(200)
.then(() => pZipStreamToFiles(asAlice.get('/v1/projects/1/forms/audits/submissions.csv.zip'))
.then((result) => {
result.filenames.should.containDeep([
result.filenames.should.eql([
'audits.csv',
'media/audit.csv',
'audits - audit.csv'
]);

Expand Down Expand Up @@ -2140,9 +2130,8 @@ one,e,/data/e,2000-01-01T00:11,,,,,hh,ii
.expect(200)
.then(() => pZipStreamToFiles(asAlice.get('/v1/projects/1/forms/audits/submissions.csv.zip'))
.then((result) => {
result.filenames.should.containDeep([
result.filenames.should.eql([
'audits.csv',
'media/audit.csv',
'audits - audit.csv'
]);

Expand Down
4 changes: 1 addition & 3 deletions test/integration/other/encryption.js
Original file line number Diff line number Diff line change
Expand Up @@ -405,10 +405,8 @@ describe('managed encryption', () => {
.then(({ body }) => body[0].id))
.then((keyId) => pZipStreamToFiles(asAlice.get(`/v1/projects/1/forms/audits/submissions.csv.zip?${keyId}=supersecret`))
.then((result) => {
result.filenames.should.containDeep([
result.filenames.should.eql([
'audits.csv',
'media/audit.csv',
'media/audit.csv',
'audits - audit.csv'
]);

Expand Down

0 comments on commit 8d42e36

Please sign in to comment.