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

Implementing #10 #13

Closed
wants to merge 6 commits into from
Closed

Implementing #10 #13

wants to merge 6 commits into from

Conversation

dns2utf8
Copy link
Contributor

@dns2utf8 dns2utf8 commented Jan 24, 2017

Implements #10
Can we deploy this?

@dbrgn
Copy link
Contributor

dbrgn commented Jan 24, 2017

Can we deploy this?

Could we integrate this validator into the website?

Note: Markdown files may contain HTML.

@dns2utf8
Copy link
Contributor Author

I would like to keep it here as well for now, because it allows to develop the service on its own.

I will create another PR for the website.

@dbrgn
Copy link
Contributor

dbrgn commented Jan 24, 2017

Sure. I'll take a look later (or maybe @rnestler has time to review).

@dns2utf8 dns2utf8 added this to the public-release milestone Jan 27, 2017
@media (min-width: 700px) {
section { width: 60%; padding: 42px 20%; min-height: 42vh; }
img { max-width: 700px; }
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd suggest to use consistent indentation style in the future, but it's not really important, so feel free to ignore my nagging :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I had the setting to 2 spaces, I agree the html, body ... part should be improoved.

<input id="input_url" type="url" value="https://status.crdmp.ch/">
<input id="submit_validate_url" type="submit" value="Validate URL">
<input id="input_url" type="url" value="https://status.crdmp.ch/" />
<input id="submit_validate_url" type="submit" value="Validate URL" />
Copy link
Contributor

Choose a reason for hiding this comment

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

That's not valid HTML5.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

<pre id="OK">OK</pre>
<pre id="ERROR">ERROR</pre>
<pre id="processing">Processing request, please hold ...</pre>
<pre id="fetching">Fetching data, please hold ...</pre>
Copy link
Contributor

Choose a reason for hiding this comment

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

Why capitalization for OK and ERROR but not for the other two values? #nag

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The capitalized values are sent by the server, the other events originate locally.

if (req.bodyUsed) {
appendLog('fetch parse fail: ' + message);
} else {
message = 'is <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS" target="_blank">CORS</a> enabled? Check the iFrame for content\n' + message;
Copy link
Contributor

Choose a reason for hiding this comment

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

Hm, I wonder if we really need code to handle misconfigured servers...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we do not, the UI will run into a timeout.

function validate_url(ev) {
banner.className = 'fetching';
ev.preventDefault();
offlineCheck();

var url = getValue(url_input);
if (url.indexOf('http://') === -1 && url.indexOf('https://') === -1) {
appendLog('\nInvalid URL: '+url);
appendLog('Invalid URL: '+url);
setBanner('ERROR', 'Invalid URL: '+url);
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we should validate URLs by testing for the presence of "https?". Why not send a request and then see if that fails because of an invalid URL? Or is there no API for that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As far as I know, there is currently no other transport method allowed. (See spacedirectory/meta#5)
There used to be gopher:// and ftp://.
file:// is not allowed for security reasons.

fetch(req)
.then(function(response) {
return response.text();
})
.then(function(response) {
appendLog('fetched: ' + response);
document.querySelector(textarea_selector).innerHTML = response;
// store response into the textarea, FIXME this is currently exploitable, paste a HTML page
Copy link
Contributor

Choose a reason for hiding this comment

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

FIXME 😉

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This will require some time to fix.
It is currently only exploitable when the user pasts an untrusted URI. See #17

@dbrgn
Copy link
Contributor

dbrgn commented Jun 3, 2017

I guess this is obsolete now that the validator is integrated into the website (SpaceApi/website#4).

@dbrgn dbrgn closed this Jun 3, 2017
@gidsi gidsi deleted the cleanup branch July 10, 2021 06:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants