-
Notifications
You must be signed in to change notification settings - Fork 248
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
fix(prop): trusted domain #440
Conversation
Codecov ReportPatch coverage:
❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more. Additional details and impacted files@@ Coverage Diff @@
## main #440 +/- ##
=======================================
Coverage 95.51% 95.52%
=======================================
Files 18 18
Lines 1226 1228 +2
=======================================
+ Hits 1171 1173 +2
Misses 55 55
☔ View full report in Codecov by Sentry. |
@@ -380,7 +380,9 @@ export function parentComponent<P, X, C>({ | |||
|
|||
const trustedChild: boolean = | |||
prop && prop.trustedDomains && prop.trustedDomains.length > 0 | |||
? prop.trustedDomains.includes(initialChildDomain) | |||
? prop.trustedDomains.reduce((acc, val) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about accepting a string or regex? We may be able to reuse code from allowedParentDomains
: https://github.com/search?q=repo%3Akrakenjs%2Fzoid%20allowedParentDomains&type=code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gregjopa I initially was going down this path until I realized using a string won't play nice when going from environment to environment like Regex does. We could always have it point to an enum. 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The domain
prop does the same thing as allowedParentDomain
in that it uses the same type def as DomainMatcher
from cross-domain-utils
. I just recently updated DomainMatcher
to except an array of string or regex.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gregjopa Yeah, I can do this. I'm using matchDomain
which allows for all. Great suggestion!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gregjopa I initially was going down this path until I realized using a string won't play nice when going from environment to environment like Regex does.
Ahh I see. I'm glad you already considered this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gregjopa Yeah, I can do this. I'm using matchDomain which allows for all.
Great to hear!
Changes trusted domain prop to accept regex rather than strings.