tighten session cookie security

This commit is contained in:
rimu 2024-03-21 11:07:11 +13:00
parent 097d37d7e0
commit c562202588
2 changed files with 6 additions and 2 deletions

View file

@ -579,8 +579,8 @@ class User(UserMixin, db.Model):
def num_content(self): def num_content(self):
content = 0 content = 0
content += db.session.execute(text('SELECT COUNT(id) as c FROM "post" WHERE user_id = ' + str(self.id))).scalar() content += db.session.execute(text('SELECT COUNT(id) as c FROM "post" WHERE user_id = :user_id'), {'user_id': self.id}).scalar()
content += db.session.execute(text('SELECT COUNT(id) as c FROM "post_reply" WHERE user_id = ' + str(self.id))).scalar() content += db.session.execute(text('SELECT COUNT(id) as c FROM "post_reply" WHERE user_id = :user_id'), {'user_id': self.id}).scalar()
return content return content
def is_local(self): def is_local(self):

View file

@ -42,3 +42,7 @@ class Config(object):
SENTRY_DSN = os.environ.get('SENTRY_DSN') or None SENTRY_DSN = os.environ.get('SENTRY_DSN') or None
AWS_REGION = os.environ.get('AWS_REGION') or None AWS_REGION = os.environ.get('AWS_REGION') or None
SESSION_COOKIE_SECURE = True
SESSION_COOKIE_HTTPONLY = True
SESSION_COOKIE_SAMESITE = 'Lax'