Skip to content

Token weakening removes storage.stage scopes by default/add --need-storage-stage flag to override#662

Merged
shreyb merged 4 commits into
fermitools:masterfrom
shreyb:issue-651
Jan 9, 2026
Merged

Token weakening removes storage.stage scopes by default/add --need-storage-stage flag to override#662
shreyb merged 4 commits into
fermitools:masterfrom
shreyb:issue-651

Conversation

@shreyb
Copy link
Copy Markdown
Collaborator

@shreyb shreyb commented Jan 8, 2026

This PR adds support for the --need-storage-stage flag to allow users to specify directories requiring the storage.stage scope in job tokens, mirroring the existing --need-storage-modify functionality. It also introduces the ability to configure which kinds of scopes are dropped from a token by default via the environment variable JOBSUB_SCOPES_DROP.

The PR also fixes a couple of pre-existing bugs in the unit tests.

Key changes include:

  • Added --need-storage-stage command-line argument to complement --need-storage-modify
  • Modified scope handling to drop both storage.modify and storage.stage scopes by default
  • Introduced JOBSUB_SCOPES_DROP environment variable for configurable scope cleaning
  • Updated documentation and man pages

Summary generated by Copilot, amended by @shreyb

Closes #651

shreyb added 3 commits January 8, 2026 10:42
This argument allows for callers to specify storage.stage scopes they
want to have in a token submitted with a job.

In addition, the need_modify, need_scopes, and the new need_stage
arguments all have default values of None so that callers don't have to
specify the values if they don't need to.

Finally, this commit adds support for a new environment variable,
JOBSUB_SCOPES_DROP, that allows users to choose which scopes get
dropped from their token.

This commit also adds a unit test and fixes a couple of tests.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for the --need-storage-stage flag to allow users to specify directories requiring storage.stage scope in job tokens, mirroring the existing --need-storage-modify functionality. The PR also fixes several pre-existing bugs and adds configurability for scope dropping via environment variables.

Key changes include:

  • Added --need-storage-stage command-line argument to complement --need-storage-modify
  • Modified scope handling to drop both storage.modify and storage.stage scopes by default
  • Introduced JOBSUB_SCOPES_DROP environment variable for configurable scope cleaning
  • Fixed multiple f-string formatting bugs and a duplicate test function name
  • Updated documentation and man pages

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/test_token_mods_unit.py Added test for new --need-storage-stage functionality, added environment variable test, fixed f-string bugs and duplicate function name
tests/test_get_parser_unit.py Added --need-storage-stage to comprehensive argument test
tests/decode_token_tests/mp1 Updated test token to include storage.stage scope
man/man1/jobsub_submit.1 Added documentation for --need-storage-stage flag, updated description to mention both modify and stage scope defaults
man/jobsub_api.md Added need_storage_stage parameter documentation, fixed typos in existing documentation
lib/token_mods.py Added need_stage parameter to get_job_scopes(), implemented configurable scope dropping via environment variable, updated warning messages to be generic
lib/mains/submit.py Passed need_storage_stage argument to get_job_scopes()
lib/jobsub_api.py Added need_storage_stage to API parameter mapping and documentation, fixed typos
lib/get_parser.py Added --need-storage-stage argument definition
bin/condor_submit_dag Passed need_storage_stage argument to get_job_scopes(), fixed docstring formatting

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/test_token_mods_unit.py Outdated
Remove ncsl declaration in test

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@shreyb shreyb marked this pull request as ready for review January 9, 2026 01:22
@shreyb shreyb added this to the 1.13 milestone Jan 9, 2026
@shreyb shreyb requested review from marcmengel and vitodb January 9, 2026 01:23
@shreyb shreyb changed the title Issue 651 Token weakening removes storage.stage scopes by default/add --need-storage-stage flag to override Jan 9, 2026
Copy link
Copy Markdown
Contributor

@marcmengel marcmengel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@shreyb shreyb merged commit 11b6863 into fermitools:master Jan 9, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Extend token weakening to include staging

3 participants