Skip to content

Application Personal Access Tokens are stored as plaintext in the database. Easy fix maybe. #3789

Closed
@BranndonWork

Description

@BranndonWork
  • Gitea version (or commit ref): 1.3.0
  • Git version: 2.7.4
  • Operating system: osx
  • Database (use [x]):
    • PostgreSQL
    • [ x] MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • [ x] Not relevant
  • Log gist:

Description

After creating an application token, I checked the database, and the token is stored in plaintext in the database! This is bad because anyone that may gain access to the database would have access to all tokens.

Suggested fix is just to hash the token before storing it locally, for example, the token you give the user is 30ab72898b83c8549e510ee36cde7c7d7be01d97 becomes A6DCC734FFB0E5A1E871E10C1B2A48CA60E9104F8F61FD41BD1DC01789062D81 when ran through a sha256 hash.

This way you can take what the user provides turing an authorized token use, and run the value they give you through sha256, and validate that the result matches what's in your database.

...

Screenshots

screen shot 2018-04-13 at 5 09 00 am

screen shot 2018-04-13 at 5 08 51 am

Metadata

Metadata

Labels

pr/breakingMerging this PR means builds will break. Needs a description what exactly breaks, and how to fix it!topic/securitySomething leaks user information or is otherwise vulnerable. Should be fixed!type/enhancementAn improvement of existing functionality

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions