Stop chrome extensions from initiating ajax requests

I'm currently managing an asp.net website that heavily relies on client javascript for making ajax calls to the server. I need assistance in finding a solution to prevent unauthorized access from a Google Chrome extension attempting to make calls to my ajax endpoints. Is there a way to differentiate between calls made by my own javascript code and those initiated by the chrome extension? I've tried monitoring referer and using httponly cookies, but haven't observed any noticeable distinctions between the two types of calls. Any suggestions or insights would be greatly valued.

Answer №1

Sorry, but no, there isn't.

Chrome extensions have special permissions that go beyond your typical website JavaScript code. They have the ability to out-permit your own code and can manipulate or even call it at will.

Even if you try to add extra security measures like anti CSRF tokens, an extension could still easily bypass them and access sensitive information. These extensions can inject their own JavaScript code into your site and make changes on the fly without you or your users ever knowing.

The best approach is to never fully trust the client with important data. Treat all incoming requests as potentially harmful and always require authentication before allowing any interactions with your server.

(Just to clarify, this applies specifically to chrome extensions running on your site)

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What is a callback function tied to a specific URL?

I need to implement a functionality in my web application where users can click on a link within a datatable, which will then load a new table on a separate page. This new table should only display rows that have the same id as the row that was clicked on ...

Enhance Text Visibility following ng-view Location Adjustment within AngularJS

How can I implement text highlighting using the jquery highlight plugin after a user changes the ng-view location? The text that needs to be highlighted is on the returned page. Upon successful view change, I invoke the highlight() method: $scope.$on(&ap ...

Problematic rendering of Bootstrap Navbar Toggle

As I work on creating a WordPress theme using Bootstrap 3, I encountered an issue with the navbar toggle when reducing the screen width for testing. The image displayed doesn't align with what I expected. While I suspect it might be a WordPress-relate ...

The art of sketching precise lines encircling a circular shape through the

What is the best way to use a for loop in JavaScript to draw lines around a circle, similar to those on a clock face? ...

Issue with jQuery.off when using a dynamic function name

I am currently implementing a modular pattern for writing my JavaScript code and it has been an enjoyable experience! However, I have encountered a challenging situation. My Namespace structure looks like this: var settings, handlers, objects, Namespace ...

In Flow, how is the asterisk (*) type utilized and what is its counterpart in TypeScript?

My expertise lies mostly in TypeScript, but I recently came across Flow which seems quite similar to TS in many aspects. However, one thing that caught my attention is the asterisk (*) type in Flow. Initially, I thought it was just another way of represent ...

Is it possible to create an observable with RXJS that emits only when the number of items currently emitted by the source observables matches?

I am dealing with two observables, obs1 and obs2, that continuously emit items without completing. I anticipate that both of them will emit the same number of items over time, but I cannot predict which one will emit first. I am in need of an observable th ...

Looking to execute a jQuery function as soon as the input value matches?

Can anyone help me with this coding issue? I have a code that is supposed to display the #result div when the user enters "TV" into the input field, but I need the page to refresh after entering the text. Is there a way to do this live so that the div wi ...

After the php array has been json_encoded, what should be my next step?

Exploring the realms of PHP and JavaScript is new to me, and I'm encountering difficulty in finding a way for them to communicate effectively. After converting a PHP array into JSON using json_encode(), I feel unsure about the next steps. Despite sear ...

Unexpected interactions between Socket.io and React using hooks

Currently, I am delving into the world of Socket.io with React utilizing Hooks. My goal is to create a timer that starts upon pressing the start button, and then every second, send the current time in the state to the server using socket.io. The server co ...

Regular expression that can be used to extract information from a text file by filtering and returning only

When I open a text file, it contains several lines like the examples below. surname australia enter name j.jonhs enter name j.cause enter name f.london enter I am seeking assistance to modify the code snippet below so that it captures the first line m ...

Restricting the fields in a $lookup operation in MongoDB

My Mongo object follows the schema provided below. { "_id" : "59fffda313d02500116e83bf::5a059c67f3ff3b001105c509", "quizzes" : [ { "topics" : [ ObjectId("5a05a1e1fc698f00118470e2") ], " ...

JavaScript not triggering Bootstrap 5 modal popup to appear

I am attempting to open a bootstrap 5 modal programmatically, but when the code runs, nothing happens My page includes bootstrap.min.js and I have an HTML modal template within the page <div class="modal fade" id="exampleModal" tabi ...

Is there a way to determine a path connecting 3D coordinates?

Understanding this concept is better with visual aids. I have a set of green points located here: https://i.sstatic.net/V8VEC.png My goal is to determine several points along the red line shown below: https://i.sstatic.net/b26AK.png Although this illus ...

Can the default position of the scrollbar be set to remain at the bottom?

I have a select option tag with a scrollbar to view the contents in the dropdown. I am looking for a way to automatically position the scroll at the bottom when an item is selected from the dropdown. jquery code $('document').ready(func ...

Having trouble with my jQuery code not functioning as expected

I'm currently a first-year student in an ICT program and we're working on a project. Right now, I'm focused on writing jQuery code for a shopping cart feature. My goal is to input the quantity of items I want to add (e.g. 5) and have the to ...

I came across a forum where someone mentioned encountering a similar issue but unfortunately, no solution was provided. Currently, I am working on setting up a reaction roles system but despite embedding the message, the role is not being

I am currently working on setting up a reaction roles system for my Discord server, but I have encountered a significant issue that may seem minor to most. The problem is that although my bot successfully sends embeds with corresponding emojis for the ro ...

I am facing an issue with JQuery and AJAX where I am unable to successfully insert form data and have it return on the same

I'm currently facing an issue while trying to insert form data into a database table and then display a success or failure message on the same page. Despite my efforts, I can't seem to make it work. Below is the code snippet I am using... FORM ...

ng-repeat did not properly listen for changes in the radio box selection

Feeling a bit confused here. I'm trying to call a function on change and pass the obj to it. From what I understand, since it's bound to the selected obj, I should be able to just use ng-model. However, in this situation, nothing happens when I s ...

Encountering a Type Error in React Native when attempting to create a 3D cube with Three.js

Following a tutorial on creating a simple app that displays a 3D cube, I encountered an issue with my code: import React from 'react' import {View} from 'react-native' import Expo from 'expo' import {Scene, Mesh, MeshBasicMate ...