ApproveDevice
View as Markdownfunction ApproveDevice(props): Element;Defined in: react-ui/src/components/ApproveDevice.tsx:80
The website’s device-approval page body for uncage setup: which computer asks to connect, when
and from which IP it asked, the code to compare with the terminal, and Approve / Deny. A code
from a link (source: 'link', the default) must be confirmed by typing its last 4 characters.
Presentational: the website looks the code up and records the decision server-side (hub.lookupDevice / approveDevice /
denyDevice with the signed-in user) and passes the outcome back in state.
Security — approving gives a computer remote access to the user’s account, so the page is a clickjacking and CSRF target:
- Serve it only on the website’s own origin, behind the user’s normal signed-in session.
- Refuse framing: send
Content-Security-Policy: frame-ancestors 'none'andX-Frame-Options: DENYon the page’s response. - Record the decision with a POST protected against CSRF (Next.js Server Actions check the
Origin; a plain route handler needs an Origin check or CSRF token and SameSite cookies). Never
approve from a GET or from the
?code=link alone. See the@uncage/react-uiREADME for a Next.js example.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
props |
ApproveDeviceProps |
Returns
Section titled “Returns”Element