Skip to content

Runtime Custom CSS JavaScript and cookie persistence - #19

Merged
pschildgen87-code merged 10 commits into
compat/android-6-api23from
feature/web-overrides-runtime
Sep 18, 2026
Merged

pschildgen87-code merged 10 commits into
compat/android-6-api23from
feature/web-overrides-runtime

Conversation

@pschildgen87-code

Copy link
Copy Markdown
Collaborator

Implements the Web Overrides runtime block: trusted-page Custom CSS injection, trusted-page Custom JavaScript execution, and configurable cookie persistence modes. Legacy Quantum/default cookie behavior remains persistent for compatibility. Includes unit tests and keeps Android 6/API 23 support.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 18, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-18T07:34:17.815490Z 08cd42e PR opened
🔒 Security Review ✅ Completed 2026-09-18T07:33:09.298350Z 08cd42e PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@pschildgen87-code
pschildgen87-code merged commit 1b48042 into compat/android-6-api23 Sep 18, 2026
3 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 08cd42ec51

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".


public static void clearForFreshSession() {
CookieManager cookies = CookieManager.getInstance();
cookies.removeAllCookies(null);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Wait for cookie deletion before starting navigation

When COOKIE_PERSISTENCE_MODE is session and cookies remain from a previous Activity instance, removeAllCookies(null) performs deletion asynchronously, but MainActivity.onCreate() proceeds directly to the initial loadUrl. That first request can therefore still carry the previous authentication cookie, and deletion may then occur after the new page has begun establishing its session. Supply a callback and defer initial navigation until removal completes.

Useful? React with 👍 / 👎.

Comment on lines +88 to +93
if (CookiePersistencePolicy.usesEncryptedPersistence(AppConfig.COOKIE_PERSISTENCE_MODE)) {
sessionCookieStore = new QuantumSessionCookieStore(this);
sessionCookieStore.restore();
} else if (savedInstanceState == null
&& CookiePersistencePolicy.startsFreshSession(AppConfig.COOKIE_PERSISTENCE_MODE)) {
CookiePersistencePolicy.clearForFreshSession();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Clear the encrypted cookie backup when leaving persistent mode

When an installed app changes from the legacy/persistent mode to server or session, this branch stops constructing QuantumSessionCookieStore but leaves its previously captured encrypted payload in SharedPreferences. If a later app update selects persistent again, restore() revives that stale session cookie, including one that the session-mode startup was supposed to discard. Non-persistent modes should delete the custom store's saved payload as part of the mode transition.

Useful? React with 👍 / 👎.

Comment on lines +91 to +92
} else if (savedInstanceState == null
&& CookiePersistencePolicy.startsFreshSession(AppConfig.COOKIE_PERSISTENCE_MODE)) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Clear session cookies after process-state restoration

When Android kills the app in the background and later recreates this Activity, it supplies a non-null savedInstanceState even though a new app process and cookie session have started. In session mode this condition therefore skips the fresh-session clear; any server-persistent authentication cookie remains available while restoreState() resumes the prior page, defeating session-only behavior after a common process-death restore. Session initialization must distinguish a new process from an in-process Activity recreation rather than relying solely on savedInstanceState.

Useful? React with 👍 / 👎.

Comment on lines 81 to +82
if (navigationPolicy.isTrustedHttps(url)) {
WebOverrides.apply(view);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Guard overrides against the document active at execution

When a trusted page rapidly navigates to an in-WebView data:, about:, or blob: document, this callback can still arrive with the completed trusted URL while evaluateJavascript() asynchronously targets the newer document. Because those schemes are deliberately allowed to remain in the WebView, the configured CSS and arbitrary JavaScript can execute on content outside the trusted HTTPS boundary. The injected script itself should verify the active document's origin at execution time rather than relying only on the callback URL.

Useful? React with 👍 / 👎.

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.

1 participant