Repository navigation
Add encrypted GitHub library tokens and retrieval diagnostics - #1948
Open
adamant-pwn wants to merge 5 commits into
Open
adamant-pwn wants to merge 5 commits into
adamant-pwn wants to merge 5 commits into
Conversation
Member
|
Thanks @adamant-pwn. @EJMFarrow could you please review this? |
EJMFarrow
requested changes
Nov 6, 2026
EJMFarrow
left a comment
Collaborator
There was a problem hiding this comment.
Thanks, @adamant-pwn . Good idea! It just needs to be a bit more useable by normal users. Happy to discuss.
Use encrypted default and per-library tokens for browser and CLI requests, with access-error fallback. Populate the same setting in CI and preserve it across PHPUnit resets. Use Moodle HTTP header collection and retain numeric rate-limit diagnostics.
Collaborator
Author
|
Thanks for the review! It's now a bit bigger, but also hopefully better integrate it with a way for administrators to set this up without server access, so it's useful outside CI too. |
EJMFarrow
reviewed
Nov 9, 2026
Moodle setting names allow only letters, digits and underscores, so the catalogue key is hashed. The full SHA-256 made the name shown under each admin field overflow. Keep the first 16 hex characters, as the private demo manifest does for question IDs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
|
Code looking good, @adamant-pwn . I think I must have closed the review by accident, though! I still want to have a look over the tests a bit further. |
EJMFarrow
approved these changes
Nov 9, 2026
EJMFarrow
left a comment
Collaborator
There was a problem hiding this comment.
OK, looks good. Thank you!
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Administrators can configure encrypted GitHub tokens in STACK settings to access private question libraries and authenticate public-library requests. A default token can serve several libraries, with optional tokens for individual entries. Access is shared with authorised external-library users.
STACK tries the library token first, then a different default token if GitHub denies access. Rate limits and connection or server errors do not trigger fallback. Downloads use the token selected when listing the library. Changing tokens or library settings clears the cache.
Browser requests and CLI scripts use the same settings. CI populates the default setting with its temporary read-only token and preserves it across PHPUnit resets. Requests are restricted to HTTPS on api.github.com without redirects. Retrieval errors report HTTP status, cURL errors and numeric rate-limit information without exposing credentials or response bodies.
Preview images remain accessible without login to anyone with their URL; the settings help explains this limitation. Site backups must include Moodle’s encryption key.
Prepared with AI assistance.