cockroach icon indicating copy to clipboard operation
cockroach copied to clipboard

Explicit auth with TEMP tokens

Open miretskiy opened this issue 6 years ago • 7 comments

Informs #56536

Use of external storage temp tokens, together with explicit authentication is dangerous. In general, explicitly specified tokens could expire while long running operation (backup, restore) is still executing, without any way for us to regenerate such temp token.

We should error out if external storage URI uses temporary credentials for backup, restore, import, scheduled backup and cdc.

We should also provide an extra URI parameter for the user to specify if they really wish to override this behavior: "&REALLY_USE_TEMP_CREDENTIALS"

Epic CRDB-71

Jira issue: CRDB-2924

miretskiy avatar Nov 11 '20 14:11 miretskiy

hey @miretskiy , may I pick up this issue?

xuhui-lu avatar Nov 16 '20 07:11 xuhui-lu

@xuhui-lu of course

miretskiy avatar Nov 30 '20 20:11 miretskiy

@xuhui-lu @miretskiy is it still valid? May I grab it? As I understand the problem is with s3 external storage uses temp token. @miretskiy , you specified a set of operation where usage of temp token should be forbidden. Does it make sense to add temp token check to the ExternalStorageConfFromURI only? Or should other operations like WriteFile, ListFiles still work with temp tokens? I would start with adding new field really_use_temp_credentials to S3 message in roachpb/api.proto.

mneverov avatar Jan 12 '21 19:01 mneverov

@mneverov @miretskiy is this issue still valid? is it currently being worked on?

cpustejovsky avatar Dec 14 '22 21:12 cpustejovsky

stale or active?

YashKumarVerma avatar Jul 06 '24 16:07 YashKumarVerma

is it active?

pannaga-perumal avatar May 25 '26 12:05 pannaga-perumal

I've been reading the current code and want to confirm the intended boundary before attempting this.

  1. Where should the rejection live? newS3Storage (pkg/cloud/amazon/s3_storage.go:401 parses AWS_SESSION_TOKEN into TempToken; :433-456 and :494-519 validate auth) runs for every S3 URI, so a check there would also break read-only uses (e.g. external tables). The body scopes this to backup/restore/import/scheduled backup/CDC. Should we reject at conf-parse time (simple, but over-broad), or thread the operation kind down to storage construction so only the long-running ops reject temp tokens?

  2. Is &REALLY_USE_TEMP_CREDENTIALS still the agreed spelling, and should it be a new S3 field in pkg/cloud/cloudpb/external_storage.proto (next to temp_token = 5 / auth = 8) rather than an ad-hoc URI param?

  3. @mneverov's 2021 question is still unanswered: should WriteFile/ListFiles keep working with temp tokens? My reading is yes (short-lived), which argues for checking at operation construction, not URI parse.

Happy to pick this up if it's still wanted.

0xMudit avatar Sep 17 '26 08:09 0xMudit