Skip to content
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

Add instructions for working around NoScript XSS upload problem #4153

Merged
merged 1 commit into from
Feb 20, 2019

Conversation

rmol
Copy link
Contributor

@rmol rmol commented Feb 18, 2019

There is currently an unpredictable problem with uploads, due to a
Firefox bug. For now, the only workarounds are implementing AJAX
uploads or disabling NoScript's cross-site request sanitization. We're
recommending the latter, since it should be safe with our recommended
Tor Browser settings, and doesn't require enabling JavaScript to use
SecureDrop.

Status

Ready for review / Work in progress

Description of Changes

Fixes #4078.

This change adds:

  • instructions in the source UI for disabling NoScript cross-site
    request sanitization before uploading
  • a note about the bug in the source guide
  • updated screenshots of the source submission page

Testing

Please proofread the changes to the instructions both on the source submission page and in the source guide.

Deployment

There are no special considerations for deployment.

Checklist

If you made changes to the server application code:

  • Linting (make ci-lint) and tests (make -C securedrop test) pass in the development container

If you made changes to documentation:

  • Doc linting (make docs-lint) passed locally

@codecov-io
Copy link

Codecov Report

Merging #4153 into develop will increase coverage by 0.01%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #4153      +/-   ##
===========================================
+ Coverage    84.78%   84.79%   +0.01%     
===========================================
  Files           43       43              
  Lines         2780     2782       +2     
  Branches       303      303              
===========================================
+ Hits          2357     2359       +2     
  Misses         355      355              
  Partials        68       68
Impacted Files Coverage Δ
securedrop/securedrop/source_app/info.py 100% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 03b4a07...0c9025b. Read the comment docs.

Copy link
Contributor

@redshiftzero redshiftzero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I'm commenting and not "requesting changes" in a blocking fashion such that if my comments are addressed and this is ready to merge tomorrow before I am not online, another maintainer should feel free to merge)

UI changes and tests look great! Just two things to resolve:

  • add gettext around the strings on the new page (disable-noscript-xss.html)
  • update the Apache AppArmor profile, see this diff:
diff --git a/install_files/ansible-base/roles/build-securedrop-app-code-deb-pkg/files/usr.sbin.apache2 b/install_files/ansible-base/roles/build-securedrop-app-code-deb-pkg/files/usr.sbin.apache2
index cc60713dc..5fe5bb89e 100644
--- a/install_files/ansible-base/roles/build-securedrop-app-code-deb-pkg/files/usr.sbin.apache2
+++ b/install_files/ansible-base/roles/build-securedrop-app-code-deb-pkg/files/usr.sbin.apache2
@@ -211,6 +211,7 @@
   /var/www/securedrop/source_templates/banner_warning_flashed.html r,
   /var/www/securedrop/source_templates/base.html r,
   /var/www/securedrop/source_templates/error.html r,
+  /var/www/securedrop/source_templates/disable-noscript-xss.html r,
   /var/www/securedrop/source_templates/first_submission_flashed_message.html r,
   /var/www/securedrop/source_templates/flashed.html r,
   /var/www/securedrop/source_templates/generate.html r,
@@ -266,6 +267,12 @@
   /var/www/securedrop/static/i/font-awesome/trash-black.png r,
   /var/www/securedrop/static/i/toronion.png r,
   /var/www/securedrop/static/i/hand_with_fingerprint.png r,
+  /var/www/securedrop/static/i/noscript-xss/advanced-settings.png r,
+  /var/www/securedrop/static/i/noscript-xss/noscript-icon-plain.png r,
+  /var/www/securedrop/static/i/noscript-xss/noscript-icon.png r,
+  /var/www/securedrop/static/i/noscript-xss/noscript-pane.png r,
+  /var/www/securedrop/static/i/noscript-xss/noscript-settings-icon.png r,
+  /var/www/securedrop/static/i/noscript-xss/settings-pane.png r,
   /var/www/securedrop/static/i/success_checkmark.png r,
   /var/www/securedrop/static/i/relieved_face.png r,
   /var/www/securedrop/static/i/server_upload.png r,


<hr class="dotted">

<h2>2. In the NoScript pane, click on the Settings icon: <img src="{{ url_for('static', filename='i/noscript-xss/noscript-settings-icon.png') }}"></h2>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's wrap these strings in gettext() such that they will be extracted for localization

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the AppArmor profile and added gettext. Switched locale and tested local translations, and I believe all the new text is now marked for translation.

resp = app.get(url_for('info.disable_noscript_xss'))
assert resp.status_code == 200
text = resp.data.decode('utf-8')
print(text)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

print statement left in from debugging i think

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.

redshiftzero
redshiftzero previously approved these changes Feb 19, 2019
Copy link
Contributor

@redshiftzero redshiftzero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good now, thanks @rmol! (note: I tested AppArmor profile in staging, no problems detected)


<p class="explanation">{{ gettext('You can submit any kind of file, a message, or both.') }}</p>
<p class="explanation"><b>1.</b> {{ gettext('Before you begin, <a href="{url}" class="text-link">turn off cross-site request sanitization in NoScript</a>. This is <strong>required</strong> for uploads to work.').format(url=url_for('info.disable_noscript_xss'))}}</p>

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per the final messaging, instead of linking the "turn off" text, there should be a "Show me how" link at the end. (The UX reasoning is that a "turn off" link could cause inexperienced users to think that clicking the link will immediately change their settings.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

redshiftzero
redshiftzero previously approved these changes Feb 20, 2019
Copy link
Contributor

@redshiftzero redshiftzero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@redshiftzero
Copy link
Contributor

hey @rmol can you modify this PR to no longer be in draft mode?

@rmol rmol marked this pull request as ready for review February 20, 2019 00:21
There is currently an unpredictable problem with uploads, due to a
Firefox bug. For now, the only workarounds are implementing AJAX
uploads or disabling NoScript's cross-site request sanitization. We're
recommending the latter, since it should be safe with our recommended
Tor Browser settings, and doesn't require enabling JavaScript to use
SecureDrop.

This change adds:

- instructions in the source UI for disabling NoScript cross-site
  request sanitization before uploading
- a note about the bug in the source guide
- updated screenshots of the source submission page

Fixes: freedomofpress#4078
Copy link
Contributor

@redshiftzero redshiftzero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

restamping after commits were squashed ✨

@redshiftzero redshiftzero merged commit cb91e59 into freedomofpress:develop Feb 20, 2019
@rmol rmol deleted the noscript-workaround branch February 20, 2019 01:36
@rmol rmol restored the noscript-workaround branch February 20, 2019 01:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants