-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: use secure cookie session backed by connect-pg-simple
- set cookie to be secure when https is enabled - remove the hardcoded symmetric key - auto-generate a good symmetric key with helm - auto-generate an ephemeral symmetric key in dev environment - deploy a session table to the private postgres schema - use connect-pg-simple as postgres backing store for session
- Loading branch information
Showing
9 changed files
with
121 additions
and
8 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
-- Deploy ggircs-portal:tables/session to pg | ||
-- requires: schema_ggircs_portal_private | ||
|
||
begin; | ||
|
||
create table ggircs_portal_private.session ( | ||
sid varchar(4093) not null collate "default", | ||
sess json not null, | ||
expire timestamp(6) not null | ||
) | ||
with (oids=false); | ||
|
||
alter table ggircs_portal_private.session | ||
add constraint ggircs_portal_private_session_pkey primary key (sid) not deferrable initially immediate; | ||
|
||
create index ggircs_portal_private_idx_session_expire | ||
on ggircs_portal_private.session(expire); | ||
|
||
grant all on ggircs_portal_private.session to public; | ||
|
||
comment on table ggircs_portal_private.session is 'The backing store for connect-pg-simple to store express session data'; | ||
comment on column ggircs_portal_private.session.sid is 'The value of the symmetric key encrypted connect.sid cookie'; | ||
comment on column ggircs_portal_private.session.sess is 'The express session middleware object picked as json containing the jwt'; | ||
comment on column ggircs_portal_private.session.expire is 'The timestamp after which this session object will be garbage collected'; | ||
|
||
commit; |
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,7 @@ | ||
-- Revert ggircs-portal:tables/session from pg | ||
|
||
begin; | ||
|
||
drop table ggircs_portal_private.session; | ||
|
||
commit; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
-- Verify ggircs-portal:tables/session on pg | ||
|
||
begin; | ||
|
||
select pg_catalog.has_table_privilege('ggircs_portal_private.session', 'select'); | ||
|
||
rollback; |