mirror of
https://github.com/traberph/short.git
synced 2026-11-22 22:55:12 +00:00
Review fixes: forwarded IP, sign-in errors, revoking access
- take the visitor IP from the last X-Forwarded-For entry (the one the proxy adds); the first can be set by the client to fake unique visitors - show "Sign-in failed" with a retry link when the identity provider rejects the callback instead of a generic 500 page - report concurrent unique-constraint conflicts (e.g. two requests claiming the same shortcode) as 409 instead of 500 - admins can revoke a user's access (end sessions, delete API tokens) from Administration; previously a removed user kept working tokens - README: security notes on the proxy header, offboarding and rate limiting Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+6
-3
@@ -27,10 +27,13 @@ export function setup(overrides: Partial<Config> = {}) {
|
||||
const db = openDb(":memory:");
|
||||
|
||||
// The fake provider returns whatever claims the test queued for the next login.
|
||||
let nextClaims: OidcClaims = { sub: "sub-x", username: "x", groups: [] };
|
||||
let nextClaims: OidcClaims | Error = { sub: "sub-x", username: "x", groups: [] };
|
||||
const oidc: OidcProvider = {
|
||||
authorizationUrl: async ({ state }) => new URL(`https://auth.test/authorize?state=${state}`),
|
||||
exchange: async () => nextClaims,
|
||||
exchange: async () => {
|
||||
if (nextClaims instanceof Error) throw nextClaims;
|
||||
return nextClaims;
|
||||
},
|
||||
};
|
||||
|
||||
const app = createApp({ db, config, oidc });
|
||||
@@ -53,7 +56,7 @@ export function setup(overrides: Partial<Config> = {}) {
|
||||
db,
|
||||
config,
|
||||
user,
|
||||
setNextLogin: (claims: OidcClaims) => {
|
||||
setNextLogin: (claims: OidcClaims | Error) => {
|
||||
nextClaims = claims;
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user