Compare commits

..

7 Commits

18 changed files with 90 additions and 107 deletions

View File

@@ -3,6 +3,18 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.93.11](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.93.10...@standardnotes/auth-server@1.93.11) (2023-03-10)
### Bug Fixes
* **auth:** chage attestation type to none ([f69073b](https://github.com/standardnotes/server/commit/f69073ba029bfe15cb6855ff764aba96010c84da))
## [1.93.10](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.93.9...@standardnotes/auth-server@1.93.10) (2023-03-10)
### Bug Fixes
* **auth:** attestation params and authenticator transports ([a3fc0d9](https://github.com/standardnotes/server/commit/a3fc0d912032d209b78f6c5ba5b47805a491fb15))
## [1.93.9](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.93.8...@standardnotes/auth-server@1.93.9) (2023-03-10)
**Note:** Version bump only for package @standardnotes/auth-server

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/auth-server",
"version": "1.93.9",
"version": "1.93.11",
"engines": {
"node": ">=18.0.0 <19.0.0"
},
@@ -40,6 +40,7 @@
"@sentry/node": "^7.28.1",
"@sentry/tracing": "^7.28.1",
"@simplewebauthn/server": "^7.0.1",
"@simplewebauthn/typescript-types": "^7.0.0",
"@standardnotes/api": "^1.25.3",
"@standardnotes/common": "workspace:*",
"@standardnotes/domain-core": "workspace:^",
@@ -73,7 +74,6 @@
"winston": "^3.8.1"
},
"devDependencies": {
"@simplewebauthn/typescript-types": "^7.0.0",
"@types/bcryptjs": "^2.4.2",
"@types/cors": "^2.8.9",
"@types/express": "^4.17.14",

View File

@@ -57,7 +57,7 @@ export class GenerateAuthenticatorAuthenticationOptions implements UseCaseInterf
type: 'public-key',
transports: authenticator.props.transports,
})),
userVerification: 'discouraged',
userVerification: 'preferred',
})
const authenticatorChallengeOrError = AuthenticatorChallenge.create({

View File

@@ -36,7 +36,6 @@ export class GenerateAuthenticatorRegistrationOptions implements UseCaseInterfac
attestationType: 'none',
authenticatorSelection: {
authenticatorAttachment: 'cross-platform',
userVerification: 'discouraged',
},
excludeCredentials: authenticators.map((authenticator) => ({
id: authenticator.props.credentialId,

View File

@@ -1,5 +1,6 @@
import * as simeplWebAuthnServer from '@simplewebauthn/server'
import { VerifiedRegistrationResponse } from '@simplewebauthn/server'
import { RegistrationResponseJSON } from '@simplewebauthn/typescript-types'
import { Result } from '@standardnotes/domain-core'
import { Authenticator } from '../../Authenticator/Authenticator'
@@ -39,14 +40,15 @@ describe('VerifyAuthenticatorRegistrationResponse', () => {
const result = await useCase.execute({
userUuid: 'invalid',
attestationResponse: {
id: Buffer.from('id'),
rawId: Buffer.from('rawId'),
id: 'id',
rawId: 'rawId',
response: {
attestationObject: Buffer.from('attestationObject'),
clientDataJSON: Buffer.from('clientDataJSON'),
attestationObject: 'attestationObject',
clientDataJSON: 'clientDataJSON',
},
type: 'type',
},
type: 'public-key',
clientExtensionResults: {},
} as jest.Mocked<RegistrationResponseJSON>,
})
expect(result.isFailed()).toBeTruthy()
@@ -63,14 +65,15 @@ describe('VerifyAuthenticatorRegistrationResponse', () => {
const result = await useCase.execute({
userUuid: '00000000-0000-0000-0000-000000000000',
attestationResponse: {
id: Buffer.from('id'),
rawId: Buffer.from('rawId'),
id: 'id',
rawId: 'rawId',
response: {
attestationObject: Buffer.from('attestationObject'),
clientDataJSON: Buffer.from('clientDataJSON'),
attestationObject: 'attestationObject',
clientDataJSON: 'clientDataJSON',
},
type: 'type',
},
type: 'public-key',
clientExtensionResults: {},
} as jest.Mocked<RegistrationResponseJSON>,
})
expect(result.isFailed()).toBeTruthy()
@@ -103,14 +106,15 @@ describe('VerifyAuthenticatorRegistrationResponse', () => {
const result = await useCase.execute({
userUuid: '00000000-0000-0000-0000-000000000000',
attestationResponse: {
id: Buffer.from('id'),
rawId: Buffer.from('rawId'),
id: 'id',
rawId: 'rawId',
response: {
attestationObject: Buffer.from('attestationObject'),
clientDataJSON: Buffer.from('clientDataJSON'),
attestationObject: 'attestationObject',
clientDataJSON: 'clientDataJSON',
},
type: 'type',
},
type: 'public-key',
clientExtensionResults: {},
} as jest.Mocked<RegistrationResponseJSON>,
})
expect(result.isFailed()).toBeTruthy()
@@ -136,14 +140,15 @@ describe('VerifyAuthenticatorRegistrationResponse', () => {
const result = await useCase.execute({
userUuid: '00000000-0000-0000-0000-000000000000',
attestationResponse: {
id: Buffer.from('id'),
rawId: Buffer.from('rawId'),
id: 'id',
rawId: 'rawId',
response: {
attestationObject: Buffer.from('attestationObject'),
clientDataJSON: Buffer.from('clientDataJSON'),
attestationObject: 'attestationObject',
clientDataJSON: 'clientDataJSON',
},
type: 'type',
},
type: 'public-key',
clientExtensionResults: {},
} as jest.Mocked<RegistrationResponseJSON>,
})
expect(result.isFailed()).toBeTruthy()
@@ -171,14 +176,15 @@ describe('VerifyAuthenticatorRegistrationResponse', () => {
const result = await useCase.execute({
userUuid: '00000000-0000-0000-0000-000000000000',
attestationResponse: {
id: Buffer.from('id'),
rawId: Buffer.from('rawId'),
id: 'id',
rawId: 'rawId',
response: {
attestationObject: Buffer.from('attestationObject'),
clientDataJSON: Buffer.from('clientDataJSON'),
attestationObject: 'attestationObject',
clientDataJSON: 'clientDataJSON',
},
type: 'type',
},
type: 'public-key',
clientExtensionResults: {},
} as jest.Mocked<RegistrationResponseJSON>,
})
expect(result.isFailed()).toBeTruthy()
@@ -220,14 +226,15 @@ describe('VerifyAuthenticatorRegistrationResponse', () => {
const result = await useCase.execute({
userUuid: '00000000-0000-0000-0000-000000000000',
attestationResponse: {
id: Buffer.from('id'),
rawId: Buffer.from('rawId'),
id: 'id',
rawId: 'rawId',
response: {
attestationObject: Buffer.from('attestationObject'),
clientDataJSON: Buffer.from('clientDataJSON'),
attestationObject: 'attestationObject',
clientDataJSON: 'clientDataJSON',
},
type: 'type',
},
type: 'public-key',
clientExtensionResults: {},
} as jest.Mocked<RegistrationResponseJSON>,
})
expect(result.isFailed()).toBeTruthy()
@@ -263,14 +270,15 @@ describe('VerifyAuthenticatorRegistrationResponse', () => {
const result = await useCase.execute({
userUuid: '00000000-0000-0000-0000-000000000000',
attestationResponse: {
id: Buffer.from('id'),
rawId: Buffer.from('rawId'),
id: 'id',
rawId: 'rawId',
response: {
attestationObject: Buffer.from('attestationObject'),
clientDataJSON: Buffer.from('clientDataJSON'),
attestationObject: 'attestationObject',
clientDataJSON: 'clientDataJSON',
},
type: 'type',
},
type: 'public-key',
clientExtensionResults: {},
} as jest.Mocked<RegistrationResponseJSON>,
})
expect(result.isFailed()).toBeFalsy()

View File

@@ -56,6 +56,7 @@ export class VerifyAuthenticatorRegistrationResponse implements UseCaseInterface
credentialId: verification.registrationInfo.credentialID,
credentialPublicKey: verification.registrationInfo.credentialPublicKey,
dates: Dates.create(new Date(), new Date()).getValue(),
transports: dto.attestationResponse.response.transports,
})
if (authenticatorOrError.isFailed()) {

View File

@@ -1,4 +1,5 @@
import { RegistrationResponseJSON } from '@simplewebauthn/typescript-types'
export interface VerifyAuthenticatorRegistrationResponseDTO {
userUuid: string
attestationResponse: Record<string, unknown>
attestationResponse: RegistrationResponseJSON
}

View File

@@ -1,4 +1,6 @@
import { RegistrationResponseJSON } from '@simplewebauthn/typescript-types'
export interface VerifyAuthenticatorRegistrationResponseRequestParams {
userUuid: string
attestationResponse: Record<string, unknown>
attestationResponse: RegistrationResponseJSON
}

View File

@@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.12.11](https://github.com/standardnotes/server/compare/@standardnotes/revisions-server@1.12.10...@standardnotes/revisions-server@1.12.11) (2023-03-15)
### Bug Fixes
* **revisions:** add warning logs if a revision dump could not be found ([c76302c](https://github.com/standardnotes/server/commit/c76302cf9868f59770bde3882dcac67f4c51314b))
## [1.12.10](https://github.com/standardnotes/server/compare/@standardnotes/revisions-server@1.12.9...@standardnotes/revisions-server@1.12.10) (2023-03-10)
**Note:** Version bump only for package @standardnotes/revisions-server

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/revisions-server",
"version": "1.12.10",
"version": "1.12.11",
"engines": {
"node": ">=18.0.0 <19.0.0"
},

View File

@@ -83,6 +83,7 @@ export class WorkerContainerConfigLoader extends CommonContainerConfigLoader {
context.container.get(TYPES.S3_BACKUP_BUCKET_NAME),
context.container.get(TYPES.S3),
context.container.get(TYPES.RevisionItemStringMapper),
context.container.get(TYPES.Logger),
)
} else {
return new FSDumpRepository(context.container.get(TYPES.RevisionItemStringMapper))

View File

@@ -1,5 +1,6 @@
import { DeleteObjectCommand, GetObjectCommand, S3Client } from '@aws-sdk/client-s3'
import { MapperInterface } from '@standardnotes/domain-core'
import { Logger } from 'winston'
import { DumpRepositoryInterface } from '../../Domain/Dump/DumpRepositoryInterface'
import { Revision } from '../../Domain/Revision/Revision'
@@ -9,6 +10,7 @@ export class S3DumpRepository implements DumpRepositoryInterface {
private dumpBucketName: string,
private s3Client: S3Client,
private revisionStringItemMapper: MapperInterface<Revision, string>,
private logger: Logger,
) {}
async getRevisionFromDumpPath(path: string): Promise<Revision | null> {
@@ -20,6 +22,8 @@ export class S3DumpRepository implements DumpRepositoryInterface {
)
if (s3Object.Body === undefined) {
this.logger.warn(`Could not find revision dump at path: ${path}`)
return null
}

View File

@@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.32.4](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.32.3...@standardnotes/syncing-server@1.32.4) (2023-03-15)
### Bug Fixes
* **syncing-server:** remove unused methods from auth http service ([10a596d](https://github.com/standardnotes/syncing-server-js/commit/10a596db655dc27f4acfef203c38362fb779cc25))
## [1.32.3](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.32.2...@standardnotes/syncing-server@1.32.3) (2023-03-10)
**Note:** Version bump only for package @standardnotes/syncing-server

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/syncing-server",
"version": "1.32.3",
"version": "1.32.4",
"engines": {
"node": ">=18.0.0 <19.0.0"
},

View File

@@ -2,5 +2,4 @@ import { KeyParamsData } from '@standardnotes/responses'
export interface AuthHttpServiceInterface {
getUserKeyParams(dto: { email?: string; uuid?: string; authenticated: boolean }): Promise<KeyParamsData>
getUserSetting(userUuid: string, settingName: string): Promise<{ uuid: string; value: string | null }>
}

View File

@@ -37,7 +37,6 @@ describe('CloudBackupRequestedEventHandler', () => {
authHttpService = {} as jest.Mocked<AuthHttpServiceInterface>
authHttpService.getUserKeyParams = jest.fn().mockReturnValue({ foo: 'bar' })
// authHttpService.getUserSetting = jest.fn().mockReturnValue
extensionsHttpService = {} as jest.Mocked<ExtensionsHttpServiceInterface>
extensionsHttpService.triggerCloudBackupOnExtensionsServer = jest.fn()

View File

@@ -3,7 +3,6 @@ import 'reflect-metadata'
import { AxiosInstance } from 'axios'
import { AuthHttpService } from './AuthHttpService'
import { SettingName } from '@standardnotes/settings'
describe('AuthHttpService', () => {
let httpClient: AxiosInstance
@@ -36,39 +35,4 @@ describe('AuthHttpService', () => {
validateStatus: expect.any(Function),
})
})
it('should send a request to auth service in order to get user setting', async () => {
httpClient.request = jest.fn().mockReturnValue({
data: {
setting: [
{
uuid: '1-2-3',
value: 'yes',
},
],
},
})
await createService().getUserSetting('1-2-3', SettingName.NAMES.MuteFailedBackupsEmails)
expect(httpClient.request).toHaveBeenCalledWith({
method: 'GET',
headers: {
Accept: 'application/json',
},
url: 'https://auth-server/internal/users/1-2-3/settings/MUTE_FAILED_BACKUPS_EMAILS',
validateStatus: expect.any(Function),
})
})
it('should throw an error if a request to auth service in order to get user setting fails', async () => {
let error = null
try {
await createService().getUserSetting('1-2-3', SettingName.NAMES.MuteFailedCloudBackupsEmails)
} catch (caughtError) {
error = caughtError
}
expect(error).not.toBeNull()
})
})

View File

@@ -6,25 +6,6 @@ import { AuthHttpServiceInterface } from '../../Domain/Auth/AuthHttpServiceInter
export class AuthHttpService implements AuthHttpServiceInterface {
constructor(private httpClient: AxiosInstance, private authServerUrl: string) {}
async getUserSetting(userUuid: string, settingName: string): Promise<{ uuid: string; value: string | null }> {
const response = await this.httpClient.request({
method: 'GET',
headers: {
Accept: 'application/json',
},
url: `${this.authServerUrl}/internal/users/${userUuid}/settings/${settingName}`,
validateStatus:
/* istanbul ignore next */
(status: number) => status >= 200 && status < 500,
})
if (!response.data.setting) {
throw new Error('Missing user setting from auth service response')
}
return response.data.setting
}
async getUserKeyParams(dto: { email?: string; uuid?: string; authenticated: boolean }): Promise<KeyParamsData> {
const keyParamsResponse = await this.httpClient.request({
method: 'GET',