Skip to content

Sensitive info is removed from source files with media type "text"#1052

Merged
pavgra merged 9 commits into
master-2.7.2from
issue-1046-sensitive_connection_info
May 17, 2019
Merged

Sensitive info is removed from source files with media type "text"#1052
pavgra merged 9 commits into
master-2.7.2from
issue-1046-sensitive_connection_info

Conversation

@ssuvorov-fls

Copy link
Copy Markdown
Contributor

fixes #1046

final String value = filterSensitiveInfo(new String(source.getContents()), variables, isAdmin);
source.setContents(value.getBytes());
@Value("${sensitiveinfo.analysis.extensions}")
private String sensitiveAnalysisExtensions;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not @Value("#{'${sensitiveinfo.analysis.extensions}'.split(',')}") or @Value("${sensitiveinfo.analysis.extensions}") private String[] sensitiveAnalysisExtensions;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed, changed to array version

return source;
}

private boolean isNeedFiltering(AnalysisResultFile source) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you rename it to isFilteringRequired?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed


private boolean checkExtension(AnalysisResultFile source) {
String extension = FilenameUtils.getExtension(source.getFileName());
for (String value : sensitiveExtensions) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it be simpler if you store sensitiveExtensions in a HashSet and use contains?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@pavgra

pavgra commented Apr 25, 2019

Copy link
Copy Markdown
Contributor

The result files, which you iterate over, are:

image
image

while the mentioned log.txt is in 3003_results.zip -> /results/log.txt

How is it going to be filtered?

@pavgra

pavgra commented Apr 25, 2019

Copy link
Copy Markdown
Contributor

Also, a back-merge will be required

@ssuvorov-fls

Copy link
Copy Markdown
Contributor Author

added filtering of archive content

return source;
}

private byte[] doFilterSensitiveInfo(Path path, byte[] bytes, Map<String, Object> variables, boolean isAdmin) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would stick to single-source of truth: bytes represents info which is derived from path. So why cannot we just pass path to avoid potential contradictions and anomalies?

return EXTENSION_ZIP.equalsIgnoreCase(extension);
}

private AnalysisResultFile checkZipArchive(AnalysisResultFile resultFile, Map<String, Object> variables, boolean isAdmin) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like a compute intense task. I suggest doing this processing one-time when results are received from EE. Not on each download

@chrisknoll

Copy link
Copy Markdown
Collaborator

The migration could break as a result of future changes to the repository definition. Instead of using the repository.findAll(), you should directly query the database to fetch the data based on the db schema at the time the migration was written and process the data via raw operations, and not depend on any classes that may change implementation over time.

@ssuvorov-fls

Copy link
Copy Markdown
Contributor Author

@chrisknoll
There is a problem with AnalysisResultFileContentSensitiveInfoServiceImpl.filterSensitiveInfo - i must pass there an AnalysisResultFileContent object, so migration will still depend on class that may implementation.

@chrisknoll

Copy link
Copy Markdown
Collaborator

Ok, I think it may be possible to work around this by making copies or 'legacy' impelmentations of the Service interfaces that we can inject into the migration. But, that sounds like a lot of work. We should be able to see errors in the migration script if something gets updated in the future, so we can address making the migrations work with the new changes when the need arises.

@ssuvorov-fls

Copy link
Copy Markdown
Contributor Author

@chrisknoll
migration now uses raw operations

@chrisknoll

Copy link
Copy Markdown
Collaborator

Excellent work, @ssuvorov-fls . This will guard against future changes that may break migration. Thanks!

@pavgra pavgra merged commit 722d7d4 into master-2.7.2 May 17, 2019
@chrisknoll

Copy link
Copy Markdown
Collaborator

Why wasn't this branch deleted?

@pavgra pavgra deleted the issue-1046-sensitive_connection_info branch May 17, 2019 20:53
anthonysena pushed a commit that referenced this pull request May 17, 2019
* increase version to 2.7.1 (#995)
* Added permissions to watch IR report (#991)
* added permissions to watch IR report
* added migrations to cover newly created sources
* simplify migration queries
* Set Priority of first daimon "1" (#998)
* Fixes performance issues with PLE & PLP generations retrieval (#1010)
* Fixes performance issues with PLE & PLP generations retrieval
* Adds filter to do cache invalidation in case of threads re-usage
* Forgotten change
* Fixed PLE & PLP jobs invalidation (2.7.1) (#1006)
* Fixed PLE & PLP jobs invalidation
* Fixes transaction
* BQ support for PLE / PLP (#1012)
* Update circe version (#1013)
* Fixes SQL execution for BQ when keyfile is uploaded (#1016)
* Fixes creation of new Datasource with keyfile (#1017)
* Customizable PLE / PLP skeletons (#1021)
* Split EE result files storage into 2 tables and avoid contents retrieval on each request (#1024)
* Split EE result files storage into 2 tables and avoid contents retrieval on each request
* Testing and review fixes
* Fixes results persistence for PLE R script (2.7.1) (#1026)
* Fixes results persistence for PLE R script
* Apply consistent approach for creating output folder for PLE & PLP
* Fixes issue with import new estimation/prediction (#1035)
* Utilizes Request compressed results from Execution Engine (#1044)
* Implements RunAs functionality (#1075)
* Improvements for PLE & PLP starter scripts (#1092)
- Install packages into local lib
- Install packages using `R CMD build` to avoid issues on Windows and forced packages `upgrade`
- Do not build vignettes
* Sensitive info is removed from analyses result files (#1052)
* Fix Estimation R script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants