-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
[NT-1774 ] Managing denied requests #1374
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1374 +/- ##
===========================================
- Coverage 85.87% 72.85% -13.03%
===========================================
Files 1100 597 -503
Lines 95970 40243 -55727
===========================================
- Hits 82418 29318 -53100
+ Misses 13552 10925 -2627
Continue to review full report at Codecov.
|
KsApi/PerimeterXClientType.swift
Outdated
func headers() -> [String: String] | ||
} | ||
|
||
public protocol PerimeterXErrorHandler { |
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 creating another file for this and removing the Perimeter X prefix? I don't think this protocol is specific to the perimeter x, but open to go either way
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.
Makes sense. Moved this into a separate file and removed the prefix in the latest commit.
KsApi/PerimeterXClientType.swift
Outdated
Verifies a URLs response and handles any errors with the Perimeter X SDK. | ||
|
||
- parameter blockResponse: An `HTTPURLResponse` object with response data from a request. | ||
- parameter data: `Data` associated with the request. |
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.
Extra comment space
.expires: NSDate(timeIntervalSinceNow: 3_600) | ||
]) | ||
|
||
public static func startPerimeterX(with pxManagerDelegate: PXManagerDelegate) { |
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.
Can you document the functions that are no in the PerimeterXClientType
?
} | ||
|
||
public func headers() -> [String: String] { | ||
return (PXManager.sharedInstance().httpHeaders() as! [String: String]) |
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.
We should try to avoid !. What do you think about PXManager.sharedInstance().httpHeaders() ?? [:]
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.
Ah good catch. This came right off of the documentation and I didn't notice the force casting.
@@ -9,6 +9,8 @@ internal class WebViewController: UIViewController { | |||
internal let webView = WKWebView(frame: .zero, configuration: WKWebViewConfiguration()) | |||
internal var bottomAnchorConstraint: NSLayoutConstraint? | |||
|
|||
var webKitCookieStore: WKHTTPCookieStore? |
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.
This variable can be private
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.
Added a comment above the variable to explain what it's doing as well.
if let newCookie = PerimeterXClient.cookie { | ||
self.webKitCookieStore?.setCookie(newCookie, completionHandler: { | ||
print("Perimeter X mobile VID cookie set.") | ||
}) |
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.
Too much indentation
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.
Called the formatter to fix this.
There seems to be a larger reduction in test coverage. What do you think about adding tests to the comments by codecov? |
馃摬 What
Re-factoring our implementation of the Perimeter X SDK with some extensions to the initial functionality. We're now enforcing a CAPTCHA screen on endpoints that are deemed suspicious.
馃 Why
We're bolstering our security against bot attacks with Perimeter Xs SDK. This should add another layer of protection and mitigate future attacks.