Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change to only upload files in allowed routes #17

Closed
wants to merge 4 commits into from

Conversation

raphaelgoms
Copy link

@raphaelgoms raphaelgoms commented Oct 3, 2022

Solution to #18 :

  • We now only allow file upload in explicitly allowed routes.
  • To do this, we added a parameter options to ExpressWraper._request function.

To allow file upload in a route, options should look like { acceptFiles: true, ... }

expresswrapper.js Outdated Show resolved Hide resolved
this.app[method](route, (req, res) =>
{
try
{
if (!options || !options.acceptFiles) {
Copy link
Member

Choose a reason for hiding this comment

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

@raphaelgoms this option should be documented at least as a comment.

Copy link
Author

Choose a reason for hiding this comment

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

I documented in readme. The text is ok?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks good to me, although an in code comment would suffice too

Copy link
Collaborator

Choose a reason for hiding this comment

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

Looking again at this, it seems to me, the need of this parameter is not making much sense as it introduces a seemingly unnecessary backward compatibility issue.

Copy link
Member

@marcelomachado marcelomachado left a comment

Choose a reason for hiding this comment

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

@raphaelgoms you will probably have to make changes in KES and HKLib to reflect this modification. KES send files to some routes to be imported in HKBase.

@raphaelgoms
Copy link
Author

@raphaelgoms you will probably have to make changes in KES and HKLib to reflect this modification. KES send files to some routes to be imported in HKBase.

The only routes I found using the req.files array were:

PUT /repository/:repoName/entity
POST /repository/:repoName/rdf/bulk/:context?

@marcelomachado @eltonfss do you know any other routes that this change could affect?

@srfiorini srfiorini self-requested a review December 1, 2022 13:13
Copy link
Collaborator

@srfiorini srfiorini left a comment

Choose a reason for hiding this comment

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

Changes look ok and have been discussed.

@eltonfss
Copy link
Collaborator

eltonfss commented Dec 1, 2022

@raphaelgoms you will probably have to make changes in KES and HKLib to reflect this modification. KES send files to some routes to be imported in HKBase.

The only routes I found using the req.files array were:

PUT /repository/:repoName/entity
POST /repository/:repoName/rdf/bulk/:context?

@marcelomachado @eltonfss do you know any other routes that this change could affect?

PUT /repository/:repoName/entity is a very critical endpoint for the ingestion of HK entities.
POST /repository/:repoName/rdf/bulk/:context?is probably less used but is also important.
Thus I recommend that @raphaelgoms tests the import of HK and Bulk RDF Ingestion after merging the changes to validate that they were not affected.
It seems likely that the options.acceptFiles parameter will have to be added to KES calls of those endpoints.

@eltonfss
Copy link
Collaborator

eltonfss commented Dec 1, 2022

Will abort this pull request as it is not essencial at the moment and could require a major release to be generated. Will keep the branch alive for future releases.

@eltonfss eltonfss closed this Dec 1, 2022
@marcelomachado
Copy link
Member

@raphaelgoms you will probably have to make changes in KES and HKLib to reflect this modification. KES send files to some routes to be imported in HKBase.

The only routes I found using the req.files array were:

PUT /repository/:repoName/entity
POST /repository/:repoName/rdf/bulk/:context?

@marcelomachado @eltonfss do you know any other routes that this change could affect?

@raphaelgoms you will probably have to make changes in KES and HKLib to reflect this modification. KES send files to some routes to be imported in HKBase.

The only routes I found using the req.files array were:

PUT /repository/:repoName/entity
POST /repository/:repoName/rdf/bulk/:context?

@marcelomachado @eltonfss do you know any other routes that this change could affect?

PUT /repository/:repoName/entity is a very critical endpoint for the ingestion of HK entities. POST /repository/:repoName/rdf/bulk/:context? is probably less used but is also important. Thus I recommend that @raphaelgoms tests the import of HK and Bulk RDF Ingestion after merging the changes to validate that they were not affected. It seems likely that the options.acceptFiles parameter will have to be added to KES calls of those endpoints.

POST /repository/:repoName/rdf/bulk/:context? this route is very important when it comes to ingesting large databases.

By now I can't remember any other routes.

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.

4 participants