Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions options/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -299,15 +299,10 @@ <h3>Rule Playground (Beta)</h3>
<section id="logs-section" class="settings-section">
<div class="logs-controls">
<div class="logs-filters">
<label class="setting-label">
<input type="checkbox" id="enableDebugLogging" class="setting-checkbox">
<span class="checkbox-custom"></span>
Enable Debug Logging
</label>
<label class="setting-label">
<input type="checkbox" id="enableDeveloperConsoleLogging" class="setting-checkbox">
<span class="checkbox-custom"></span>
Developer Mode
Developer Mode (enables debug logging)
</label>
<label class="setting-label">
<input type="checkbox" id="simulateEnterpriseMode" class="setting-checkbox">
Expand Down
11 changes: 4 additions & 7 deletions options/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,6 @@ class CheckOptions {
this.elements.clearPlaygroundBtn = document.getElementById("clearPlaygroundBtn");
this.elements.loadCurrentRulesBtn = document.getElementById("loadCurrentRulesBtn");

// Logging settings (moved from privacy section)
this.elements.enableDebugLogging =
document.getElementById("enableDebugLogging");
this.elements.enableDeveloperConsoleLogging = document.getElementById(
"enableDeveloperConsoleLogging"
);
Expand Down Expand Up @@ -949,8 +946,6 @@ class CheckOptions {
}

// Logging settings
this.elements.enableDebugLogging.checked =
this.config.enableDebugLogging || false;
this.elements.enableDeveloperConsoleLogging.checked =
this.config.enableDeveloperConsoleLogging || false;

Expand Down Expand Up @@ -1162,10 +1157,12 @@ class CheckOptions {
? this.elements.urlAllowlist.value.split('\n').filter(line => line.trim())
: [],

// Debug logging setting
enableDebugLogging: this.elements.enableDebugLogging?.checked || false,
// Developer mode (debug logging auto-enabled when this is true)
enableDeveloperConsoleLogging:
this.elements.enableDeveloperConsoleLogging?.checked || false,
// Auto-enable debug logging when developer mode is enabled
Comment on lines +1160 to +1163
Copy link

Copilot AI Nov 20, 2025

Choose a reason for hiding this comment

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

[nitpick] The comment on line 1163 is redundant with the comment on line 1160, and the code duplicates the same condition. Consider consolidating the comments or making the relationship more explicit. For example, combine into a single comment block above line 1160: // Developer mode - also auto-enables debug logging

Suggested change
// Developer mode (debug logging auto-enabled when this is true)
enableDeveloperConsoleLogging:
this.elements.enableDeveloperConsoleLogging?.checked || false,
// Auto-enable debug logging when developer mode is enabled
// Developer mode - also auto-enables debug logging
enableDeveloperConsoleLogging:
this.elements.enableDeveloperConsoleLogging?.checked || false,

Copilot uses AI. Check for mistakes.
enableDebugLogging:
this.elements.enableDeveloperConsoleLogging?.checked || false,
};

// If in managed mode, filter out settings that are managed by policy
Expand Down
17 changes: 14 additions & 3 deletions scripts/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -2431,10 +2431,21 @@ if (window.checkExtensionLoaded) {
logger.log("⚠️ Page is in an iframe");
}

// Load configuration to check protection settings and URL allowlist
// Load configuration from background (includes merged enterprise policies)
const config = await new Promise((resolve) => {
chrome.storage.local.get(["config"], (result) => {
resolve(result.config || {});
chrome.runtime.sendMessage({ type: "GET_CONFIG" }, (response) => {
if (chrome.runtime.lastError || !response || !response.success || !response.config) {
// Optionally log the error for debugging
if (chrome.runtime.lastError) {
logger.log(`[M365-Protection] Error getting config from background: ${chrome.runtime.lastError.message}`);
}
// Fallback to local storage if background not available or response invalid
chrome.storage.local.get(["config"], (result) => {
resolve(result.config || {});
});
} else {
resolve(response.config);
}
});
});

Expand Down
6 changes: 6 additions & 0 deletions scripts/modules/config-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,12 @@ export class ConfigManager {
if (merged.customBranding) {
delete merged.customBranding;
}

// Auto-enable debug logging when developer console logging is enabled
if (merged.enableDeveloperConsoleLogging === true && merged.enableDebugLogging !== true) {
merged.enableDebugLogging = true;
logger.log("Check: Auto-enabled debug logging (developer console logging is enabled)");
}

// Ensure enterprise policies cannot be overridden
if (enterpriseConfig.enforcedPolicies) {
Expand Down