Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8656921
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T15:23:53+00:00 2026-06-12T15:23:53+00:00

I created a google-chrome-extension which redirects all requests of a javascript-file on a website

  • 0

I created a google-chrome-extension which redirects all requests of a javascript-file on a website to a modified version of this file which is on my harddrive.
It works and I do it simplified like this:

... redirectUrl: chrome.extension.getURL("modified.js")  ...

Modified.js is the same javascript file except that I modified a line in the code.
I changed something that looks like

var message = mytext.value;

to var message = aes.encrypt(mytext.value,"mysecretkey");

My question is now is it possible for the admin of this website where I redirect the javascript-file to modify his webpage that he can obtain “mysecretkey”. (The admin knows how my extension works and which line is modified but doesn’t know the used key)

Thanks in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T15:23:54+00:00Added an answer on June 12, 2026 at 3:23 pm

    Yes, the “admin” can read the source code of your code.
    Your method is very insecure. There are two ways to read “mysecretkey”.

    Let’s start with the non-trivial one: Get a reference to the source. Examples, assume that your aes.encrypt method looks like this:

    (function() {
        var aes = {encrypt: function(val, key) {
            if (key.indexOf('whatever')) {/* ... */}
        }};
    })();
    

    Then it can be compromised using:

    (function(indexOf) {
        String.prototype.indexOf = function(term) {
            if (term !== 'known') (new Image).src = '/report.php?t=' + term;
            return indexOf.apply(this, arguments);
        };
    })(String.prototype.indexOf);
    

    Many prototype methods result in possible leaking, as well as arguments.callee. If the “admin” wants to break your code, he’ll surely be able to achieve this.

    The other method is much easier to implement:

    var x = new XMLHttpRequest();
    x.open('GET', '/possiblymodified.js');
    x.onload = function() {
        console.log(x.responseText); // Full source code here....
    };
    x.send();
    

    You could replace the XMLHttpRequest method, but at this point, you’re just playing the cat and mouse game. Whenever you think that you’ve secured your code, the other will find a way to break it (for instance, using the first described method).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I included some adsense code in my google chrome extension popup file. Unfortunately this
I've created a basic extension for Google Chrome to change the behavior of which
This is not just for Google Chrome extension but also for JavaScript I am
I'm following this tutorial to create a simple Hello World extension for Chrome: http://code.google.com/chrome/extensions/getstarted.html
I'm trying to create an extension using this docs: http://code.google.com/chrome/extensions/content_scripts.html I want a part
I have a Google Chrome extension that creates a select-all function for a search
I am trying to create a simple google chrome extension which can convert selected
To learn JavaScript I am writing a small text editor Google Chrome extension. But
I am creating a Google chrome extension which can read the contents of clipboard.
I want to build a Google Chrome extension to sync all my bookmarks across

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.