-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update viewer-only earthengine repo to master branch of main repo as of 2013-10-22 #1
Conversation
More about this commit from pdille, explaining a number of the diffs: "Around the time of the the final stages of the Landsat release, Yen-Chia, in parallel to everything going on, had gone through and completely redid the UI we use for our standard timelapses. The file that controlled this was timelapseViewer.js and then became defaultUI.js He also refactored the Landsat UI file to go along with how the UI was now being loaded. The original file was customTimeline.js and then it became customUI.js. This also explains why you see so many images being removed and tons of css changes, since we had an image based UI before. Anyway, since this was so close to release I didn't want you, Eric, to deal with changing js/css includes on your embeds or worrying about why there are new files. I thought that was the last thing you wanted with your sleepless nights. So I left it as is. customUI.js was just a refactor and didn't introduce new fixes or new features, so it's not like you guess missed out on anything." |
<content url="file://$MODULE_DIR$" /> | ||
<orderEntry type="sourceFolder" forTests="false" /> | ||
</component> | ||
</module> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test line comment: Should these .iml and .ipr files also be .gitignored and removed from the repository?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes they should. But more importantly, they actually get removed down
the road. So you'll see them disappear once we get things up to the HEAD
of master.
On 3/31/2014 1:18 PM, Eric Nguyen wrote:
In TimeMachineExplorer.iml:
@@ -0,0 +1,9 @@
+
+
+
Test line comment: Should these .iml and .ipr files also be
.gitignored and removed from the repository?—
Reply to this email directly or view it on GitHub
https://github.com/CMU-CREATE-Lab/timemachine-viewer/pull/1/files#r11125955.
Is this waiting on my review? |
No, I believe Eric is doing it all this round. At least that's what he said at our last meeting. |
Yes, I'm taking a first look at this. Probably I'll take this round and ~e On Fri, Apr 4, 2014 at 8:36 AM, pdille [email protected] wrote:
|
Hi, CMU team. Could you add some more orienting notes to this pull request? For example:
|
Oh and another question I had was how all the example *.html files are related. Tnx! |
(And I'd also recommend in the notes calling out the files that won't be On Fri, Apr 4, 2014 at 10:30 PM, Eric Nguyen [email protected]:
|
Here are some more detailed notes to go along with this commit: Specific notes:You can find a version of the viewer at this merge point live here. /images/* (We moved from an image based UI to a fully css based one. It's probably not worth looking at them, but feel free.) The *.html files you see in the root directory are either template files or example embed files. The examples were all renamed or moved to /tests or /examples at a later date. The templates remain in the root directory to this day. The template files are: player_template.html, time_warp_composer.html and annotation_editor.html customTimeline.css became customUI.css defaultUI.css was created and was populated from files like player.css or timelapse.css
All the tour editor logic (both creating tours and viewing them) has always been part of the repo. There is a flag when embedding the viewer that enables/disables the tour editor UI from appearing and we choose to disable it on brassy. The core tour related code lives in snaplapse.js and snaplapseViewer.js. Files removed at a later date.iml Files not used in brassyVERSION (for our internal use) |
Hi, team. TLDR: Focusing this review on security. Max, PTAL. After contemplating a longish list of changes that I realized were going to be annoying to merge forward, I've decided that it makes sense to focus this review on security. We'll get my and Max's eyes on the timemachine codebase and get some certainty that what's committed on our end is secure. The next step is that we can merge forward any small changes and then Max and I can split up a monolithic review of your current state relative to a secure baseline. Sound good? Okay, on to security review. Overall, I think we're in good shape. I include all my notes below to indicate to Max (and you guys) what I looked at and how I was thinking so that we can look for more potential issues together. As you might expect, I'm looking for places where input from one user can be fed to another user, allowing script to be executed on their behalf. I explored two major possibilities. 1) Threats coming via cross-domain calls (embedded iframe) Time machine instances can be embedded in an iframe, and we expose certain APIs. A vulnerability could allow an attacker-controlled parent page to execute script within the embedded iframe, i.e. in the context of one of our domains and with the end user's cookies/credentials. First, I looked at postmessage.js. We use this to do cross-frame, cross-domain communication. It's a a fairly well-used open source project. However, it's not really used at Google, and the authors (who are here) told me that it's never been security reviewed. It may be prudent to use raw window.postMessage instead, since I believe it is supported on all platforms that thetimemachine client supports anyway (http://caniuse.com/#search=postmessage). Next, I looked at how we sanitize user input generally. Luckily, we did most of this work in util.js in the pre-launch review. I've copied the last email from that long thread at the bottom, here. Essentially, util.js and a few other classes funnel user input through the getUnsafeHashVars() method and others like timelapse.unsafeViewToView(). Notes on this are at the bottom of this message. However, here are a bunch of fixes to make this better:
Next, we need to make sure all data coming through the postmessage handlers is being properly sanitized. I looked at crossdomain_api.js for this:
2) Threats coming in on load, via the URL itself For both embedded and non-embedded instances of the timemachine player, attackers can also simply add data directly to the URL that the player will use on load. Most of this flows through the paths described in the section above, but I also took a look at all occurrences of window.location, window.top.location, and document.referrer. I think we're good here. The timelapse.getShareView() method and custom variants (e.g. viewer_animation_test.html) pull data from window.location, but only ever do so to populate a share URL dialog. These URLs will all necessarily be parsed by the sanitized util.js if another user opens them, so we should be safe here. 3) Anything else? Other attacks I'm not considering? Note that we'll be in much better shape once each of these classes of concerns can be expressed as a set of tests, but I'll reserve that for the full review, later. Earlier Security review notes, for reference... Eric Nguyen Hey Paul, thanks for your fixes on the security stuff. I still found myself without a fully clear path to trace security-review-wise, so I added some notes in commit 5ba090ed2dba1963ad376f57040a6a8f2c341e18. Here's how it looks now:
Hope that makes sense. Again, just being detailed so you understand why all these changes are being made and so that you can model this thinking next time. ~e |
I see no obvious security issues (ignoring the files not used by Brassy and/or removed later). Also, Eric, I don't see the parts you discuss in this particular pull request (e.g. postMessage is not called anywhere that I can see). |
Max: I should have clarified. There were earlier changes that I felt On Sat, Apr 19, 2014 at 7:00 PM, Max Shawabkeh [email protected]:
|
…ussion here: #1 (comment) - Added test page for testing cross-domain functionality.
FYI, I pushed changes to master based on your security comments, Eric. I wasn't in disagreement on any points. You'll see a link to the commit right above this post. |
Added comments to the commit, Paul. Mostly minor changes and some confusion around how |
Just discussed offline: Paul is still working on a small wrapper for raw postMessage. |
Here's the commit that replaces the postmessage library we were using with our own wrapper on the postMessage protocol. No hacks/fallbacks for older browsers (since they can't use our viewer anyway) and should thus be easier to review. It should be a drop in replacement and keeps the same API that the library was using. e92347e |
#1 (comment) - Fixed issue with playing/pausing through the cross domain protocol when the time machine is looping.
The next commit above should cover the rest of the comments you made in regards |
Okay, I only had the one comment on e92347. Otherwise, the postMessage stuff looks good. To test the specific case we will have in the wild with existing installs of Timelapse, we should run an instance with the old version of postmessage.js on the parent page and the new timelapse client (with this new version of postmessage.js) in the iframe. The other minor commits around unsafeViewToView, etc. also all look good! So once you address that one comment mentioned above, let's call this a wrap! |
Sent email about a test page for testing backwards compatibility of embeds with postmessage. A login is required, and though not a loss if it gets outs, I just don't want it on a public page like this. |
Update viewer-only earthengine repo to master branch of main repo as of 2013-10-22
…ontains 205 squashed commits from master, from be89b4e to beb7023, to make reviewing the pull request easier. - Tour share link now works with all datasets. - cleaned up intergrated-viewer.html - added support to fit viewer to browser window (full screen support coming soon) - merged hyperwall code - merged joystick code - file formatting changes - fixed UI race condition when stopping/replaying tours Hyperwall controller elements now has latlng center view data. - Fixed regression when doing an instant warp between keyframes. - Fixed issue if viewerGeometry param is not specified in the viewer options when creating a time machine. - integrated-viewer.html is now a bare bones example, as it was in the past. Needed for TMCA. Further html examples/file cleanup forthcoming. - Tweaked fix from previous commit for instant warps between keframes in tours. - Tweaked default params in the viewer options for integrated-viewer.html Pulled in hyperwall change. Added old code as comments for future debugging. Hyperwall related changes. Server can change the play button UI on the controller. Tweaked the zooming and panning for hyperwall controller. Fixed a bug that caused zoomGracefully to not zoom to the correct level. File formatting changes to crossdomain_api.js Fixed a bug that zoomGracefully() will not zoom to the final level if there exists 0.5 difference. Fixed a bug in controller.html for sorting keyframes due to the update from Android 4.3 to 4.4 Disable thumbnail sorting in hyperwall controller due to Android version issues. - Hyperwall related changes for play/pause button UI. Changed thumbnails for hyperwall controller. Synced hyperwall code. Fixed the timer for the zooming gracefully function. - Fixed mouseup issues while dragging a time lapse and the mouse goes outside the browser window or outside an iframe. - Removed console messages from previous commit. - Cleanup to previous mouse handling commits. - Fixed issue where the zoom slider would get stuck (mouseup never fires) when the user's mouse leaves the viewport that is inside an iframe. - Synced with hyperwall code. - Synced with hyperwall branch. Added MODIS UI. Added presentation mode. Added the ability to rearrange keyframes while creating a tour. Misc bug fixes. Added new example files. Fixed the bug that the speed toggling button does not change correclty if the speed is set to less than 100%. The spinner values for MODIS UI are now consistent. Fixed a bug in timelapse.js that skipping frames at the end does not correctly remove the captured times. Fixed some MODIS editor UI bugs. Redesign the default UI. Fixed a month lock related bug in MODIS UI. - Removed old, unused kineticjs library file. - Minor cleanup. - Added a public method for generating a link to a thumbnail of the current view. - Updated how templates/json are loaded so that we can mix and match ajax loading and loading via javascript includes. - Updated the template javascript include file. - Updated jQuery to 1.11.0 and jQuery UI to 1.10.4 - Removed unnecessary console messages from previous commit. - You can dynamically change datasets without the need to reload the entire page. - Some code cleanup. Cleaned up the code for visualizer (the context map). Fixed the loading bug for visualizer. Minor default UI tweaks. Fixed a bug for the home view when initially loading a dataset. Updated template_includes.js Fixed minor editor UI bugs. Redesign the UI for toggling between different editor modes. Redesign the button for toggling between modes for custom UI. Added the function and UI for adding keyframe titles (different from captions). Fixed minor bugs for loading keyframe titles. Added a textbox showing up when hovering mouse cursors over thumbnails in the presentation slider. Added focusing effect on thumbnails in presentation mode. Instruction layout for custom UI editor is now correct. Added several testing html files. Repositioned the hovering box so that it will not be cropped in an iframe. Fixed minor bugs. Cleaned up HTML files. Tweaked UI for MODIS tour editor. Fixed the UI bugs for MODIS tour editor. Fixed minor bugs related to settings. - Fixed an issue if datasets did not have a trailing slash and were loaded dynamically from loadTimelapse(). Removed the tooltip for the timeline slider on default UI. The viewer mode toggling button would not show up if the editor is not enabled. Removed useless settings. Cleaned up HTML examples. Removed useless files. Fixed bugs related to settings. Added a setting for hiding the logo on default UI. Updated template_includes.js Updated how logos are loaded. Fixed a bug for the presentation slider. Tweaked the default UI. Separated the tour and presentation slider object. Fixed minor resizing issues. Added a function for loading a presentation slider using JavaScript. Fixed a bug that keyframe titles will appear even when disabled. Fixed a bug that loop times in the last keyframe is sometimes wrong after rearranging it. The last keyframe will always be reset after completing the loading process. Fixed IE bug related to text selection with the tour saving dialog. Fixed a hyperwall related bug. Synced to hyperwall code. Tweaked the UI for video quality selector. The button for playing and stopping a tour is now more obvious. The opacity of the keyframe container is changed when a tour is playing. Tweaked the default UI. Tweaked the UI of the button for playing and stopping a tour. Added a setting for showing the editor on default UI after loading. Deleted some useless html files. Added some html pages for testing. Updated the viewer animation test html file. Synced to hyperwall code. Synced to hyperwall code. The presentation slider now starts from the home view. The shared view from hash now works again on presentation view-only mode. Clicking on the last icon on the left or right animates a scroll. The presentation mode now starts from the first keyframe if there is no shared view from hash. Added 0.5 sec loop dwell time to the playback of month lock for MODIS. Fixed a bug that clicking help does not stop the playback of month lock. The locking state of MODIS can now be shared as hash. Fixed a date text bug in Landsat UI on Firefox. Fixed a hovering effect bug in the presentation slider on IE 10. Fixed date text UI bugs when playing a tour. Fixed a bug that users cannot select the text in the textbox in the transition table in IE. - Fixed an issue where the timeline would not update accordingly when you dynamically load a new timelapse. Tweaked the behavior of scrolling animation when clicking the last thumbnails on the right or left. Redesigned the graphical effect for the selected thumbnail and the hovering box. Changed the position of delete button on the editor. Updated MODIS demo files. Synced to hyperwall code. Updated html demo files. Synced to hyperwall code. - Fixed issues related to the timeline slider after dynamically changing a dataset. Fixed a bug that the mode toggling button on default UI is sometimes broken. Synced to hyperwall code. - Code cleanup. Fixed regression with playback when pressing help button. Fixed iframe mouse leaving bug for the help overlay on MODIS UI. Changed the help overlay box to white background and black text. Tweaked the hovering textbox for thumbnail slider. IE 11 has changed its user agent which prevented all our IE checks from running. Fixed isIE() check to account for this. Player UI is now only displayed once all sizes and css are correctly set. This prevents the initial 'broken UI' look on page load. Changed the background of the title bar on the top of the dialog box. Added a funtion for going to a location on the slider from shared hash. Added an event listener to detect when a location on the slider is selected. - Some cleanup to browser detection code. - Modifications to Opera detection. - Refactored coordinate system functions. - Added another error check when setting the size of the viewport. - First stage of adding parabolic motion for view changes. - Parabolic motion is now used when changing a view. Looks very smooth. - More cleanup. - Refactored all example html files. - Fixed path for images and hand cursors so that they work no matter the location of the index page. - Other misc cleanup. - Cleanup of unused files. - Removed unnecessary script includes from example html files. - More cleanup and proper includes for cross domain communication. Create README.md Update README.md - Tweaked default viewer html file. - Fix for regression with cursor paths. - Fix for useThumbnailServer option being set incorrectly. Fixed a bug for the visualizer geometry. - Cleanup of old files. Moved hyperwall related html files to the hyperwall repository. Tweaked animation related parameters. Removed hyperwall related js files. Tweaked the path speed for parabolic motions. - Removed more unused files. - Fixed some file formatting. - Minified some jquery libraries. Hyperwall related changes. Update README.md Update README.md Tweaked the animation for hyperwall. Added a function for going to a location on the slider in cross domain api. Canceled the parabolic motion on mousedown inside the viewer. Fixed a bug that the presentation slider is sometimes positioned incorrectly. Improved the testing html page for viewer animation settings. The presentation slider will not go to a location initially if there is a shared tour. Fixed a UI problem related to hyperwall. Added new html test pages. Fixed a UI bug related to the context map. Added a media type flag in the function for generating a thumbnail url. Added Google Analytics event tracking, which can be enabled from settings. Removed useless code. - Fix for how we compute the root URL. Refactored the math code for camera motion control in the editor. Fixed a bug that sometimes the duration between two keyframes does not consider loop dwell time. Added a html test page for Time Machine wiki website. Added a html test page for Time Machine wiki webpage. Changed onTimeMachineReady to a viewer setting. Changed the speed control for default UI. Updated the instruction overlay for default UI. - When calling loadTimelapse(), we can now load a new timelapse at specific view/time or load based on the same view/time of the previously displayed dataset. - Added default return param of onTimeMachinePlayerReady() to the example/test html files. Fixed regression from last commit with how hashes are loaded (tours, presentations, etc) Replaced enableCustomUI setting with datasetType. Added Time Machine wiki website support. Redesigned the scrollbar on the editor. The editor scrollbar now always shows up for OS X trackpad users in WebKit. Hided the video quality bar when in presentation view only mode. Updated view.html - Further improvements for computing the root URL. Should be more robust. - Various security related changes and code cleanup based on the discussion here: #1 (comment) - Added test page for testing cross-domain functionality. Refactored UI. Removed duplicated editor code from viewer UI classes and moved them to snaplapseViewer.js Moved UI code from snaplapse.js to snaplapseViewer.js Added a new snaplapse object to load tours to the viewer but not editor. Added a function for loading shared data in cross domain API. Updated template_includes.js Removed wiki related code. Added a function for switching layers in cross domain API. Time Machine website related changes. Fixed a bug that the subtitle is sometimes in the wrong position. Removed useless code in timelapse.js Tweaked the css for buttons on default UI. Tweaked the css of buttons on default UI. Added a flag to disable the ability for adding keyframe titles. - If the user is watching a tour and then clicks a share link (that uses the cross domain api) stop and clear out the tour before changing to the new view. - Added a new workaround for the Chrome cache bug (https://code.google.com/p/chromium/issues/detail?id=31014) - Disabled the visualizer context map used by the editor when the defaultUI is utilized. See the comment in the code for details regarding bizarre behavior in Chrome that rears its head under low/flaky bandwidth connections. Changed the min and max size of the viewer. Tweaked the search box UI. Fixed a viewer resizing bug when switching between layers. When playing a tour, always show captured time when using default UI. Tweaked the position and animation of the tour loading overlay. Added a new embed page for the Time Machine website. Added the presentation slider height to the embeding window height. Tweaked the position of the tour overlay title. Tweaked the UI for the capture time when playing a tour. - Updated jQuery to 1.11.1 Removed the captured time UI when using custom UI. Updated the logo on default UI. Refactored the autoscrolling logic. Hide the logo on the default UI on time machine website. Added a possible source URL for time machine website. Fixed a bug in switching between layers in cross domain API. Refactored the logic for loading the tour playback overlay. Fixed viewer_animation_test.html - Moved templates to their own directory. - Added comments inside ruby scripts. - Minor cleanup. Refactored a small part of default UI class. Added a flag to enable the context map on default UI. Removed useless code in html testing files. - Changed logic with how the wiki viewer checks for and uses the forceMP4 flag. Removed useless code. - wiki metadata is all coming in as strings, so we need to be careful when we check the values. Simplify the logic for resizing the instruction overlay. Renamed player.css to defaultUI.css Simplify the logic to resize viewer controls. Simplify the logic in setViewportSize function in timelapse.js Deprecated viewportGeometry setting. Viewport size is now defined according to its parent div container. Viewer is automatically resized to fit the browser window if no css is specified. Temporarily fixed a bug in the viewer UI loading logic that will be refactored later. Refactored part of the logic for setting the viewer size initially. Added more html testing pages. Refactored the logic for resizing the viewer. Refactored how the home view is computed. Refactored the logic for creating a time machine viewer in the DOM. Refactored the viewer resizing logic. - Rewrote postmessage.js to be our own wrapper on the postMessage protocol; before it was a library that had many fallbacks/hacks for older browsers. This does mean we lost cross domain support for older browsers, but they could not have used the viewer anyway. The only scenario that all browsers could handle would be binding some handler based on the browser compatibility that the viewer reports. Now the page that embeds the viewer will have to do its own detection for older browsers if a fallback is wanted besides the default message the viewer would display in this case. The API stays the same, so this should be a drop in replacement. - Further minor changes and clarifications based on the discussion here: #1 (comment) - Fixed issue with playing/pausing through the cross domain protocol when the time machine is looping. - Refactored browser detection code. A plus from all this is that if a user forces a video format in the viewer settings and the browser doesn't actually support it, a message will be displayed rather than a black viewport. - Minor cleanup: Removed includes from example files that were unnecessary; Fixed syntax errors tripping up older browsers (IE < 8); Removed unused CSS - Cleanup to timelapse.js constructor and loadPlayerControlsTemplate() Refactored the logic for updating the context map and the scale bar. Added tests for loading views, presentations, and tours from JavaScript or hash. Renamed flags for defining whether the editor, presentation slider, and annotator are enabled. Fixed a bug that the hovering textbox on the presentation slider was misplaced. Updated test pages. Revived the annotator. Fixed the way to insert the browser supported message. Using showEditorOnLoad setting now updates the UI correctly. Playing a tour now hides the annotator UI. Fixed a bug that loading tours from JavaScript for several times breaks the custom UI. Tweaked the button for toggling the annotator. Clicking on a tag on the annotator now prints the pixel coordinates in the console. Updated testing html pages. Changed the default parameters of an annotation. Fixed a bug related to loading a tour from hash. Fixed the logic for getting the default loop times in the tour. Made the findExactOrClosestCaptureTime() function public. Added a function for removing the video-made-visible listener. Dragging the timeline on default UI now pauses the video if it is playing. When creating a new timeline after loading a new dataset, remove all previously added mousedown events. - Refactored the logic for how views are initiialy set and how we seek upon page load. For the case of initially loading a dataset, this has reduced the number of times a video is loaded or seeked by about half. - Bug fixes that came about as a result of the refactor above. Added the ability to pass in a desired date when loading a new timelapse. Improved the comment.
This reverts commit b7c6bd0.