Skip to content

Commit a83ccc5

Browse files
authored
Merge pull request #336 from Yubico/origin-error-message
Refer to RelyingParty.origins setting in origin mismatch error message
2 parents 72b84fb + fadd7ab commit a83ccc5

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

webauthn-server-core/src/main/java/com/yubico/webauthn/FinishAssertionSteps.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,8 @@ public void validate() {
400400
final String responseOrigin = response.getResponse().getClientData().getOrigin();
401401
assertTrue(
402402
OriginMatcher.isAllowed(responseOrigin, origins, allowOriginPort, allowOriginSubdomain),
403-
"Incorrect origin: " + responseOrigin);
403+
"Incorrect origin, please see the RelyingParty.origins setting: %s",
404+
responseOrigin);
404405
}
405406

406407
@Override

webauthn-server-core/src/main/java/com/yubico/webauthn/FinishRegistrationSteps.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,8 @@ public void validate() {
215215
final String responseOrigin = clientData.getOrigin();
216216
assertTrue(
217217
OriginMatcher.isAllowed(responseOrigin, origins, allowOriginPort, allowOriginSubdomain),
218-
"Incorrect origin: " + responseOrigin);
218+
"Incorrect origin, please see the RelyingParty.origins setting: %s",
219+
responseOrigin);
219220
}
220221

221222
@Override

webauthn-server-core/src/main/java/com/yubico/webauthn/RelyingParty.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,11 @@ public class RelyingParty {
281281
* If <code>true</code>, the origin matching rule is relaxed to allow any subdomain, of any depth,
282282
* of the values of {@link RelyingPartyBuilder#origins(Set) origins}.
283283
*
284+
* <p>Please see <a
285+
* href="https://www.w3.org/TR/2023/WD-webauthn-3-20230927/#sctn-code-injection">Security
286+
* Considerations: Code injection attacks</a> for discussion of the risks in setting this to
287+
* <code>true</code>.
288+
*
284289
* <p>The default is <code>false</code>.
285290
*
286291
* <p>Examples with <code>origins: ["https://example.org", "https://acme.com:8443"]</code>
@@ -315,6 +320,9 @@ public class RelyingParty {
315320
* <li><code>https://acme.com</code>
316321
* </ul>
317322
* </ul>
323+
*
324+
* @see <a href="https://www.w3.org/TR/2023/WD-webauthn-3-20230927/#sctn-code-injection">§13.4.8.
325+
* Code injection attacks</a>
318326
*/
319327
@Builder.Default private final boolean allowOriginSubdomain = false;
320328

0 commit comments

Comments
 (0)