Skip to content

fix(auth): allow token downloads past expiry - #57

Merged
Gutts-n merged 1 commit into
mainfrom
fix/token-download-expired-password
Nov 23, 2026
Merged

Gutts-n merged 1 commit into
mainfrom
fix/token-download-expired-password

Conversation

@Gutts-n

@Gutts-n Gutts-n commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

What changed and why

Password rotation redirects any user with an expired password to the change-password page. The API (/api/) was already exempt, but file downloads were not. A service that fetches uploaded files with an API token, such as the datapusher, was redirected and its download failed.

The idea, in simple words

Scripts cannot fill in a "change your password" form. The API was already excused for that reason. Download links were forgotten. Now a download link is also excused, but only when the request came in with an API token. A person using a browser session with an expired password is still sent to the change-password page. Every other page works the way it did before.

Files

  • ckanext/sse/password_policy.py
    • New TOKEN_DOWNLOAD_ENDPOINTS: resource.download (CKAN core) and s3_resource.resource_download (ckanext-s3filestore).
    • _enforce_rotation() returns early when the request is token-authenticated (g.login_via_auth_header) and the endpoint is one of those two.
  • ckanext/sse/tests/test_password_policy.py: four new tests.
    • A token download is allowed on both endpoints.
    • A browser-session download is still redirected.
    • A token request to a normal page is still redirected.

Verified / not verified

  • Verified: both files compile.
  • Not verified: the new tests have not been run locally, because CKAN is not installed there. Check CI.
  • Not verified: the S3 endpoint name was read from the blueprint source, not exercised on a running request.

Deployment

Merging to main runs release.yml. Deployments that pin a specific ckanext-sse commit only pick this up when that pin is bumped.

@coderabbitai

coderabbitai Bot commented Nov 23, 2026

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 82eaeb5c-1c15-4781-ae93-eacf36619947
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@anuveyatsu

Copy link
Copy Markdown
Member

✅ Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
✅ Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@Gutts-n
Gutts-n merged commit 17f81e8 into main Nov 23, 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.

2 participants