Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#628] Clean up stored auth tokens #627

Open
wants to merge 58 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 54 commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
257fde6
update logging library to v2
roberlander2 Nov 21, 2022
9a91e96
revert testing changes [#624]
roberlander2 Nov 21, 2022
f02cdb6
upgrade core-auth-library-go to v2.1.0, add empty enc APIs policy [#624]
roberlander2 Nov 22, 2022
7826b59
remove individual web auth entities, use claimsCheck functions
roberlander2 Nov 22, 2022
d88a78a
upgrade auth-lib and logging-lib versions [#624]
roberlander2 Dec 18, 2022
02b4249
clean up unnecessary schema files, upgrade dependencies, trouble with…
roberlander2 Dec 18, 2022
7910450
downgrade openapi to 0.110.0, remove more unnecessary schemas [#624]
roberlander2 Dec 19, 2022
d096c13
update error messages with new logutils strings [#624]
roberlander2 Dec 20, 2022
6bccfd9
update swagger docs to only use yaml syntax [#624]
roberlander2 Dec 20, 2022
50b78b0
update changelog
roberlander2 Dec 21, 2022
526f402
fix typo
roberlander2 Dec 21, 2022
9754a25
logging adjustments, fix comment
roberlander2 Dec 22, 2022
2baa253
bug fixes
roberlander2 Dec 22, 2022
2812529
do not store access tokens in DB, encrypt oidc tokens in login sessio…
roberlander2 Dec 23, 2022
d1ac3bb
return raw oidc tokens in login, refresh responses, only store encryp…
roberlander2 Dec 25, 2022
92382e2
remove whitespace from decrypted refresh tokens
roberlander2 Dec 26, 2022
1f955bc
store hashed refresh tokens, prefix refresh tokens with session ID, r…
roberlander2 Dec 26, 2022
fe5807b
first implementation of session ID rate limit
roberlander2 Dec 27, 2022
037fa1c
delete login session on rate limit hit
roberlander2 Dec 27, 2022
4c37c96
add allow legacy refresh flag to env vars, don't send oidc refresh to…
roberlander2 Jan 3, 2023
5e2d864
update login and refresh response docs
roberlander2 Jan 3, 2023
c0aabb8
limit block size in pkcs7 padding
roberlander2 Jan 3, 2023
88f56a2
limit ciphertext size
roberlander2 Jan 3, 2023
e35e17c
don't allow negative ciphertext size
roberlander2 Jan 3, 2023
dcd4ee4
fix padded ciphertext length
roberlander2 Jan 3, 2023
e18d761
use AES encryption in GCM mode instead of CBC, store nonce in session…
roberlander2 Jan 5, 2023
f28fb3a
update usage of global configs, will probably update to be used more …
roberlander2 Jan 5, 2023
26de1bc
start refactoring GlobalConfig into Config [#628]
roberlander2 Jan 7, 2023
a2f04cf
add new files
roberlander2 Jan 7, 2023
b37649d
finish global_configs -> configs refactor, bug fixes [#628]
roberlander2 Jan 9, 2023
a4decc9
handle backward compatibility
roberlander2 Jan 9, 2023
a00e85e
use Log.SendHTTPResponse
roberlander2 Jan 11, 2023
53d1421
merged changes from 624-upgrade-dependencies
roberlander2 Jan 17, 2023
5cb0c9b
setup CORS handler in web adapter
roberlander2 Jan 17, 2023
08a6283
update go mod
roberlander2 Jan 20, 2023
d6985c4
fix go mod
roberlander2 Feb 3, 2023
d0d7a62
merge configs change from clean-up-stored-auth-tokens, add cors [#632]
roberlander2 Feb 3, 2023
c084e30
update changelog
roberlander2 Feb 3, 2023
7ea8a55
update config data type [#632]
roberlander2 Feb 3, 2023
35fc827
gen mocks
shurwit Feb 3, 2023
27c8544
merged changes from develop
roberlander2 Feb 4, 2023
c7873db
start moving config APIs to admin subrouter, add type, appID, and orgID
roberlander2 Feb 4, 2023
bcc68cf
fix changelog
roberlander2 Feb 4, 2023
e17212f
update configs admin API docs
roberlander2 Feb 6, 2023
e31b536
update GitHub actions
shurwit Feb 6, 2023
0e4104a
test detect-secrets github action fix
shurwit Feb 6, 2023
775b914
complete admin configs APIs [#628]
roberlander2 Feb 6, 2023
6e90570
prevent admins from accessing configs outside of their app, org based…
roberlander2 Feb 7, 2023
364ac8f
bug fixes, add request examples to API docs
roberlander2 Feb 7, 2023
0dced87
fix decoding configs
shurwit Feb 9, 2023
f9751ea
fix legacy refresh and refresh rate limit, add app id and org id to a…
shurwit Feb 10, 2023
bb74a74
return config on create (with id)
shurwit Feb 10, 2023
98a36fc
fix test
shurwit Feb 10, 2023
dcf8c99
fix test
shurwit Feb 10, 2023
083ecca
update configs to use auth library and generics
roberlander2 Feb 23, 2023
03af831
merged changes from develop
roberlander2 Feb 23, 2023
51f4d50
fix bug in Config schema
roberlander2 Mar 2, 2023
bc5ef7f
merged changes from develop, add externalCredential interface
roberlander2 Jun 17, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v2
uses: actions/setup-go@v3
with:
go-version: 1.19

Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/detect-secrets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@ jobs:
container: python:latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- run: git config --global --add safe.directory "$GITHUB_WORKSPACE"

- name: Install Yelp's detect secrets
run: |
apt-get update && apt-get install -y jq
pip install yq
pip install detect-secrets==$(yq -r .repos[0].rev .pre-commit-config.yaml)

- name: Detect potential secrets
run: find -type f -not -path './.git/*' -printf '%P\n' | xargs detect-secrets-hook --baseline .secrets.baseline
run: git ls-files -z | xargs -0 detect-secrets-hook --baseline .secrets.baseline
91 changes: 29 additions & 62 deletions .secrets.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,6 @@
},
{
"path": "detect_secrets.filters.heuristic.is_templated_secret"
},
{
"path": "detect_secrets.filters.regex.should_exclude_file",
"pattern": [
"go.sum"
]
}
],
"results": {
Expand All @@ -124,8 +118,7 @@
"filename": "README.md",
"hashed_secret": "112bb791304791ddcf692e29fd5cf149b35fea37",
"is_verified": false,
"line_number": 38,
"is_secret": false
"line_number": 38
}
],
"core/app_shared.go": [
Expand All @@ -134,8 +127,7 @@
"filename": "core/app_shared.go",
"hashed_secret": "44e17306b837162269a410204daaa5ecee4ec22c",
"is_verified": false,
"line_number": 41,
"is_secret": false
"line_number": 41
}
],
"core/auth/apis.go": [
Expand All @@ -144,8 +136,7 @@
"filename": "core/auth/apis.go",
"hashed_secret": "394e3412459f79523e12e1fa95a4cf141ccff122",
"is_verified": false,
"line_number": 2049,
"is_secret": false
"line_number": 2097
}
],
"core/auth/auth.go": [
Expand All @@ -154,32 +145,28 @@
"filename": "core/auth/auth.go",
"hashed_secret": "417355fe2b66baa6826739a6d8006ab2ddcf5186",
"is_verified": false,
"line_number": 143,
"is_secret": false
"line_number": 154
},
{
"type": "Secret Keyword",
"filename": "core/auth/auth.go",
"hashed_secret": "700f93e97a8aaf0664601a8f298ac5ad0ff13c37",
"hashed_secret": "120f777df3c851d4d59aae3d6752bed780b47e4f",
"is_verified": false,
"line_number": 145,
"is_secret": false
"line_number": 156
},
{
"type": "Secret Keyword",
"filename": "core/auth/auth.go",
"hashed_secret": "58f3388441fbce0e48aef2bf74413a6f43f6dc70",
"is_verified": false,
"line_number": 895,
"is_secret": false
"line_number": 906
},
{
"type": "Secret Keyword",
"filename": "core/auth/auth.go",
"hashed_secret": "94a7f0195bbbd2260c4e4d02b6348fbcd90b2b30",
"is_verified": false,
"line_number": 2383,
"is_secret": false
"line_number": 2402
}
],
"core/auth/auth_type_email.go": [
Expand All @@ -188,56 +175,49 @@
"filename": "core/auth/auth_type_email.go",
"hashed_secret": "f3f2fb17a3bf9f307cb6e79b61b9d4baf07dd681",
"is_verified": false,
"line_number": 75,
"is_secret": false
"line_number": 75
},
{
"type": "Secret Keyword",
"filename": "core/auth/auth_type_email.go",
"hashed_secret": "fe70d8c51780596c0b3399573122bba943a461da",
"is_verified": false,
"line_number": 76,
"is_secret": false
"line_number": 76
},
{
"type": "Secret Keyword",
"filename": "core/auth/auth_type_email.go",
"hashed_secret": "06354d205ab5a3b6c7ad2333c58f1ddc810c97ba",
"is_verified": false,
"line_number": 87,
"is_secret": false
"line_number": 87
},
{
"type": "Secret Keyword",
"filename": "core/auth/auth_type_email.go",
"hashed_secret": "7cbe6dcf7274355d223e3174e4d8a7ffb55a9227",
"is_verified": false,
"line_number": 156,
"is_secret": false
"line_number": 156
},
{
"type": "Secret Keyword",
"filename": "core/auth/auth_type_email.go",
"hashed_secret": "69411040443be576ce64fc793269d7c26dd0866a",
"is_verified": false,
"line_number": 253,
"is_secret": false
"line_number": 253
},
{
"type": "Secret Keyword",
"filename": "core/auth/auth_type_email.go",
"hashed_secret": "cba104f0870345d3ec99d55c06441bdce9fcf584",
"is_verified": false,
"line_number": 390,
"is_secret": false
"line_number": 390
},
{
"type": "Secret Keyword",
"filename": "core/auth/auth_type_email.go",
"hashed_secret": "c74f3640d83fd19d941a4f44b28fbd9e57f59eef",
"is_verified": false,
"line_number": 391,
"is_secret": false
"line_number": 391
}
],
"core/auth/auth_type_oidc.go": [
Expand All @@ -246,8 +226,7 @@
"filename": "core/auth/auth_type_oidc.go",
"hashed_secret": "0ade4f3edccc8888bef404fe6b3c92c13cdfad6b",
"is_verified": false,
"line_number": 376,
"is_secret": false
"line_number": 388
}
],
"core/auth/service_static_token.go": [
Expand All @@ -256,8 +235,7 @@
"filename": "core/auth/service_static_token.go",
"hashed_secret": "44e17306b837162269a410204daaa5ecee4ec22c",
"is_verified": false,
"line_number": 78,
"is_secret": false
"line_number": 77
}
],
"driven/emailer/adapter.go": [
Expand All @@ -266,8 +244,7 @@
"filename": "driven/emailer/adapter.go",
"hashed_secret": "9df4524d2441f00999342c4541a39932198d4bb4",
"is_verified": false,
"line_number": 70,
"is_secret": false
"line_number": 70
}
],
"driven/profilebb/adapter.go": [
Expand All @@ -276,8 +253,7 @@
"filename": "driven/profilebb/adapter.go",
"hashed_secret": "36c48d6ac9d10902792fa78b9c2d7d535971c2cc",
"is_verified": false,
"line_number": 224,
"is_secret": false
"line_number": 224
}
],
"driven/storage/database.go": [
Expand All @@ -286,8 +262,7 @@
"filename": "driven/storage/database.go",
"hashed_secret": "6547f385c6d867e20f8217018a4d468a7d67d638",
"is_verified": false,
"line_number": 202,
"is_secret": false
"line_number": 202
}
],
"driver/web/apis_system.go": [
Expand All @@ -296,8 +271,7 @@
"filename": "driver/web/apis_system.go",
"hashed_secret": "44e17306b837162269a410204daaa5ecee4ec22c",
"is_verified": false,
"line_number": 700,
"is_secret": false
"line_number": 637
}
],
"driver/web/docs/gen/def.yaml": [
Expand All @@ -306,8 +280,7 @@
"filename": "driver/web/docs/gen/def.yaml",
"hashed_secret": "448ed7416fce2cb66c285d182b1ba3df1e90016d",
"is_verified": false,
"line_number": 55,
"is_secret": false
"line_number": 55
}
],
"driver/web/docs/gen/gen_types.go": [
Expand All @@ -316,24 +289,21 @@
"filename": "driver/web/docs/gen/gen_types.go",
"hashed_secret": "c9739eab2dfa093cc0e450bf0ea81a43ae67b581",
"is_verified": false,
"line_number": 1371,
"is_secret": false
"line_number": 1398
},
{
"type": "Secret Keyword",
"filename": "driver/web/docs/gen/gen_types.go",
"hashed_secret": "9afb15df443d57204a2a0f82e164a9c46749dec6",
"is_verified": false,
"line_number": 1765,
"is_secret": false
"line_number": 1792
},
{
"type": "Secret Keyword",
"filename": "driver/web/docs/gen/gen_types.go",
"hashed_secret": "b296a47f167e06833104ebf060da1b4bbb4d619b",
"is_verified": false,
"line_number": 1768,
"is_secret": false
"line_number": 1795
}
],
"driver/web/docs/resources/admin/auth/login.yaml": [
Expand All @@ -342,8 +312,7 @@
"filename": "driver/web/docs/resources/admin/auth/login.yaml",
"hashed_secret": "448ed7416fce2cb66c285d182b1ba3df1e90016d",
"is_verified": false,
"line_number": 26,
"is_secret": false
"line_number": 26
}
],
"driver/web/docs/resources/services/auth/account/auth-type/link.yaml": [
Expand All @@ -352,8 +321,7 @@
"filename": "driver/web/docs/resources/services/auth/account/auth-type/link.yaml",
"hashed_secret": "448ed7416fce2cb66c285d182b1ba3df1e90016d",
"is_verified": false,
"line_number": 26,
"is_secret": false
"line_number": 26
}
],
"driver/web/docs/resources/services/auth/login.yaml": [
Expand All @@ -362,10 +330,9 @@
"filename": "driver/web/docs/resources/services/auth/login.yaml",
"hashed_secret": "448ed7416fce2cb66c285d182b1ba3df1e90016d",
"is_verified": false,
"line_number": 24,
"is_secret": false
"line_number": 24
}
]
},
"generated_at": "2023-02-03T22:06:32Z"
"generated_at": "2023-02-10T23:20:59Z"
}
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased
### Changed
- Clean up stored auth tokens [#628](https://github.com/rokwire/core-building-block/issues/628)

## [1.30.0] - 2023-02-03
### Added
- Update role admin API [#516](https://github.com/rokwire/core-building-block/issues/516)
Expand Down
32 changes: 20 additions & 12 deletions core/apis.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,26 @@ type administrationImpl struct {
app *application
}

func (s *administrationImpl) AdmGetConfig(id string, appID string, orgID string, system bool) (*model.Config, error) {
return s.app.admGetConfig(id, appID, orgID, system)
}

func (s *administrationImpl) AdmGetConfigs(configType *string, appID string, orgID string, system bool) ([]model.Config, error) {
return s.app.admGetConfigs(configType, appID, orgID, system)
}

func (s *administrationImpl) AdmCreateConfig(config model.Config, appID string, orgID string, system bool) (*model.Config, error) {
return s.app.admCreateConfig(config, appID, orgID, system)
}

func (s *administrationImpl) AdmUpdateConfig(config model.Config, appID string, orgID string, system bool) error {
return s.app.admUpdateConfig(config, appID, orgID, system)
}

func (s *administrationImpl) AdmDeleteConfig(id string, appID string, orgID string, system bool) error {
return s.app.admDeleteConfig(id, appID, orgID, system)
}

func (s *administrationImpl) AdmGetTest() string {
return s.app.admGetTest()
}
Expand Down Expand Up @@ -501,18 +521,6 @@ type systemImpl struct {
app *application
}

func (s *systemImpl) SysCreateGlobalConfig(setting string) (*model.GlobalConfig, error) {
return s.app.sysCreateGlobalConfig(setting)
}

func (s *systemImpl) SysGetGlobalConfig() (*model.GlobalConfig, error) {
return s.app.sysGetGlobalConfig()
}

func (s *systemImpl) SysUpdateGlobalConfig(setting string) error {
return s.app.sysUpdateGlobalConfig(setting)
}

func (s *systemImpl) SysGetApplicationOrganizations(appID *string, orgID *string) ([]model.ApplicationOrganization, error) {
return s.app.sysGetApplicationOrganizations(appID, orgID)
}
Expand Down
Loading