Files
sori.studio/tests/google-oauth.test.js

12 lines
613 B
JavaScript

import test from 'node:test'
import assert from 'node:assert/strict'
import { normalizeGoogleOAuthRedirect } from '../server/utils/google-oauth.js'
test('Google OAuth redirect는 내부 경로만 허용한다', () => {
assert.equal(normalizeGoogleOAuthRedirect('/settings', '/'), '/settings')
assert.equal(normalizeGoogleOAuthRedirect('/admin?google=linked', '/'), '/admin?google=linked')
assert.equal(normalizeGoogleOAuthRedirect('https://example.com', '/'), '/')
assert.equal(normalizeGoogleOAuthRedirect('//example.com', '/'), '/')
assert.equal(normalizeGoogleOAuthRedirect('/\\evil', '/'), '/')
})