Repository navigation
OpenConceptLab/ocl_online#201 | Map project endpoint tokens are write-only - #991
Conversation
…-only: stored apart by URL, shown as has_token, removed from run snapshots; OCL API lookup tokens are no longer stored
…dentials, verbose ones included
8a6cc2f to
6a4a6c9
Compare
snyaggarwal
left a comment
There was a problem hiding this comment.
Review of the token split: 9 inline comments. The first two are the ones I'd address before merge: nested token keys stay stored and leave in the verbose CSV, and migrated OCL lookup tokens are kept and reported as has_token.
…ped, OCL lookups never flagged, credentials read under row lock, shared URLs share one token, URL origins normalized Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… is a 400; OCL lookup URL rule matches the Mapper (only http(s):// is absolute)
snyaggarwal
left a comment
There was a problem hiding this comment.
Reviewed with OpenConceptLab/oclmap#130 at the current heads. One migration finding below. I did not run tests or pylint locally, per request.
…ject, when algorithms on one URL hold different tokens
snyaggarwal
left a comment
There was a problem hiding this comment.
Rereviewed with OpenConceptLab/oclmap#130. The earlier P2 is addressed: 0041 now checks for conflicting tokens on one URL before changing project rows, and covers conflict and same-token cases. I found no further actionable findings or nits in this pass. I did not run tests or pylint locally, per request.
… never keep tokens (stripped on save and read; 0041 keeps log-only ones in credentials)
… write only their fields; settings must be objects; save errors don't echo the database row
… from algorithms, lookup_config and logs as each value is written
Refs OpenConceptLab/ocl_online#201. The Mapper side is OpenConceptLab/oclmap#130.
Map projects stored endpoint tokens inside
algorithmsandlookup_config, and every map project response returned them.Changes
MapProject.credentialsfield holds the tokens, keyed by endpoint URL. No serializer includes it, so it can't be read or written through the API; plain lists defer it, and CSV exports, plain and verbose, leave it out (get_readable_field_names()skipsWRITE_ONLY_FIELDS).clean_tokens()(fromclean()) moves tokens out on every save,PUTandPATCHalike.PATCHnow saves throughpersist_changes, so it runs full model validation too.tokenkeys are removed too.API_BASE_URL's origin. Onlyhttp(s)://, in any case, is absolute, as in the Mapper.lookup_configand each algorithm must be objects.has_token: truein place of a token, never for an OCL API lookup. Tokens are stripped on read from algorithms,lookup_config(whatever its shape),logsand auto-match run snapshots.save()stripstokenfromlogs, and run snapshots drop it when created.0041:credentialsand strips them from algorithms,lookup_config,logsand run snapshots.credentials['logs']. A cleanup can remove both later.credentials['logs'], aren't restored and go with the column. Roll back the image rather than the migration.core/common/utils.py:drop_key_deep,get_url_origin.Not in this PR
credentialsat rest.Tests
core/map_projects/tests/test_tokens.py:PUTandPATCH, OCL lookups, shared URLs, shapes, stale and deleted saves, logs.🤖 Generated with Claude Code