-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Protect PIN validation from brute force attack (#96)
* Protect PIN validation from brute force attack Enables an attempt limit for the PIN number so that an attacker can't just try all possible PIN numbers * Fix failing rollback
- Loading branch information
1 parent
2c42920
commit 95e6511
Showing
13 changed files
with
216 additions
and
24 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/models/db/migrations/20240710162655_invite-invalidation-cols.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import type { Knex } from 'knex' | ||
|
||
export async function up(knex: Knex): Promise<void> { | ||
await knex.schema.alterTable('connection', (def) => { | ||
def.tinyint('pin_attempt_count').unsigned().notNullable().defaultTo(0) | ||
}) | ||
|
||
await knex.schema.alterTable('connection_invite', (def) => { | ||
def | ||
.enum('validity', ['valid', 'expired', 'too_many_attempts', 'used'], { | ||
useNative: true, | ||
enumName: 'connection_invite_verification_status', | ||
}) | ||
.defaultTo('valid') | ||
}) | ||
} | ||
|
||
export async function down(knex: Knex): Promise<void> { | ||
await knex.schema.alterTable('connection', (def) => { | ||
def.dropColumn('pin_attempt_count') | ||
}) | ||
|
||
await knex.schema.alterTable('connection_invite', (def) => { | ||
def.dropColumn('validity') | ||
}) | ||
|
||
await knex.raw('DROP TYPE connection_invite_verification_status') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.