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 8301417
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T16:56:33+00:00 2026-06-08T16:56:33+00:00

I decided to use knockout.js for my web application and have some concerns regarding

  • 0

I decided to use knockout.js for my web application and have some concerns regarding security.

The flow of data is as follows:

  • user requests controller via url
  • controller gathers together required information, sends to view as json string
  • json string is saved to dom to allow my javascript code to access it
  • json is loaded into knockout view model inside the $(document).ready

My issue is that the json string is clearly viewable by users by just clicking ‘View Source’
and this worries me because I’m aware this can easily be changed client-side but I’m not
fully sure of the implications.

Here is some example code to illustrate my point. First, the controller:

 function view($id = null)
 {
    //other processing...

    $data = array();
    $data['json'] = $this->get_profile_json($id);
    $this->load->view('profile_page',$data);
 }

The profile page view

<script type="text/javascript">
    window.profile_json = "<?php echo $json; ?>";
</script>
<script type="text/javascript" src="<?php echo site_url('assets/js/profile_page.js'); ?>"></script>
<!-- The profile page below... -->

The profile page javascript

var vm = new ViewModel(profile_json); //load the json into view model
ko.applyBindings(vm);

Now I understand I can achieve the same goal by loading the json from the javascript code just before
creating the view model, using $.getJSON for example.

However, someone with a developer tools extension on their browser could also see (and possibly edit?)
this data too. This is a particular problem is some of that data contains things like permissions flags
and so on.

My question is, how do you ensure data passed down to your view model is unable to be tampered with?

  • 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-08T16:56:35+00:00Added an answer on June 8, 2026 at 4:56 pm

    There is no way to ever guarantee the safety of your information from the client side. This is why it is always important to do server side checks on the information, and then send back your response on whether the information is usable or not.

    For some security checks you should use the following:

    1) Strip_tags($_POST['key'])
    2) Check to see if the value is numeric (if its a number)
    3) Check to see if it only has alphabet and numbers (if this is all that's allowed)
    ...and so on
    

    The client side information to be passed to your back-end can always be tampered with, which is why it is important to lock it down as much as possible and if any information does not appear to be valid then you should immediately throw an error to the client and ask them to try again 🙂

    Assuming the back-end data is safe, then the front-end data should never have a problem.

    Hope this helps!

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

Sidebar

Related Questions

We decided to use mongodb for some web application (instead of mysql) but want
We have decided to use ExtJS for one of our large application's web-remake and
I decided to use UIScrollView in my application since I have to scroll the
In the current project we have decided to use dto's to transfer data between
I am writing an iPhone application and I have finally decided to use RestKit
Hy guys, I decided to use FOSUserBundle for handling user authentication in my application.
I have decided to use the singleton pattern for my application. It makes the
I have decided to use ResourceBundles to provide translations for my php application. While
I'm developing a user preferences page and I've decided to use AngularJS to control
I had a Navigation Controller based application and decided to use tab bars. And

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.