Skip to content

Comments

Added support for opening JSON by URL parameter#84

Open
BartCardan wants to merge 14 commits intow3c:mainfrom
BartCardan:main
Open

Added support for opening JSON by URL parameter#84
BartCardan wants to merge 14 commits intow3c:mainfrom
BartCardan:main

Conversation

@BartCardan
Copy link

I've modified the file \src\components\form\OpenEvaluation.svelte to add support for opening a JSON file by a URL parameter.

For example:

https://www.w3.org/WAI/eval/report-tool/?jsonUrl=https://domain.com/evaluation.json

This adds possibilities to add an default evaluation template or automate some processes from a back office.

@netlify
Copy link

netlify bot commented Oct 5, 2021

✔️ Deploy Preview for wcag-em-report-tool-2021-redesign ready!

🔨 Explore the source changes: 7f025ce

🔍 Inspect the deploy log: https://app.netlify.com/sites/wcag-em-report-tool-2021-redesign/deploys/61684462d2881c000870bce8

😎 Browse the preview: https://deploy-preview-84--wcag-em-report-tool-2021-redesign.netlify.app

@BartCardan
Copy link
Author

BartCardan commented Oct 6, 2021

Access-Control-Allow-Origin

You need to set Access-Control-Allow-Origin on the remote server which contains the JSON file.
For example with .htaccess:

<FilesMatch "\.(json)$"> <IfModule mod_headers.c> Header set Access-Control-Allow-Origin "*" </IfModule> </FilesMatch>

Example URL for testing: https://deploy-preview-84--wcag-em-report-tool-2021-redesign.netlify.app/?jsonUrl=https://technobility.nl/json.json

What needs to be done

  • Check if the external URL is a valid URL (if not it causes js errors)
  • Maybe it needs some sanitizing OR is this already been done while opening the json?

@rvantonisse
Copy link
Contributor

With some modification You could also host this application on your own domain for full control. Then you can keep your domain and content secure.

@BartCardan
Copy link
Author

@rvantonisse Yes indeed. That's how we are planning to do it in the near future.

@SteveALee
Copy link
Contributor

Are there any security implications?

@BartCardan
Copy link
Author

Are there any security implications?

One of the questions on the to-do list. It may need sanitizing. This really depends on how the "Open report" functionalitity in the tool works. If the JSON itself is already sanitizing during opening it's probably OK.

Another layer of security is to only allow data which has a JSON mime-type.
I'll check if I can implement such check on a short notice.

@hidde
Copy link
Member

hidde commented Oct 7, 2021

@BartCardan In this PR, could you add a heading to README.MD documenting this functionality?

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