Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F33423134
D6126.1769004048.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D6126.1769004048.diff
View Options
diff --git a/keyserver/src/responders/landing-handler.js b/keyserver/src/responders/landing-handler.js
--- a/keyserver/src/responders/landing-handler.js
+++ b/keyserver/src/responders/landing-handler.js
@@ -7,7 +7,10 @@
import ReactDOMServer from 'react-dom/server';
import { promisify } from 'util';
-import { isValidSIWENonce } from 'lib/utils/siwe-utils.js';
+import {
+ isValidPrimaryIdentityPublicKey,
+ isValidSIWENonce,
+} from 'lib/utils/siwe-utils.js';
import { type LandingSSRProps } from '../landing/landing-ssr.react';
import { waitForStream } from '../utils/json-stream';
@@ -116,6 +119,21 @@
});
return;
}
+ const siwePrimaryIdentityPublicKey = req.header(
+ 'siwe-primary-identity-public-key',
+ );
+ if (
+ siwePrimaryIdentityPublicKey !== null &&
+ siwePrimaryIdentityPublicKey !== undefined &&
+ !isValidPrimaryIdentityPublicKey(siwePrimaryIdentityPublicKey)
+ ) {
+ res.status(400).send({
+ message:
+ 'Invalid primary identity public key in siwe-primary-identity-public-key header.',
+ });
+ return;
+ }
+
const [{ jsURL, fontURLs, cssInclude }, LandingSSR] = await Promise.all([
getAssetInfo(),
getWebpackCompiledRootComponentForSSR(),
@@ -182,10 +200,14 @@
await waitForStream(reactStream);
const siweNonceString = siweNonce ? `"${siweNonce}"` : 'null';
+ const siwePrimaryIdentityPublicKeyString = siwePrimaryIdentityPublicKey
+ ? `"${siwePrimaryIdentityPublicKey}"`
+ : 'null';
// prettier-ignore
res.end(html`</div>
<script>var routerBasename = "${routerBasename}";</script>
<script>var siweNonce = ${siweNonceString};</script>
+ <script>var siwePrimaryIdentityPublicKey = ${siwePrimaryIdentityPublicKeyString};</script>
<script src="${jsURL}"></script>
</body>
</html>
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Jan 21, 2:00 PM (1 h, 58 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5969055
Default Alt Text
D6126.1769004048.diff (1 KB)
Attached To
Mode
D6126: [keyserver] Include `siwePrimaryIdentityPublicKey` in `landingResponder` response
Attached
Detach File
Event Timeline
Log In to Comment