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

<amp-pinterest> Sanitize URLs #13885

Merged
merged 2 commits into from
Mar 8, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion extensions/amp-pinterest/0.1/pin-widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import {Services} from '../../../src/services';
import {Util} from './util';
import {assertHttpsUrl} from '../../../src/url';
import {assertAbsoluteHttpOrHttpsUrl, assertHttpsUrl} from '../../../src/url';
import {openWindowDialog} from '../../../src/dom';
import {toWin} from '../../../src/types';

Expand Down Expand Up @@ -57,6 +57,7 @@ export class PinWidget {
const href = el.getAttribute('data-pin-href');
const log = el.getAttribute('data-pin-log');
if (href) {
assertAbsoluteHttpOrHttpsUrl(href);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Asserting that the href is starting with http/https here.

Won't allow localhost - so testing 🤷
Also can one still force code in the latter part of the URL?

if (shouldPop) {
openWindowDialog(window, href, '_pinit', POP);
} else {
Expand Down