Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Adam Barth. All Rights Reserved. | 2 * Copyright (C) 2011 Adam Barth. All Rights Reserved. |
| 3 * Copyright (C) 2011 Daniel Bates (dbates@intudata.com). | 3 * Copyright (C) 2011 Daniel Bates (dbates@intudata.com). |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 346 ASSERT(request.shouldAllowCDATA || !m_scriptTagNestingLevel); | 346 ASSERT(request.shouldAllowCDATA || !m_scriptTagNestingLevel); |
| 347 m_scriptTagNestingLevel++; | 347 m_scriptTagNestingLevel++; |
| 348 } else if (hasName(request.token, objectTag)) | 348 } else if (hasName(request.token, objectTag)) |
| 349 didBlockScript |= filterObjectToken(request); | 349 didBlockScript |= filterObjectToken(request); |
| 350 else if (hasName(request.token, paramTag)) | 350 else if (hasName(request.token, paramTag)) |
| 351 didBlockScript |= filterParamToken(request); | 351 didBlockScript |= filterParamToken(request); |
| 352 else if (hasName(request.token, embedTag)) | 352 else if (hasName(request.token, embedTag)) |
| 353 didBlockScript |= filterEmbedToken(request); | 353 didBlockScript |= filterEmbedToken(request); |
| 354 else if (hasName(request.token, appletTag)) | 354 else if (hasName(request.token, appletTag)) |
| 355 didBlockScript |= filterAppletToken(request); | 355 didBlockScript |= filterAppletToken(request); |
| 356 else if (hasName(request.token, iframeTag)) | 356 else if (hasName(request.token, iframeTag) || hasName(request.token, frameTa g)) |
| 357 didBlockScript |= filterIframeToken(request); | 357 didBlockScript |= filterIframeToken(request); |
|
abarth-chromium
2013/09/13 21:19:51
filterIframeToken -> Can we rename this function t
Tom Sepez
2013/09/13 21:29:28
Done.
| |
| 358 else if (hasName(request.token, metaTag)) | 358 else if (hasName(request.token, metaTag)) |
| 359 didBlockScript |= filterMetaToken(request); | 359 didBlockScript |= filterMetaToken(request); |
| 360 else if (hasName(request.token, baseTag)) | 360 else if (hasName(request.token, baseTag)) |
| 361 didBlockScript |= filterBaseToken(request); | 361 didBlockScript |= filterBaseToken(request); |
| 362 else if (hasName(request.token, formTag)) | 362 else if (hasName(request.token, formTag)) |
| 363 didBlockScript |= filterFormToken(request); | 363 didBlockScript |= filterFormToken(request); |
| 364 else if (hasName(request.token, inputTag)) | 364 else if (hasName(request.token, inputTag)) |
| 365 didBlockScript |= filterInputToken(request); | 365 didBlockScript |= filterInputToken(request); |
| 366 else if (hasName(request.token, buttonTag)) | 366 else if (hasName(request.token, buttonTag)) |
| 367 didBlockScript |= filterButtonToken(request); | 367 didBlockScript |= filterButtonToken(request); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 456 if (isContainedInRequest(decodedSnippetForName(request))) { | 456 if (isContainedInRequest(decodedSnippetForName(request))) { |
| 457 didBlockScript |= eraseAttributeIfInjected(request, codeAttr, String(), SrcLikeAttribute); | 457 didBlockScript |= eraseAttributeIfInjected(request, codeAttr, String(), SrcLikeAttribute); |
| 458 didBlockScript |= eraseAttributeIfInjected(request, objectAttr); | 458 didBlockScript |= eraseAttributeIfInjected(request, objectAttr); |
| 459 } | 459 } |
| 460 return didBlockScript; | 460 return didBlockScript; |
| 461 } | 461 } |
| 462 | 462 |
| 463 bool XSSAuditor::filterIframeToken(const FilterTokenRequest& request) | 463 bool XSSAuditor::filterIframeToken(const FilterTokenRequest& request) |
| 464 { | 464 { |
| 465 ASSERT(request.token.type() == HTMLToken::StartTag); | 465 ASSERT(request.token.type() == HTMLToken::StartTag); |
| 466 ASSERT(hasName(request.token, iframeTag)); | 466 ASSERT(hasName(request.token, iframeTag) || hasName(request.token, frameTag) ); |
| 467 | 467 |
| 468 bool didBlockScript = false; | 468 bool didBlockScript = false; |
| 469 if (isContainedInRequest(decodedSnippetForName(request))) { | 469 if (isContainedInRequest(decodedSnippetForName(request))) { |
| 470 didBlockScript |= eraseAttributeIfInjected(request, srcAttr, String(), S rcLikeAttribute); | 470 didBlockScript |= eraseAttributeIfInjected(request, srcAttr, String(), S rcLikeAttribute); |
| 471 didBlockScript |= eraseAttributeIfInjected(request, srcdocAttr, String() , ScriptLikeAttribute); | 471 didBlockScript |= eraseAttributeIfInjected(request, srcdocAttr, String() , ScriptLikeAttribute); |
| 472 } | 472 } |
| 473 return didBlockScript; | 473 return didBlockScript; |
| 474 } | 474 } |
| 475 | 475 |
| 476 bool XSSAuditor::filterMetaToken(const FilterTokenRequest& request) | 476 bool XSSAuditor::filterMetaToken(const FilterTokenRequest& request) |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 716 } | 716 } |
| 717 | 717 |
| 718 bool XSSAuditor::isSafeToSendToAnotherThread() const | 718 bool XSSAuditor::isSafeToSendToAnotherThread() const |
| 719 { | 719 { |
| 720 return m_documentURL.isSafeToSendToAnotherThread() | 720 return m_documentURL.isSafeToSendToAnotherThread() |
| 721 && m_decodedURL.isSafeToSendToAnotherThread() | 721 && m_decodedURL.isSafeToSendToAnotherThread() |
| 722 && m_decodedHTTPBody.isSafeToSendToAnotherThread(); | 722 && m_decodedHTTPBody.isSafeToSendToAnotherThread(); |
| 723 } | 723 } |
| 724 | 724 |
| 725 } // namespace WebCore | 725 } // namespace WebCore |
| OLD | NEW |