Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Website Source Code Thought

Website Source Code Thought

Scheduled Pinned Locked Moved The Lounge
javascripthtmlcsscomsecurity
27 Posts 22 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    Nithin Sundar
    wrote on last edited by
    #1

    We're able to view any website's HTML and in (almost) all cases, the javascript code as well. Might sound a bit silly but any website out there which actually tries to protect it's code from the viewer? Javascript and probably CSS can go in protected mode by including the files in the html or aspx pages than including them in the main page itself. Can this improve a website's security by any way?

    My Blog My Achievements: * Posted 25,000th message in GIT O_O * Official supporter of the "thatraja's GIT Meet Sponsor Foundation" :D What you do, when you don't know what to do is what you do when you don't want to do what you do.

    C R K T 4 Replies Last reply
    0
    • N Nithin Sundar

      We're able to view any website's HTML and in (almost) all cases, the javascript code as well. Might sound a bit silly but any website out there which actually tries to protect it's code from the viewer? Javascript and probably CSS can go in protected mode by including the files in the html or aspx pages than including them in the main page itself. Can this improve a website's security by any way?

      My Blog My Achievements: * Posted 25,000th message in GIT O_O * Official supporter of the "thatraja's GIT Meet Sponsor Foundation" :D What you do, when you don't know what to do is what you do when you don't want to do what you do.

      C Offline
      C Offline
      Chris Maunder
      wrote on last edited by
      #2

      HTML is just markup - fancy formatting for text - so "protecting" it is like protecting the text you're displaying to the user. ie kinda pointless. CSS is just styling and layout, so the same deal. However, one minor niggle here is that maybe you have content on your site you don't want some people to see (hidden link, hidden that only spiders and bots will see). In this case the HTML and CSS could be used to hide stuff, and so obfuscating this may be useful. That is, if hiding ocntent on a webpage is useful. Javscript obfuscation is well known and falls into the same bucket as any other obfuscation such as .NET binaries.

      cheers, Chris Maunder The Code Project | Co-founder Microsoft C++ MVP

      N N F 3 Replies Last reply
      0
      • C Chris Maunder

        HTML is just markup - fancy formatting for text - so "protecting" it is like protecting the text you're displaying to the user. ie kinda pointless. CSS is just styling and layout, so the same deal. However, one minor niggle here is that maybe you have content on your site you don't want some people to see (hidden link, hidden that only spiders and bots will see). In this case the HTML and CSS could be used to hide stuff, and so obfuscating this may be useful. That is, if hiding ocntent on a webpage is useful. Javscript obfuscation is well known and falls into the same bucket as any other obfuscation such as .NET binaries.

        cheers, Chris Maunder The Code Project | Co-founder Microsoft C++ MVP

        N Offline
        N Offline
        NormDroid
        wrote on last edited by
        #3

        He could an obfuscated Silverlight App ;)

        Software Kinetics Wear a hard hat it's under construction
        Metro RSS

        N W 2 Replies Last reply
        0
        • C Chris Maunder

          HTML is just markup - fancy formatting for text - so "protecting" it is like protecting the text you're displaying to the user. ie kinda pointless. CSS is just styling and layout, so the same deal. However, one minor niggle here is that maybe you have content on your site you don't want some people to see (hidden link, hidden that only spiders and bots will see). In this case the HTML and CSS could be used to hide stuff, and so obfuscating this may be useful. That is, if hiding ocntent on a webpage is useful. Javscript obfuscation is well known and falls into the same bucket as any other obfuscation such as .NET binaries.

          cheers, Chris Maunder The Code Project | Co-founder Microsoft C++ MVP

          N Offline
          N Offline
          Nithin Sundar
          wrote on last edited by
          #4

          Agreed about Layout HTML and CSS. Javascript can be hidden with a simple include of a file inside script tag right? We don't even need to go for obfuscation. Unless obfuscation means the same thing. Okay I'm a bit confused. Pardon this newb! :)

          My Blog My Achievements: * Posted 25,000th message in GIT O_O * Official supporter of the "thatraja's GIT Meet Sponsor Foundation" :D What you do, when you don't know what to do is what you do when you don't want to do what you do.

          B J P 3 Replies Last reply
          0
          • N Nithin Sundar

            Agreed about Layout HTML and CSS. Javascript can be hidden with a simple include of a file inside script tag right? We don't even need to go for obfuscation. Unless obfuscation means the same thing. Okay I'm a bit confused. Pardon this newb! :)

            My Blog My Achievements: * Posted 25,000th message in GIT O_O * Official supporter of the "thatraja's GIT Meet Sponsor Foundation" :D What you do, when you don't know what to do is what you do when you don't want to do what you do.

            B Offline
            B Offline
            BillWoodruff
            wrote on last edited by
            #5

            Nithin Sundar wrote:

            Javascript can be hidden with a simple include of a file inside script tag right?

            Not quite. You can, usually, easily, figure out the path of the file: then, slap it in the web-browser address bar, and download it. However, if it's encrypted, obfuscated, etc. ? Well, I'm not sure about this, because I have looked at site's file includes maybe once or twice only, out of curiosity, but I suspect any hacker with moderate level skills could be using some kind of tools to watch everything happening "under the hood" ? Again, I have no knowledge in this area, but I bet there are some hacker tools out there specifically for tracing code executing in the browser, etc. best, Bill

            “Every existing thing is born without reason, prolongs itself out of weakness, and dies by chance.” Jean-Paul Sartre, "Nausea"

            N D 2 Replies Last reply
            0
            • N Nithin Sundar

              Agreed about Layout HTML and CSS. Javascript can be hidden with a simple include of a file inside script tag right? We don't even need to go for obfuscation. Unless obfuscation means the same thing. Okay I'm a bit confused. Pardon this newb! :)

              My Blog My Achievements: * Posted 25,000th message in GIT O_O * Official supporter of the "thatraja's GIT Meet Sponsor Foundation" :D What you do, when you don't know what to do is what you do when you don't want to do what you do.

              J Offline
              J Offline
              Jan Steyn
              wrote on last edited by
              #6

              You would still be able to get to the source of the script in that way if it is a link. The only way for that would be obfuscation, meaning the code get made unreadable by human.

              J 1 Reply Last reply
              0
              • B BillWoodruff

                Nithin Sundar wrote:

                Javascript can be hidden with a simple include of a file inside script tag right?

                Not quite. You can, usually, easily, figure out the path of the file: then, slap it in the web-browser address bar, and download it. However, if it's encrypted, obfuscated, etc. ? Well, I'm not sure about this, because I have looked at site's file includes maybe once or twice only, out of curiosity, but I suspect any hacker with moderate level skills could be using some kind of tools to watch everything happening "under the hood" ? Again, I have no knowledge in this area, but I bet there are some hacker tools out there specifically for tracing code executing in the browser, etc. best, Bill

                “Every existing thing is born without reason, prolongs itself out of weakness, and dies by chance.” Jean-Paul Sartre, "Nausea"

                N Offline
                N Offline
                Nithin Sundar
                wrote on last edited by
                #7

                That was a great explanation Thanks! :D But according to what you said, does that mean the person trying to download the js file can still get it even if I place it in a folder with no access to others? I have seen websites saying "You don't have permission to access "Folder"" sometimes when the website is down.

                My Blog My Achievements: * Posted 25,000th message in GIT O_O * Official supporter of the "thatraja's GIT Meet Sponsor Foundation" :D What you do, when you don't know what to do is what you do when you don't want to do what you do.

                A 1 Reply Last reply
                0
                • N NormDroid

                  He could an obfuscated Silverlight App ;)

                  Software Kinetics Wear a hard hat it's under construction
                  Metro RSS

                  N Offline
                  N Offline
                  Nagy Vilmos
                  wrote on last edited by
                  #8

                  I thought that Silverdark was obfuscated. :-D


                  Panic, Chaos, Destruction. My work here is done. Drink. Get drunk. Fall over - P O'H OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett

                  S D 2 Replies Last reply
                  0
                  • N Nagy Vilmos

                    I thought that Silverdark was obfuscated. :-D


                    Panic, Chaos, Destruction. My work here is done. Drink. Get drunk. Fall over - P O'H OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett

                    S Offline
                    S Offline
                    StM0n
                    wrote on last edited by
                    #9

                    The Dark Force is Strong with this one...

                    (yes|no|maybe)*

                    1 Reply Last reply
                    0
                    • N Nithin Sundar

                      Agreed about Layout HTML and CSS. Javascript can be hidden with a simple include of a file inside script tag right? We don't even need to go for obfuscation. Unless obfuscation means the same thing. Okay I'm a bit confused. Pardon this newb! :)

                      My Blog My Achievements: * Posted 25,000th message in GIT O_O * Official supporter of the "thatraja's GIT Meet Sponsor Foundation" :D What you do, when you don't know what to do is what you do when you don't want to do what you do.

                      P Offline
                      P Offline
                      Pete OHanlon
                      wrote on last edited by
                      #10

                      Ultimately, you can't hide the JavaScript. The browser has to be able to get to it to run it, which means that a copy has to "come to" your machine.

                      *pre-emptive celebratory nipple tassle jiggle* - Sean Ewington

                      "Mind bleach! Send me mind bleach!" - Nagy Vilmos

                      My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility

                      G E 2 Replies Last reply
                      0
                      • N Nithin Sundar

                        That was a great explanation Thanks! :D But according to what you said, does that mean the person trying to download the js file can still get it even if I place it in a folder with no access to others? I have seen websites saying "You don't have permission to access "Folder"" sometimes when the website is down.

                        My Blog My Achievements: * Posted 25,000th message in GIT O_O * Official supporter of the "thatraja's GIT Meet Sponsor Foundation" :D What you do, when you don't know what to do is what you do when you don't want to do what you do.

                        A Offline
                        A Offline
                        Ankur m
                        wrote on last edited by
                        #11

                        Nithin Sundar wrote:

                        does that mean the person trying to download the js file can still get it even if I place it in a folder with no access to others?

                        You website too will not be able to use that file then. You will get a 403 error for the request (just for that file) and thus your site will also break if that js file is referenced.

                        Nithin Sundar wrote:

                        I have seen websites saying "You don't have permission to access "Folder"

                        That's a different thing. It's called "Directory Listing" which is disabled by default or your website content will be seen by others.

                        ..Go Green..

                        1 Reply Last reply
                        0
                        • N NormDroid

                          He could an obfuscated Silverlight App ;)

                          Software Kinetics Wear a hard hat it's under construction
                          Metro RSS

                          W Offline
                          W Offline
                          wizardzz
                          wrote on last edited by
                          #12

                          Yeah, but he probably wants people to use the site.

                          1 Reply Last reply
                          0
                          • J Jan Steyn

                            You would still be able to get to the source of the script in that way if it is a link. The only way for that would be obfuscation, meaning the code get made unreadable by human.

                            J Offline
                            J Offline
                            jnelso99
                            wrote on last edited by
                            #13

                            And even then, you have sites that will unobfuscate/unminify javascript.

                            1 Reply Last reply
                            0
                            • P Pete OHanlon

                              Ultimately, you can't hide the JavaScript. The browser has to be able to get to it to run it, which means that a copy has to "come to" your machine.

                              *pre-emptive celebratory nipple tassle jiggle* - Sean Ewington

                              "Mind bleach! Send me mind bleach!" - Nagy Vilmos

                              My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility

                              G Offline
                              G Offline
                              greldak
                              wrote on last edited by
                              #14

                              Well you could use serverside javascript or indeed any other language for any functionality you don't want publicly visible

                              P 1 Reply Last reply
                              0
                              • B BillWoodruff

                                Nithin Sundar wrote:

                                Javascript can be hidden with a simple include of a file inside script tag right?

                                Not quite. You can, usually, easily, figure out the path of the file: then, slap it in the web-browser address bar, and download it. However, if it's encrypted, obfuscated, etc. ? Well, I'm not sure about this, because I have looked at site's file includes maybe once or twice only, out of curiosity, but I suspect any hacker with moderate level skills could be using some kind of tools to watch everything happening "under the hood" ? Again, I have no knowledge in this area, but I bet there are some hacker tools out there specifically for tracing code executing in the browser, etc. best, Bill

                                “Every existing thing is born without reason, prolongs itself out of weakness, and dies by chance.” Jean-Paul Sartre, "Nausea"

                                D Offline
                                D Offline
                                Danny Martin
                                wrote on last edited by
                                #15

                                BillWoodruff wrote:

                                but I bet there are some hacker tools out there specifically for tracing code executing in the browser, etc.

                                There are, they're called Webkit browsers... Just right click and inspect away! The best way to obfuscate JS is to get it written by a "Professional", it's guaranteed to be completely incomprehensible. ;) Server side is the way to go if you want to hide your nefarious deeds from the general public. Danny

                                1 Reply Last reply
                                0
                                • N Nithin Sundar

                                  We're able to view any website's HTML and in (almost) all cases, the javascript code as well. Might sound a bit silly but any website out there which actually tries to protect it's code from the viewer? Javascript and probably CSS can go in protected mode by including the files in the html or aspx pages than including them in the main page itself. Can this improve a website's security by any way?

                                  My Blog My Achievements: * Posted 25,000th message in GIT O_O * Official supporter of the "thatraja's GIT Meet Sponsor Foundation" :D What you do, when you don't know what to do is what you do when you don't want to do what you do.

                                  R Offline
                                  R Offline
                                  Reelix
                                  wrote on last edited by
                                  #16

                                  In all my years of web-surfing, I have successfully come across a single site that successfully protects its information (More than its code really) The server reads the information from a database, horrifically muddles the order of the words, splatters them in the code, then uses some rather funky CSS to make the text perfectly readable to the viewer. This makes it impossibly to simply copy-paste information from the site. I can't remember which site specifically, but it was awesome :laugh:

                                  -= Reelix =-

                                  M B 2 Replies Last reply
                                  0
                                  • R Reelix

                                    In all my years of web-surfing, I have successfully come across a single site that successfully protects its information (More than its code really) The server reads the information from a database, horrifically muddles the order of the words, splatters them in the code, then uses some rather funky CSS to make the text perfectly readable to the viewer. This makes it impossibly to simply copy-paste information from the site. I can't remember which site specifically, but it was awesome :laugh:

                                    -= Reelix =-

                                    M Offline
                                    M Offline
                                    mostafa heidary
                                    wrote on last edited by
                                    #17

                                    yeah, it was, i hope you remember

                                    1 Reply Last reply
                                    0
                                    • P Pete OHanlon

                                      Ultimately, you can't hide the JavaScript. The browser has to be able to get to it to run it, which means that a copy has to "come to" your machine.

                                      *pre-emptive celebratory nipple tassle jiggle* - Sean Ewington

                                      "Mind bleach! Send me mind bleach!" - Nagy Vilmos

                                      My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility

                                      E Offline
                                      E Offline
                                      ekolis
                                      wrote on last edited by
                                      #18

                                      Perhaps someday we will have "compiled Javascript" where instead of the browser downloading the Javascript source, it downloads a compiled binary of the Javascript to run in some sort of VM (a la Java or .NET)... then again, that's essentially how Java applets and Silverlight work, apart from the source being Javascript! But perhaps someone has written a compiler that turns Javascript into JVM or CLR bytecode already?

                                      1 Reply Last reply
                                      0
                                      • G greldak

                                        Well you could use serverside javascript or indeed any other language for any functionality you don't want publicly visible

                                        P Offline
                                        P Offline
                                        Patrick Fox
                                        wrote on last edited by
                                        #19

                                        You can do that. Or you could use your server side language.... The problem comes in when the JS or client side code must run on the client. In those cases... it must run on the client. If the client can run it, the client can see it.

                                        G 1 Reply Last reply
                                        0
                                        • N Nagy Vilmos

                                          I thought that Silverdark was obfuscated. :-D


                                          Panic, Chaos, Destruction. My work here is done. Drink. Get drunk. Fall over - P O'H OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett

                                          D Offline
                                          D Offline
                                          DeDawg
                                          wrote on last edited by
                                          #20

                                          I think the word you were look for was Deprecated :-D

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups